fesa-core  4.2.0
fesa::ServerData Class Referenceabstract

The framework's abstraction of a property's data or of a property's data filters. More...

#include <ServerData.h>

Inheritance diagram for fesa::ServerData:
fesa::PropertyData

Classes

struct  Array2DSize
 Representation of the size of a two-dimensional array. More...
 
struct  ArraySize
 Representation of the size of a one-dimensional array. More...
 
struct  StringArray2DSize
 Representation of the size of a two-dimensional array of strings. More...
 
struct  StringArraySize
 Representation of the size of a one-dimensional array of strings. More...
 

Public Member Functions

const cmw::data::Data & getCMWData () const
 Get the underlying CMW data STD: Not sure we can do everything w/o this member function, e.g. More...
 
std::auto_ptr< cmw::data::Data > releaseCMWData ()
 
void checkOutgoingDataConsistency () const
 Check consistency of outgoing data. More...
 

Protected Member Functions

 ServerData (std::auto_ptr< cmw::data::Data > data)
 
bool isItemAvailable (const std::string &name) const
 Check if a value item is available in the data. More...
 
virtual bool areItemsAvailable () const =0
 Check that all the input value items are present in the data. More...
 
virtual void checkItemsTypes () const =0
 Check if the types of the items in the data are the expected ones. More...
 
template<class T >
void set (const std::string &name, T value)
 Set a scalar value item. More...
 
void set (const std::string &name, const char *value, std::size_t maxLength)
 Set a string value item. More...
 
void setArray (const std::string &name, const char **value, const StringArraySize &size)
 Set a string array value item. More...
 
void setArray2D (const std::string &name, const char **value, const StringArray2DSize &size)
 Set a string 2D array value item. More...
 
void setDiscreteFunction (const std::string &name, const ImmutableFunction &value, std::size_t maxSize)
 Set a discrete function value item. More...
 
void setDiscreteFunctionList (const std::string &name, const ImmutableFunctionList &value, std::size_t maxNFunctions, std::size_t maxNPoints)
 Set a discrete function list value item. More...
 
const char * getString (const std::string &name, std::size_t maxLength) const
 Get a string value item. More...
 
const char ** getStringArray (const std::string &name, StringArraySize &size) const
 Get a string array value item. More...
 
const char ** getStringArray2D (const std::string &name, StringArray2DSize &size) const
 Get a string 2D array value item. More...
 
ImmutableFunction getDiscreteFunction (const std::string &name, ArraySize &size) const
 Get a function value item. More...
 
ImmutableFunctionList getDiscreteFunctionList (const std::string &name, Array2DSize &size) const
 Get a function-list value item. More...
 
void checkItemType (const std::string &name, const std::string &expectedType) const
 Check if the type of the item in the data is the expected one. More...
 
template<class T >
void checkItemValue (const std::string &name) const
 Check if the value of the item in the data belong to the allowed set, e.g. More...
 
virtual void checkIncomingItemsValues () const =0
 Check if the values of the items in the data belong to the allowed sets, e.g. More...
 
template<class T >
void setArray (const std::string &name, const T *value, const ArraySize &size)
 Set an array value item. More...
 
template<class T >
void setArray2D (const std::string &name, const T *value, const Array2DSize &size)
 Set an 2D array value item. More...
 
template<class T >
get (const std::string &name) const
 Get a scalar value item. More...
 
template<class T >
const T * getArray (const std::string &name, ArraySize &size) const
 Get an array value item. More...
 
template<class T >
const T * getArray2D (const std::string &name, Array2DSize &size) const
 Get a 2D array value item. More...
 

Detailed Description

The framework's abstraction of a property's data or of a property's data filters.

It provides access to the "raw" CMW data for get and set requests

Constructor & Destructor Documentation

fesa::ServerData::ServerData ( std::auto_ptr< cmw::data::Data >  data)
explicitprotected

Constructor that takes ownership of the passed Data object.

Parameters
dataauto_ptr containing the data to use.
Exceptions
FesaExceptionif data points to NULL

Member Function Documentation

virtual bool fesa::ServerData::areItemsAvailable ( ) const
protectedpure virtual

Check that all the input value items are present in the data.

The check is necessary when partial setting of a property is not allowed

