Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (98f5f38d)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaudiConfig2.semantics._SetHelper Class Reference
Inheritance diagram for GaudiConfig2.semantics._SetHelper:
Collaboration diagram for GaudiConfig2.semantics._SetHelper:

Public Member Functions

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

Public Attributes

 value_semantics
 
 default
 
 is_dirty
 
 data
 

Static Public Attributes

 union
 
 update
 
 intersection
 
 difference
 
 symmetric_difference
 

Private Attributes

 _data
 

Detailed Description

Definition at line 470 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 471 of file semantics.py.

471  def __init__(self, semantics):
472  self.value_semantics = semantics
473  self.default = set() # cannot use None due to the way __ior__ is implemented
474  self._data = set()
475  self.is_dirty = False
476 

Member Function Documentation

◆ __contains__()

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

Definition at line 491 of file semantics.py.

491  def __contains__(self, value):
492  return self.value_semantics.store(value) in self.data
493 

◆ __eq__()

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

Definition at line 494 of file semantics.py.

494  def __eq__(self, other):
495  return self.data == other
496 

◆ __iter__()

def GaudiConfig2.semantics._SetHelper.__iter__ (   self)

Definition at line 497 of file semantics.py.

497  def __iter__(self):
498  for value in self.data:
499  yield self.value_semantics.load(value)
500 

◆ __len__()

def GaudiConfig2.semantics._SetHelper.__len__ (   self)

Definition at line 488 of file semantics.py.

488  def __len__(self):
489  return len(self.data)
490 

◆ __repr__()

def GaudiConfig2.semantics._SetHelper.__repr__ (   self)

Definition at line 518 of file semantics.py.

518  def __repr__(self):
519  if self.data:
520  # sort into list but print as set to get reproducible repr
521  return "{" + repr(sorted(self.data))[1:-1] + "}"
522  else:
523  return "set()"
524 
525 

◆ add()

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

Definition at line 501 of file semantics.py.

501  def add(self, value):
502  self.is_dirty = True
503  self.data.add(self.value_semantics.store(value))
504 

◆ data()

def GaudiConfig2.semantics._SetHelper.data (   self)

Definition at line 485 of file semantics.py.

485  def data(self):
486  return self._data if self.is_dirty else self.default
487 

◆ discard()

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

Definition at line 505 of file semantics.py.

505  def discard(self, value):
506  if not self.is_dirty:
507  raise RuntimeError("cannot remove elements from the default value")
508  self.data.discard(value)
509 

◆ opt_value()

def GaudiConfig2.semantics._SetHelper.opt_value (   self)

Definition at line 515 of file semantics.py.

515  def opt_value(self):
516  return set(self.value_semantics.opt_value(item) for item in self.data)
517 

◆ pop()

def GaudiConfig2.semantics._SetHelper.pop (   self)

Definition at line 510 of file semantics.py.

510  def pop(self):
511  if not self.is_dirty:
512  raise RuntimeError("cannot remove elements from the default value")
513  return self.data.pop()
514 

Member Data Documentation

◆ _data

GaudiConfig2.semantics._SetHelper._data
private

Definition at line 474 of file semantics.py.

◆ data

GaudiConfig2.semantics._SetHelper.data

Definition at line 495 of file semantics.py.

◆ default

GaudiConfig2.semantics._SetHelper.default

Definition at line 473 of file semantics.py.

◆ difference

GaudiConfig2.semantics._SetHelper.difference
static

Definition at line 481 of file semantics.py.

◆ intersection

GaudiConfig2.semantics._SetHelper.intersection
static

Definition at line 480 of file semantics.py.

◆ is_dirty

GaudiConfig2.semantics._SetHelper.is_dirty

Definition at line 475 of file semantics.py.

◆ symmetric_difference

GaudiConfig2.semantics._SetHelper.symmetric_difference
static

Definition at line 482 of file semantics.py.

◆ union

GaudiConfig2.semantics._SetHelper.union
static

Definition at line 478 of file semantics.py.

◆ update

GaudiConfig2.semantics._SetHelper.update
static

Definition at line 479 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._SetHelper.value_semantics

Definition at line 472 of file semantics.py.


The documentation for this class was generated from the following file:
GaudiPartProp.decorators.__repr__
__repr__
decorate the vector of properties
Definition: decorators.py:173
GaudiPartProp.decorators.__len__
__len__
Definition: decorators.py:177
GaudiPython.Pythonizations.__iter__
__iter__
Definition: Pythonizations.py:143
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50