The Gaudi Framework  master (3415b466)
Loading...
Searching...
No Matches
GaudiConfig2.semantics._SetHelper Class Reference
Inheritance diagram for GaudiConfig2.semantics._SetHelper:
Collaboration diagram for GaudiConfig2.semantics._SetHelper:

Public Member Functions

 __init__ (self, semantics)
 
 data (self)
 
 __len__ (self)
 
 __contains__ (self, value)
 
 __eq__ (self, other)
 
 __iter__ (self)
 
 add (self, value)
 
 discard (self, value)
 
 pop (self)
 
 opt_value (self)
 
 __repr__ (self)
 

Public Attributes

 value_semantics = semantics
 
 default = set()
 
bool is_dirty = False
 
 data
 

Static Public Attributes

 union = MutableSet.__ior__
 
 update = MutableSet.__ior__
 
 intersection = MutableSet.__iand__
 
 difference = MutableSet.__isub__
 
 symmetric_difference = MutableSet.__ixor__
 

Protected Attributes

 _data = set()
 

Detailed Description

Definition at line 506 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiConfig2.semantics._SetHelper.__init__ ( self,
semantics )

Definition at line 507 of file semantics.py.

507 def __init__(self, semantics):
508 self.value_semantics = semantics
509 self.default = set() # cannot use None due to the way __ior__ is implemented
510 self._data = set()
511 self.is_dirty = False
512

Member Function Documentation

◆ __contains__()

GaudiConfig2.semantics._SetHelper.__contains__ ( self,
value )

Definition at line 527 of file semantics.py.

527 def __contains__(self, value):
528 return self.value_semantics.store(value) in self.data
529

◆ __eq__()

GaudiConfig2.semantics._SetHelper.__eq__ ( self,
other )

Definition at line 530 of file semantics.py.

530 def __eq__(self, other):
531 return self.data == other
532

◆ __iter__()

GaudiConfig2.semantics._SetHelper.__iter__ ( self)

Definition at line 533 of file semantics.py.

533 def __iter__(self):
534 for value in self.data:
535 yield self.value_semantics.load(value)
536

◆ __len__()

GaudiConfig2.semantics._SetHelper.__len__ ( self)

Definition at line 524 of file semantics.py.

524 def __len__(self):
525 return len(self.data)
526

◆ __repr__()

GaudiConfig2.semantics._SetHelper.__repr__ ( self)

Definition at line 554 of file semantics.py.

554 def __repr__(self):
555 if self.data:
556 # sort into list but print as set to get reproducible repr
557 return "{" + repr(sorted(self.data))[1:-1] + "}"
558 else:
559 return "set()"
560
561

◆ add()

GaudiConfig2.semantics._SetHelper.add ( self,
value )

Definition at line 537 of file semantics.py.

537 def add(self, value):
538 self.is_dirty = True
539 self.data.add(self.value_semantics.store(value))
540

◆ data()

GaudiConfig2.semantics._SetHelper.data ( self)

Definition at line 521 of file semantics.py.

521 def data(self):
522 return self._data if self.is_dirty else self.default
523

◆ discard()

GaudiConfig2.semantics._SetHelper.discard ( self,
value )

Definition at line 541 of file semantics.py.

541 def discard(self, value):
542 if not self.is_dirty:
543 raise RuntimeError("cannot remove elements from the default value")
544 self.data.discard(value)
545

◆ opt_value()

GaudiConfig2.semantics._SetHelper.opt_value ( self)

Definition at line 551 of file semantics.py.

551 def opt_value(self):
552 return set(self.value_semantics.opt_value(item) for item in self.data)
553

◆ pop()

GaudiConfig2.semantics._SetHelper.pop ( self)

Definition at line 546 of file semantics.py.

546 def pop(self):
547 if not self.is_dirty:
548 raise RuntimeError("cannot remove elements from the default value")
549 return self.data.pop()
550

Member Data Documentation

◆ _data

GaudiConfig2.semantics._SetHelper._data = set()
protected

Definition at line 510 of file semantics.py.

◆ data

GaudiConfig2.semantics._SetHelper.data

Definition at line 525 of file semantics.py.

◆ default

GaudiConfig2.semantics._SetHelper.default = set()

Definition at line 509 of file semantics.py.

◆ difference

GaudiConfig2.semantics._SetHelper.difference = MutableSet.__isub__
static

Definition at line 517 of file semantics.py.

◆ intersection

GaudiConfig2.semantics._SetHelper.intersection = MutableSet.__iand__
static

Definition at line 516 of file semantics.py.

◆ is_dirty

bool GaudiConfig2.semantics._SetHelper.is_dirty = False

Definition at line 511 of file semantics.py.

◆ symmetric_difference

GaudiConfig2.semantics._SetHelper.symmetric_difference = MutableSet.__ixor__
static

Definition at line 518 of file semantics.py.

◆ union

GaudiConfig2.semantics._SetHelper.union = MutableSet.__ior__
static

Definition at line 514 of file semantics.py.

◆ update

GaudiConfig2.semantics._SetHelper.update = MutableSet.__ior__
static

Definition at line 515 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._SetHelper.value_semantics = semantics

Definition at line 508 of file semantics.py.


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