1 from __future__
import print_function
4 cpluginsvc is a ctypes-based wrapper for the C-API of the GaudiPluginService. 8 >>> from GaudiPluginService import cpluginsvc 9 >>> for _,f in cpluginsvc.factories().items(): 13 ... print ("** could not load [%s] for factory [%s]" % (f.library, f.name)) 16 ... for k,v in f.properties.iteritems(): 17 ... print ("\t%s: %s" % (k,v)) 38 name = platform.system()
41 'Darwin':
"libGaudiPluginService.dylib",
42 'Windows':
"libGaudiPluginService.dll",
43 'Linux':
"libGaudiPluginService.so",
49 _lib = ctypes.CDLL(_libname, ctypes.RTLD_GLOBAL)
53 '''Registry holds the list of factories known by the gaudi PluginService. 55 _fields_ = [(
"_registry", ctypes.c_void_p)]
60 n = _lib.cgaudi_pluginsvc_get_factory_size(self)
62 f = _lib.cgaudi_pluginsvc_get_factory_at(self, i)
73 '''registry returns the singleton-like instance of the plugin service.''' 78 _instance = _lib.cgaudi_pluginsvc_instance()
84 factories returns the list of components factory informations known to the plugin service 91 Factory holds informations about a component's factory: 93 - the library hosting that component 94 - the type of component (algorithm, service, tool, ...) 95 - the return type of this factory 96 - the C++ class name of that component 97 - the properties which may decorate that component. 100 (
"_registry", Registry),
101 (
"_id", ctypes.c_char_p),
106 return self._id.decode(
'ascii')
110 return _lib.cgaudi_factory_get_library(self).decode(
'ascii')
114 return _lib.cgaudi_factory_get_type(self).decode(
'ascii')
118 return _lib.cgaudi_factory_get_classname(self).decode(
'ascii')
123 nprops = _lib.cgaudi_factory_get_property_size(self)
124 for i
in range(nprops):
125 prop = _lib.cgaudi_factory_get_property_at(self, i)
126 props[prop.key] = prop.value
130 '''load the C++ library hosting this factory 132 return ctypes.CDLL(self.
library, ctypes.RTLD_GLOBAL)
135 return "<Factory id=%s library=%s type=%s class=%s props=%d>" % (
148 Property is a pair (key, value) optionally decorating a factory. 149 It is used to attach additional informations about a factory. 152 (
"_registry", Registry),
153 (
"_id", ctypes.c_char_p),
154 (
"_key", ctypes.c_char_p),
159 return _lib.cgaudi_property_get_key(self).decode(
'ascii')
163 return _lib.cgaudi_property_get_value(self).decode(
'ascii')
169 "cgaudi_pluginsvc_instance",
173 "cgaudi_pluginsvc_get_factory_size",
177 "cgaudi_pluginsvc_get_factory_at",
178 [Registry, ctypes.c_int],
181 "cgaudi_factory_get_library",
185 "cgaudi_factory_get_type",
189 "cgaudi_factory_get_classname",
193 "cgaudi_factory_get_property_size",
197 "cgaudi_factory_get_property_at",
198 [Factory, ctypes.c_int],
201 "cgaudi_property_get_key",
205 "cgaudi_property_get_value",
210 for f
in _functions_list:
212 func = getattr(_lib, n)
219 if __name__ ==
"__main__":
221 print(
"factories: %d" % len(
factories()))
226 print(
"** could not load [%s] for factory [%s]" % (f.library,
230 for k, v
in f.properties.items():
231 print(
"\t%s: %s" % (k, v))
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.