DUECA/DUSIME
|
This is a facilitator for writing multi-stream data. More...
#include <DataUpdater.hxx>
Public Member Functions | |
DataUpdater (ChannelWriteToken &token, const TimeSpec &ts) | |
Constructor. | |
DataUpdater (ChannelWriteToken &token, const DataTimeSpec &ts) | |
Constructor. | |
DataUpdater (ChannelWriteToken &token, const TimeTickType &ts) | |
Constructor with tick. | |
T & | data () |
Access the data in the channel, returns a reference to the data. | |
~DataUpdater () | |
Destructor. | |
Additional Inherited Members | |
Protected Member Functions inherited from dueca::DataUpdaterBase | |
DataUpdaterBase (ChannelWriteToken &token, const DataTimeSpec &ts) | |
Constructor. | |
void * | baseGetAccess (uint32_t magic) |
Lets the token copy the latest data written (or, if not available, return a default object) | |
void | releaseAccess (void *data_ptr) |
Releasing the read access means that the data will be sent to the channel and made accessible for reading. | |
Protected Attributes inherited from dueca::DataUpdaterBase | |
ChannelWriteToken & | token |
Access to the channel. | |
DataTimeSpec | ts |
Time specification to be used. | |
This is a facilitator for writing multi-stream data.
By creating a "DataUpdater", the access token is used to gain access to the data in the channel. A copy of the latest data written is returned to the updater. Using the data() accessor method, any changes to this data may be made. When at the end of scope the DataUpdater is destroyed, the access is released again, and the actual data is sent to the channel.
An example, suppose you have created a ChannelWriteToken for a channel with MyData objects:
UnifiedChannel channels work differently from Event and Stream channels, in that the data written there is persistent. The next time you create a DataUpdater on a channel, the data you had written before is present (and readable) in the Updater. If you want, you can limit yourself to only writing the changes.
If you rather start from a blank/default object, use the DataWriter template, which will create an object for your modification, but always starts from clean, blank objects. Note that you should provide a proper definition of what is default when you write the .dco file defining your data type, otherwise the object's members are undefined.
|
inline |
Constructor.
Gains access to the channel for which the token was made. The accessed data will contain the latest written values.
token | Write access token. |
ts | Time specification. The specification is used, to define the new data validity span, or only the start time is used if the token has been opened with Channel::Events for time aspect. |
|
inline |
Constructor.
Gains access to the channel for which the token was made.
token | Write access token. |
ts | Time specification. |
|
inline |
Constructor with tick.
Gains access to the channel for which the token was made.
Note that using only a tick does not make sense with stream data, only use for event data!
token | Write access token. |
ts | Time tick/moment. |
|
inline |
Destructor.
At destruction of the updater, the data is sent.