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 515 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 534 of file dal.py.

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

Member Function Documentation

◆ pyclassName()

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

Definition at line 563 of file dal.py.

563 def pyclassName(cls):
564 """Returns this class name"""
565 return cls.__name__
566

◆ pyoksTypes()

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

Definition at line 567 of file dal.py.

567 def pyoksTypes(cls):
568 """Returns a join of this class and base class names"""
569 return cls.__okstypes__
570
571

Member Data Documentation

◆ __okstypes__

conffwk.dal.DalType.__okstypes__ = alltypes
private

Definition at line 561 of file dal.py.


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