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

Public Member Functions

 __init__ (self, conffwk, all=True)
 
 update (self, conffwk)
 
 update_dal (self, conffwk)
 
 __getitem__ (self, key)
 
 __str__ (self)
 

Public Attributes

dict data = {}
 
 all = all
 

Detailed Description

Defines a cache for all known schemas at a certain time.

Definition at line 327 of file schema.py.

Constructor & Destructor Documentation

◆ __init__()

conffwk.schema.Cache.__init__ ( self,
conffwk,
all = True )
Initializes the cache with information from the Configuration
object.

This method will browse for all declared classes in the Configuration
object given as input and will setup the schema for all known classes.
After this you can still update the cache using the update() method.

Keyword parameters:

conffwk -- The conffwk.Configuration object to use as base for the
current cache.

all -- A boolean indicating if I should store all the attributes and
relations from a certain class or just the ones directly associated
with a class.

Definition at line 331 of file schema.py.

331 def __init__(self, conffwk, all=True):
332 """Initializes the cache with information from the Configuration
333 object.
334
335 This method will browse for all declared classes in the Configuration
336 object given as input and will setup the schema for all known classes.
337 After this you can still update the cache using the update() method.
338
339 Keyword parameters:
340
341 conffwk -- The conffwk.Configuration object to use as base for the
342 current cache.
343
344 all -- A boolean indicating if I should store all the attributes and
345 relations from a certain class or just the ones directly associated
346 with a class.
347 """
348 self.data = {}
349 self.all = all
350 self.update(conffwk)
351

Member Function Documentation

◆ __getitem__()

conffwk.schema.Cache.__getitem__ ( self,
key )
Gets the description of a certain class.

Definition at line 385 of file schema.py.

385 def __getitem__(self, key):
386 """Gets the description of a certain class."""
387 return self.data[key]
388

◆ __str__()

conffwk.schema.Cache.__str__ ( self)
Prints a nice display of myself

Definition at line 389 of file schema.py.

389 def __str__(self):
390 """Prints a nice display of myself"""
391 return '%s: %d classes loaded' % \
392 (self.__class__.__name__, len(self.data)) + '\n' + \
393 str(list(self.data.keys()))

◆ update()

conffwk.schema.Cache.update ( self,
conffwk )
Updates this cache with information from the Configuration object.

This method will add new classes not yet know to this cache. Classes
with existing names will not be added. No warning is generated (this
should be done by the OKS layer in any case.

Definition at line 352 of file schema.py.

352 def update(self, conffwk):
353 """Updates this cache with information from the Configuration object.
354
355 This method will add new classes not yet know to this cache. Classes
356 with existing names will not be added. No warning is generated (this
357 should be done by the OKS layer in any case.
358 """
359 for k in conffwk.classes():
360 if k in list(self.data.keys()):
361 continue
362 self.data[k] = {}
363 self.data[k]['attribute'] = conffwk.attributes(k, self.all)
364 self.data[k]['relation'] = conffwk.relations(k, self.all)
365 self.data[k]['superclass'] = conffwk.superclasses(k, self.all)
366 self.data[k]['subclass'] = conffwk.subclasses(k, self.all)
367 map_coercion(k, self.data[k])
368

◆ update_dal()

conffwk.schema.Cache.update_dal ( self,
conffwk )
Updates this cache with information for DAL.

This method will add new DAL classes not yet know to this cache.
Classes with existing DAL representations will not be touched.

Definition at line 369 of file schema.py.

369 def update_dal(self, conffwk):
370 """Updates this cache with information for DAL.
371
372 This method will add new DAL classes not yet know to this cache.
373 Classes with existing DAL representations will not be touched.
374 """
375 from .dal import generate
376
377 # generate
378 klasses = generate(conffwk, [self.data[k]['dal'] for k
379 in list(self.data.keys())
380 if 'dal' in self.data[k]])
381 # associate
382 for k in klasses:
383 self.data[k.pyclassName()]['dal'] = k
384

Member Data Documentation

◆ all

conffwk.schema.Cache.all = all

Definition at line 349 of file schema.py.

◆ data

conffwk.schema.Cache.data = {}

Definition at line 348 of file schema.py.


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