rad 6.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rad::ActivityUpdateOldb Class Reference

#include <activityUpdateOldb.hpp>

Inheritance diagram for rad::ActivityUpdateOldb:
rad::ThreadActivity rad::ThreadBaseActivity scxml4cpp::Activity

Public Member Functions

 ActivityUpdateOldb (const std::string &id, const std::string &logger_name, rad::DoubleMap< rad::cii::OldbType > &oldb_map, std::chrono::seconds conn_timeout, std::chrono::milliseconds period)
 
virtual ~ActivityUpdateOldb ()
 
std::chrono::milliseconds GetPeriod ()
 
rad::cii::OldbAdapterGetOldbAdapter ()
 
void SetPeriod (const std::chrono::milliseconds period)
 
void SetOldbPrefix (const std::string &prefix)
 
void Run () override
 
 ActivityUpdateOldb (const ActivityUpdateOldb &)=delete
 
ActivityUpdateOldboperator= (const ActivityUpdateOldb &)=delete
 Disable copy constructor.
 
- Public Member Functions inherited from rad::ThreadActivity
 ThreadActivity (const ThreadActivity &)=delete
 
ThreadActivityoperator= (const ThreadActivity &)=delete
 
pthread_t GetNativeHandle () const override
 
bool IsThreadJoined () const override
 
 ThreadBaseActivity (ThreadBaseActivity const &)=delete
 
- Public Member Functions inherited from rad::ThreadBaseActivity
 ThreadBaseActivity (ThreadBaseActivity const &)=delete
 
void start (scxml4cpp::Context *c) override
 
void stop (scxml4cpp::Context *c) override
 
bool IsStopRequested () const
 
- Public Member Functions inherited from scxml4cpp::Activity
 Activity (const std::string &id)
 
virtual ~Activity ()
 
std::string getId () const
 
void setId (const std::string &id)
 

Additional Inherited Members

- Protected Member Functions inherited from rad::ThreadActivity
void StartThread () override
 
void JoinThread () override
 
std::string GetPthreadName ()
 
int SetPthreadName (const std::string &name)
 

Detailed Description

This activity class implement a thread that can be used to write to the OLDB periodically attributes and associated values.

The attributes and values are taken from an object of type rad::DoubleMap<rad::cii::OldbType> which is shared between this class (the consumer) and the data producer(s).

The attributes and values are written to the OLDB via a rad::cii::OldbAdapter class.

The period of the activity and the connection timeout to write to the OLDB are configurable.

Constructor & Destructor Documentation

◆ ActivityUpdateOldb() [1/2]

rad::ActivityUpdateOldb::ActivityUpdateOldb ( const std::string & id,
const std::string & logger_name,
rad::DoubleMap< rad::cii::OldbType > & oldb_map,
std::chrono::seconds conn_timeout,
std::chrono::milliseconds period )

Constructor for the ActivityUpdateOldb class.

Parameters
idActivity identifier.
logger_nameName of the logger to be used by the class.
smReference to the SM adapter that can be used to inject events.
oldb_mapReference to the attributes/values to be written.
conn_timeoutTimeout when connecting to the OLDB.
periodMinimum period between two consecutive updates of the OLDB.

◆ ~ActivityUpdateOldb()

rad::ActivityUpdateOldb::~ActivityUpdateOldb ( )
virtual

◆ ActivityUpdateOldb() [2/2]

rad::ActivityUpdateOldb::ActivityUpdateOldb ( const ActivityUpdateOldb & )
delete

Member Function Documentation

◆ GetOldbAdapter()

rad::cii::OldbAdapter & rad::ActivityUpdateOldb::GetOldbAdapter ( )
Returns
Reference to the adapter object used to write to the OLDB.

◆ GetPeriod()

std::chrono::milliseconds rad::ActivityUpdateOldb::GetPeriod ( )
Returns
The min. period of one update cycle of the activity.

◆ operator=()

ActivityUpdateOldb & rad::ActivityUpdateOldb::operator= ( const ActivityUpdateOldb & )
delete

Disable copy constructor.

◆ Run()

void rad::ActivityUpdateOldb::Run ( )
overridevirtual

Method implementing the thread which writes periodically to the OLDB the attributes and values taken from the rad::DoubleMap<rad::cii::OldbType> shared object.

Implements rad::ThreadActivity.

◆ SetOldbPrefix()

void rad::ActivityUpdateOldb::SetOldbPrefix ( const std::string & prefix)

This method allows to set a prefix to be added to all the keys before writing to the OLDB.

Parameters
prefixPrefix to be added to the keys.

◆ SetPeriod()

void rad::ActivityUpdateOldb::SetPeriod ( const std::chrono::milliseconds period)

This method allows to set the min. duration of one update loop of the activity.


The documentation for this class was generated from the following files: