58#ifndef gusimplewhiteboard_WBMsg_h
59#define gusimplewhiteboard_WBMsg_h
77#pragma clang diagnostic push
78#pragma clang diagnostic ignored "-Wweak-vtables"
79#pragma clang diagnostic ignored "-Wpadded"
80#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
81#pragma clang diagnostic ignored "-Wconversion"
82#pragma clang diagnostic ignored "-Wdeprecated"
113 std::string typeName;
114 std::string stringVal;
123 WBMsg(
const WBMsg &orig) { memcpy(
this, &orig,
sizeof(orig)); }
176 WBMsg(
const void *data,
int nBytes,
bool needsFree =
false):
binaryVal(data), type(
TypeBinary), binarySize(nBytes), doFree(needsFree) {}
193 WBMsg(
const std::vector<int> &val,
bool needsFree =
false):
arrayVal(new std::vector<int>(val)), type(
TypeArray), doFree(true) {
if (needsFree)
delete &val; }
223 std::cerr <<
"Setting a life span (" << life <<
") not supported on WBMsg()\n" << std::endl;
226#pragma clang diagnostic push
227#pragma clang diagnostic ignored "-Wswitch-enum"
244 return toupper(stringVal[0]) ==
'Y' ||
245 toupper(stringVal[0]) ==
'T' ||
246 stringVal ==
"on" || stringVal ==
"On" ||
248 atoi(stringVal.c_str()) != 0;
250 return !
arrayVal->size() || (*arrayVal)[0];
271 return atoi(stringVal.c_str());
294 return atof(stringVal.c_str());
308 std::stringstream ss;
324 std::vector<int>::const_iterator i =
arrayVal->begin();
335 const unsigned char *c =
static_cast<const unsigned char *
>(
binaryVal);
336 ss.setf(std::ios::hex);
337 for (
int i = 0; i < binarySize; i++)
339 ss << static_cast<unsigned>(c[i]);
340 if (i < binarySize-1)
351#pragma clang diagnostic pop
408#pragma clang diagnostic pop
Old WB class for storing shared data.
WBMsg(bool val)
WBMsg - Boolean constructor.
WBMsg(const WBMsg &orig)
WBMsg - copy constructor.
const std::string & getStringValue() const
getStringValue.
WBMsg(const std::string &val)
WBMsg - String constructor.
WBMsg(const char *val)
WBMsg - String constructor.
const std::string stringValue() const
stringValue.
int intValue() const
intValue.
int getIntValue() const
getIntValue.
const std::vector< int > * arrayVal
WBMsg()
WBMsg - empty constructor.
bool boolValue() const
boolValue.
WBMsg(const std::vector< int > *val, bool needsFree=false)
WBMsg - Vector<int> pointer constructor.
~WBMsg()
default destructor
const std::vector< int > & getArrayValue() const
getArrayValue.
int getLifeSpan() const
getLifeSpan
wb_type
Message internal Datatype Enum.
void setTypeName(const std::string &t)
setTypeName
float getFloatValue() const
getFloatValue.
const std::string & getTypeName() const
getTypeName
WBMsg(const std::vector< int > &val, bool needsFree=false)
WBMsg - Vector<int> constructor.
WBMsg(float val)
WBMsg - Float constructor.
WBType getType() const
getType.
const void * getBinaryValue() const
getBinaryValue.
void setLifeSpan(int life)
setLifeSpan
int getSizeInBytes() const
getSizeInBytes.
bool getBoolValue() const
getBoolValue.
WBMsg(const void *data, int nBytes, bool needsFree=false)
WBMsg - Binary data constructor.
enum WBMsg::wb_type WBType
Message internal Datatype Enum.
WBMsg(int val)
WBMsg - Integer constructor.
int floatValue() const
floatValue.
#define GU_SIMPLE_WHITEBOARD_GENERATIONS
lifespan (max)