Classes | Public Member Functions | Private Attributes

ACSSampObjImpl< ACS_SAMP_C > Class Template Reference

#include <acssampObjImpl.h>

Collaboration diagram for ACSSampObjImpl< ACS_SAMP_C >:
Collaboration graph
[legend]

List of all members.

Classes

struct  SampData

Public Member Functions

 ACSSampObjImpl (const ACE_CString &_cobName, const ACE_CString &_propertyName, ACS::TimeInterval _sampFrequency, ACS::TimeInterval _sampReportRate, baci::BACIComponent *_m_cob, ACS::Property_var _genProperty, ACSSampImpl *_sampPtr)
virtual ~ACSSampObjImpl ()
virtual void start ()
virtual void stop ()
virtual void destroy ()
virtual void suspend ()
virtual void resume ()
virtual void setFrequency (ACS::TimeInterval sFrequency)
virtual void getFrequency (ACS::TimeInterval_out sFrequency)
virtual void setRate (ACS::TimeInterval rRate)
virtual void getRate (ACS::TimeInterval_out rRate)
virtual void initialize ()
virtual void doSamp ()
virtual void flushSamp ()
ACS::TimeInterval getSampFrequency () const
void setSampFrequency (const ACS::TimeInterval &_sampFrequency)
ACS::TimeInterval getReportRate () const
void setReportRate (const ACS::TimeInterval &_sampReportRate)
CORBA::Object_ptr getCORBAReference () const
virtual char * getChannelName ()
bool isInDestructState () const

Private Attributes

ACE_CString cobName
ACE_CString propertyName
ACE_CString sampObjName
ACE_CString sampChannelName
ACS::TimeInterval sampFrequency
ACS::TimeInterval sampReportRate
bool inDestructState
baci::BACIComponentcob_p
SamplingThread< ACS_SAMP_TL > * controlLoop_p
SamplingThreadFlush
< ACS_SAMP_TL > * 
flush_p
ACS::Property_var genProperty_p
T_var propToSamp_p
ACE_Message_Queue< ACE_SYNCH > * mq_p
nc::SimpleSuppliersampSupplier_p
CORBA::Object_ptr reference_p
ACSSampImplsamp_p

Detailed Description

template<ACS_SAMP_C>
class ACSSampObjImpl< ACS_SAMP_C >

This class implements all methods used to sample a specific property. In particular, once a new sampling object is initialized, with user-defined parameters (like the sampling rate, the report rate etc.) it allows to start/stop/pause/continue the sampling. Moreover it expose methods to change these parametrs on-the-fly. All buffered data are delivered automatically to the notification channel; trough it a client could retrieve them, and subsequently plot them or perform the necessary kind of analysis.

This class is a template. This because the type of the property could be RWdouble, RWlong etc.

This class is meant to be used trough the factory class ACSSampImpl.


Constructor & Destructor Documentation

template<ACS_SAMP_C >
ACSSampObjImpl< ACS_SAMP_C >::ACSSampObjImpl ( const ACE_CString &  _cobName,
const ACE_CString &  _propertyName,
ACS::TimeInterval  _sampFrequency,
ACS::TimeInterval  _sampReportRate,
baci::BACIComponent _m_cob,
ACS::Property_var  _genProperty,
ACSSampImpl _sampPtr 
)

Constructor It construct the sampling object, using the following parameters:

Parameters:
_cobName name of the component, which property is to be sampled (e.g.LAMP1 )
_propertyName name of the property to be sampled (e.g. brightness )
_sampFrequency sampling frequency: period between two consecutive sampling (units are 100ns; e.g. 1000000 means 0.1 sec i.e. 10 samples per second)
_sampReportRate number of second the process should buffer before actually sending (notifying) data (units are 100ns; e.g. 10000000 means collect data for 1 second)
_m_cob BACIComponent of the factory object.
_genProperty reference to a generic property
_sampPtr pointer to the factory object. It is used to store created sampling object in an internal (member of factory object) list; when the the sampling objects are destroyed, the corresponding entry in the list is cleared. When the base factory is destroyed, it checks the list and in case takes care to clean-up correctly all the existing sampling objects (still not removed from the list).
template<ACS_SAMP_C >
virtual ACSSampObjImpl< ACS_SAMP_C >::~ACSSampObjImpl (  )  [virtual]

