cumbia-tango 1.x
C++ multi threaded library based on cumbia and the Tango control system
Public Member Functions | List of all members
CuTWriter Class Reference

#include <cutwriter.h>

Inheritance diagram for CuTWriter:
Inheritance graph
[legend]

Public Member Functions

 CuTWriter (const TSource &src, CumbiaTango *ct, const CuData &conf, const CuData &options=CuData(), const CuData &tag=CuData())
 
virtual ~CuTWriter ()
 
void setWriteValue (const CuVariant &wval)
 set the value that will be written after start is called More...
 
void setConfiguration (const CuData &db_conf)
 Set database configuration. More...
 
void setOptions (const CuData &options)
 
void setTag (const CuData &tag)
 
void onProgress (int step, int total, const CuData &data)
 
void onResult (const CuData &data)
 calls onUpdate on all listeners and deletes itself afterwards More...
 
void onResult (const std::vector< CuData > &datalist)
 unused. To comply with interface More...
 
CuData getToken () const
 
TSource getSource () const
 return a TSource object that stores information about the Tango source More...
 
Type getType () const
 returns the type of CuTangoActionI implemented More...
 
void addDataListener (CuDataListener *l)
 insert a CuDataListener to the list of listeners of data updates More...
 
void removeDataListener (CuDataListener *l)
 remove a CuDataListener from the list of listeners of data updates More...
 
size_t dataListenersCount ()
 return the number of registered data listeners More...
 
void start ()
 creates and registers a CuWriteActivity to trigger a write operation on the Tango control system More...
 
void stop ()
 the method where activities are unregistered from Cumbia More...
 
void sendData (const CuData &data)
 subclasses will implement the necessary code to set data on themselves or to the activities More...
 
void getData (CuData &d_inout) const
 subclasses will implement the necessary code to analyze the request stored in the input argument and fill it in with output data More...
 
- Public Member Functions inherited from CuTangoActionI
virtual ~CuTangoActionI ()
 virtual destructor, to make compilers happy More...
 
virtual TSource getSource () const =0
 return a TSource object that stores information about the Tango source More...
 
virtual Type getType () const =0
 returns the type of CuTangoActionI implemented More...
 
virtual void addDataListener (CuDataListener *l)=0
 insert a CuDataListener to the list of listeners of data updates More...
 
virtual void removeDataListener (CuDataListener *l)=0
 remove a CuDataListener from the list of listeners of data updates More...
 
virtual size_t dataListenersCount ()=0
 return the number of registered data listeners More...
 
virtual void start ()=0
 the method where activities are created and registered More...
 
virtual void stop ()=0
 the method where activities are unregistered from Cumbia More...
 
virtual void sendData (const CuData &data)=0
 subclasses will implement the necessary code to set data on themselves or to the activities More...
 
virtual void getData (CuData &d_inout) const =0
 subclasses will implement the necessary code to analyze the request stored in the input argument and fill it in with output data More...
 

Additional Inherited Members

- Public Types inherited from CuTangoActionI
enum  Type {
  ActionUnknown = -1 , Reader = 0 , Writer , ReaderConfig ,
  WriterConfig , TaDb
}
 list of types of actions More...
 

Constructor & Destructor Documentation

◆ CuTWriter()

CuTWriter::CuTWriter ( const TSource src,
CumbiaTango ct,
const CuData &  conf,
const CuData &  options = CuData(),
const CuData &  tag = CuData() 
)

◆ ~CuTWriter()

CuTWriter::~CuTWriter ( )
virtual

Member Function Documentation

◆ addDataListener()

void CuTWriter::addDataListener ( CuDataListener *  l)
virtual

insert a CuDataListener to the list of listeners of data updates

Parameters
la CuDataListener that receives notifications when data is ready, through CuDataListener::onUpdate

Implements CuTangoActionI.

◆ dataListenersCount()

size_t CuTWriter::dataListenersCount ( )
virtual

return the number of registered data listeners

Returns
the number of data listeners currently installed

Implements CuTangoActionI.

◆ getData()

void CuTWriter::getData ( CuData &  d_inout) const
virtual

subclasses will implement the necessary code to analyze the request stored in the input argument and fill it in with output data

