@@ -141,17 +141,49 @@ std::set<std::string> getLocationsOfEntry(const ObjectFactory::ClassEntry &entry
141141 return locations;
142142}
143143
144+ std::string className (const ObjectFactory::ClassEntry &e) { return e.className ; }
145+
146+ py::list aliases (const ObjectFactory::ClassEntry &self)
147+ {
148+ py::list list;
149+ for (auto alias : self.aliases )
150+ list.append (alias);
151+ return list;
152+ }
153+
154+ std::string description (const ObjectFactory::ClassEntry &e) { return e.description ; }
155+
156+ std::string authors (const ObjectFactory::ClassEntry &e) { return e.authors ; }
157+
158+ std::string license (const ObjectFactory::ClassEntry &e) { return e.license ; }
159+
160+ std::string defaultTemplate (const ObjectFactory::ClassEntry &e) { return e.defaultTemplate ; }
161+
162+ py::dict dataAlias (const ObjectFactory::ClassEntry &self)
163+ {
164+ py::dict dict;
165+ for (auto alias : self.m_dataAlias )
166+ {
167+ py::list aliases;
168+ for (auto a : alias.second )
169+ aliases.append (a);
170+ dict[alias.first .c_str ()] = aliases;
171+ }
172+ return dict;
173+ }
174+
175+
144176void moduleAddObjectFactory (py::module &m) {
145177 py::class_<ObjectFactory> factory (m, " ObjectFactory" , sofapython3::doc::objectmodel::ObjectFactoryClass);
146178
147179 py::class_<ObjectFactory::ClassEntry> entry (m, sofapython3::doc::objectmodel::ClassEntryClass);
148- entry.def_readonly (" className" , &ObjectFactory::ClassEntry:: className);
149- entry.def_readonly (" aliases" , &ObjectFactory::ClassEntry:: aliases);
150- entry.def_readonly (" description" , &ObjectFactory::ClassEntry:: description);
151- entry.def_readonly (" authors" , &ObjectFactory::ClassEntry:: authors);
152- entry.def_readonly (" license" , &ObjectFactory::ClassEntry:: license);
153- entry.def_readonly (" defaultTemplate" , &ObjectFactory::ClassEntry:: defaultTemplate);
154- entry.def_readonly (" dataAlias" , &ObjectFactory::ClassEntry::m_dataAlias );
180+ entry.def_property_readonly (" className" , &className);
181+ entry.def_property_readonly (" aliases" , &aliases);
182+ entry.def_property_readonly (" description" , &description);
183+ entry.def_property_readonly (" authors" , &authors);
184+ entry.def_property_readonly (" license" , &license);
185+ entry.def_property_readonly (" defaultTemplate" , &defaultTemplate);
186+ entry.def_property_readonly (" dataAlias" , &dataAlias );
155187 entry.def_property_readonly (" templates" , &getTemplates);
156188 entry.def_property_readonly (" targets" , &getTargetsOfEntry);
157189 entry.def_property_readonly (" locations" , &getLocationsOfEntry);
0 commit comments