Space Engineers
Classes | Public Member Functions | Protected Member Functions | Properties | Events | List of all members
ProtoBuf.Meta.RuntimeTypeModel Class Reference

Provides protobuf serialization support for a number of types that can be defined at runtime More...

Inheritance diagram for ProtoBuf.Meta.RuntimeTypeModel:
ProtoBuf.Meta.TypeModel

Public Member Functions

IEnumerable GetTypes ()
 Returns a sequence of the Type instances that can be processed by this model. More...
 
override string GetSchema (Type type)
 Suggest a .proto definition for the given type More...
 
*Specified *</remarks > *< paramname="type"> The type to be supported</param > *< paramname="applyDefaultBehaviour"> Whether to apply the inbuilt configuration or *just add the type with no additional allowing *further configuration.</returns > *MetaType Add (Type type, bool applyDefaultBehaviour)
 
void Freeze ()
 Prevents further changes to this model More...
 
void SetDefaultFactory (MethodInfo methodInfo)
 Designate a factory-method to use to create instances of any type; note that this only affect types seen by the serializer after setting the factory. More...
 
- Public Member Functions inherited from ProtoBuf.Meta.TypeModel
void Serialize (Stream dest, object value)
 Writes a protocol-buffer representation of the given instance to the supplied stream. More...
 
void Serialize (Stream dest, object value, SerializationContext context)
 Writes a protocol-buffer representation of the given instance to the supplied stream. More...
 
void Serialize (ProtoWriter dest, object value)
 Writes a protocol-buffer representation of the given instance to the supplied writer. More...
 
object DeserializeWithLengthPrefix (Stream source, object value, Type type, PrefixStyle style, int fieldNumber)
 Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed data - useful with network IO. More...
 
object DeserializeWithLengthPrefix (Stream source, object value, Type type, PrefixStyle style, int expectedField, Serializer.TypeResolver resolver)
 Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed data - useful with network IO. More...
 
object DeserializeWithLengthPrefix (Stream source, object value, Type type, PrefixStyle style, int expectedField, Serializer.TypeResolver resolver, out int bytesRead)
 Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed data - useful with network IO. More...
 
System.Collections.IEnumerable DeserializeItems (System.IO.Stream source, Type type, PrefixStyle style, int expectedField, Serializer.TypeResolver resolver)
 Reads a sequence of consecutive length-prefixed items from a stream, using either base-128 or fixed-length prefixes. Base-128 prefixes with a tag are directly comparable to serializing multiple items in succession (use the Serializer.ListItemTag tag to emulate the implicit behavior when serializing a list/array). When a tag is specified, any records with different tags are silently omitted. The tag is ignored. The tag is ignores for fixed-length prefixes. More...
 
System.Collections.IEnumerable DeserializeItems (System.IO.Stream source, Type type, PrefixStyle style, int expectedField, Serializer.TypeResolver resolver, SerializationContext context)
 Reads a sequence of consecutive length-prefixed items from a stream, using either base-128 or fixed-length prefixes. Base-128 prefixes with a tag are directly comparable to serializing multiple items in succession (use the Serializer.ListItemTag tag to emulate the implicit behavior when serializing a list/array). When a tag is specified, any records with different tags are silently omitted. The tag is ignored. The tag is ignores for fixed-length prefixes. More...
 
System.Collections.Generic.IEnumerable< T > DeserializeItems< T > (Stream source, PrefixStyle style, int expectedField)
 Reads a sequence of consecutive length-prefixed items from a stream, using either base-128 or fixed-length prefixes. Base-128 prefixes with a tag are directly comparable to serializing multiple items in succession (use the Serializer.ListItemTag tag to emulate the implicit behavior when serializing a list/array). When a tag is specified, any records with different tags are silently omitted. The tag is ignored. The tag is ignores for fixed-length prefixes. More...
 
System.Collections.Generic.IEnumerable< T > DeserializeItems< T > (Stream source, PrefixStyle style, int expectedField, SerializationContext context)
 Reads a sequence of consecutive length-prefixed items from a stream, using either base-128 or fixed-length prefixes. Base-128 prefixes with a tag are directly comparable to serializing multiple items in succession (use the Serializer.ListItemTag tag to emulate the implicit behavior when serializing a list/array). When a tag is specified, any records with different tags are silently omitted. The tag is ignored. The tag is ignores for fixed-length prefixes. More...
 
