The Gaudi Framework  master (37c0b60a)
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 387 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 388 of file semantics.py.

388  def __init__(self, semantics):
389  self.value_semantics = semantics
390  self.default = set() # cannot use None due to the way __ior__ is implemented
391  self._data = set()
392  self.is_dirty = False
393 

Member Function Documentation

◆ __contains__()

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

Definition at line 408 of file semantics.py.

408  def __contains__(self, value):
409  return self.value_semantics.store(value) in self.data
410 

◆ __eq__()

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

Definition at line 411 of file semantics.py.

411  def __eq__(self, other):
412  return self.data == other
413 

◆ __iter__()

def GaudiConfig2.semantics._SetHelper.__iter__ (   self)

Definition at line 414 of file semantics.py.

414  def __iter__(self):
415  for value in self.data:
416  yield self.value_semantics.load(value)
417 

◆ __len__()

def GaudiConfig2.semantics._SetHelper.__len__ (   self)

Definition at line 405 of file semantics.py.

405  def __len__(self):
406  return len(self.data)
407 

◆ __repr__()

def GaudiConfig2.semantics._SetHelper.__repr__ (   self)

Definition at line 435 of file semantics.py.

435  def __repr__(self):
436  if self.data:
437  # sort into list but print as set to get reproducible repr
438  return "{" + repr(sorted(self.data))[1:-1] + "}"
439  else:
440  return "set()"
441 
442 

◆ add()

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

Definition at line 418 of file semantics.py.

418  def add(self, value):
419  self.is_dirty = True
420  self.data.add(self.value_semantics.store(value))
421 

◆ data()

def GaudiConfig2.semantics._SetHelper.data (   self)

Definition at line 402 of file semantics.py.

402  def data(self):
403  return self._data if self.is_dirty else self.default
404 

◆ discard()

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

Definition at line 422 of file semantics.py.

422  def discard(self, value):
423  if not self.is_dirty:
424  raise RuntimeError("cannot remove elements from the default value")
425  self.data.discard(value)
426 

◆ opt_value()

def GaudiConfig2.semantics._SetHelper.opt_value (   self)

Definition at line 432 of file semantics.py.

432  def opt_value(self):
433  return set(self.value_semantics.opt_value(item) for item in self.data)
434 

◆ pop()

def GaudiConfig2.semantics._SetHelper.pop (   self)

Definition at line 427 of file semantics.py.

427  def pop(self):
428  if not self.is_dirty:
429  raise RuntimeError("cannot remove elements from the default value")
430  return self.data.pop()
431 

Member Data Documentation

◆ _data

GaudiConfig2.semantics._SetHelper._data
private

Definition at line 391 of file semantics.py.

◆ data

GaudiConfig2.semantics._SetHelper.data

Definition at line 412 of file semantics.py.

◆ default

GaudiConfig2.semantics._SetHelper.default

Definition at line 390 of file semantics.py.

◆ difference

GaudiConfig2.semantics._SetHelper.difference
static

Definition at line 398 of file semantics.py.

◆ intersection

GaudiConfig2.semantics._SetHelper.intersection
static

Definition at line 397 of file semantics.py.

◆ is_dirty

GaudiConfig2.semantics._SetHelper.is_dirty

Definition at line 392 of file semantics.py.

◆ symmetric_difference

GaudiConfig2.semantics._SetHelper.symmetric_difference
static

Definition at line 399 of file semantics.py.

◆ union

GaudiConfig2.semantics._SetHelper.union
static

Definition at line 395 of file semantics.py.

◆ update

GaudiConfig2.semantics._SetHelper.update
static

Definition at line 396 of file semantics.py.

◆ value_semantics

GaudiConfig2.semantics._SetHelper.value_semantics

Definition at line 389 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