Parameters
dataa CuData compiled with the necessary fields accepted by the specific implementation as input argument. data will contain additional output fields filled in by the method when it returns.
note
getData must be synchronous: it's called with input arguments (d_inout) and they are filled in within the same method in the same thread. Asynchronous data fetch from an activity executed in a separate thread can be accomplished by sendData in combination with CuDataListener::onUpdate. There, received data will have to be recognised as coming from a specific request and treated accordingly.

Implements CuTangoActionI.

◆ getSource()

TSource CuTWriter::getSource ( ) const
virtual

return a TSource object that stores information about the Tango source

Returns
TSource, an object storing information on the Tango source

Implements CuTangoActionI.

◆ getToken()

CuData CuTWriter::getToken ( ) const

◆ getType()

CuTangoActionI::Type CuTWriter::getType ( ) const
virtual

returns the type of CuTangoActionI implemented

Returns
one of the values from the Type enum

Implements CuTangoActionI.

References CuTangoActionI::Writer.

Referenced by onResult().

◆ onProgress()

void CuTWriter::onProgress ( int  step,
int  total,
const CuData &  data 
)

this method is currently void

Note
onProgress is executed in the main thread

◆ onResult() [1/2]

void CuTWriter::onResult ( const CuData &  data)

calls onUpdate on all listeners and deletes itself afterwards

Parameters
dataCuData with the result to be delivered to every CuDataListener
Note
onResult is called just once from CuWriteActivity.execute (since v1.2.0) This allows cleaning everything after updating listeners.
onResult is executed in the main thread

References getType().

◆ onResult() [2/2]

void CuTWriter::onResult ( const std::vector< CuData > &  datalist)

unused. To comply with interface

See also
onResult(const CuData &data)

◆ removeDataListener()

void CuTWriter::removeDataListener ( CuDataListener *  l)
virtual

remove a CuDataListener from the list of listeners of data updates

Parameters
la CuDataListener that will be removed from the list of listeners

Implements CuTangoActionI.

References stop().

◆ sendData()

void CuTWriter::sendData ( const CuData &  data)
virtual

subclasses will implement the necessary code to set data on themselves or to the activities

Parameters
dataa CuData compiled with the necessary fields accepted by the specific implementation

The data can be set locally on the object implementing this interface or can be forwarded to the activity by means of Cumbia::postEvent carrying an argument derived from CuActivityEvent. See CuTReader::sendData for an example

Send a request and receive a response <em>asynchronously</em>
Use sendData in conjunction with CuDataListener::onUpdate, as described in the getData documentation.

Implements CuTangoActionI.

◆ setConfiguration()

void CuTWriter::setConfiguration ( const CuData &  db_conf)

Set database configuration.

Parameters
db_confdata of type "property" obtained from a

◆ setOptions()

void CuTWriter::setOptions ( const CuData &  options)

◆ setTag()

void CuTWriter::setTag ( const CuData &  tag)

◆ setWriteValue()

void CuTWriter::setWriteValue ( const CuVariant &  write_val)

set the value that will be written after start is called

Parameters
write_vala const reference to a CuVariant containing the value to write when start is called
See also
start

Referenced by CuTangoWriterFactory::create().

◆ start()

void CuTWriter::start ( )
virtual

creates and registers a CuWriteActivity to trigger a write operation on the Tango control system

Note
This function is internally used by the library. Clients shouldn't need to deal with it.

This method

  • fills in a CuData called activity token, that will be passed to the CuWriteActivity
  • fills in a CuData called thread token, used to register the CuWriteActivity and make the activity shared between writers with the same target.
  • instantiates and registers (i.e. starts) a CuWriteActivity.
Note
start is usually called by CumbiaTango::addAction, which in turn is called by qumbia-tango-controls CuTControlsWriter::execute.

Implements CuTangoActionI.

References CuDeviceFactoryService::CuDeviceFactoryServiceType, and TSource::SrcCmd.

◆ stop()

void CuTWriter::stop ( )
virtual

the method where activities are unregistered from Cumbia

This is the place where activities are unregistered from Cumbia by the Cumbia::unregisterActivity method

Examples
See also Cumbia::unregisterActivity

Implements CuTangoActionI.

Referenced by removeDataListener().


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