6 #ifndef _cisstMultiTask_mtsComponentState_h
7 #define _cisstMultiTask_mtsComponentState_h
13 #endif // CISST_HAS_JSON
66 enum Enum {CONSTRUCTED, INITIALIZING,
READY, ACTIVE, FINISHING, FINISHED };
67 static std::string EnumToString(
const Enum & value)
throw (std::runtime_error);
68 static Enum EnumFromString(
const std::string & value)
throw (std::runtime_error);
86 bool operator == (
const ThisType & state)
const;
87 bool operator != (
const ThisType & state)
const;
90 bool operator < (
const ThisType & state)
const;
91 bool operator <= (
const ThisType & state)
const;
94 bool operator > (
const ThisType & state)
const;
95 bool operator >= (
const ThisType & state)
const;
102 void SerializeRaw(std::ostream & outputStream)
const;
103 void DeSerializeRaw(std::istream & inputStream);
104 void ToStream(std::ostream & outputStream)
const;
105 void ToStreamRaw(std::ostream & outputStream,
const char delimiter =
' ',
106 bool headerOnly =
false,
const std::string & headerPrefix =
"")
const;
110 void SerializeBinary(std::ostream & outputStream)
const throw (std::runtime_error);
111 void DeSerializeBinary(std::istream & inputStream,
const cmnDataFormat & localFormat,
const cmnDataFormat & remoteFormat)
throw (std::runtime_error);
112 void SerializeText(std::ostream & outputStream,
const char delimiter =
',')
const throw (std::runtime_error);
113 std::
string SerializeDescription(const
char delimiter = ',', const std::
string & userDescription = "") const;
114 void DeSerializeText(std::istream & inputStream, const
char delimiter = ',') throw (std::runtime_error);
115 std::
string HumanReadable(
void) const;
116 bool ScalarNumberIsFixed(
void) const;
117 size_t ScalarNumber(
void) const;
118 double Scalar(const
size_t index) const throw (std::out_of_range);
119 std::
string ScalarDescription(const
size_t index, const std::
string & userDescription = "") const throw (std::out_of_range);
121 void SerializeTextJSON(Json::Value & jsonValue)
const;
122 void DeSerializeTextJSON(
const Json::Value & jsonValue)
throw (std::runtime_error);
123 #endif // CISST_HAS_JSON
146 data.SerializeBinary(outputStream);
149 data.DeSerializeBinary(inputStream, localFormat, remoteFormat);
151 static void SerializeText(
const DataType & data, std::ostream & outputStream,
const char delimiter =
',') throw (std::runtime_error) {
154 static void DeSerializeText(
DataType & data, std::istream & inputStream,
const char delimiter =
',') throw (std::runtime_error) {
166 static std::string
ScalarDescription(
const DataType & data,
const size_t index,
const std::string & userDescription =
"") throw (std::out_of_range) {
169 static double Scalar(
const DataType & data,
const size_t index)
throw (std::out_of_range) {
170 return data.Scalar(index);
174 outputStream << cmnData<mtsComponentState >::HumanReadable(data);
179 template <>
void CISST_EXPORT cmnDataJSON<mtsComponentState >::DeSerializeText(
mtsComponentState & data,
const Json::Value & jsonValue)
throw (std::runtime_error);
180 #endif // CISST_HAS_JSON
185 #endif // CISST_HAS_JSON
188 #endif // _cisstMultiTask_mtsComponentState_h
static std::string HumanReadable(const DataType &data)
Definition: mtsComponentState.h:157
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
void SerializeText(std::ostream &outputStream, const char delimiter= ',') const
void Copy(const mtsComponentState &source)
static size_t ScalarNumber(const DataType &data)
Definition: mtsComponentState.h:163
static double Scalar(const DataType &data, const size_t index)
Definition: mtsComponentState.h:169
Class registration macros.
std::string ScalarDescription(const size_t index, const std::string &userDescription="") const
static bool ScalarNumberIsFixed(const DataType &data)
Definition: mtsComponentState.h:160
#define CMN_DECLARE_DATA_FUNCTIONS_JSON_FOR_ENUM(_enum)
Definition: cmnDataFunctionsEnumMacros.h:100
bool ScalarNumberIsFixed(void) const
mtsGenericObjectProxy< mtsComponentState > mtsComponentStateProxy
Definition: mtsComponentState.h:128
Enum
Definition: mtsComponentState.h:66
static void DeSerializeText(DataType &data, std::istream &inputStream, const char delimiter= ',')
Definition: mtsComponentState.h:154
std::ostream & operator<<(std::ostream &outputStream, const mtsComponentState &data)
Definition: mtsComponentState.h:173
void DeSerializeText(std::istream &inputStream, const char delimiter= ',')
mtsComponentState::Enum mState
Definition: mtsComponentState.h:71
static std::string ScalarDescription(const DataType &data, const size_t index, const std::string &userDescription="")
Definition: mtsComponentState.h:166
static void Copy(DataType &data, const DataType &source)
Definition: mtsComponentState.h:139
Forward declarations and #define for cisstMultiTask.
Definition: mtsComponentState.h:34
Definition: cmnDataFunctions.h:53
Definition: mtsComponentState.h:66
static void DeSerializeBinary(DataType &data, std::istream &inputStream, const cmnDataFormat &localFormat, const cmnDataFormat &remoteFormat)
Definition: mtsComponentState.h:148
Definition: cmnDataFunctions.h:56
static void SerializeBinary(const DataType &data, std::ostream &outputStream)
Definition: mtsComponentState.h:145
Defines cmnClassServices.
void CISST_EXPORT cmnSerializeRaw(std::ostream &outputStream, const mtsComponentState &object)
CMN_DECLARE_SERVICES_INSTANTIATION(mtsComponentStateProxy)
size_t ScalarNumber(void) const
std::string SerializeDescription(const char delimiter= ',', const std::string &userDescription="") const
std::string CISST_EXPORT cmnDataHumanReadable_mtsComponentState_Enum(const mtsComponentState::Enum &data)
mtsComponentState DataType
Definition: mtsComponentState.h:138
Definition: mtsGenericObjectProxy.h:45
static void SerializeText(const DataType &data, std::ostream &outputStream, const char delimiter= ',')
Definition: mtsComponentState.h:151
std::string HumanReadable(void) const
void CISST_EXPORT cmnDeSerializeRaw(std::istream &inputStream, mtsComponentState &placeHolder)
mtsComponentState ThisType
Definition: mtsComponentState.h:79
static std::string SerializeDescription(const DataType &data, const char delimiter, const std::string &userDescription)
Definition: mtsComponentState.h:142
CMN_DATA_SPECIALIZATION_FOR_ENUM_USER_HUMAN_READABLE(mtsComponentState::Enum, int, cmnDataHumanReadable_mtsComponentState_Enum)