Returns
'true' if the data contains all the items, 'false' otherwise

Implemented in fesa::PropertyData.

virtual void fesa::ServerData::checkIncomingItemsValues ( ) const
protectedpure virtual

Check if the values of the items in the data belong to the allowed sets, e.g.

the value is in the range between the minimal and the maximal value, the value of an enumeration type is one of the enumerated values

Exceptions
FesaExceptionif the values of the items in the data are not the allowed ones

Implemented in fesa::PropertyData.

virtual void fesa::ServerData::checkItemsTypes ( ) const
protectedpure virtual

Check if the types of the items in the data are the expected ones.

Exceptions
FesaExceptionif the types of the items in the data are not the expected ones

Implemented in fesa::PropertyData.

void fesa::ServerData::checkItemType ( const std::string &  name,
const std::string &  expectedType 
) const
protected

Check if the type of the item in the data is the expected one.

Parameters
nameThe name of the item
expectedTypeThe expected type of the item
Exceptions
FesaExceptionif the type of the item in the data is not the expected one
template<class T >
void fesa::ServerData::checkItemValue ( const std::string &  name) const
inlineprotected

Check if the value of the item in the data belong to the allowed set, e.g.

the value is in the range between the minimal and the maximal value, the value of an enumeration type is one of the enumerated values

Parameters
nameThe name of the value item
directionOptional direction. If set, the value is checked taking into account the direction.
Exceptions
FesaExceptionif the values of the items in the data are not the allowed ones
void fesa::ServerData::checkOutgoingDataConsistency ( ) const

Check consistency of outgoing data.

Ensure validity of the value items

Exceptions
FesaExceptionif the values of items in the data do not belong to the set of allowed values
template<class T >
T fesa::ServerData::get ( const std::string &  name) const
protected

Get a scalar value item.

Parameters
nameThe name of the item
Returns
The value of the item
template<class T >
const T* fesa::ServerData::getArray ( const std::string &  name,
ArraySize size 
) const
protected

Get an array value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the array (size.size is [OUT], size.maxSize is [IN])
Returns
The pointer to the memory of the array. It should not be deleted
Exceptions
FesaExceptionif the number of elements is bigger than the maximal one
template<class T >
const T* fesa::ServerData::getArray2D ( const std::string &  name,
Array2DSize size 
) const
protected

Get a 2D array value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the array (size.nRows is [OUT], size.nColumns is [OUT], size.maxNRows is [IN], size.maxNColumns is [IN])
Returns
The pointer to the memory of the array. It should not be deleted
Exceptions
FesaExceptionif the number of rows is bigger than the maximal one
FesaExceptionif the number of columns is bigger than the maximal one
const cmw::data::Data & fesa::ServerData::getCMWData ( ) const

Get the underlying CMW data STD: Not sure we can do everything w/o this member function, e.g.

set with ProxyInterface. Needed for ServerAction to return it to property and CallbackGetSet. Needed by ProxyInterface to give it to CMW

Returns
The underlying CMW data
ImmutableFunction fesa::ServerData::getDiscreteFunction ( const std::string &  name,
ArraySize size 
) const
protected

Get a function value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the function (size.size is [OUT], size.maxSize is [IN])
Returns
An ImmutableFunction object.
Exceptions
FesaExceptionif the number of points is greater than the maximal one
ImmutableFunctionList fesa::ServerData::getDiscreteFunctionList ( const std::string &  name,
Array2DSize size 
) const
protected

Get a function-list value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the function list. Inputs: maxNRows is the maximum number of functions, maxNColumns the maximum number of points per function. Outputs: nRows is the number of functions, nCols is the maximum number of points in a single function.
Returns
An ImmutableFunctionList object.
Exceptions
FesaExceptionif the number of functions or points is greater than the maximal one
const char * fesa::ServerData::getString ( const std::string &  name,
std::size_t  maxLength 
) const
protected

Get a string value item.

Parameters
nameThe name of the item
maxLengthThe maximal length of the string
Returns
The value of the item
Exceptions
FesaExceptionif the length of the string is longer than the maximal one
const char ** fesa::ServerData::getStringArray ( const std::string &  name,
StringArraySize size 
) const
protected

