RTI Connext C# API
6.1.2
|
A data sample of any complex data type, which can be inspected and manipulated reflectively. More...
Inherits IDisposable, and IEquatable< DynamicData >.
Public Member Functions | |
DynamicData (DynamicType type) | |
Create a new DynamicData object for a given type More... | |
DynamicData (DynamicType type, DynamicDataProperty property) | |
Create a new DynamicData object for a given type and custom configuration More... | |
DynamicData | Clone () |
Creates a deep copy of this object More... | |
void | CopyFrom (DynamicData source) |
Copies the sample into this one, overwritting it. Both samples must have the same type. More... | |
T | GetValue< T > (string memberName) |
Gets value of type T using the name of the member. More... | |
T | GetValue< T > (int memberId) |
Gets value of type T using the id of the member. More... | |
DynamicData | SetValue< T > (string memberName, T value) |
Sets value of type T using the name of the member. More... | |
DynamicData | SetValue< T > (int memberId, T value) |
Sets value of type T using the id of the member. More... | |
DynamicData | SetAnyValue (string memberName, object value) |
Sets a member value from any object More... | |
DynamicData | SetAnyValue (int memberId, object value) |
Sets a member value from an object More... | |
object | GetAnyValue (string memberName) |
Gets a member value without specifying its expected type at compilation time More... | |
object | GetAnyValue (int memberId) |
Gets a member value without specifying its expected type at compilation time More... | |
int | GetDiscriminatorValue () |
Obtains the value of the union discriminator (only for unions) More... | |
LoanedDynamicData | LoanValue (string memberName) |
Returns a loaned object to provide access to a complex field of this DynamicData object. More... | |
LoanedDynamicData | LoanValue (int memberId) |
Returns a loaned object to provide access to a complex field of this DynamicData object. More... | |
void | ClearAllMembers () |
Clear the contents of all data members of this object. More... | |
void | ClearMember (string memberName) |
Clear the contents of a single data member of this object. More... | |
void | ClearMember (int memberId) |
Clear the contents of a single data member of this object. More... | |
void | ClearOptionalMember (string memberName) |
Clear the contents of a single optional data member of this object. More... | |
void | ClearOptionalMember (int memberId) |
Clear the contents of a single optional data member of this object. More... | |
bool | MemberExists (string memberName) |
Indicates whether a member exists in this sample More... | |
bool | MemberExists (int memberId) |
Indicates whether a member exists in this sample More... | |
bool | MemberExistsInType (string memberName) |
Indicates whether a member is defined in this data sample's type. More... | |
bool | MemberExistsInType (int memberId) |
Indicates whether a member is defined in this data sample's type. More... | |
bool | IsMemberKey (string memberName) |
Indicates whether a given member forms part of the key of this sample's data type. More... | |
bool | IsMemberKey (int memberId) |
Indicates whether a given member forms part of the key of this sample's data type. More... | |
MemberInfo | GetMemberInfo (string memberName) |
Gets information about a member of this DynamicData sample. More... | |
MemberInfo | GetMemberInfo (int memberId) |
Gets information about a member of this DynamicData sample. More... | |
MemberInfo | GetMemberInfoByIndex (uint index) |
Gets information about a member (identified by its position) of this DynamicData sample. More... | |
void | Dispose () |
Releases the native resources (a finalizer is provided as well) More... | |
byte[] | ToCdrBuffer () |
Serializes a DynamicData as a CDR buffer of octets into a new array. More... | |
int | ToCdrBuffer (byte[] buffer) |
Serializes a DynamicData as a CDR buffer of octets into an existing array More... | |
void | FromCdrBuffer (byte[] buffer) |
Populates this DynamicData object from the serialized CDR data in a buffer More... | |
override int | GetHashCode () |
Returns a simple hash code. More... | |
string | ToString (PrintFormatProperty format) |
Get a string representation of a DynamicData object. More... | |
override string | ToString () |
Get a string representation of a DynamicData object with the default format More... | |
override bool | Equals (object other) |
Indicate whether two data samples are equal More... | |
bool | Equals (DynamicData other) |
Indicate whether two data samples are equal More... | |
Properties | |
bool | Disposed [get] |
Indicates whether this object has been disposed More... | |
DynamicType | Type [get] |
Get the data type, of which this DynamicData represents an instance. More... | |
TypeKind | TypeKind [get] |
Get the kind of this object's data type. More... | |
uint | MemberCount [get] |
The number of data members in this DynamicData sample. More... | |
DynamicDataInfo | Info [get] |
Gets information about this DynamicData sample. More... | |
A data sample of any complex data type, which can be inspected and manipulated reflectively.
DynamicData | ( | DynamicType | type | ) |
Create a new DynamicData object for a given type
type | The type definition for this data sample |
DynamicData | ( | DynamicType | type, |
DynamicDataProperty | property | ||
) |
Create a new DynamicData object for a given type and custom configuration
type | The type definition for this data sample |
property | Configures this object's behavior |
void ClearAllMembers | ( | ) |
Clear the contents of all data members of this object.
The full documentation is available in the C API: DDS_DynamicData_clear_all_members
void ClearMember | ( | int | memberId | ) |
Clear the contents of a single data member of this object.
The full documentation is available in the C API: DDS_DynamicData_clear_member
void ClearMember | ( | string | memberName | ) |
Clear the contents of a single data member of this object.
The full documentation is available in the C API: DDS_DynamicData_clear_member
void ClearOptionalMember | ( | int | memberId | ) |
Clear the contents of a single optional data member of this object.
The full documentation is available in the C API: DDS_DynamicData_clear_optional_member
void ClearOptionalMember | ( | string | memberName | ) |
Clear the contents of a single optional data member of this object.
The full documentation is available in the C API: DDS_DynamicData_clear_optional_member
DynamicData Clone | ( | ) |
Creates a deep copy of this object
void CopyFrom | ( | DynamicData | source | ) |
Copies the sample into this one, overwritting it. Both samples must have the same type.
void Dispose | ( | ) |
Releases the native resources (a finalizer is provided as well)
bool Equals | ( | DynamicData | other | ) |
Indicate whether two data samples are equal
override bool Equals | ( | object | other | ) |
Indicate whether two data samples are equal
void FromCdrBuffer | ( | byte[] | buffer | ) |
Populates this DynamicData object from the serialized CDR data in a buffer
buffer | Contains the serialized data |
The full documentation is available in the C API: DDS_DynamicData_from_cdr_buffer
object GetAnyValue | ( | int | memberId | ) |
Gets a member value without specifying its expected type at compilation time
memberId | The id of the member to set |
object GetAnyValue | ( | string | memberName | ) |
Gets a member value without specifying its expected type at compilation time
memberName | The name of the member to set |
This function allows getting the value of member without knowing its type at compilation time. If the type is known, use the specific getter, such as GetValue<int> for ints.
int GetDiscriminatorValue | ( | ) |
Obtains the value of the union discriminator (only for unions)
override int GetHashCode | ( | ) |
Returns a simple hash code.
MemberInfo GetMemberInfo | ( | int | memberId | ) |
Gets information about a member of this DynamicData sample.
The full documentation is available in the C API: DDS_DynamicData_get_member_info
MemberInfo GetMemberInfo | ( | string | memberName | ) |
Gets information about a member of this DynamicData sample.
The full documentation is available in the C API: DDS_DynamicData_get_member_info
MemberInfo GetMemberInfoByIndex | ( | uint | index | ) |
Gets information about a member (identified by its position) of this DynamicData sample.
The full documentation is available in the C API: DDS_DynamicData_get_member_info
T GetValue< T > | ( | int | memberId | ) |
Gets value of type T using the id of the member.
T | The type of the value to retrieve. Supported types are: byte, short, ushort, int, uint, float, double, LongDouble, decimal, bool, char, long, ulong,string, DynamicData, byte[], short[], ushort[], int[], uint[], float[], double[], LongDouble[], bool[], char[], long[], ulong[]. |
T GetValue< T > | ( | string | memberName | ) |
Gets value of type T using the name of the member.
T | The type of the value to retrieve. Supported types are: byte, short, ushort, int, uint, float, double, LongDouble, decimal, bool, char, long, ulong,string, DynamicData, byte[], short[], ushort[], int[], uint[], float[], double[], LongDouble[], bool[], char[], long[], ulong[]. |
bool IsMemberKey | ( | int | memberId | ) |
Indicates whether a given member forms part of the key of this sample's data type.
The full documentation is available in the C API: DDS_DynamicData_is_member_key
bool IsMemberKey | ( | string | memberName | ) |
Indicates whether a given member forms part of the key of this sample's data type.
The full documentation is available in the C API: DDS_DynamicData_is_member_key
LoanedDynamicData LoanValue | ( | int | memberId | ) |
Returns a loaned object to provide access to a complex field of this DynamicData object.
The full documentation is available in the C API: DDS_DynamicData_bind_complex_member
LoanedDynamicData LoanValue | ( | string | memberName | ) |
Returns a loaned object to provide access to a complex field of this DynamicData object.
The full documentation is available in the C API: DDS_DynamicData_bind_complex_member
bool MemberExists | ( | int | memberId | ) |
Indicates whether a member exists in this sample
The full documentation is available in the C API: DDS_DynamicData_member_exists
bool MemberExists | ( | string | memberName | ) |
Indicates whether a member exists in this sample
The full documentation is available in the C API: DDS_DynamicData_member_exists
bool MemberExistsInType | ( | int | memberId | ) |
Indicates whether a member is defined in this data sample's type.
The full documentation is available in the C API: DDS_DynamicData_member_exists_in_type
bool MemberExistsInType | ( | string | memberName | ) |
Indicates whether a member is defined in this data sample's type.
The full documentation is available in the C API: DDS_DynamicData_member_exists_in_type
DynamicData SetAnyValue | ( | int | memberId, |
object | value | ||
) |
Sets a member value from an object
memberId | The id of the member to set |
value | The value to set. This method will try to convert it to the type of the member |
DynamicData SetAnyValue | ( | string | memberName, |
object | value | ||
) |
Sets a member value from any object
memberName | The name of the member to set |
value | The value to set. This method will try to convert it to the type of the member |
This method allows setting a member value without knowing the type of the value at compilation time. If the runtime type of value
doesn't coincide with the type of the member type, this method uses System.Convert to attempt to convert it. If the conversion is not possible, any of the exceptions thrown by System.Convert may be thrown by this method as well.
This method provides great flexibility, but is less efficient than the concrete setters.
The following example shows how to set an integer from a string:
DynamicData SetValue< T > | ( | int | memberId, |
T | value | ||
) |
Sets value of type T using the id of the member.
T | The type of the value to retrieve. Supported types are: byte, short, ushort, int, uint, float, double, LongDouble, decimal, bool, char, long, ulong, string, DynamicData, byte[], short[], ushort[], int[], uint[], float[], double[], LongDouble[], bool[], char[], long[], ulong[]. |
DynamicData SetValue< T > | ( | string | memberName, |
T | value | ||
) |
Sets value of type T using the name of the member.
T | The type of the value to retrieve. Supported types are: byte, short, ushort, int, uint, float, double, LongDouble, decimal, bool, char, long, ulong,string, DynamicData, byte[], short[], ushort[], int[], uint[], float[], double[], LongDouble[], bool[], char[], long[], ulong[]. |
The type of the value, T
, must coincide with the declared type of the member. T
is string
for both regular IDL string and IDL wstring. If the member is an aggregation or a collection, T
is DynamicData. SetAnyValue(string, object) can be used to perform conversion from T
to the declared type of the member.
byte [] ToCdrBuffer | ( | ) |
Serializes a DynamicData as a CDR buffer of octets into a new array.
The full documentation is available in the C API: DDS_DynamicData_to_cdr_buffer
int ToCdrBuffer | ( | byte[] | buffer | ) |
Serializes a DynamicData as a CDR buffer of octets into an existing array
buffer | An existing buffer where to write the serialized data. It needs to have enough space to include the data or the operation will fail. You can use StructType.GetCdrSerializedSampleMaxSize to get the max possible size |
The full documentation is available in the C API: DDS_DynamicData_to_cdr_buffer
override string ToString | ( | ) |
Get a string representation of a DynamicData object with the default format
string ToString | ( | PrintFormatProperty | format | ) |
Get a string representation of a DynamicData object.
format | Allows changing the print format |
|
get |
Indicates whether this object has been disposed
|
get |
Gets information about this DynamicData sample.
The full documentation is available in the C API: DDS_DynamicData_get_info
|
get |
The number of data members in this DynamicData sample.
The full documentation is available in the C API: DDS_DynamicDataInfo::member_count
|
get |
Get the data type, of which this DynamicData represents an instance.
The full documentation is available in the C API: DDS_DynamicData_get_type