|
template<> |
void CISST_EXPORT | Copy (mtsGenericObject &data, const mtsGenericObject &source) |
|
template<> |
void CISST_EXPORT | SerializeBinary (const mtsGenericObject &data, std::ostream &outputStream) throw(std::runtime_error) |
|
template<> |
void CISST_EXPORT | DeSerializeBinary (mtsGenericObject &data, std::istream &inputStream, const cmnDataFormat &localFormat, const cmnDataFormat &remoteFormat) throw(std::runtime_error) |
|
template<> |
void CISST_EXPORT | SerializeText (const mtsGenericObject &data, std::ostream &outputStream, const char delimiter) throw(std::runtime_error) |
|
template<> |
std::string CISST_EXPORT | SerializeDescription (const mtsGenericObject &data, const char delimiter, const std::string &userDescription) |
|
template<> |
void CISST_EXPORT | DeSerializeText (mtsGenericObject &data, std::istream &inputStream, const char delimiter) throw(std::runtime_error) |
|
template<> |
std::string CISST_EXPORT | HumanReadable (const mtsGenericObject &data) |
|
template<> |
bool CISST_EXPORT | ScalarNumberIsFixed (const mtsGenericObject &data) |
|
template<> |
size_t CISST_EXPORT | ScalarNumber (const mtsGenericObject &data) |
|
template<> |
double CISST_EXPORT | Scalar (const mtsGenericObject &data, const size_t index) throw(std::out_of_range) |
|
template<> |
std::string CISST_EXPORT | ScalarDescription (const mtsGenericObject &data, const size_t index, const std::string &userDescription) throw(std::out_of_range) |
|
|
static std::string | HumanReadable (const DataType &data) |
|
static void | Copy (DataType &data, const DataType &source) |
|
static std::string | SerializeDescription (const DataType &data, const char delimiter, const std::string &userDescription="") |
|
static void | SerializeText (const DataType &data, std::ostream &outputStream, const char delimiter= ',') throw (std::runtime_error) |
|
static void | DeSerializeText (DataType &data, std::istream &inputStream, const char delimiter= ',') throw (std::runtime_error) |
|
static void | SerializeBinary (const DataType &data, std::ostream &outputStream) throw (std::runtime_error) |
|
static void | DeSerializeBinary (DataType &data, std::istream &inputStream, const cmnDataFormat &localFormat, const cmnDataFormat &remoteFormat) throw (std::runtime_error) |
|
static size_t | SerializeBinaryByteSize (const DataType &data) |
|
static size_t | SerializeBinary (const DataType &data, char *buffer, size_t bufferSize) |
|
static size_t | DeSerializeBinary (DataType &data, const char *buffer, size_t bufferSize, const cmnDataFormat &CMN_UNUSED(localFormat), const cmnDataFormat &CMN_UNUSED(remoteFormat)) |
|
static std::string | ScalarDescription (const DataType &data, const size_t index, const std::string &userDescription="") throw (std::out_of_range) |
|
static double | Scalar (const DataType &data, const size_t index) throw (std::out_of_range) |
|
static size_t | ScalarNumber (const DataType &data) |
|
static bool | ScalarNumberIsFixed (const DataType &data) |
|
template<typename _elementType>
class cmnData< _elementType >
cmnDataFunction. Data functions used to handle objects across the cisst libraries. All data function names use the prefix cmnData and the first parameter is the object currently manipulated.
The main principle is to rely on the compiler to find the proper class overload for each object type. void cmnData<int>::HumanReadable(const int & data); void cmnData<std::string>::HumanReadable(const std::string & data); ...
This approach allows to manipulate external data types by overloading the required cmnData class.
Error handling is based on standard exceptions using std::runtime_error.
template<typename _elementType>
static std::string cmnData< _elementType >::SerializeDescription |
( |
const DataType & |
data, |
|
|
const char |
delimiter, |
|
|
const std::string & |
userDescription = "" |
|
) |
| |
|
static |
Provides a human readble string describing each element of the data object. This description is for all instances of the same "size". For example, if the data object is a dynamic vector of intergers of size 4, the delimiter is a comma and the user description is "V", the returned string would look like "V.size,v[0],v[1],v[2],v[3]".
template<typename _elementType>
static void cmnData< _elementType >::SerializeText |
( |
const DataType & |
data, |
|
|
std::ostream & |
outputStream, |
|
|
const char |
delimiter = ',' |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
static |
Serializes each element of the data object in text format, separated by the user provided delimiter. Using the previous example, this method would stream the size followed by the 4 value: "4,11,22,33,44". I/O stream errors can lead to exceptions.