Get a string array value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the array (size.size is [OUT], size.maxSize is [IN], size.maxLength is [IN])
Returns
The pointer to the memory of the array. It should not be deleted
Exceptions
FesaExceptionif the number of elements is bigger than the maximal one
FesaExceptionif the length of a string is longer than the maximal one
const char ** fesa::ServerData::getStringArray2D ( const std::string &  name,
StringArray2DSize size 
) const
protected

Get a string 2D array value item.

Parameters
nameThe name of the item
size[IN][OUT] The size of the array (size.nRows is [OUT], size.nColumns is [OUT], size.maxNRows is [IN], size.maxNColumns is [IN], size.maxLength is [IN])
Returns
The pointer to the memory of the array. It should not be deleted
Exceptions
FesaExceptionif the number of rows is bigger than the maximal one
FesaExceptionif the number of columns is bigger than the maximal one
FesaExceptionif the length of a string is longer than the maximal one
bool fesa::ServerData::isItemAvailable ( const std::string &  name) const
protected

Check if a value item is available in the data.

Parameters
nameThe name of the value item
Returns
'true' if the data contains the item, 'false' otherwise
std::auto_ptr< cmw::data::Data > fesa::ServerData::releaseCMWData ( )

/!\ /!\ This object cannot be used anymore after this function is called. /!\ /!\ Releases the contained CMW Data object. Ownership is transfered to the caller. Leaves this object in an unusable state.

Exceptions
FesaExceptionif this object was instantiated with a reference to a Data object.
template<class T >
void fesa::ServerData::set ( const std::string &  name,
value 
)
inlineprotected

Set a scalar value item.

Parameters
nameThe name of the item
valueThe value of the item
void fesa::ServerData::set ( const std::string &  name,
const char *  value,
std::size_t  maxLength 
)
protected

Set a string value item.

Parameters
nameThe name of the item
valueThe value of the item
maxLengthThe maximal length of the string
Exceptions
FesaExceptionif the length of the string is longer than the maximal one
template<class T >
void fesa::ServerData::setArray ( const std::string &  name,
const T *  value,
const ArraySize size 
)
inlineprotected

Set an array value item.

Parameters
nameThe name of the item
valueThe value of the item
sizeThe size of the array
Exceptions
FesaExceptionif the provided number of elements is bigger than the maximal one
void fesa::ServerData::setArray ( const std::string &  name,
const char **  value,
const StringArraySize size 
)
protected

Set a string array value item.

Parameters
nameThe name of the item
valueThe value of the item
sizeThe size of the array
Exceptions
FesaExceptionif the provided number of elements is bigger than the maximal one
FesaExceptionif the length of a string is longer than the maximal one
template<class T >
void fesa::ServerData::setArray2D ( const std::string &  name,
const T *  value,
const Array2DSize size 
)
inlineprotected

Set an 2D array value item.

The array must be allocated contiguously

Parameters
nameThe name of the item
valueThe value of the item
sizeThe size of the array
Exceptions
FesaExceptionif the provided number of rows is bigger than the maximal one
FesaExceptionif the provided number of columns is bigger than the maximal one
void fesa::ServerData::setArray2D ( const std::string &  name,
const char **  value,
const StringArray2DSize size 
)
protected

Set a string 2D array value item.

The array must be allocated contiguously. FESA doesn't support 2D arrays of strings

Parameters
nameThe name of the item
valueThe value of the item
sizeThe size of the array
Exceptions
FesaExceptionif the provided number of rows is bigger than the maximal one
FesaExceptionif the provided number of columns is bigger than the maximal one
FesaExceptionif the length of a string is longer than the maximal one
void fesa::ServerData::setDiscreteFunction ( const std::string &  name,
const ImmutableFunction value,
std::size_t  maxSize 
)
protected

Set a discrete function value item.

Parameters
nameThe name of the item
valueThe value of the item
maxSizeThe maximum size (in number of points) of the item
void fesa::ServerData::setDiscreteFunctionList ( const std::string &  name,
const ImmutableFunctionList value,
std::size_t  maxNFunctions,
std::size_t  maxNPoints 
)
protected

Set a discrete function list value item.

Parameters
nameThe name of the item
valueThe value of the item
maxNFunctionsThe maximum number of functions of the item
maxNPointsThe maximum number of points per function of the item

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