1 #ifndef SHAPE_SHIFTER_FACTORY_HPP 2 #define SHAPE_SHIFTER_FACTORY_HPP 31 std::map<std::string, RosIntrospection::ShapeShifter>
_ss_map;
45 const std::string &md5sum,
46 const std::string &datatype,
47 const std::string &definition)
49 auto& instance =
get();
50 auto it = instance._ss_map.find(topic_name);
51 if(
it == instance._ss_map.end() ||
it->second.getMD5Sum() != md5sum )
54 msg.
morph(md5sum, datatype,definition);
55 instance._ss_map.insert( std::make_pair(topic_name, std::move(msg) ));
62 auto& instance =
get();
63 auto it = instance._ss_map.find( topic_name );
64 return (
it == instance._ss_map.end()) ?
nullptr : &(
it->second);
69 std::vector<const std::string*>
out;
70 auto& instance =
get();
71 out.reserve( instance._ss_map.size() );
73 for (
const auto& ss: instance._ss_map)
75 out.push_back( &(ss.first) );
82 return get().
_ss_map.count(topic_name) != 0;
90 #endif // SHAPE_SHIFTER_FACTORY_HPP
static void registerMessage(const std::string &topic_name, const std::string &md5sum, const std::string &datatype, const std::string &definition)
static bool isRegistered(const std::string &topic_name)
The ShapeShifter class is a type erased container for ROS Messages. It can be used also to create gen...
std::map< std::string, RosIntrospection::ShapeShifter > _ss_map
static RosIntrospectionFactory & get()
void morph(const std::string &md5sum, const std::string &datatype_, const std::string &msg_def_)
static RosIntrospection::Parser & parser()
static std::vector< const std::string * > getTopicList()
RosIntrospectionFactory()=default
static RosIntrospection::ShapeShifter * getShapeShifter(const std::string &topic_name)
const char * definition()
RosIntrospection::Parser _parser
void registerMessageDefinition(const std::string &message_identifier, const ROSType &main_type, const std::string &definition)
A single message definition will (most probably) generate myltiple ROSMessage(s). In fact the "child"...