libAwtDaProtocol
This library is necessary for instantiating AWT-DA Objects, to serialize and deserialize them.
More...
This library is necessary for instantiating AWT-DA Objects, to serialize and deserialize them.
The API can be used in two basic way:
- In the process of sending data:
- Instantiate the necessary AWT-DA Objects in order to make a message (using AWT_XXX_New() )
- Serialize the message (using AWT_DaObject_Serialize() )
- Release AWT-DA Objects (using AWT_DaObject_Release() )
- Send the serialized buffer to the receiver (see libAwtDaCom library)
- In the process of receiving data:
- Get the serialized buffer
- Deserialize the message (using AWT_DaObject_[Transport_]Deserialize() )
- Parse/Use the data from the AWT-DA Objects
- Release the AWT-DA Objects when you are done.
Objects are created/released dynamically. A simple garbage collecting system is provided so that the user does not have to deals with malloc and free, and does not have to take care of object references.
The garbage collecting system is based on reference counters. When objects are created or used by other objects the reference counter is incremented, when object are released the reference counter is decremented. When there are no more references on the object (refcounter is null) it is destroyed and the memory is freed.
As a general rule of thumb:
- when a function takes an object as input (AwtDaObject *) in order to store a reference internally, then the reference counter of this object is incremented (as for example in AWT_Message_New() function).
- similarly when a function returns an object in order for the user to use it (AwtDaObject **), then the reference counter of this object is incremented as well (as for example in AWT_List_Iterator_GetNext() function).