fesa-core  4.3.1
fesa::Property Class Reference

This class represents a property which computes through server actions the value of a requested attribute. More...

#include <Property.h>

Public Member Functions

 Property (const PropertyConstructorParameters &parameters, AbstractServerAction *getServerAction, AbstractServerAction *setServerAction)
 Constructor. More...
 
virtual ~Property ()
 Destructor.
 
template<typename PropDataType , typename PropFilterType >
std::auto_ptr< PropDataType > get (AbstractDevice &device, const std::string &cyleSelector, const PropFilterType &filter)
 Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property. More...
 
template<typename PropDataType >
std::auto_ptr< PropDataType > get (AbstractDevice &device, const std::string &cyleSelector)
 Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property. More...
 
std::auto_ptr< PropertyDataget (AbstractDevice &device, const MultiplexingContext &context)
 Return the data of the property. To be used by property data exporters. More...
 
template<typename PropDataType , typename PropFilterType >
 __attribute__ ((deprecated)) void get(AbstractDevice &device
 Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property. More...
 
template<typename PropDataType >
 __attribute__ ((deprecated)) void get(AbstractDevice &device
 Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property. More...
 
template<typename PropDataType , typename PropFilterType >
void set (AbstractDevice &dev, const std::string &cyleSelector, const PropDataType &data, const PropFilterType &filter)
 This method modifies the value of the property. More...
 
template<typename PropDataType >
void set (AbstractDevice &dev, const std::string &cyleSelector, const PropDataType &data)
 This method modifies the value of the property. More...
 
bool hasDataChanged (const MultiplexingContext &context, AbstractDevice &device, const cmw::data::Data &filter)
 Check if the data published by this property changed This method will be called to decide whether a notification needs to be sent or not. More...
 
void validateParameters (const AbstractDevice &dev, const Selector &cycleSelector, bool hasFilter, const RequestType::RequestType requestType) const
 This method validates the request to the property throwing an exception in case it is not correct. More...
 
const std::string & getName () const
 get name of the property More...
 
PropertyType::PropertyType getType () const
 the type of the property (Acquisition/Setting) More...
 
bool isAcquisition () const
 
bool isGlobal () const
 to know if the property is global More...
 
bool isMultiplexed () const
 
bool isSetting () const
 
bool isAccessPointMultiplexed (const AbstractDevice &device) const
 Returns true if the access point represented by this property is multiplexed on the given device. An access point is the instantiation of this property on a device. This method returns true if the property and the device are both multiplexed, false otherwise. More...
 
bool isSubscribable () const
 
virtual void printConfig (FesaStream *configStream) const
 this method prints the property configuration into the stream passed by argument More...
 
virtual void printState (FesaStream *fesaStream, double elapsedTime) const
 this method prints the actual state of the property (frequency of the completed actions) into the stream passed by argument More...
 
const std::string & getNotificationThreadKey () const
 this method generates an Listener error for all underliing subscribers More...
 

Protected Member Functions

std::auto_ptr< PropertyDatagetInternal (AbstractDevice &device, const MultiplexingContext &context, const cmw::data::Data &filter)
 This method returns the value of a property for a specific context. More...
 
std::auto_ptr< PropertyDatagetInternal (AbstractDevice &device, const Selector &cycleSelector, const cmw::data::Data &filter)
 This method returns the value of a property for a cycle selector. More...
 
void setInternal (AbstractDevice &device, const Selector &cycleSelector, const cmw::data::Data &filter, const PropertyData &value)
 This method modifies the value of the property for a selector. More...
 
virtual void validateCycleSelector (const AbstractDevice &device, const Selector &cycleSelector, RequestType::RequestType reqType) const
 Validates a cycle selector. Throws an exception if the selector is invalid. More...
 
bool hasDataChanged (const RequestEvent &event, AbstractDevice &device, const cmw::data::Data &filter)
 Check if the data published by this property changed This method will be called to decide whether a notification needs to be sent or not. More...
 
bool needFilter () const
 true if the property needs a filter
 

Protected Attributes

std::string name_
 name of the property
 
bool isGlobal_
 true if the property is global
 
bool isSubscribable_
 true if the property supports subscription
 
PropertyType::PropertyType type_
 indicates if the property is an acquisition or setting property
 
bool multiplexed_
 
std::string notificationThreadKey_
 the notification thread key associated to this property. This value is taken from teh code-generation and identifies the thread where all teh notification for this property will run
 
AbstractServerActiongetServerAction_
 server action to get the value of the property
 
AbstractServerActionsetServerAction_
 server action to set the value of the property
 
std::string className_
 name of the class the property belongs to
 

Detailed Description

This class represents a property which computes through server actions the value of a requested attribute.

Constructor & Destructor Documentation

fesa::Property::Property ( const PropertyConstructorParameters parameters,
AbstractServerAction getServerAction,
AbstractServerAction setServerAction 
)

Constructor.

Parameters
parameterscontains all mandatory parameters of the property
getServerActionwith the pointer to the server action that will be executed to get the value for the property (NULL if not used)
setServerActionwith the pointer to the server action that will be executed to set the value for the property (NULL if not used)

Member Function Documentation

template<typename PropDataType , typename PropFilterType >
fesa::Property::__attribute__ ( (deprecated)  )

Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property.

Deprecated:
Use the version that returns a std::auto_ptr<PropDataType> instead.
Template Parameters
PropDataTypeType of the data, as it is defined in the custom class
PropFilterTypeType of the filter, as it is defined in the custom class
Parameters
devicethe device we want to access
cyleSelectorcycle for which the value of the property will be retrieved
[out]valuedata containing the value of the property
Exceptions
Thisfunction can throw different FesaExceptions
template<typename PropDataType >
fesa::Property::__attribute__ ( (deprecated)  )

Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property.

Deprecated:
Use the version that returns a std::auto_ptr<PropDataType> instead.
Template Parameters
PropDataTypeType of the data, as it is defined in the custom class
Parameters
devicethe device we want to access
cyleSelectorcycle for which the value of the property will be retrieved
[out]valuedata containing the value of the property
Exceptions
Thisfunction can throw different FesaExceptions
template<typename PropDataType , typename PropFilterType >
std::auto_ptr< PropDataType > fesa::Property::get ( AbstractDevice device,
const std::string &  cyleSelector,
const PropFilterType &  filter 
)

Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property.

Template Parameters
PropDataTypeType of the data, as it is defined in the custom class
PropFilterTypeType of the filter, as it is defined in the custom class
Parameters
devicethe device we want to access
cyleSelectorcycle for which the value of the property will be retrieved
filterdata containing the filter of the property
Returns
value data containing the value of the property
Exceptions
Thisfunction can throw different FesaExceptions
template<typename PropDataType >
std::auto_ptr< PropDataType > fesa::Property::get ( AbstractDevice device,
const std::string &  cyleSelector 
)

Template method that returns the value of a property This method is meant to be used by the developer to call a property without using the RDA data but using the real data type of the user's property.

Template Parameters
PropDataTypeType of the data, as it is defined in the custom class
Parameters
devicethe device we want to access
cyleSelectorcycle for which the value of the property will be retrieved
Returns
value data containing the value of the property
Exceptions
Thisfunction can throw different FesaExceptions
std::auto_ptr< PropertyData > fesa::Property::get ( AbstractDevice device,
const MultiplexingContext context 
)

Return the data of the property. To be used by property data exporters.

Parameters
deviceThe device for which the data of the property to be taken
contextThe context for which the data of the property to be taken
Returns
The data of the property for the given device and the given context
Exceptions
FesaException
std::auto_ptr< PropertyData > fesa::Property::getInternal ( AbstractDevice device,
const MultiplexingContext context,
const cmw::data::Data &  filter 
)
protected

This method returns the value of a property for a specific context.

Parameters
devicedevice we want to access
contextcontext for which we want the value of the property
filterRDA data containing the filter of the property
Exceptions
Thisfunction can throw different FesaExceptions
Returns
a PropertyData object containing the value of the property.
std::auto_ptr< PropertyData > fesa::Property::getInternal ( AbstractDevice device,
const Selector &  cycleSelector,
const cmw::data::Data &  filter 
)
protected

This method returns the value of a property for a cycle selector.

Parameters
devicedevice we want to access
cycleSelectorcycle for which the value of the property will be retrieved
filterRDA data containing the filter of the property
Returns
a PropertyData object containing the value of the property.
const std::string & fesa::Property::getName ( ) const
inline

get name of the property

Returns
reference to the name of the property
const std::string & fesa::Property::getNotificationThreadKey ( ) const

this method generates an Listener error for all underliing subscribers

Parameters
MesssageThe error message
PropertyType::PropertyType fesa::Property::getType ( ) const
inline

the type of the property (Acquisition/Setting)

Returns
the type
bool fesa::Property::hasDataChanged ( const MultiplexingContext context,
AbstractDevice device,
const cmw::data::Data &  filter 
)

Check if the data published by this property changed This method will be called to decide whether a notification needs to be sent or not.

Parameters
contextThe context to use
deviceThe device this property belongs to
filterThe data filter
Returns
true if the data published by the property changed, false otherwise
bool fesa::Property::hasDataChanged ( const RequestEvent event,
AbstractDevice device,
const cmw::data::Data &  filter 
)
protected

Check if the data published by this property changed This method will be called to decide whether a notification needs to be sent or not.

Parameters
eventThe request event that triggered this server action
deviceThe device this property belongs to
filterThe data filter
Returns
true if the data published by the property changed, false otherwise
bool fesa::Property::isAccessPointMultiplexed ( const AbstractDevice device) const

Returns true if the access point represented by this property is multiplexed on the given device. An access point is the instantiation of this property on a device. This method returns true if the property and the device are both multiplexed, false otherwise.

Returns
true if the access point represented by this property is multiplexed on the given device.
bool fesa::Property::isAcquisition ( ) const
inline
Returns
true if the property is an acquisition property
bool fesa::Property::isGlobal ( ) const
inline

to know if the property is global

Returns
true if the property is global, otherwise false
bool fesa::Property::isMultiplexed ( ) const
inline
Returns
true if the property is multiplexed
bool fesa::Property::isSetting ( ) const
inline
Returns
true if the property is a setting property
bool fesa::Property::isSubscribable ( ) const
inline
Returns
true if the property is subscribable
void fesa::Property::printConfig ( FesaStream *  configStream) const
virtual

this method prints the property configuration into the stream passed by argument

Parameters
configStreamin which the information will be printed
void fesa::Property::printState ( FesaStream *  fesaStream,
double  elapsedTime 
) const
virtual

this method prints the actual state of the property (frequency of the completed actions) into the stream passed by argument

Parameters
fesaStreamin which the information will be printed
template<typename PropDataType , typename PropFilterType >
void fesa::Property::set ( AbstractDevice dev,
const std::string &  cyleSelector,
const PropDataType &  data,
const PropFilterType &  filter 
)

This method modifies the value of the property.

Parameters
devdevice we want to access
cycleSelectorcycle for which the value of the property will be retrieved
datavalue to set
filterdata containing the filter of the property
Exceptions
Thisfunction can throw different FesaExceptions
template<typename PropDataType >
void fesa::Property::set ( AbstractDevice dev,
const std::string &  cyleSelector,
const PropDataType &  data 
)

This method modifies the value of the property.

Parameters
devdevice we want to access
cycleSelectorcycle for which the value of the property will be retrieved
datavalue to set
Exceptions
Thisfunction can throw different FesaExceptions
void fesa::Property::setInternal ( AbstractDevice device,
const Selector &  cycleSelector,
const cmw::data::Data &  filter,
const PropertyData value 
)
protected

This method modifies the value of the property for a selector.

Parameters
devicedevice we want to access
cycleSelectorcycle for which the property will be set (ignored if the property is not multiplexed)
filterRDA data containing the filter of the property
valuePropertyData containing the value to set
Exceptions
Thisfunction can throw different FesaExceptions
void fesa::Property::validateCycleSelector ( const AbstractDevice device,
const Selector &  cycleSelector,
RequestType::RequestType  reqType 
) const
protectedvirtual

Validates a cycle selector. Throws an exception if the selector is invalid.

Parameters
deviceThe device on which the operation (get/set/monitor) is done
cycleSelectorto be checked
reqTypeThe type of request
Exceptions
FesaExceptionindicating the reason why the selector is refused
void fesa::Property::validateParameters ( const AbstractDevice dev,
const Selector &  cycleSelector,
bool  hasFilter,
const RequestType::RequestType  requestType 
) const

This method validates the request to the property throwing an exception in case it is not correct.

Parameters
devdevice
cycleSelector
hasFiltertrue if the property has filter
requestTypethe type of request

Member Data Documentation

bool fesa::Property::multiplexed_
protected

multiplexing Criterion of the property


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