3 cpluginsvc is a ctypes-based wrapper for the C-API of the GaudiPluginService. 7 >>> from GaudiPluginService import cpluginsvc 8 >>> for _,f in cpluginsvc.factories().items(): 12 ... print ("** could not load [%s] for factory [%s]" % (f.library, f.name)) 15 ... for k,v in f.properties.iteritems(): 16 ... print ("\t%s: %s" % (k,v)) 37 name = platform.system()
40 'Darwin':
"libGaudiPluginService.dylib",
41 'Windows':
"libGaudiPluginService.dll",
42 'Linux':
"libGaudiPluginService.so",
48 _lib = ctypes.cdll.LoadLibrary(_libname)
52 '''Registry holds the list of factories known by the gaudi PluginService. 54 _fields_ = [(
"_registry", ctypes.c_void_p)]
59 n = _lib.cgaudi_pluginsvc_get_factory_size(self)
61 f = _lib.cgaudi_pluginsvc_get_factory_at(self, i)
71 '''registry returns the singleton-like instance of the plugin service.''' 76 _instance = _lib.cgaudi_pluginsvc_instance()
82 factories returns the list of components factory informations known to the plugin service 89 Factory holds informations about a component's factory: 91 - the library hosting that component 92 - the type of component (algorithm, service, tool, ...) 93 - the return type of this factory 94 - the C++ class name of that component 95 - the properties which may decorate that component. 98 (
"_registry", Registry),
99 (
"_id", ctypes.c_char_p),
108 return _lib.cgaudi_factory_get_library(self)
112 return _lib.cgaudi_factory_get_type(self)
116 return _lib.cgaudi_factory_get_rtype(self)
120 return _lib.cgaudi_factory_get_classname(self)
125 nprops = _lib.cgaudi_factory_get_property_size(self)
126 for i
in range(nprops):
127 prop = _lib.cgaudi_factory_get_property_at(self, i)
128 props[prop.key] = prop.value
132 '''load the C++ library hosting this factory 134 return ctypes.cdll.LoadLibrary(self.
library)
137 return "<Factory id=%s library=%s type=%s rtype=%s class=%s props=%d>" % (
150 Property is a pair (key, value) optionally decorating a factory. 151 It is used to attach additional informations about a factory. 154 (
"_registry", Registry),
155 (
"_id", ctypes.c_char_p),
156 (
"_key", ctypes.c_char_p),
161 return _lib.cgaudi_property_get_key(self)
165 return _lib.cgaudi_property_get_value(self)
171 (
"cgaudi_pluginsvc_instance",
176 (
"cgaudi_pluginsvc_get_factory_size",
181 (
"cgaudi_pluginsvc_get_factory_at",
182 [Registry, ctypes.c_int],
186 (
"cgaudi_factory_get_library",
191 (
"cgaudi_factory_get_type",
196 (
"cgaudi_factory_get_rtype",
201 (
"cgaudi_factory_get_classname",
206 (
"cgaudi_factory_get_property_size",
211 (
"cgaudi_factory_get_property_at",
212 [Factory, ctypes.c_int],
216 (
"cgaudi_property_get_key",
221 (
"cgaudi_property_get_value",
227 for f
in _functions_list:
229 func = getattr(_lib, n)
237 if __name__ ==
"__main__":
239 print (
"factories: %d" % len(
factories()))
245 "** could not load [%s] for factory [%s]" % (f.library, f.name))
248 for k, v
in f.properties.items():
249 print (
"\t%s: %s" % (k, v))
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.