41 #include "rtt-config.h" 43 #include "../Logger.hpp" 46 #include "../internal/mystd.hpp" 47 #include "../internal/DataSourceTypeInfo.hpp" 48 #include <boost/algorithm/string.hpp> 53 using namespace detail;
56 boost::shared_ptr<TypeInfoRepository> typerepos;
78 loadTypeKitForName = loader;
84 map_t::const_iterator i = data.find( name );
85 if ( i != data.end() ) {
91 string tkname =
"/" + boost::replace_all_copy(boost::replace_all_copy(name,
string(
"."),
"/"),
"<",
"</");
92 i = data.find( tkname );
93 if ( i != data.end() ) {
99 for (i = data.begin(); i != data.end(); ++i) {
100 std::vector< std::string > names = i->second->getTypeNames();
101 vector<std::string>::iterator j = names.begin();
102 for (; j != names.end(); ++j) {
103 if(((*j) == name) || ((*j) == tkname)) {
117 if(!ret && loadTypeKitForName)
119 if(loadTypeKitForName(name))
120 ret = typeInternal(name);
129 vector<TypeInfo*> todelete =
values(data);
130 sort(todelete.begin(), todelete.end());
131 vector<TypeInfo*>::iterator begin, last = unique( todelete.begin(), todelete.end() );
132 begin = todelete.begin();
133 for( ; begin != last; ++begin )
144 map_t::const_iterator i = data.begin();
145 for (; i != data.end(); ++i){
146 if (i->second->getTypeId() && *(i->second->getTypeId()) == *type_id)
155 map_t::const_iterator i = data.begin();
156 for (; i != data.end(); ++i){
157 if (i->second->getTypeId() && i->second->getTypeId()->name() == type_id_name)
186 if (ti && data.count(tname) && data[tname] != ti ) {
187 log(
Error) <<
"Refusing to add type information for '" << tname <<
"': the name is already in use by another type."<<
endlog();
205 for(Transports::iterator it = transports.begin(); it != transports.end(); ++it)
206 if ( (*it)->registerTransport( tname, ti) )
207 log(
Info) <<
"Registered new '"<< (*it)->getTransportName()<<
"' transport for " << tname <<
endlog();
222 string dotname = boost::replace_all_copy(boost::replace_all_copy(type,
string(
"/"),
"."),
"<.",
"<");
223 if ( dotname[0] ==
'.')
224 dotname = dotname.substr(1);
231 vector<string> result =
keys( data );
232 for( vector<string>::iterator it = result.begin(); it != result.end(); ++it)
240 transports.reserve( transports.size() + 1 );
241 transports.push_back( tr );
243 map_t::const_iterator i = data.begin();
244 for( ; i != data.end(); ++i )
257 for(map_t::const_iterator it = data.begin(); it != data.end(); ++it)
259 std::vector<int> transports;
260 transports = it->second->getTransportNames();
262 <<
" (" << (*it).second->getTypeName() <<
") protocols [";
263 for (std::vector<int>::const_iterator iter=transports.begin();
264 iter != transports.end();
273 for(Transports::const_iterator it = transports.begin(); it != transports.end(); ++it)
void addAlias(const std::string &alias)
const std::string & getTypeName() const
std::vector< std::string > getDottedTypes() const
std::vector< std::string > getTypes() const
virtual bool installTypeInfoObject(TypeInfo *ti)=0
const std::type_info * TypeId
virtual std::string getTransportName() const =0
std::string toDot(const std::string &type) const
void registerTransport(TransportPlugin *tr)
TypeInfo * typeInternal(const std::string &name) const
static std::ostream & endl(std::ostream &__os)
bool addType(TypeInfo *ti)
virtual TypeInfo * getTypeInfoObject() const =0
std::vector< typename MapT::key_type > keys(const MapT &map)
static shared_ptr Instance()
std::vector< typename MapT::mapped_type > values(const MapT &map)
TypeInfo * getTypeById(TypeInfo::TypeId type_id) const
void setAutoLoader(const boost::function< bool(const std::string &)> &loader)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual const std::string & getTypeName() const =0
virtual bool registerTransport(std::string type_name, TypeInfo *ti)=0
static Logger::LogFunction endlog()
TypeInfo * type(const std::string &name) const
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...