pvAccessCPP  7.1.1
serializationHelper.h
1 /*
2  * serializationHelper.h
3  *
4  * Created on: Jul 24, 2012
5  * Author: msekoranja
6  */
7 
8 #ifndef SERIALIZATIONHELPER_H_
9 #define SERIALIZATIONHELPER_H_
10 
11 #include <pv/serialize.h>
12 #include <pv/pvData.h>
13 #include <pv/noDefaultMethods.h>
14 #include <pv/pvIntrospect.h>
15 #include <pv/byteBuffer.h>
16 
17 #include <pv/pvaConstants.h>
18 #include <pv/pvAccess.h>
19 
20 namespace epics {
21 namespace pvAccess {
22 
23 class epicsShareClass SerializationHelper {
24  EPICS_NOT_COPYABLE(SerializationHelper)
25 public:
26 
27  static epics::pvData::PVDataCreatePtr _pvDataCreate;
28 
29  /**
30  * Deserialize PVRequest.
31  * @param payloadBuffer data buffer.
32  * @return deserialized PVRequest, can be <code>null</code>.
33  */
34  static epics::pvData::PVStructure::shared_pointer deserializePVRequest(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
35 
36  /**
37  * Deserialize Structure and create PVStructure instance, if necessary.
38  * @param payloadBuffer data buffer.
39  * @param control deserialization control.
40  * @param existingStructure if deserialized Field matches <code>existingStrcuture</code> Field, then
41  * <code>existingStructure</code> instance is returned. <code>null</code> value is allowed.
42  * @return PVStructure instance, can be <code>null</code>.
43  */
44  static epics::pvData::PVStructure::shared_pointer deserializeStructureAndCreatePVStructure(epics::pvData::ByteBuffer* payloadBuffer,
45  epics::pvData::DeserializableControl* control,
46  epics::pvData::PVStructure::shared_pointer const & existingStructure = epics::pvData::PVStructure::shared_pointer());
47 
48  /**
49  * Deserialize optional PVStructrue.
50  * @param payloadBuffer data buffer.
51  * @return deserialized PVStructure, can be <code>null</code>.
52  */
53  static epics::pvData::PVStructure::shared_pointer deserializeStructureFull(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
54 
55  /**
56  * Deserialize optional PVField.
57  * @param payloadBuffer data buffer.
58  * @return deserialized PVField, can be <code>null</code>.
59  */
60  static epics::pvData::PVField::shared_pointer deserializeFull(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
61 
62  /**
63  * Serialize <code>null</code> PVField.
64  * @param buffer
65  * @param control
66  */
67  static void serializeNullField(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control);
68 
69  /**
70  * Serialize PVRequest.
71  * @param buffer data buffer.
72  */
73  static void serializePVRequest(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructure::shared_pointer const & pvRequest);
74 
75  /**
76  * Serialize optional PVStructrue.
77  * @param buffer data buffer.
78  */
79  static void serializeStructureFull(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructure::shared_pointer const & pvStructure);
80 
81  /**
82  * Serialize optional PVField.
83  * @param buffer data buffer.
84  */
85  static void serializeFull(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, const epics::pvData::PVField::const_shared_pointer &pvField);
86 
87 };
88 
89 }
90 }
91 
92 #endif /* SERIALIZATIONHELPER_H_ */