#include "CasePacker.h" const char* ROSBridge::CasePacker::topicKey = "topic"; const char* ROSBridge::CasePacker::messageTypeKey = "messageType"; ROSBridge::CasePacker::CasePacker() { } void ROSBridge::CasePacker::_addTag(JsonDoc &doc, const char *topic, const char *messageType) { using namespace ROSBridge; using namespace rapidjson; { // add topic rapidjson::Value key(CasePacker::topicKey, doc.GetAllocator()); rapidjson::Value value(topic, doc.GetAllocator()); doc.AddMember(key, value, doc.GetAllocator()); } // add messageType rapidjson::Value key(CasePacker::messageTypeKey, doc.GetAllocator()); rapidjson::Value value(messageType, doc.GetAllocator()); doc.AddMember(key, value, doc.GetAllocator()); } void ROSBridge::CasePacker::_removeTag(JsonDoc &doc) { using namespace ROSBridge; using namespace rapidjson; if ( doc.HasMember(CasePacker::topicKey) ) doc.RemoveMember(CasePacker::topicKey); if ( doc.HasMember(CasePacker::messageTypeKey) ) doc.RemoveMember(CasePacker::messageTypeKey); }