Space Engineers
|
Simple base class for supporting unexpected fields allowing for loss-less round-tips/merge, even if the data is not understod. The additional fields are (by default) stored in-memory in a buffer. More...
Static Public Member Functions | |
static IExtension | GetExtensionObject (ref IExtension extensionObject, bool createIfMissing) |
Provides a simple, default implementation for extension support, optionally creating it if it does not already exist. Designed to be called by classes implementing IExtensible. More... | |
static void | AppendValue< TValue > (IExtensible instance, int tag, TValue value) |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value. More... | |
static void | AppendValue< TValue > (IExtensible instance, int tag, DataFormat format, TValue value) |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value. More... | |
static TValue | GetValue< TValue > (IExtensible instance, int tag) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static TValue | GetValue< TValue > (IExtensible instance, int tag, DataFormat format) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static bool | TryGetValue< TValue > (IExtensible instance, int tag, out TValue value) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static bool | TryGetValue< TValue > (IExtensible instance, int tag, DataFormat format, out TValue value) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static bool | TryGetValue< TValue > (IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out TValue value) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static IEnumerable< TValue > | GetValues< TValue > (IExtensible instance, int tag) |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields. More... | |
static IEnumerable< TValue > | GetValues< TValue > (IExtensible instance, int tag, DataFormat format) |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields. More... | |
static bool | TryGetValue (TypeModel model, System.Type type, IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out object value) |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead. More... | |
static IEnumerable | GetValues (TypeModel model, System.Type type, IExtensible instance, int tag, DataFormat format) |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields. More... | |
static void | AppendValue (TypeModel model, IExtensible instance, int tag, DataFormat format, object value) |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value. More... | |
Protected Member Functions | |
virtual IExtension | GetExtensionObject (bool createIfMissing) |
Retrieves the extension object for the current instance, optionally creating it if it does not already exist. More... | |
Additional Inherited Members |
Simple base class for supporting unexpected fields allowing for loss-less round-tips/merge, even if the data is not understod. The additional fields are (by default) stored in-memory in a buffer.
As an example of an alternative implementation, you might choose to use the file system (temporary files) as the back-end, tracking only the paths [such an object would ideally be IDisposable and use a finalizer to ensure that the files are removed].
Definition at line 20 of file Extensible.cs.
|
inlinestatic |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value.
Note that appending a value does not remove the old value from the stream; avoid repeatedly appending values for the same field.
model | The model to use for configuration. |
format | The data-format to use when encoding the value. |
instance | The extensible object to append the value to. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
value | The value to append. |
Definition at line 281 of file Extensible.cs.
|
inlinestatic |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value.
Note that appending a value does not remove the old value from the stream; avoid repeatedly appending values for the same field.
TValue | The type of the value to append. |
instance | The extensible object to append the value to. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
value | The value to append. |
Definition at line 81 of file Extensible.cs.
|
inlinestatic |
Appends the value as an additional (unexpected) data-field for the instance. Note that for non-repeated sub-objects, this equates to a merge operation; for repeated sub-objects this adds a new instance to the set; for simple values the new value supercedes the old value.
Note that appending a value does not remove the old value from the stream; avoid repeatedly appending values for the same field.
TValue | The data-type of the field. |
format | The data-format to use when encoding the value. |
instance | The extensible object to append the value to. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
value | The value to append. |
Definition at line 99 of file Extensible.cs.
|
inlineprotectedvirtual |
Retrieves the extension object for the current instance, optionally creating it if it does not already exist.
createIfMissing | Should a new extension object be created if it does not already exist? |
The createIfMissing
argument is false during serialization, and true during deserialization upon encountering unexpected fields.
Implements ProtoBuf.IExtensible.
Definition at line 42 of file Extensible.cs.
|
inlinestatic |
Provides a simple, default implementation for extension support, optionally creating it if it does not already exist. Designed to be called by classes implementing IExtensible.
createIfMissing | Should a new extension object be created if it does not already exist? |
extensionObject | The extension field to check (and possibly update). |
The createIfMissing
argument is false during serialization, and true during deserialization upon encountering unexpected fields.
Definition at line 59 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
TValue | The data-type of the field. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
Definition at line 112 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
TValue | The data-type of the field. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
Definition at line 127 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields.
The extended data is processed lazily as the enumerator is iterated.
model | The model to use for configuration. |
type | The data-type of the field. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
Definition at line 263 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields.
The extended data is processed lazily as the enumerator is iterated.
TValue | The data-type of the field. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
Definition at line 202 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. Each occurrence of the field is yielded separately, making this usage suitable for "repeated" (list) fields.
The extended data is processed lazily as the enumerator is iterated.
TValue | The data-type of the field. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
Definition at line 218 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
type | The data-type of the field. |
model | The model to use for configuration. |
value | The effective value of the field, or the default value if not found. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
allowDefinedTag | Allow tags that are present as part of the definition; for example, to query unknown enum values. |
Definition at line 237 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
TValue | The data-type of the field. |
value | The effective value of the field, or the default value if not found. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
Definition at line 144 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
TValue | The data-type of the field. |
value | The effective value of the field, or the default value if not found. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
Definition at line 160 of file Extensible.cs.
|
inlinestatic |
Queries an extensible object for an additional (unexpected) data-field for the instance. The value returned (in "value") is the composed value after merging any duplicated content; if the value is "repeated" (a list), then use GetValues instead.
TValue | The data-type of the field. |
value | The effective value of the field, or the default value if not found. |
instance | The extensible object to obtain the value from. |
tag | The field identifier; the tag should not be defined as a known data-field for the instance. |
format | The data-format to use when decoding the value. |
allowDefinedTag | Allow tags that are present as part of the definition; for example, to query unknown enum values. |
Definition at line 177 of file Extensible.cs.