mbeckerle commented on a change in pull request #651:
URL: https://github.com/apache/daffodil/pull/651#discussion_r725355099
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LayerTransformer.scala
##########
@@ -271,15 +212,227 @@ class JavaIOOutputStream(dos: DataOutputStream, finfo:
FormatInfo)
}
abstract class LayerException(
- layerSRD: SequenceRuntimeData,
- state: PState,
+ val schemaFileLocation: SchemaFileLocation,
+ dataLocation: DataLocation,
maybeCause: Maybe[Throwable],
maybeFormatString: Maybe[String],
args: Any*)
-extends ThinDiagnostic(One(layerSRD.dpathCompileInfo.schemaFileLocation),
One(state.currentLocation), maybeCause, maybeFormatString, args: _*)
+extends ThinDiagnostic(One(schemaFileLocation), One(dataLocation), maybeCause,
maybeFormatString, args: _*)
-case class LayerNotEnoughDataException(layerSRD: SequenceRuntimeData, state:
PState, cause: Throwable, nBytesRequired: Int)
- extends LayerException(layerSRD, state, One(cause), None, nBytesRequired) {
+case class LayerNotEnoughDataException(sfl: SchemaFileLocation, dataLocation:
DataLocation, cause: Throwable, nBytesRequired: Int)
+ extends LayerException(sfl, dataLocation, One(cause), None, nBytesRequired) {
override def isError = true
override def modeName = "Parse"
- }
\ No newline at end of file
+ }
+
+final class LayerSerializedInfo(val srd: SequenceRuntimeData,
+ maybeLayerCharsetEv: Maybe[LayerCharsetEv],
+ maybeLayerLengthKind: Maybe[LayerLengthKind],
+ maybeLayerLengthEv: Maybe[LayerLengthEv],
+ maybeLayerLengthUnits: Maybe[LayerLengthUnits],
+ maybeLayerBoundaryMarkEv: Maybe[LayerBoundaryMarkEv])
+extends Serializable {
+
+ def evaluatables: Seq[Evaluatable[AnyRef]] =
+ maybeLayerCharsetEv.toScalaOption.toSeq ++
+ maybeLayerLengthEv.toScalaOption.toSeq ++
+ maybeLayerBoundaryMarkEv.toScalaOption.toSeq
+
+
+ def layerRuntimeInfo(state: ParseOrUnparseState): LayerRuntimeInfo =
+ new LayerRuntimeInfo(state, srd,
+ maybeLayerCharsetEv,
+ maybeLayerLengthKind,
+ maybeLayerLengthEv,
+ maybeLayerLengthUnits,
+ maybeLayerBoundaryMarkEv)
+}
+
+/**
+ * Allows access to all the layer properties, if defined, including
+ * evaluating expressions if the properties values are defined as expressions.
+ * Also provides access to variables.
+ */
+
+final class LayerRuntimeInfo(state: ParseOrUnparseState,
+ srd: SequenceRuntimeData,
+ maybeLayerCharsetEv: Maybe[LayerCharsetEv],
+ maybeLayerLengthKind: Maybe[LayerLengthKind],
+ maybeLayerLengthEv: Maybe[LayerLengthEv],
+ maybeLayerLengthUnits: Maybe[LayerLengthUnits],
+ maybeLayerBoundaryMarkEv: Maybe[LayerBoundaryMarkEv])
+{
+
+ def SDE(msg: String, args: Any*) =
+ state.SDE(msg, args)
+
+ /**
+ * Only needed because unparser suspensions need one, and it is used in too
many places
+ * @return
+ */
+ def runtimeData: RuntimeData = srd
Review comment:
Yeah, that's a thread I did not want to start pulling.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]