Destructor


Member Function Documentation

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::destroy (  )  [virtual]

Destroy the sampling object. Implementation of IDL destroy() interface (inherited from the ACS:Subscription interface).

Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::doSamp (  )  [virtual]

Do the sampling. Retrieves data from the property using get_sync(). Data are stored in an internal array used as a buffer.

Returns:
void

Referenced by SamplingThread< ACS_SAMP_TL >::runLoop().

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::flushSamp (  )  [virtual]

Flush data from the internal array to the notification channel.

Returns:
void

Referenced by SamplingThreadFlush< ACS_SAMP_TL >::runLoop().

template<ACS_SAMP_C >
virtual char* ACSSampObjImpl< ACS_SAMP_C >::getChannelName (  )  [virtual]

Is the channel name of the notification channel onto which the data are delivered. The name is composed by concatenation of the following string: NC_ Component name_ Property name_ SampRate_ ReportRate_ (e.g. NC_LAMP1_brightness_1000000_10000000)

Returns:
channelName.

template<ACS_SAMP_C >
CORBA::Object_ptr ACSSampObjImpl< ACS_SAMP_C >::getCORBAReference (  )  const [inline]

Internal method to get the CORBA reference to the newly activated CORBA object (i.e. this sampling object).

Returns:
reference_p reference to the CORBA object.

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::getFrequency ( ACS::TimeInterval_out  sFrequency  )  [virtual]

Gets the sampling frequency of an already activated sampling object.

Parameters:
sFrequency the current sampling frequency (units are 100ns; e.g. 1000000 means 10 sample per second)
Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::getRate ( ACS::TimeInterval_out  rRate  )  [virtual]

Gets the report rate of an already activated sampling object.

Parameters:
sFrequency the current report rate report rate (units are 100ns; e.g. 10000000 means collect data for 1 second)
Returns:
void

template<ACS_SAMP_C >
ACS::TimeInterval ACSSampObjImpl< ACS_SAMP_C >::getReportRate (  )  const [inline]

Internal method to retrieve the report rate.

Returns:
sampReportRate

template<ACS_SAMP_C >
ACS::TimeInterval ACSSampObjImpl< ACS_SAMP_C >::getSampFrequency (  )  const [inline]

Internal method to retrieve the sampling frequency.

Returns:
sampFrequency

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::initialize (  )  [virtual]

Initialize (activate) the sampling object, with parameters passed in the constructor.

Exceptions:
ACSErrTypeCommon::OutOfBoundsExImpl 
ACSErrTypeCommon::MemoryFaultExImpl 
ACSErrTypeCommon::CORBAProblemExImpl 
ACSErrTypeCommon::CouldntCreateObjectExImpl 
Returns:
void

template<ACS_SAMP_C >
bool ACSSampObjImpl< ACS_SAMP_C >::isInDestructState (  )  const [inline]

Internal thread used to determine when the sampling object is to be destroyed.

Returns:
state 1 if is in a destruction state.

Referenced by SamplingThreadFlush< ACS_SAMP_TL >::runLoop(), and SamplingThread< ACS_SAMP_TL >::runLoop().

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::resume (  )  [virtual]

Resume the sampling. Implementation of IDL resume() interface (inherited from the ACS:Subscription interface).

Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::setFrequency ( ACS::TimeInterval  sFrequency  )  [virtual]

Sets the sampling frequency of an already activated sampling object.

Parameters:
sFrequency a new sampling frequency (units are 100ns; e.g. 1000000 means 10 sample per second)
Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::setRate ( ACS::TimeInterval  rRate  )  [virtual]

