Presentation is loading. Please wait.

Presentation is loading. Please wait.

Proposed Changes of the DDS Dynamic Data interface based on the consideration of EPICS PVData and Google’s Protocol Buffers Nikolay Malitsky 1.

Similar presentations


Presentation on theme: "Proposed Changes of the DDS Dynamic Data interface based on the consideration of EPICS PVData and Google’s Protocol Buffers Nikolay Malitsky 1."— Presentation transcript:

1 Proposed Changes of the DDS Dynamic Data interface based on the consideration of EPICS PVData and Google’s Protocol Buffers Nikolay Malitsky 1

2 Rationale Interface Example with a primitive variable Example with a variable-size sequence Example with a structure

3 Rationale Two issues and their solutions:
1. In-out arguments for accessing the primitive values This issue is addressed by the recent revised submission of Java 5 Language PSM for DDS, August It replaced the in-out arguments with the return values. methods Replace three alternative sets of methods (value-by-name, value-by-id, and value-at-index) with a single set value-by-id and one method get-id-by-name. Reuse methods and consider arguments in the context of the particular type, for example, ‘int getUint32ValueAtIndexOverflow ‘ in Java 5 Language PSM for DDS can be represented by ‘int getInt32ValueAtIndex’. Replace the different set-sequence and set-array methods with two generic methods: copySubCollection(in unsigned int id, in unsigned int offset, in DynamicData src, in unsigned int srcOffset, in unsigned int length) implementing the value semantics and setComplexValue(in unsigned int id, in DynamicData src) implementing the reference semantics.

4 Dynamic Data Interface (in Java) – 1 of 3
DynamicType getType(); // // methods used in the context of aggregation data types and associative collection int getId(String name); boolean hasValue(String name); void clearValue(String name); // // method used in the context of collections and aggregation data types // Returns a number of collection elements, members, dimensions of multi-dimensional arrays, etc. int getLength(); // methods used in the context of variable-size sequences void setBound(int bound); void setLength(int length);

5 Dynamic Data Interface (in Java) – 2 of 3
// // setters and getters of primitive values: Boolean, Byte, Char8, Char32, // Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64, Float128 int getInt32Value(int id); float getFloat32Value(int id); double getFloat64Value(int id); void setInt32Value(int id, int value); void setFloat32Value(int id, float value); void setFloat64Value(int id, double value); // setters and getters of string and wstring String getString(int id); void setString(int id, String value);

6 Dynamic Data Interface (in Java) – 3 of 3
// // setters and getters of other types: fixed-size multi-dimensional arrays, // variable-size single-dimensional sequences, structures, etc. DynamicData getComplexValue(int id); void setComplexValue(int id, DynamicData value); // methods implementing the value semantics void copySubCollection(int id, int offset, DynamicData src, int srcOffset, int length); DynamicData cloneSubCollection(int id, int offset, int length); void copyComplexValue(int id, DynamicData value); DynamicData cloneComplexValue(int id); void copy(DynamicData value); DynamicData clone();

7 Example with a primitive variable
DynamicData doubleData = factory.createData(doubleType); int id = 0; // or any integer // setting a value doubleData.setFloat64Value(id, 1.0); // getting a value double doubleValue = doubleData.getFloat64Value(id);

8 Example with a variable-size sequence
DynamicData doubleSeq = factory.createData(doubleSeqType); doubleSeq.setBound(10); // accessing elements (without boundary checking)‏ double doubleValue = 0; for(int i = 0; i < 5; i++){ doubleSeq.setFloat64Value(i, 1.0*i); doubleValue = doubleSeq.getFloat64Value(i); } doubleSeq.setLength(5); // copying (or merging ) a sequence DynamicData anotherSeq = factory.createData(doubleSeqType); int id = 0; // or any integer anotherSeq.copySubCollection(id, 0, doubleSeq, 0, doubleSeq.getLength());

9 Example with a structure
DynamicData sample = factory.createData(NameDoublesType); int nameId = sample.getId(“name”); int doublesId = sample.getId(“doubles”); // accessing members String name = sample.getStringValue(nameId); DynamicData doubles = sample.getComplexValue(doublesId); // setting values // copying a structure DynamicData anotherSample= factory.createData(NameDoublesType); anotherSample.copy(sample); struct NameDoubles { string name; sequence<double> doubles; }


Download ppt "Proposed Changes of the DDS Dynamic Data interface based on the consideration of EPICS PVData and Google’s Protocol Buffers Nikolay Malitsky 1."

Similar presentations


Ads by Google