Class CTransaction#
Defined in File transaction.h
Inheritance Relationships#
Base Types#
public sdv::IInterfaceAccess
(Struct IInterfaceAccess)public sdv::IObjectDestroy
(Struct IObjectDestroy)
Class Documentation#
-
class CTransaction : public sdv::IInterfaceAccess, public sdv::IObjectDestroy#
Transaction administration.
During creation of the transaction object, the transaction is of undefined type. The transaction takes the read or write type only after a call to the read or write function. After this, the transaction doesn’t change type any more and will block calls to the functions provided for the other type (e.g. a read transaction doesn’t allow a write and a write transaction doesn’t allow a read). A read transaction is using the transaction ID to identify the current time of the transaction. Any data available before can be read. Any data coming after will not be transmitted. In case there is no data any more (the transaction is too old) the default value will be used. A write transaction will collect the signal values. The distribution is deferred until the transaction is finalized. During finalization, a new transaction ID is requested and the values are distributed using this ID (this is necessary so a read transaction can decide whether the values are included in a read operation). The written values are stored in a ringbuffer in the signal class. The latest position in the ring buffer contains the last distributed transaction.
Public Functions
-
explicit CTransaction(CDispatchService &rDispatchSvc)#
Constructor.
- Parameters:
rDispatchSvc – [in] Reference to the dispatch service.
-
virtual void DestroyObject() override#
Destroy the object. Overload of sdv::IObjectDestroy::DestroyObject.
-
uint64_t GetReadTransactionID() const#
When called, enables the transaction as read-transaction. This would only happen when the transaction is still in undefined state.
- Returns:
Returns the read-transaction ID or 0 when the transaction is not registered as read-transaction.
-
void DeferWrite(CSignal &rSignal, sdv::any_t &ranyVal)#
When called, enables the transaction as write-transaction. This would only happen when the transaction is still in undefined state. In that case, the value will be added to the deferred signal map. Any previous value will be overwritten.
- Parameters:
rSignal – [in] Reference to the signal class.
ranyVal – [in] Reference to the value.
-
void FinalizeWrite()#
Finalizes the transaction. For read transactions, nothing happens. For write transactions, a transaction ID is stored with the written signal value.
-
void SetIterator(std::list<CTransaction>::iterator itTransaction)#
Set the iterator to this transaction (prevents having to search for the transaction in the transaction list).
- Parameters:
itTransaction – [in] The iterator to store.
-
std::list<CTransaction>::iterator GetIterator() const#
Get the stored iterator to the transaction.
- Returns:
The stored iterator.
-
explicit CTransaction(CDispatchService &rDispatchSvc)#