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)
72 '''registry returns the singleton-like instance of the plugin service.''' 77 _instance = _lib.cgaudi_pluginsvc_instance()
83 factories returns the list of components factory informations known to the plugin service 90 Factory holds informations about a component's factory: 92 - the library hosting that component 93 - the type of component (algorithm, service, tool, ...) 94 - the return type of this factory 95 - the C++ class name of that component 96 - the properties which may decorate that component. 99 (
"_registry", Registry),
100 (
"_id", ctypes.c_char_p),
109 return _lib.cgaudi_factory_get_library(self)
113 return _lib.cgaudi_factory_get_type(self)
117 return _lib.cgaudi_factory_get_classname(self)
122 nprops = _lib.cgaudi_factory_get_property_size(self)
123 for i
in range(nprops):
124 prop = _lib.cgaudi_factory_get_property_at(self, i)
125 props[prop.key] = prop.value
129 '''load the C++ library hosting this factory 131 return ctypes.CDLL(self.
library, ctypes.RTLD_GLOBAL)
134 return "<Factory id=%s library=%s type=%s class=%s props=%d>" % (
147 Property is a pair (key, value) optionally decorating a factory. 148 It is used to attach additional informations about a factory. 151 (
"_registry", Registry),
152 (
"_id", ctypes.c_char_p),
153 (
"_key", ctypes.c_char_p),
158 return _lib.cgaudi_property_get_key(self)
162 return _lib.cgaudi_property_get_value(self)
168 "cgaudi_pluginsvc_instance",
172 "cgaudi_pluginsvc_get_factory_size",
176 "cgaudi_pluginsvc_get_factory_at",
177 [Registry, ctypes.c_int],
180 "cgaudi_factory_get_library",
184 "cgaudi_factory_get_type",
188 "cgaudi_factory_get_classname",
192 "cgaudi_factory_get_property_size",
196 "cgaudi_factory_get_property_at",
197 [Factory, ctypes.c_int],
200 "cgaudi_property_get_key",
204 "cgaudi_property_get_value",
209 for f
in _functions_list:
211 func = getattr(_lib, n)
218 if __name__ ==
"__main__":
220 print(
"factories: %d" % len(
factories()))
225 print(
"** could not load [%s] for factory [%s]" % (f.library,
229 for k, v
in f.properties.items():
230 print(
"\t%s: %s" % (k, v))
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.