DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
conffwk.dal.DalType Class Reference
Inheritance diagram for conffwk.dal.DalType:
[legend]
Collaboration diagram for conffwk.dal.DalType:
[legend]

Public Member Functions

 __init__ (cls, name, bases, dct)
 pyclassName (cls)
 pyoksTypes (cls)

Private Attributes

 __okstypes__ = alltypes

Detailed Description

This class is the metaclass that every DAL class will be created with.

DalType is a metaclass (something like a C++ template) that allows us to
create DAL classes without having to go through the 'exec' burden all the
time and being, therefore, much faster than that mechanism. The idea is
that we create DAL types everytime we see a new class and archive this in a
cache, together with the configuration object. Everytime an object of a
certain OKS type is needed by the user, we make use of the generated class
living in that cache to make it a new DAL object.

The DAL type consistency checks are limited by the amount of generic
functionality one can extract by looking at the C++ Configuration class.

The work here is modelled after the old PyDALBase implementation that used
to live in the "genconffwk" package.

Definition at line 520 of file dal.py.

Constructor & Destructor Documentation

◆ __init__()

conffwk.dal.DalType.__init__ ( cls,
name,
bases,
dct )
Class constructor.

Keyword Parameters:

cls -- This is a pointer to the class being constructed

name -- The name that the class will have

bases -- These are the classes, objects of the new generated type will
inherit from. It is useful in our context, to express the OKS
inheritance relations between the classes.

dct -- This is a dictionary that will contain mappings between
methods/attributes of the newly generated class and values or methods
that will be bound to it. The dictionary should contain a pointer to
the class schema, and that should be called '__schema__'.

Definition at line 539 of file dal.py.

539 def __init__(cls, name, bases, dct):
540 """Class constructor.
541
542 Keyword Parameters:
543
544 cls -- This is a pointer to the class being constructed
545
546 name -- The name that the class will have
547
548 bases -- These are the classes, objects of the new generated type will
549 inherit from. It is useful in our context, to express the OKS
550 inheritance relations between the classes.
551
552 dct -- This is a dictionary that will contain mappings between
553 methods/attributes of the newly generated class and values or methods
554 that will be bound to it. The dictionary should contain a pointer to
555 the class schema, and that should be called '__schema__'.
556 """
557 # set all types as expected by the DAL
558 alltypes = [name]
559 for b in bases:
560 if hasattr(b, 'pyoksTypes'):
561 for t in b.pyoksTypes():
562 if t not in alltypes:
563 alltypes.append(t)
564
565 super(DalType, cls).__init__(name, bases, dct)
566 cls.__okstypes__ = alltypes
567

Member Function Documentation

◆ pyclassName()

conffwk.dal.DalType.pyclassName ( cls)
Returns this class name

Definition at line 568 of file dal.py.

568 def pyclassName(cls):
569 """Returns this class name"""
570 return cls.__name__
571

◆ pyoksTypes()

conffwk.dal.DalType.pyoksTypes ( cls)
Returns a join of this class and base class names

Definition at line 572 of file dal.py.

572 def pyoksTypes(cls):
573 """Returns a join of this class and base class names"""
574 return cls.__okstypes__
575
576

Member Data Documentation

◆ __okstypes__

conffwk.dal.DalType.__okstypes__ = alltypes
private

Definition at line 566 of file dal.py.


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