75 if ( !xml_file.isEmpty() )
78 TiXmlDocument document;
79 document.LoadFile(xml_file.toStdString());
80 TiXmlElement *
config = document.RootElement();
83 ROS_ERROR(
"Skipping XML Document \"%s\" which had no Root Element. This likely means the XML is malformed or missing.", xml_file.toStdString().c_str());
84 return QSet<QString>();
86 if (config->ValueStr() !=
"library" &&
87 config->ValueStr() !=
"class_libraries")
89 ROS_ERROR(
"The XML document \"%s\" given to add must have either \"library\" or \ 90 \"class_libraries\" as the root tag", xml_file.toStdString().c_str());
91 return QSet<QString>();
94 if (config->ValueStr() ==
"class_libraries")
96 config = config->FirstChildElement(
"library");
100 while ( library !=
NULL)
102 TiXmlElement* class_element = library->FirstChildElement(
"class");
103 while (class_element)
105 std::string derived_class = class_element->Attribute(
"type");
107 std::string current_class_id;
108 if(class_element->Attribute(
"name") !=
NULL)
110 current_class_id = class_element->Attribute(
"name");
111 ROS_DEBUG(
"XML file specifies lookup name (i.e. magic name) = %s.", current_class_id.c_str());
115 ROS_DEBUG(
"XML file has no lookup name (i.e. magic name) for class %s, assuming class_id == real class name.", derived_class.c_str());
116 current_class_id = derived_class;
119 QSet<QString> message_types;
120 TiXmlElement* message_type = class_element->FirstChildElement(
"message_type");
122 while ( message_type )
124 if ( message_type->GetText() )
126 const char* message_type_str = message_type->GetText();
127 ROS_DEBUG_STREAM(current_class_id <<
" supports message type " << message_type_str );
128 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 129 message_types.insert( QString::fromAscii( message_type_str ) );
131 message_types.insert( QString(message_type_str) );
134 message_type = message_type->NextSiblingElement(
"message_type");
140 class_element = class_element->NextSiblingElement(
"class" );
142 library = library->NextSiblingElement(
"library" );
152 return QSet<QString>();
virtual void setIcon(const QIcon &icon)
Set the Display's icon.
virtual Type * makeRaw(const QString &class_id, QString *error_return=NULL)
Instantiate and return a instance of a subclass of Type using our pluginlib::ClassLoader.
virtual void addBuiltInClass(const QString &package, const QString &name, const QString &description, Display *(*factory_function)())
virtual QIcon getIcon(const QString &class_id) const
virtual QSet< QString > getMessageTypes(const QString &class_id)
Get all supported message types for the given class id.
A Display object which stores other Displays as children.
virtual Display * makeRaw(const QString &class_id, QString *error_return=NULL)
Overridden from PluginlibFactory<Display> to set the icon of the Display.
QMap< QString, QSet< QString > > message_type_cache_
#define ROS_DEBUG_STREAM(args)
static Display * newDisplayGroup()
virtual QString getPluginManifestPath(const QString &class_id) const