RTI Connext C# API
6.1.0
|
Example C# class generated from the IDL struct MyType
More...
Inherits IEquatable< MyType >.
Public Member Functions | |
MyType () | |
Creates a fully initialized new instance with the default values More... | |
MyType (int MyKey, string MyString, Example.Point MyPoint, ISequence< int > MyIntSequence, ISequence< Example.Point > MyPointSequence, Example.Point[] MyPointArray, int? MyOptionalInt, Example.Point MyOptionalPoint) | |
Creates a new instance with a given value for each property More... | |
MyType (MyType other_) | |
Creates a new instance by making a deep copy of an existing one More... | |
bool | Equals (MyType other) |
Compares two MyType instances for equality (IEquatable implementation). The comparison is deep. More... | |
override bool | Equals (object obj) |
Compares this instance with another object (override of object.Equals) More... | |
override string | ToString () |
Provides a readable string representation More... | |
override int | GetHashCode () |
Calculates the hash code based on the values of each property More... | |
Properties | |
int | MyKey [get, set] |
Gets or sets the value for the field MyKey More... | |
string | MyString [get, set] |
Gets or sets the value for the field MyString More... | |
Example.Point | MyPoint [get, set] |
Gets or sets the value for the field MyPoint. More... | |
ISequence< int > | MyIntSequence [get] |
Gets the sequence MyIntSequence More... | |
ISequence< Example.Point > | MyPointSequence [get] |
Gets the sequence MyPointSequence More... | |
Example.Point[] | MyPointArray [get, set] |
Gets or sets the array MyPointArray. More... | |
int? | MyOptionalInt [get, set] |
Gets or sets the optional value of MyOptionalInt. A null value is allowed. More... | |
Example.Point | MyOptionalPoint [get, set] |
Gets or sets the optional value of MyOptionalPoint. A null value is allowed. More... | |
Example C# class generated from the IDL struct MyType
Use the documentation of this example class as a guide to understand the IDL-to-C# mapping of user data types, based on the OMG IDL4-CSHARP specification.
The IDL definition of MyType is the following:
The code generation tool (rtiddsgen) generates the C# types:
MyType | ( | ) |
Creates a fully initialized new instance with the default values
Each member is fully initialized as follows:
MyKey
is set to 0
MyString
is set to string.Empty
MyPoint
is created with the default constructor (which sets X
and Y
to 0)MyIntSequence
is created as an empty Rti.Types.Sequence.MyPointSequence
is created as an empty Rti.Types.Sequence.MyPointArray
is created as an array of 5 Point
s, each created using Point
's default constructorMyOptionalInt
is set to null
MyOptionalPoint
is set to null
MyType | ( | int | MyKey, |
string | MyString, | ||
Example.Point | MyPoint, | ||
ISequence< int > | MyIntSequence, | ||
ISequence< Example.Point > | MyPointSequence, | ||
Example.Point[] | MyPointArray, | ||
int? | MyOptionalInt, | ||
Example.Point | MyOptionalPoint | ||
) |
Creates a new instance with a given value for each property
The parameters are directly assigned to the properties; they're not deeply copied.
Creates a new instance by making a deep copy of an existing one
other_ | The object to copy |
Each property is deeply copied. For example:
bool Equals | ( | MyType | other | ) |
Compares two MyType instances for equality (IEquatable implementation). The comparison is deep.
other | The instance to compare |
override bool Equals | ( | object | obj | ) |
Compares this instance with another object (override of object.Equals)
obj | Any object |
override int GetHashCode | ( | ) |
Calculates the hash code based on the values of each property
For sequence types only the sequence length is used in the hash; for arrays only the first element is used to calculate the hash.
override string ToString | ( | ) |
Provides a readable string representation
MyTypeSupport provides additional options (such as XML and JSON formatting) via Rti.Dds.Topics.TypeSupport<T>.ToString(T, Rti.Dds.Topics.PrintFormatProperty).
|
get |
Gets the sequence MyIntSequence
This property is defined as follows:
Sequences do not provide a setter, only a getter, which allows adding or removing elements.
If a bounded sequence contains more elements than its bound (in this case, 128), Rti.Dds.Publication.DataWriter<T>.Write(T) will fail.
|
getset |
Gets or sets the value for the field MyKey
This property is defined as follows:
|
getset |
Gets or sets the optional value of MyOptionalInt. A null value is allowed.
This property is defined as follows:
|
getset |
Gets or sets the optional value of MyOptionalPoint. A null value is allowed.
This property is defined as follows:
|
getset |
Gets or sets the value for the field MyPoint.
The property can't be set to null unless the field is optional. Otherwise Rti.Dds.Publication.DataWriter<T>.Write(T) will fail.
|
getset |
Gets or sets the array MyPointArray.
If a new array is set, it must contain exactly the number of elements that was specified in the IDL file (5). Otherwise Rti.Dds.Publication.DataWriter<T>.Write(T) will fail.
|
get |
Gets the sequence MyPointSequence
This property is defined as follows:
Sequences do not provide a setter, only a getter, which allows adding or removing elements.
If a bounded sequence contains more elements than its bound (in this case, 8), Rti.Dds.Publication.DataWriter<T>.Write(T) will fail.
|
getset |
Gets or sets the value for the field MyString
This property is defined as follows:
The property can't be set to null (because it's not @optional
) and can't contain more bytes than its bound (512). In any of these cases Rti.Dds.Publication.DataWriter<T>.Write(T) would fail.
string
and wstring
map to C# string
. However, an IDL string
is encoded in UTF-8, whereas a wstring
is encoded in UTF-16. The bound of a string
refers to the total number of bytes in UTF-8, after being encoded. In the case of wstring
, the bound refers to the total number of characters.