All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
LArSoftUtils.ServiceManagerClass Class Reference
Inheritance diagram for LArSoftUtils.ServiceManagerClass:
LArSoftUtils.ServiceManagerInterface LArSoftUtils.ServiceManagerInterface

Public Member Functions

def __init__
 
def registry
 
def loaders
 
def get
 
def __init__
 
def registry
 
def loaders
 
def get
 
- Public Member Functions inherited from LArSoftUtils.ServiceManagerInterface
def registry
 
def loaders
 
def loaded
 
def supported
 
def registerLoader
 
def get
 
def __call__
 
def registry
 
def loaders
 
def loaded
 
def supported
 
def registerLoader
 
def get
 
def __call__
 

Public Attributes

 registry_
 
 loadingTable
 

Detailed Description

Definition at line 331 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

Constructor & Destructor Documentation

def LArSoftUtils.ServiceManagerClass.__init__ (   self,
  config,
  loadingTable = {},
  preload = [] 
)

Definition at line 333 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

334  def __init__(self, config, loadingTable = {}, preload = []):
335 
336  #
337  # prepare the service registry
338  #
340 
341  #
342  # register the standard services
343  #
344  self.loadingTable = loadingTable.copy()
345 
346  #
347  # message facility
348  #
349  galleryUtils.startMessageFacility(self.registry().config("message"))
350  self.registry().register("message", None) # there is no direct access, sorry
351 
352  #
353  # preload services
354  #
355  for serviceKey in preload: self.get(serviceKey)
def LArSoftUtils.ServiceManagerClass.__init__ (   self,
  config,
  loadingTable = {},
  preload = [] 
)

Definition at line 333 of file sbndcode/sbndcode/gallery/python/LArSoftUtils.py.

334  def __init__(self, config, loadingTable = {}, preload = []):
335 
336  #
337  # prepare the service registry
338  #
340 
341  #
342  # register the standard services
343  #
344  self.loadingTable = loadingTable.copy()
345 
346  #
347  # message facility
348  #
349  galleryUtils.startMessageFacility(self.registry().config("message"))
350  self.registry().register("message", None) # there is no direct access, sorry
351 
352  #
353  # preload services
354  #
355  for serviceKey in preload: self.get(serviceKey)

Member Function Documentation

def LArSoftUtils.ServiceManagerClass.get (   self,
  serviceKey,
  interfaceClass = None 
)
Return the specified service.

The service can be specified by name or by class.
In the former case, if the service is not already configured, an exception
will be raised.
If the service is specified by class instead, an attempt is made to load it,
in which case `interfaceClass` is also passed to
`LArSoftUtils.loadSimpleService()`.

Definition at line 363 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

364  def get(self, serviceKey, interfaceClass = None):
365  """Return the specified service.
366 
367  The service can be specified by name or by class.
368  In the former case, if the service is not already configured, an exception
369  will be raised.
370  If the service is specified by class instead, an attempt is made to load it,
371  in which case `interfaceClass` is also passed to
372  `LArSoftUtils.loadSimpleService()`.
373 
374  """
375 
376  # if it is already cached, let's use it
377  try: return self.registry().get(serviceKey)
378  except KeyError: pass
379 
380  # first try to see if there is a loader available for this service
381  try:
382  loader = self.loadingTable[serviceKey]
383  except KeyError:
384  loader = SimpleServiceLoader(serviceKey, interfaceClass=interfaceClass)
385 
386  print("Loading service provider: '{}'".format(serviceKey))
387  return loader(self)
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
Definition: fclmodule.cxx:374
tuple loader
Definition: demo.py:7
do one_file $F done echo for F in find $TOP name CMakeLists txt print
def LArSoftUtils.ServiceManagerClass.get (   self,
  serviceKey,
  interfaceClass = None 
)
Return the specified service.

The service can be specified by name or by class.
In the former case, if the service is not already configured, an exception
will be raised.
If the service is specified by class instead, an attempt is made to load it,
in which case `interfaceClass` is also passed to
`LArSoftUtils.loadSimpleService()`.

Definition at line 363 of file sbndcode/sbndcode/gallery/python/LArSoftUtils.py.

364  def get(self, serviceKey, interfaceClass = None):
365  """Return the specified service.
366 
367  The service can be specified by name or by class.
368  In the former case, if the service is not already configured, an exception
369  will be raised.
370  If the service is specified by class instead, an attempt is made to load it,
371  in which case `interfaceClass` is also passed to
372  `LArSoftUtils.loadSimpleService()`.
373 
374  """
375 
376  # if it is already cached, let's use it
377  try: return self.registry().get(serviceKey)
378  except KeyError: pass
379 
380  # first try to see if there is a loader available for this service
381  try:
382  loader = self.loadingTable[serviceKey]
383  except KeyError:
384  loader = SimpleServiceLoader(serviceKey, interfaceClass=interfaceClass)
385 
386  print("Loading service provider: '{}'".format(serviceKey))
387  return loader(self)
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
Definition: fclmodule.cxx:374
tuple loader
Definition: demo.py:7
do one_file $F done echo for F in find $TOP name CMakeLists txt print
def LArSoftUtils.ServiceManagerClass.loaders (   self)

Definition at line 360 of file sbndcode/sbndcode/gallery/python/LArSoftUtils.py.

361  def loaders(self): return self.loadingTable
362 
def LArSoftUtils.ServiceManagerClass.loaders (   self)

Definition at line 360 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

361  def loaders(self): return self.loadingTable
362 
def LArSoftUtils.ServiceManagerClass.registry (   self)

Definition at line 358 of file sbndcode/sbndcode/gallery/python/LArSoftUtils.py.

359  def registry(self): return self.registry_
def LArSoftUtils.ServiceManagerClass.registry (   self)

Definition at line 358 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

359  def registry(self): return self.registry_

Member Data Documentation

LArSoftUtils.ServiceManagerClass.loadingTable

Definition at line 343 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.

LArSoftUtils.ServiceManagerClass.registry_

Definition at line 338 of file icarusalg/icarusalg/gallery/helpers/python/LArSoftUtils.py.


The documentation for this class was generated from the following files: