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(_libname, ctypes.RTLD_GLOBAL)
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_classname(self)
121 nprops = _lib.cgaudi_factory_get_property_size(self)
122 for i
in range(nprops):
123 prop = _lib.cgaudi_factory_get_property_at(self, i)
124 props[prop.key] = prop.value
128 '''load the C++ library hosting this factory 130 return ctypes.CDLL(self.
library, ctypes.RTLD_GLOBAL)
133 return "<Factory id=%s library=%s type=%s class=%s props=%d>" % (
145 Property is a pair (key, value) optionally decorating a factory. 146 It is used to attach additional informations about a factory. 149 (
"_registry", Registry),
150 (
"_id", ctypes.c_char_p),
151 (
"_key", ctypes.c_char_p),
156 return _lib.cgaudi_property_get_key(self)
160 return _lib.cgaudi_property_get_value(self)
166 (
"cgaudi_pluginsvc_instance",
171 (
"cgaudi_pluginsvc_get_factory_size",
176 (
"cgaudi_pluginsvc_get_factory_at",
177 [Registry, ctypes.c_int],
181 (
"cgaudi_factory_get_library",
186 (
"cgaudi_factory_get_type",
191 (
"cgaudi_factory_get_classname",
196 (
"cgaudi_factory_get_property_size",
201 (
"cgaudi_factory_get_property_at",
202 [Factory, ctypes.c_int],
206 (
"cgaudi_property_get_key",
211 (
"cgaudi_property_get_value",
217 for f
in _functions_list:
219 func = getattr(_lib, n)
227 if __name__ ==
"__main__":
229 print (
"factories: %d" % len(
factories()))
235 "** could not load [%s] for factory [%s]" % (f.library, f.name))
238 for k, v
in f.properties.items():
239 print (
"\t%s: %s" % (k, v))
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.