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 std::string &name, bool isGlobal, bool isOnChange, bool isSubscribable, PropertyType type, bool multiplexed, int32_t priorityOffset, const std::string ¬ificationThreadKey, AbstractServerAction *getServerAction, AbstractServerAction *setServerAction, const std::string &className) | |
Constructor. | |
virtual | ~Property () |
Destructor. | |
template<typename PropDataType , typename PropFilterType > | |
void | get (AbstractDevice &device, const std::string &cyleSelector, const PropFilterType &filter, const PropDataType &value) |
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<typename PropDataType > | |
void | get (AbstractDevice &device, const std::string &cyleSelector, const PropDataType &value) |
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<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. | |
template<typename PropDataType > | |
void | set (AbstractDevice &dev, const std::string &cyleSelector, const PropDataType &data) |
This method modifies the value of the property. | |
void | validateParameters (AbstractDevice &dev, const std::string &cycleSelector, bool hasFilter, RequestType reqType) |
This method validates the request to the property throwing an exception in case it is not correct. | |
int64_t | getDataTimestamp (AbstractDevice &device, MultiplexingContext &context, const rdaData &filter) |
This method returns the newest timestamp found on the fields, corresponding to the given parameters. | |
std::string & | getName () |
get name of the property | |
PropertyType | getType () |
the type of the property (Acquisition/Setting) | |
int32_t | getPriorityOffset () |
priority of the property | |
bool | isGlobal () |
to know if the property is global | |
bool | isOnChange () |
to know if the property is global | |
bool | isMultiplexed () |
bool | isSubscribable () |
virtual void | printConfig (FesaStream *configStream) |
this method prints the property configuration into the stream passed by argument | |
virtual void | printState (FesaStream *fesaStream, double elapsedTime) |
this method prints the actual state of the property (frequency of the completed actions) into the stream passed by argument | |
const std::string & | getNotificationThreadKey () |
this method generates an Listener error for all underliing subscribers | |
const std::string & | getClassName () |
Protected Member Functions | |
void | get (AbstractDevice &device, MultiplexingContext &context, const rdaData &filter, rdaData &value, RequestType reqType) |
This method returns the value of a property when the context is necessary. | |
void | get (AbstractDevice &device, const std::string &cycleSelector, const rdaData &filter, rdaData &value, RequestType reqType) |
This method returns the value of a property when the context is not necessary. | |
void | set (AbstractDevice &device, const std::string &cycleSelector, const rdaData &filter, const rdaData &value) |
This method modifies the value of the property. | |
void | validateCycleSelector (AbstractDevice &device, const std::string &cycleSelector, RequestType reqType) |
this pure virtual method is needed in order to validate a cycle selector. It is implemented in the lab-specific package, and throws an exception, if the cycle selector is invalid. | |
bool | needFilter () |
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 | isOnChange_ |
true if the OnChange mechanism can be used for this property | |
bool | isSubscribable_ |
true if the property supports subscription | |
PropertyType | type_ |
indicates if the property is an acquisition or setting property | |
bool | multiplexed_ |
int32_t | priorityOffset_ |
priority offset: level 0 means normal priority -1 has highest BG priority than level -2. | |
std::vector < SubscriptionParameter * > | subscribers_ |
here the subscribers of the property are stored | |
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 | |
AbstractServerAction * | getServerAction_ |
server action to get the value of the property | |
AbstractServerAction * | setServerAction_ |
server action to set the value of the property | |
std::string | className_ |
name of the class the property belongs to | |
Friends | |
class | AbstractSubscriptionFilter |
class | SubscriptionFilter |
class | FesaDeviceServer |
This class represents a property which computes through server actions the value of a requested attribute.
Definition at line 27 of file Property.h.
fesa::Property::Property | ( | const std::string & | name, | |
bool | isGlobal, | |||
bool | isOnChange, | |||
bool | isSubscribable, | |||
PropertyType | type, | |||
bool | multiplexed, | |||
int32_t | priorityOffset, | |||
const std::string & | notificationThreadKey, | |||
AbstractServerAction * | getServerAction, | |||
AbstractServerAction * | setServerAction, | |||
const std::string & | className | |||
) |
Constructor.
name | of the property | |
isGlobal | true if the property is on the | |
isOnChange | ||
multiplexed | true if the property is multiplexed | |
priorityOffset | level 0 means normal priority -1 has highest BG priority than level -2. | |
getServerAction | with the pointer to the server action that will be executed to get the value for the property | |
setServerAction | with the pointer to the server action that will be executed to set the value for the property |
Definition at line 21 of file Property.cpp.
fesa::Property::~Property | ( | ) | [virtual] |
Destructor.
Definition at line 40 of file Property.cpp.
References getServerAction_, and setServerAction_.
void fesa::Property::get | ( | AbstractDevice & | device, | |
const std::string & | cycleSelector, | |||
const rdaData & | filter, | |||
rdaData & | value, | |||
RequestType | reqType | |||
) | [protected] |
This method returns the value of a property when the context is not necessary.
device | device we want to access | |
cycleSelector | cycle for which the value of the property will be retrieved | |
filter | RDA data containing the filter of the property | |
[out] | value | data containing the value of the propertyy |
reqType |
Definition at line 55 of file Property.cpp.
References fesa::MultiplexingContext::CHECK_FLAG_TO_BE_SYNC, fesa::AbstractServerAction::execute(), fesa::EXTRA_CRITERION_NAME, FesaErrorPropertyNotReadable, getServerAction_, name_, fesa::Output, fesa::MultiplexingContext::SET_NOT_ALLOWED, fesa::MultiplexingContext::setAcquisitionAccess(), fesa::MultiplexingContext::setExtraCondition(), fesa::MultiplexingContext::setSettingAccess(), and validateParameters().
void fesa::Property::get | ( | AbstractDevice & | device, | |
MultiplexingContext & | context, | |||
const rdaData & | filter, | |||
rdaData & | value, | |||
RequestType | reqType | |||
) | [protected] |
This method returns the value of a property when the context is necessary.
device | device we want to access | |
context | context for which we want the value of the property | |
filter | RDA data containing the filter of the property | |
[out] | value | data containing the value of the propertyy |
reqType |
This | function can throw different FesaExceptions |
Definition at line 90 of file Property.cpp.
References fesa::MultiplexingContext::CHECK_FLAG_TO_BE_SYNC, fesa::AbstractServerAction::execute(), FesaErrorPropertyNotReadable, getServerAction_, name_, fesa::Output, fesa::MultiplexingContext::SET_NOT_ALLOWED, fesa::MultiplexingContext::setAcquisitionAccess(), and fesa::MultiplexingContext::setSettingAccess().
void fesa::Property::get | ( | AbstractDevice & | device, | |
const std::string & | cyleSelector, | |||
const PropDataType & | value | |||
) | [inline] |
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.
PropDataType | Type of the data, as it is defined in the custom class | |
PropFilterType | Type of the filter, as it is defined in the custom class |
device | the device we want to access | |
cyleSelector | cycle for which the value of the property will be retrieved | |
[out] | value | data containing the valur of the property |
This | function can throw different FesaExceptions |
Definition at line 366 of file Property.h.
void fesa::Property::get | ( | AbstractDevice & | device, | |
const std::string & | cyleSelector, | |||
const PropFilterType & | filter, | |||
const PropDataType & | value | |||
) | [inline] |
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.
PropDataType | Type of the data, as it is defined in the custom class | |
PropFilterType | Type of the filter, as it is defined in the custom class |
device | the device we want to access | |
cyleSelector | cycle for which the value of the property will be retrieved | |
filter | data containing the filter of the property | |
[out] | value | data containing the value of the property |
This | function can throw different FesaExceptions |
Definition at line 352 of file Property.h.
Referenced by fesa::AbstractSubscriptionFilter::cycleFirstUpdate(), and fesa::SubscriptionFilter::doUpdate().
const std::string & fesa::Property::getClassName | ( | ) |
Definition at line 261 of file Property.cpp.
References className_.
Referenced by fesa::SubscriptionTreeManager::addSubscriptionParam().
int64_t fesa::Property::getDataTimestamp | ( | AbstractDevice & | device, | |
MultiplexingContext & | context, | |||
const rdaData & | filter | |||
) |
This method returns the newest timestamp found on the fields, corresponding to the given parameters.
device | the device, from which we need the stamp | |
context | the context, from which we need the stamp | |
filter | Some criteria, which could specify our stamp |
Definition at line 226 of file Property.cpp.
Referenced by fesa::SubscriptionFilter::doUpdate().
std::string & fesa::Property::getName | ( | ) | [inline] |
get name of the property
Definition at line 346 of file Property.h.
References name_.
Referenced by fesa::AbstractServerDeviceClass::configurePropertiesActions().
const std::string & fesa::Property::getNotificationThreadKey | ( | ) |
this method generates an Listener error for all underliing subscribers
Messsage | The error message |
Definition at line 256 of file Property.cpp.
References notificationThreadKey_.
int32_t fesa::Property::getPriorityOffset | ( | ) | [inline] |
priority of the property
Definition at line 332 of file Property.h.
References priorityOffset_.
PropertyType fesa::Property::getType | ( | ) | [inline] |
the type of the property (Acquisition/Setting)
Definition at line 327 of file Property.h.
References type_.
Referenced by fesa::SubscriptionParameter::addSubscriber().
bool fesa::Property::isGlobal | ( | ) | [inline] |
to know if the property is global
Definition at line 307 of file Property.h.
References isGlobal_.
Referenced by fesa::FesaDeviceServer::decodeIOPoint().
bool fesa::Property::isMultiplexed | ( | ) | [inline] |
Definition at line 322 of file Property.h.
References multiplexed_.
Referenced by fesa::SubscriptionParameter::addSubscriber().
bool fesa::Property::isOnChange | ( | ) | [inline] |
to know if the property is global
Definition at line 312 of file Property.h.
References isOnChange_.
bool fesa::Property::isSubscribable | ( | ) | [inline] |
Definition at line 317 of file Property.h.
References isSubscribable_.
bool fesa::Property::needFilter | ( | ) | [inline, protected] |
true if the property needs a filter
Definition at line 337 of file Property.h.
References getServerAction_, fesa::AbstractServerAction::needFilter(), and setServerAction_.
Referenced by validateParameters().
void fesa::Property::printConfig | ( | FesaStream * | configStream | ) | [virtual] |
this method prints the property configuration into the stream passed by argument
configStream | in which the information will be printed |
Definition at line 232 of file Property.cpp.
References getServerAction_, isOnChange_, isSubscribable_, multiplexed_, name_, fesa::AbstractServerAction::printConfig(), and setServerAction_.
void fesa::Property::printState | ( | FesaStream * | fesaStream, | |
double | elapsedTime | |||
) | [virtual] |
this method prints the actual state of the property (frequency of the completed actions) into the stream passed by argument
fesaStream | in which the information will be printed |
Definition at line 251 of file Property.cpp.
void fesa::Property::set | ( | AbstractDevice & | device, | |
const std::string & | cycleSelector, | |||
const rdaData & | filter, | |||
const rdaData & | value | |||
) | [protected] |
This method modifies the value of the property.
device | device we want to access | |
cycleSelector | cycle for which the property will be set | |
filter | RDA data containing the filter of the property | |
value | RDA data containing the value to set |
This | function can throw different FesaExceptions |
Definition at line 111 of file Property.cpp.
References fesa::AbstractServerAction::execute(), fesa::EXTRA_CRITERION_NAME, FesaErrorPropertyNotWritable, fesa::Input, name_, fesa::SET, fesa::MultiplexingContext::SET_ALLOWED, fesa::MultiplexingContext::SET_NOT_ALLOWED, fesa::MultiplexingContext::setAcquisitionAccess(), fesa::MultiplexingContext::setExtraCondition(), setServerAction_, fesa::MultiplexingContext::setSettingAccess(), and validateParameters().
void fesa::Property::set | ( | AbstractDevice & | dev, | |
const std::string & | cyleSelector, | |||
const PropDataType & | data | |||
) | [inline] |
This method modifies the value of the property.
dev | device we want to access | |
cycleSelector | cycle for which the value of the property will be retrieved | |
data | value to set |
This | function can throw different FesaExceptions |
Definition at line 373 of file Property.h.
void fesa::Property::set | ( | AbstractDevice & | dev, | |
const std::string & | cyleSelector, | |||
const PropDataType & | data, | |||
const PropFilterType & | filter | |||
) | [inline] |
This method modifies the value of the property.
dev | device we want to access | |
cycleSelector | cycle for which the value of the property will be retrieved | |
data | value to set | |
filter | data containing the filter of the property |
This | function can throw different FesaExceptions |
Definition at line 359 of file Property.h.
void fesa::Property::validateCycleSelector | ( | fesa::AbstractDevice & | device, | |
const std::string & | cycleSelector, | |||
fesa::RequestType | reqType | |||
) | [protected] |
this pure virtual method is needed in order to validate a cycle selector. It is implemented in the lab-specific package, and throws an exception, if the cycle selector is invalid.
this method validates the cycle selector We assume that cycle selector is not empty.
device | The related device | |
cycleSelector | The cycle selector, which needs to be checked | |
reqType | The type of request |
FesaException | The exception, which indicates a invalid cycle selector |
Definition at line 197 of file Property.cpp.
References fesa::CycleSelector::criterion_, fesa::CycleSelector::domain_, FesaErrorIllegalTiming, FesaErrorWrongTimingDomain, fesa::ConfigFieldString::get(), fesa::SynchronizationLabObjectFactory::getInstance(), fesa::AbstractDevice::isMultiplexed(), fesa::CycleDescriptor::isValidCycleSelector(), fesa::AbstractDevice::mainMuxCriterion, name_, fesa::parseCycleSelector(), fesa::SUBSCRIBE, and fesa::AbstractDevice::timingDomain.
Referenced by validateParameters().
void fesa::Property::validateParameters | ( | AbstractDevice & | dev, | |
const std::string & | cycleSelector, | |||
bool | hasFilter, | |||
RequestType | reqType | |||
) |
This method validates the request to the property throwing an exception in case it is not correct.
dev | device | |
cycleSelector | ||
hasFilter | true if the property has filter | |
reqType | which specifies the type of request GET , SET , SUBSCRIBE |
Definition at line 150 of file Property.cpp.
References FesaErrorCycleNULLInMultiplexedProperty, FesaErrorMixedGlobalWithNoneGlobal, FesaErrorPropertyNeedsFilter, FesaErrorPropertyNotSubscribable, FesaErrorPropertyNotSupportFilter, isGlobal_, fesa::AbstractDevice::isMultiplexed(), isSubscribable_, multiplexed_, name_, needFilter(), fesa::SUBSCRIBE, and validateCycleSelector().
friend class AbstractSubscriptionFilter [friend] |
Definition at line 188 of file Property.h.
friend class FesaDeviceServer [friend] |
Definition at line 190 of file Property.h.
friend class SubscriptionFilter [friend] |
Definition at line 189 of file Property.h.
std::string fesa::Property::className_ [protected] |
name of the class the property belongs to
Definition at line 301 of file Property.h.
Referenced by getClassName().
AbstractServerAction* fesa::Property::getServerAction_ [protected] |
server action to get the value of the property
Definition at line 286 of file Property.h.
Referenced by get(), needFilter(), printConfig(), and ~Property().
bool fesa::Property::isGlobal_ [protected] |
true if the property is global
Definition at line 245 of file Property.h.
Referenced by isGlobal(), and validateParameters().
bool fesa::Property::isOnChange_ [protected] |
true if the OnChange mechanism can be used for this property
Definition at line 250 of file Property.h.
Referenced by isOnChange(), and printConfig().
bool fesa::Property::isSubscribable_ [protected] |
true if the property supports subscription
Definition at line 255 of file Property.h.
Referenced by isSubscribable(), printConfig(), and validateParameters().
bool fesa::Property::multiplexed_ [protected] |
multiplexing Criterion of the property
Definition at line 265 of file Property.h.
Referenced by isMultiplexed(), printConfig(), and validateParameters().
std::string fesa::Property::name_ [protected] |
name of the property
Definition at line 240 of file Property.h.
Referenced by get(), getName(), printConfig(), set(), validateCycleSelector(), and validateParameters().
std::string fesa::Property::notificationThreadKey_ [protected] |
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
Definition at line 281 of file Property.h.
Referenced by getNotificationThreadKey().
int32_t fesa::Property::priorityOffset_ [protected] |
priority offset: level 0 means normal priority -1 has highest BG priority than level -2.
Definition at line 270 of file Property.h.
Referenced by getPriorityOffset().
AbstractServerAction* fesa::Property::setServerAction_ [protected] |
server action to set the value of the property
Definition at line 291 of file Property.h.
Referenced by needFilter(), printConfig(), set(), and ~Property().
std::vector<SubscriptionParameter*> fesa::Property::subscribers_ [protected] |
here the subscribers of the property are stored
Definition at line 274 of file Property.h.
PropertyType fesa::Property::type_ [protected] |
indicates if the property is an acquisition or setting property
Definition at line 260 of file Property.h.
Referenced by getType().