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)) 35 name = platform.system()
38 'Darwin':
"libGaudiPluginService.so",
39 'Windows':
"libGaudiPluginService.dll",
40 'Linux':
"libGaudiPluginService.so",
45 _lib = ctypes.cdll.LoadLibrary(_libname)
48 '''Registry holds the list of factories known by the gaudi PluginService. 50 _fields_ = [(
"_registry", ctypes.c_void_p)]
55 n = _lib.cgaudi_pluginsvc_get_factory_size(self)
57 f = _lib.cgaudi_pluginsvc_get_factory_at(self, i)
64 '''registry returns the singleton-like instance of the plugin service.''' 69 _instance = _lib.cgaudi_pluginsvc_instance()
74 factories returns the list of components factory informations known to the plugin service 80 Factory holds informations about a component's factory: 82 - the library hosting that component 83 - the type of component (algorithm, service, tool, ...) 84 - the return type of this factory 85 - the C++ class name of that component 86 - the properties which may decorate that component. 89 (
"_registry", Registry),
90 (
"_id", ctypes.c_char_p),
99 return _lib.cgaudi_factory_get_library(self)
103 return _lib.cgaudi_factory_get_type(self)
107 return _lib.cgaudi_factory_get_rtype(self)
111 return _lib.cgaudi_factory_get_classname(self)
116 nprops = _lib.cgaudi_factory_get_property_size(self)
117 for i
in range(nprops):
118 prop = _lib.cgaudi_factory_get_property_at(self, i)
119 props[prop.key] = prop.value
123 '''load the C++ library hosting this factory 125 return ctypes.cdll.LoadLibrary(self.
library)
128 return "<Factory id=%s library=%s type=%s rtype=%s class=%s props=%d>" % (
140 Property is a pair (key, value) optionally decorating a factory. 141 It is used to attach additional informations about a factory. 144 (
"_registry", Registry),
145 (
"_id", ctypes.c_char_p),
146 (
"_key", ctypes.c_char_p),
151 return _lib.cgaudi_property_get_key(self)
155 return _lib.cgaudi_property_get_value(self)
160 (
"cgaudi_pluginsvc_instance",
165 (
"cgaudi_pluginsvc_get_factory_size",
170 (
"cgaudi_pluginsvc_get_factory_at",
171 [Registry, ctypes.c_int],
175 (
"cgaudi_factory_get_library",
180 (
"cgaudi_factory_get_type",
185 (
"cgaudi_factory_get_rtype",
190 (
"cgaudi_factory_get_classname",
195 (
"cgaudi_factory_get_property_size",
200 (
"cgaudi_factory_get_property_at",
201 [Factory, ctypes.c_int],
205 (
"cgaudi_property_get_key",
210 (
"cgaudi_property_get_value",
216 for f
in _functions_list:
218 func = getattr(_lib, n)
221 if len(f) == 4: func.errcheck = f[3]
225 if __name__ ==
"__main__":
227 print (
"factories: %d" % len(
factories()))
232 print (
"** could not load [%s] for factory [%s]" % (f.library, f.name))
235 for k,v
in f.properties.items():
236 print (
"\t%s: %s" % (k,v))
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.