Sets the report rate of an already activated sampling object.

Parameters:
sFrequency a new report rate (units are 100ns; e.g. 10000000 means collect data for 1 second)
Returns:
void

template<ACS_SAMP_C >
void ACSSampObjImpl< ACS_SAMP_C >::setReportRate ( const ACS::TimeInterval &  _sampReportRate  ) 

Internal method to set the report rate.

Parameters:
_sampReportRate. 
Returns:
void

template<ACS_SAMP_C >
void ACSSampObjImpl< ACS_SAMP_C >::setSampFrequency ( const ACS::TimeInterval &  _sampFrequency  ) 

Internal method to set the sampling frequency.

Parameters:
_sampFrequency. 
Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::start (  )  [virtual]

Starts the sampling. Implementation of IDL start() interface.

Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::stop (  )  [virtual]

Stops the sampling. Implementation of IDL stop() interface.

Returns:
void

template<ACS_SAMP_C >
virtual void ACSSampObjImpl< ACS_SAMP_C >::suspend (  )  [virtual]

Suspend the sampling. Implementation of IDL suspend() interface (inherited from the ACS:Subscription interface).

Returns:
void


Member Data Documentation

template<ACS_SAMP_C >
baci::BACIComponent* ACSSampObjImpl< ACS_SAMP_C >::cob_p [private]

BACI Component instance This is a reference to the factory CORBA object

template<ACS_SAMP_C >
ACE_CString ACSSampObjImpl< ACS_SAMP_C >::cobName [private]
template<ACS_SAMP_C >
SamplingThread<ACS_SAMP_TL>* ACSSampObjImpl< ACS_SAMP_C >::controlLoop_p [private]

controlLoop_p is only started once the sampling object is initialized, through the call of method start. It determines the ticks, when the sampling actually occurs; the thread is destroyed when the method destroy is called.

template<ACS_SAMP_C >
SamplingThreadFlush<ACS_SAMP_TL>* ACSSampObjImpl< ACS_SAMP_C >::flush_p [private]

flush_p is only started once the sampling object is initialized, through the call of method start. It determines the time, when the sampling are actually flushed on the NC; the thread is destroyed when the method destroy is called.

template<ACS_SAMP_C >
ACS::Property_var ACSSampObjImpl< ACS_SAMP_C >::genProperty_p [private]
template<ACS_SAMP_C >
bool ACSSampObjImpl< ACS_SAMP_C >::inDestructState [private]
template<ACS_SAMP_C >
ACE_Message_Queue<ACE_SYNCH>* ACSSampObjImpl< ACS_SAMP_C >::mq_p [private]

Internal buffer containing all data, before the delivering to the notification channel.

template<ACS_SAMP_C >
ACE_CString ACSSampObjImpl< ACS_SAMP_C >::propertyName [private]
template<ACS_SAMP_C >
T_var ACSSampObjImpl< ACS_SAMP_C >::propToSamp_p [private]
template<ACS_SAMP_C >
CORBA::Object_ptr ACSSampObjImpl< ACS_SAMP_C >::reference_p [private]
template<ACS_SAMP_C >
ACSSampImpl* ACSSampObjImpl< ACS_SAMP_C >::samp_p [private]
template<ACS_SAMP_C >
ACE_CString ACSSampObjImpl< ACS_SAMP_C >::sampChannelName [private]
template<ACS_SAMP_C >
ACS::TimeInterval ACSSampObjImpl< ACS_SAMP_C >::sampFrequency [private]
template<ACS_SAMP_C >
ACE_CString ACSSampObjImpl< ACS_SAMP_C >::sampObjName [private]
template<ACS_SAMP_C >
ACS::TimeInterval ACSSampObjImpl< ACS_SAMP_C >::sampReportRate [private]
template<ACS_SAMP_C >
nc::SimpleSupplier* ACSSampObjImpl< ACS_SAMP_C >::sampSupplier_p [private]

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