void SerializeWithLengthPrefix (Stream dest, object value, Type type, PrefixStyle style, int fieldNumber)
 Writes a protocol-buffer representation of the given instance to the supplied stream, with a length-prefix. This is useful for socket programming, as DeserializeWithLengthPrefix can be used to read the single object back from an ongoing stream. More...
 
void SerializeWithLengthPrefix (Stream dest, object value, Type type, PrefixStyle style, int fieldNumber, SerializationContext context)
 Writes a protocol-buffer representation of the given instance to the supplied stream, with a length-prefix. This is useful for socket programming, as DeserializeWithLengthPrefix can be used to read the single object back from an ongoing stream. More...
 
object Deserialize (Stream source, object value, System.Type type)
 Applies a protocol-buffer stream to an existing instance (which may be null). More...
 
object Deserialize (Stream source, object value, System.Type type, SerializationContext context)
 Applies a protocol-buffer stream to an existing instance (which may be null). More...
 
object Deserialize (Stream source, object value, System.Type type, int length)
 Applies a protocol-buffer stream to an existing instance (which may be null). More...
 
object Deserialize (Stream source, object value, System.Type type, int length, SerializationContext context)
 Applies a protocol-buffer stream to an existing instance (which may be null). More...
 
object Deserialize (ProtoReader source, object value, System.Type type)
 Applies a protocol-buffer reader to an existing instance (which may be null). More...
 
bool IsDefined (Type type)
 Indicates whether the supplied type is explicitly modelled by the model More...
 
object DeepClone (object value)
 Create a deep clone of the supplied instance; any sub-items are also cloned. More...
 
bool CanSerializeContractType (Type type)
 Returns true if the type supplied is either a recognised contract type, or a list of a recognised contract type. More...
 
bool CanSerialize (Type type)
 Returns true if the type supplied is a basic type with inbuilt handling, a recognised contract type, or a list of a basic / contract type. More...
 
bool CanSerializeBasicType (Type type)
 Returns true if the type supplied is a basic type with inbuilt handling, or a list of a basic type with inbuilt handling More...
 

Protected Member Functions

override int GetKeyImpl (Type type)
 Provides the key that represents a given type in the current model. More...
 

Properties

bool InferTagFromNameDefault [get, set]
 Global default that enables/disables automatic tag generation based on the existing name / order of the defined members. See

See also
ProtoContractAttribute.InferTagFromName

for usage and important warning / explanation. You must set the global default before attempting to serialize/deserialize any impacted type. More...

 
bool AutoAddProtoContractTypesOnly [get, set]
 Global default that determines whether types are considered serializable if they have [DataContract] / [XmlType]. With this enabled, ONLY types marked as [ProtoContract] are added automatically. More...
 
bool UseImplicitZeroDefaults [get, set]
 Global switch that enables or disables the implicit handling of "zero defaults"; meanning: if no other default is specified, it assumes bools always default to false, integers to zero, etc. More...
 
bool AllowParseableTypes [get, set]
 Global switch that determines whether types with a .ToString() and a Parse(string) should be serialized as strings. More...
 
static RuntimeTypeModel Default [get]
 The default model, used to support ProtoBuf.Serializer More...
 
MetaType this[Type type] [get]
 Obtains the MetaType associated with a given Type for the current model, allowing additional configuration. More...
 
bool AutoAddMissingTypes [get, set]
 Should support for unexpected types be added automatically? If false, an exception is thrown when unexpected types are encountered. More...
 
int MetadataTimeoutMilliseconds [get, set]
 The amount of time to wait if there are concurrent metadata access operations More...
 

Events

LockContentedEventHandler LockContended
 If a lock-contention is detected, this event signals the owner of the lock responsible for the blockage, indicating what caused the problem; this is only raised if the lock-owning code successfully completes. More...
 
- Events inherited from ProtoBuf.Meta.TypeModel
TypeFormatEventHandler DynamicTypeFormatting
 Used to provide custom services for writing and parsing type names when using dynamic types. Both parsing and formatting are provided on a single API as it is essential that both are mapped identically at all times. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ProtoBuf.Meta.TypeModel
static RuntimeTypeModel Create ()
 Creates a new runtime model, to which the caller can add support for a range of types. A model can be used "as is", or can be compiled for optimal performance. More...
 
static void ThrowCannotCreateInstance (Type type)
 Indicates that the given type cannot be constructed; it may still be possible to deserialize into existing instances. More...
 

Detailed Description

Provides protobuf serialization support for a number of types that can be defined at runtime

Definition at line 27 of file RuntimeTypeModel.cs.

Member Function Documentation

