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 332 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 336 of file schema.py.

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

Member Function Documentation

◆ __getitem__()

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

Definition at line 390 of file schema.py.

390 def __getitem__(self, key):
391 """Gets the description of a certain class."""
392 return self.data[key]
393

◆ __str__()

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

Definition at line 394 of file schema.py.

394 def __str__(self):
395 """Prints a nice display of myself"""
396 return '%s: %d classes loaded' % \
397 (self.__class__.__name__, len(self.data)) + '\n' + \
398 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 357 of file schema.py.

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

◆ 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 374 of file schema.py.

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

Member Data Documentation

◆ all

conffwk.schema.Cache.all = all

Definition at line 354 of file schema.py.

◆ data

conffwk.schema.Cache.data = {}

Definition at line 353 of file schema.py.


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