1 #ifndef SHAPE_SHIFTER_FACTORY_HPP 2 #define SHAPE_SHIFTER_FACTORY_HPP 14 const std::string &md5sum,
15 const std::string& datatype,
16 const std::string& definition );
33 std::map<std::string, RosIntrospection::ShapeShifter>
_ss_map;
47 const std::string &md5sum,
48 const std::string &datatype,
49 const std::string &definition)
51 auto& instance =
get();
52 auto it = instance._ss_map.find(topic_name);
53 if( it == instance._ss_map.end() || it->second.getMD5Sum() != md5sum )
56 msg.
morph(md5sum, datatype,definition);
57 instance._ss_map.insert( std::make_pair(topic_name, std::move(msg) ));
64 auto& instance =
get();
65 auto it = instance._ss_map.find( topic_name );
66 return ( it == instance._ss_map.end()) ?
nullptr : &(it->second);
71 std::vector<const std::string*>
out;
72 auto& instance =
get();
73 out.reserve( instance._ss_map.size() );
75 for (
const auto& ss: instance._ss_map)
77 out.push_back( &(ss.first) );
84 return get().
_ss_map.count(topic_name) != 0;
92 #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)
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)
RosIntrospection::Parser _parser
void registerMessageDefinition(const std::string &message_identifier, const ROSType &main_type, const std::string &definition)