The Gaudi Framework  master (594c33fa)
GaudiConfig2.semantics Namespace Reference

Classes

class  _DictHelper
 
class  _ListHelper
 
class  _SetHelper
 
class  BoolSemantics
 
class  ComponentSemantics
 
class  DefaultSemantics
 
class  FloatSemantics
 
class  IntSemantics
 
class  MappingSemantics
 
class  OrderedSetSemantics
 
class  PropertySemantics
 
class  SequenceSemantics
 
class  SetSemantics
 
class  StringSemantics
 

Functions

def extract_template_args (cpp_type)
 
def getSemanticsFor (cpp_type)
 

Variables

 is_64bits
 
 _IDENTIFIER_RE
 
 _NS_IDENT_RE
 
 ident
 
 _COMMA_SEPARATION_RE
 
 SEMANTICS
 

Function Documentation

◆ extract_template_args()

def GaudiConfig2.semantics.extract_template_args (   cpp_type)
Return an iterator over the list of template arguments in a C++ type
string.

>>> t = 'map<string, vector<int, allocator<int> >, allocator<v<i>, a<i>> >'
>>> list(extract_template_args(t))
['string', 'vector<int, allocator<int> >', 'allocator<v<i>, a<i>>']
>>> list(extract_template_args('int'))
[]

Definition at line 268 of file semantics.py.

268 def extract_template_args(cpp_type):
269  """
270  Return an iterator over the list of template arguments in a C++ type
271  string.
272 
273  >>> t = 'map<string, vector<int, allocator<int> >, allocator<v<i>, a<i>> >'
274  >>> list(extract_template_args(t))
275  ['string', 'vector<int, allocator<int> >', 'allocator<v<i>, a<i>>']
276  >>> list(extract_template_args('int'))
277  []
278  """
279  template_level = 0
280  arg_start = -1
281  for p, c in enumerate(cpp_type):
282  if c == ",":
283  if template_level == 1:
284  yield cpp_type[arg_start:p].strip()
285  arg_start = p + 1
286  elif c == "<":
287  template_level += 1
288  if template_level == 1:
289  arg_start = p + 1
290  elif c == ">":
291  template_level -= 1
292  if template_level == 0:
293  yield cpp_type[arg_start:p].strip()
294 
295 

◆ getSemanticsFor()

def GaudiConfig2.semantics.getSemanticsFor (   cpp_type)

Definition at line 636 of file semantics.py.

636 def getSemanticsFor(cpp_type):
637  for semantics in SEMANTICS:
638  try:
639  return semantics(cpp_type)
640  except TypeError:
641  pass
642  return DefaultSemantics(cpp_type)

Variable Documentation

◆ _COMMA_SEPARATION_RE

GaudiConfig2.semantics._COMMA_SEPARATION_RE
private

Definition at line 199 of file semantics.py.

◆ _IDENTIFIER_RE

GaudiConfig2.semantics._IDENTIFIER_RE
private

Definition at line 197 of file semantics.py.

◆ _NS_IDENT_RE

GaudiConfig2.semantics._NS_IDENT_RE
private

Definition at line 198 of file semantics.py.

◆ ident

GaudiConfig2.semantics.ident

Definition at line 198 of file semantics.py.

◆ is_64bits

GaudiConfig2.semantics.is_64bits

Definition at line 18 of file semantics.py.

◆ SEMANTICS

GaudiConfig2.semantics.SEMANTICS

Definition at line 627 of file semantics.py.

GaudiConfig2.semantics.getSemanticsFor
def getSemanticsFor(cpp_type)
Definition: semantics.py:636
GaudiConfig2.semantics.extract_template_args
def extract_template_args(cpp_type)
Definition: semantics.py:268