Interface IGeneratedLogger<TModel>
Inherited Members
Namespace: Mars.Core.Data
Assembly: Mars.Core.dll
Syntax
public interface IGeneratedLogger<TModel> : IOutputLogger
Type Parameters
Name | Description |
---|---|
TModel |
Properties
| Improve this Doc View SourceEntity
The associated entity model object (either an agent or a layer)
Is refined implemented in IGeneratedEntityLogger.
Declaration
TModel Entity { get; set; }
Property Value
Type | Description |
---|---|
TModel |
Id
Gets the Id of the entity which is cared by this mapping proxy
Declaration
Guid Id { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
IdString
Gets the serialized Id of the entity prepared for the output
Declaration
string IdString { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Use this when the entity id is used within the output
Methods
| Improve this Doc View SourceIsSerializable()
Checks for the current instance, based on precondition whether this instance shall be persisted or not.
Declaration
bool IsSerializable()
Returns
Type | Description |
---|---|
System.Boolean | Returns true when the instance can be serialized otherwise false |
Serialize()
Serialize the snapshot of an agent with output properties as a MessagePack
formatted byte field, encoded in hex. Instead of creating a new DataFrame struct
the primitive output properties will be serialized directly. This MessagePack format
is much more smaller and faster than just to use the Serialize()
method, but for the client within the database or in the client programme (with another language)
there an explicit MessagePack deserialization step necessary.
MessagePack specification
https://msgpack.org
.Net binding of MessagePack with all options described
https://github.com/neuecc/MessagePack-CSharp#performance
Declaration
byte[] Serialize()
Returns
Type | Description |
---|---|
System.Byte[] | A System.Byte array in MessagePack format |
SerializeCompressed()
Serialize the snapshot of an agent with output properties as a MessagePack
formatted byte field, encoded in hex and compressed by the LZ4 compression algorithm.
Instead of creating a new DataFrame struct
the primitive output properties will be serialized directly. This MessagePack format
is much more smaller and faster than just to use the Serialize()
method, but for the client within the database or in the client programme (with another language)
there an explicit MessagePack deserialization step necessary.
MessagePack specification
https://msgpack.org
LZ4 compression algorithm
https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)
.Net binding of MessagePack with all options described
https://github.com/neuecc/MessagePack-CSharp#performance
Declaration
byte[] SerializeCompressed()
Returns
Type | Description |
---|---|
System.Byte[] | A System.Byte array in MessagePack format compressed by the LZ4 algorithm. |
SerializeProperties()
Serialize the values of all output properties by returning the actual values with the underlying property structure
as an iterator.
Declaration
IEnumerable<(string, object, Type)> SerializeProperties()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.ValueTuple<System.String, System.Object, System.Type>> | Returns an iterator containing each output property value with the associated name, and the corresponding data type of this property. When no output properties are registered, then the iterator returns nothing. |
Remarks
This method can be used to get the concrete values of an entity or layer or to generate the schema by using
the returned property names.
|
Improve this Doc
View Source
SerializePropertyValues()
Serialize the values of all output properties by returning the actual value as an iterator.
Declaration
IEnumerable<object> SerializePropertyValues()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | Returns an iterator containing each output property value. |
SerializeToDocument()
Serialize the output properties directly into a MongoDB.Bson.BsonDocument structure
in which the document is always be reused for each tick.
This document the whole output tree of the associated Entity.
Declaration
BsonDocument SerializeToDocument()
Returns
Type | Description |
---|---|
MongoDB.Bson.BsonDocument | Returns an updated MongoDB.Bson.BsonDocument for the current valid tick, containing the latest snapshot of the associated Entity |
SerializeToJson()
Serialize the output properties directly as a JSON suited document.
Based on the output configuration SimulationConfig, in default case,
this DOES NOT include the property names as keys.
Declaration
string SerializeToJson()
Returns
Type | Description |
---|---|
System.String | A JSON formatted string of all output properties for the associated agent. |