39 const string BoolConverter::WIRE_SCHEMA =
"bool";
41 BoolConverter::BoolConverter() :
49 assert(data.first == this->getDataType());
51 boost::shared_ptr<bool> s
52 = boost::static_pointer_cast<
bool>(data.second);
54 wire[0] = ((*s) ? 1 : 0);
62 if (wire.size() == 1 && wire[0] == 0) {
63 return make_pair(
getDataType(), boost::shared_ptr<bool>(
new bool(
false)));
64 }
else if (wire.size() == 1 && wire[0] == 1) {
65 return make_pair(
getDataType(), boost::shared_ptr<bool>(
new bool(
true)));
67 throw runtime_error(
"Invalid encoding for bool.");