* Specified*</remarks> *<paramname="type"> The type to be supported</param>*<paramname="applyDefaultBehaviour"> Whether to apply the inbuilt configuration or* just add the type with no additional allowing* further configuration.</returns> * MetaType ProtoBuf.Meta.RuntimeTypeModel.Add ( Type  type,
bool  applyDefaultBehaviour 
)
inline

Definition at line 553 of file RuntimeTypeModel.cs.

void ProtoBuf.Meta.RuntimeTypeModel.Freeze ( )
inline

Prevents further changes to this model

Definition at line 639 of file RuntimeTypeModel.cs.

override int ProtoBuf.Meta.RuntimeTypeModel.GetKeyImpl ( Type  type)
inlineprotectedvirtual

Provides the key that represents a given type in the current model.

Implements ProtoBuf.Meta.TypeModel.

Definition at line 650 of file RuntimeTypeModel.cs.

override string ProtoBuf.Meta.RuntimeTypeModel.GetSchema ( Type  type)
inlinevirtual

Suggest a .proto definition for the given type

Parameters
typeThe type to generate a .proto definition for, or null to generate a .proto that represents the entire model
Returns
The .proto definition as a string

Reimplemented from ProtoBuf.Meta.TypeModel.

Definition at line 130 of file RuntimeTypeModel.cs.

IEnumerable ProtoBuf.Meta.RuntimeTypeModel.GetTypes ( )
inline

Returns a sequence of the Type instances that can be processed by this model.

Definition at line 123 of file RuntimeTypeModel.cs.

void ProtoBuf.Meta.RuntimeTypeModel.SetDefaultFactory ( MethodInfo  methodInfo)
inline

Designate a factory-method to use to create instances of any type; note that this only affect types seen by the serializer after setting the factory.

Definition at line 1820 of file RuntimeTypeModel.cs.

Property Documentation

bool ProtoBuf.Meta.RuntimeTypeModel.AllowParseableTypes
getset

Global switch that determines whether types with a .ToString() and a Parse(string) should be serialized as strings.

Definition at line 101 of file RuntimeTypeModel.cs.

bool ProtoBuf.Meta.RuntimeTypeModel.AutoAddMissingTypes
getset

Should support for unexpected types be added automatically? If false, an exception is thrown when unexpected types are encountered.

Definition at line 618 of file RuntimeTypeModel.cs.

bool ProtoBuf.Meta.RuntimeTypeModel.AutoAddProtoContractTypesOnly
getset

Global default that determines whether types are considered serializable if they have [DataContract] / [XmlType]. With this enabled, ONLY types marked as [ProtoContract] are added automatically.

Definition at line 70 of file RuntimeTypeModel.cs.

RuntimeTypeModel ProtoBuf.Meta.RuntimeTypeModel.Default
staticget

The default model, used to support ProtoBuf.Serializer

Definition at line 116 of file RuntimeTypeModel.cs.

bool ProtoBuf.Meta.RuntimeTypeModel.InferTagFromNameDefault
getset

Global default that enables/disables automatic tag generation based on the existing name / order of the defined members. See

See also
ProtoContractAttribute.InferTagFromName

for usage and important warning / explanation. You must set the global default before attempting to serialize/deserialize any impacted type.

Definition at line 59 of file RuntimeTypeModel.cs.

int ProtoBuf.Meta.RuntimeTypeModel.MetadataTimeoutMilliseconds
getset

The amount of time to wait if there are concurrent metadata access operations

Definition at line 1542 of file RuntimeTypeModel.cs.

MetaType ProtoBuf.Meta.RuntimeTypeModel.this[Type type]
get

Obtains the MetaType associated with a given Type for the current model, allowing additional configuration.

Definition at line 395 of file RuntimeTypeModel.cs.

bool ProtoBuf.Meta.RuntimeTypeModel.UseImplicitZeroDefaults
getset

Global switch that enables or disables the implicit handling of "zero defaults"; meanning: if no other default is specified, it assumes bools always default to false, integers to zero, etc.

If this is disabled, no such assumptions are made and only explicit default values are processed. This is enabled by default to preserve similar logic to v1.

Definition at line 85 of file RuntimeTypeModel.cs.

Event Documentation

LockContentedEventHandler ProtoBuf.Meta.RuntimeTypeModel.LockContended

If a lock-contention is detected, this event signals the owner of the lock responsible for the blockage, indicating what caused the problem; this is only raised if the lock-owning code successfully completes.

Definition at line 1645 of file RuntimeTypeModel.cs.


The documentation for this class was generated from the following file: