Class ConfigurationSerializer<T>
Implements IConfigurationTransformer<TOutput> by serializing the syntax tree into some string or binary format.
Implements
Inherited Members
Namespace: Snowflake.Configuration.Serialization.Serializers
Assembly: Snowflake.Framework.dll
Syntax
public abstract class ConfigurationSerializer<T> : IConfigurationTransformer<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of the serialized data after traversing the tree. |
Methods
SerializeBlockBegin(IConfigurationSerializationContext<T>, Int32)
Serialize a marker or header where a block or section begins in the serialized stream.
Declaration
public abstract void SerializeBlockBegin(IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeBlockEnd(IConfigurationSerializationContext<T>, Int32)
Serialize a marker or footer where a block or section ends in the serialized stream.
Declaration
public abstract void SerializeBlockEnd(IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeFooter(IConfigurationSerializationContext<T>)
Write the header to the serialized stream.
Declaration
public virtual void SerializeFooter(IConfigurationSerializationContext<T> context)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfigurationSerializationContext<T> | context | The serialization context. |
SerializeHeader(IConfigurationSerializationContext<T>)
Write the header to the serialized stream.
Declaration
public virtual void SerializeHeader(IConfigurationSerializationContext<T> context)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfigurationSerializationContext<T> | context | The serialization context. |
SerializeNode(BooleanConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a System.Boolean.
Declaration
protected void SerializeNode(BooleanConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| BooleanConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(DecimalConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a decimal value, implemented as a System.Double.
Contrary to the name, this is not implemented as a System.Decimal, and IEEE 754 floating point semantics for double precision floating point numbers should be taken into account.
Declaration
protected void SerializeNode(DecimalConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| DecimalConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(DeviceCapabilityElementConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a ControllerElement.
This is only used when serializing syntax trees that came from IInputTemplate.
Declaration
protected void SerializeNode(DeviceCapabilityElementConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| DeviceCapabilityElementConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(EnumConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates an System.Enum value.
Declaration
protected void SerializeNode(EnumConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| EnumConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(IAbstractConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serialize a IAbstractConfigurationNode with the given context.
Declaration
public void SerializeNode(IAbstractConfigurationNode node, IConfigurationSerializationContext<T> context, int index = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| IAbstractConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(IntegralConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates an integral value, implemented as a System.Int64
Declaration
protected void SerializeNode(IntegralConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IntegralConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(ListConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a list of configuration nodes.
For each child node to be serialized, the index should be incremented. Serializing a list node will enter a new block, and thus block headers and footers are written at the beginning and end of serialization of this node respectively.
Declaration
protected void SerializeNode(ListConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| ListConfigurationNode | node | The list of configuration nodes represented as a ListConfigurationNode |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNode(StringConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a System.String.
Declaration
protected void SerializeNode(StringConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| StringConfigurationNode | node | The node to serialize. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Boolean, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a BooleanConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializeNodeValue(bool value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | value | The raw value of the node. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Double, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a DecimalConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializeNodeValue(double value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | The raw value of the node. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Enum, String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a EnumConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializeNodeValue(Enum enumValue, string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Enum | enumValue | The value of the node as the System.Enum object. |
| System.String | value | The raw value of the node. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Int64, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a IntegralConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializeNodeValue(long value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | value | The raw value of the node. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a StringConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializeNodeValue(string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The raw value of the node. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
SerializerNodeValue(ControllerElement, String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a EnumConfigurationNode. Override this when implementing a serializer.
Declaration
public abstract void SerializerNodeValue(ControllerElement controllerElementValue, string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| ControllerElement | controllerElementValue | The value of the node |
| System.String | value | The raw value of the node as the string representation of the element consistent with the IDeviceInputMapping the syntax tree was originally serialized with. |
| System.String | key | The key of the node. |
| IConfigurationSerializationContext<T> | context | The serialization context. |
| System.Int32 | index | The position or index of the given node within the current block in the context. |
Transform(IAbstractConfigurationNode)
Declaration
public abstract T Transform(IAbstractConfigurationNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| IAbstractConfigurationNode | node |
Returns
| Type | Description |
|---|---|
| T |