cfl_nameset.cpp
Go to the documentation of this file.
1 /** @file cfl_nameset.cpp @brief Classes NameSet */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2006 Bernd Opitz
6  Exclusive copyright is granted to Klaus Schmidt
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21 
22 
23 #include "cfl_nameset.h"
24 
25 namespace faudes {
26 
27 /*
28 *********************************************************************************
29 *********************************************************************************
30 *********************************************************************************
31 
32  NameSet
33 
34 *********************************************************************************
35 *********************************************************************************
36 *********************************************************************************
37 */
38 
39 
40 // std faudes type (cannot do New() with macro)
41 FAUDES_TYPE_IMPLEMENTATION_COPY(EventSet,NameSet,TBaseSet<Idx>)
42 FAUDES_TYPE_IMPLEMENTATION_CAST(EventSet,NameSet,TBaseSet<Idx>)
43 FAUDES_TYPE_IMPLEMENTATION_ASSIGN(EventSet,NameSet,TBaseSet<Idx>)
44 FAUDES_TYPE_IMPLEMENTATION_EQUAL(EventSet,NameSet,TBaseSet<Idx>)
45 
46 
47 // empty constructor
49  mpSymbolTable = SymbolTable::GlobalEventSymbolTablep();
50  Name("NameSet");
51  FD_DC("NameSet("<<this<<")::NameSet() with symtab "<< mpSymbolTable);
52 }
53 
54 // constructor from nameset
55 NameSet::NameSet(const NameSet& rOtherSet) : TBaseSet<Idx>() {
56  FD_DC("NameSet(" << this << ")::NameSet(rOtherSet " << &rOtherSet << ")");
57  mpSymbolTable = rOtherSet.mpSymbolTable;
58  Assign(rOtherSet);
59  FD_DC("NameSet(" << this << ")::NameSet(rOtherSet " << &rOtherSet << "): done");
60 }
61 
62 // read file constructor
63 NameSet::NameSet(const std::string& rFilename, const std::string& rLabel) : TBaseSet<Idx>() {
64  FD_DC("NameSet(" << this << ")::NameSet(" << rFilename << ")");
66  Read(rFilename, rLabel);
67 }
68 
69 // destructor
71  FD_DC("NameSet("<<this<<")::~NameSet()");
72 }
73 
74 // New()
75 NameSet* NameSet::New(void) const {
76  NameSet* res= new NameSet();
78  return res;
79 }
80 
81 
82 // copy (attributes to default)
83 void NameSet::DoAssign(const NameSet& rSourceSet) {
84  FD_DC("NameSet(" << this << ")::DoAssign(..)");
85  // fix my symboltable
86  mpSymbolTable=rSourceSet.mpSymbolTable;
87  // call base
88  TBaseSet<Idx>::DoAssign(rSourceSet);
89 }
90 
91 // Compare
92 bool NameSet::DoEqual(const NameSet& rOtherSet) const {
93  FD_DC("NameSet::DoEqual()");
94 #ifdef FAUDES_CHECKED
95  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
96  std::stringstream errstr;
97  errstr << "symboltable mismazch aka not implemented" << std::endl;
98  throw Exception("NameSet::DoEqual()", errstr.str(), 67);
99  }
100 #endif
101  return TBaseSet<Idx>::DoEqual(rOtherSet);
102 }
103 
104 // SymbolTablep()
106  return mpSymbolTable;
107 }
108 
109 // SymbolTablep(pSymTab)
111  FD_DC("NameSet(" << this << ")::SymbolTablep(" << pSymTab << ")");
112  if(!Empty()) {
113  Clear();
114  }
115  mpSymbolTable=pSymTab;
116 }
117 
118 // DoWrite(tw, rLabel)
119 void NameSet::DoWrite(TokenWriter& tw, const std::string& rLabel, const Type* pContext) const {
120  std::string label=rLabel;
121  if(label=="") label=Name();
122  FD_DC("NameSet(" << this << ")::DoWrite(..): section " << label << " #" << Size());
123  tw.WriteBegin(label);
124  Token token;
125  Iterator it;
126  for (it = Begin(); it != End(); ++it) {
127 #ifdef FAUDES_DEBUG_CODE
128  if (SymbolicName(*it) == "") {
129  FD_ERR("NameSet::Write(): "
130  << "index " << *it << " not in SymbolTable. aborting...");
131  abort();
132  }
133 #endif
134  token.SetString(SymbolicName(*it));
135  tw << token;
136  Attribute(*it).Write(tw,"",pContext);
137  }
138  tw.WriteEnd(label);
139 }
140 
141 // DoDWrite()
142 void NameSet::DoDWrite(TokenWriter& tw, const std::string& rLabel, const Type* pContext) const {
143  std::string label=rLabel;
144  if(label=="") label=Name();
145  if(label=="") label=TypeName();
146  tw.WriteBegin(label);
147  Token token;
148  Iterator it;
149  for (it = Begin(); it != End(); ++it) {
150  tw << Str(*it);
151  Attribute(*it).Write(tw,"",pContext);
152  }
153  tw.WriteEnd(label);
154 }
155 
156 
157 // DoXWrite(tw, rLabel)
158 void NameSet::DoXWrite(TokenWriter& tw, const std::string& rLabel, const Type* pContext) const {
159  // Set up outer tag
160  Token btag=XBeginTag(rLabel,"NameSet");
161  tw.Write(btag);
162  FD_DC("NameSet(" << this << ")::DoXWrite(..): section " << btag.StringValue() << " #" << Size());
163  // loop elements
164  std::string etstr=XElementTag();
165  for (Iterator it = Begin(); it != End(); ++it) {
166  Token etoken;
167  const AttributeVoid& attr=Attribute(*it);
168  // case a: no attribute value
169  if(attr.IsDefault()) {
170  etoken.SetEmpty(etstr);
171  etoken.InsAttributeString("name",SymbolicName(*it));
172  tw << etoken;
173  }
174  // case b: incl attribute value
175  if(!attr.IsDefault()) {
176  etoken.SetBegin(etstr);
177  etoken.InsAttributeString("name",SymbolicName(*it));
178  tw << etoken;
179  Attribute(*it).XWrite(tw,"",pContext);
180  etoken.SetEnd(etstr);
181  tw << etoken;
182  }
183  }
184  tw.WriteEnd(btag.StringValue());
185 }
186 
187 // DoRead(rTr, rLabel, pContext)
188 void NameSet::DoRead(TokenReader& rTr, const std::string& rLabel, const Type* pContext) {
189  // set up defaults
190  std::string label=rLabel;
191  std::string ftype=TypeName();
192  std::string etstr=XElementTag();
193  // figure section
194  Token token;
195  if(label=="") {
196  rTr.Peek(token);
197  if(token.Type()==Token::Begin) label=token.StringValue();
198  }
199  if(label=="") label=ftype;
200  Name(label);
201  // read begin
202  rTr.ReadBegin(label,token);
203  if(token.ExistsAttributeString("name"))
204  Name(token.AttributeStringValue("name"));
205  FD_DC("NameSet(" << this << ")::DoRead(..): section " << label << " with symtab " << mpSymbolTable);
206  // prepare attribute
207  AttributeVoid* attrp = AttributeType()->New();
208  FD_DC("NameSet(" << this << ")::DoRead(..): attribute type " << typeid(*attrp).name());
209  // loop tokens
210  std::string name;
211  while(!rTr.Eos(label)) {
212  rTr.Peek(token);
213  // read by name (faudes format)
214  if(token.IsString()) {
215  FD_DC("TaNameSet(" << this << ")::DoRead(..): inserting element in faudes format \""
216  << token.StringValue() << "\"");
217  rTr.Get(token);
218  name=token.StringValue();
219  // read faudes attribute
220  attrp->Read(rTr,"",pContext);
221  // skip unknown faudes attributes
222  AttributeVoid::Skip(rTr);
223  // insert element with attribute
224  Idx index=Insert(name);
225  Attribute(index,*attrp);
226  continue;
227  }
228  // read element section (XML format)
229  if(token.IsBegin(etstr)) {
230  FD_DC("TaNameSet(" << this << ")::DoRead(..): inserting element in xml format \""
231  << token.StringValue() << "\"");
232  rTr.ReadBegin(etstr,token);
233  name=token.AttributeStringValue("name");
234  // read faudes attribute
235  attrp->Read(rTr,"",pContext);
236  // skip unknown faudes attributes
237  rTr.ReadEnd(etstr);
238  // insert element with attribute
239  Idx index=Insert(name);
240  Attribute(index,*attrp);
241  continue;
242  }
243  // cannot process token
244  delete attrp;
245  std::stringstream errstr;
246  errstr << "Invalid token of type " << token.Type() << " at " << rTr.FileLine();
247  throw Exception("NameSet::DoRead", errstr.str(), 50);
248  }
249  rTr.ReadEnd(label);
250  delete attrp;
251  FD_DC("NameSet(" << this << ")::DoRead(tr," << label << ", " << pContext << "): done");
252 }
253 
254 
255 // Insert(index)
256 bool NameSet::Insert(const Idx& index) {
257 #ifdef FAUDES_CHECKED
258  if(!mpSymbolTable->Exists(index)) {
259  std::stringstream errstr;
260  errstr << "index " << index << " not known to symboltable" << std::endl;
261  throw Exception("NameSet::Insert", errstr.str(), 65);
262  }
263 #endif
264  return TBaseSet<Idx>::Insert(index);
265 }
266 
267 // Insert(rName)
268 Idx NameSet::Insert(const std::string& rName) {
269  FD_DC("NameSet(" << this << ")::Insert(" << rName <<")");
270  Idx index = mpSymbolTable->InsEntry(rName);
271  TBaseSet<Idx>::Insert(index);
272  return index;
273 }
274 
275 // InsertSet(set)
276 void NameSet::InsertSet(const TBaseSet<Idx>& rOtherSet) {
277 #ifdef FAUDES_CHECKED
278  const NameSet* nset = dynamic_cast<const NameSet*>(&rOtherSet);
279  if(!nset) {
280  std::stringstream errstr;
281  errstr << "cannot cast to nameset" << std::endl;
282  throw Exception("NameSet::InsertSet", errstr.str(), 67);
283  }
284  if(nset->mpSymbolTable!=mpSymbolTable) {
285  std::stringstream errstr;
286  errstr << "symboltable mismatch aka not implemented" << std::endl;
287  throw Exception("NameSet::InsertSet", errstr.str(), 67);
288  }
289 #endif
290  TBaseSet<Idx>::InsertSet(rOtherSet);
291 }
292 
293 
294 // InsertSet(set)
295 void NameSet::InsertSet(const NameSet& rOtherSet) {
296  FD_DC("NameSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
297 #ifdef FAUDES_CHECKED
298  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
299  std::stringstream errstr;
300  errstr << "symboltable mismatch aka not implemented" << std::endl;
301  throw Exception("NameSet::InsertSet", errstr.str(), 67);
302  }
303 #endif
304  TBaseSet<Idx>::InsertSet(rOtherSet);
305 }
306 
307 // Erase(index)
308 bool NameSet::Erase(const Idx& index) {
309  FD_DC("NameSet(" << this << ")::Erase(" << index <<")");
310  return TBaseSet<Idx>::Erase(index);
311 }
312 
313 // Erase(rName)
314 bool NameSet::Erase(const std::string& rName) {
315  FD_DC("NameSet(" << this << ")::Erase(" << rName <<")");
316  Idx index = mpSymbolTable->Index(rName);
317 #ifdef FAUDES_CHECKED
318  if (index == 0) {
319  std::stringstream errstr;
320  errstr << "name \"" << rName << "\" not found in NameSet" << std::endl;
321  throw Exception("NameSet::Erase", errstr.str(), 66);
322  }
323 #endif
324  return TBaseSet<Idx>::Erase(index);
325 }
326 
327 // Erase(pos)
328 NameSet::Iterator NameSet::Erase(const Iterator& pos) {
329  return TBaseSet<Idx>::Erase(pos);
330 }
331 
332 // EraseSet(set)
333 void NameSet::EraseSet(const TBaseSet<Idx>& rOtherSet) {
334 #ifdef FAUDES_CHECKED
335  const NameSet* nset = dynamic_cast<const NameSet*>(&rOtherSet);
336  if(!nset) {
337  std::stringstream errstr;
338  errstr << "cannot cast to nameset" << std::endl;
339  throw Exception("NameSet::EraseSet", errstr.str(), 67);
340  }
341  if(nset->mpSymbolTable!=mpSymbolTable) {
342  std::stringstream errstr;
343  errstr << "symboltable mismatch aka not implemented" << std::endl;
344  throw Exception("NameSet::EraseSet", errstr.str(), 67);
345  }
346 #endif
347  TBaseSet<Idx>::EraseSet(rOtherSet);
348 }
349 
350 
351 // EraseSet(set)
352 void NameSet::EraseSet(const NameSet& rOtherSet) {
353 #ifdef FAUDES_CHECKED
354  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
355  std::stringstream errstr;
356  errstr << "symboltable mismatch aka not implemented" << std::endl;
357  throw Exception("NameSet::EraseSet", errstr.str(), 67);
358  }
359 #endif
360  TBaseSet<Idx>::EraseSet(rOtherSet);
361 }
362 
363 
364 // RestrictSet(set)
365 void NameSet::RestrictSet(const TBaseSet<Idx>& rOtherSet) {
366 #ifdef FAUDES_CHECKED
367  const NameSet* nset = dynamic_cast<const NameSet*>(&rOtherSet);
368  if(!nset) {
369  std::stringstream errstr;
370  errstr << "cannot cast to nameset" << std::endl;
371  throw Exception("NameSet::RestrictSet", errstr.str(), 67);
372  }
373  if(nset->mpSymbolTable!=mpSymbolTable) {
374  std::stringstream errstr;
375  errstr << "symboltable mismatch aka not implemented" << std::endl;
376  throw Exception("NameSet::RestrictSet", errstr.str(), 67);
377  }
378 #endif
379  TBaseSet<Idx>::RestrictSet(rOtherSet);
380 }
381 
382 // RestrictSet(set)
383 void NameSet::RestrictSet(const NameSet& rOtherSet) {
384 #ifdef FAUDES_CHECKED
385  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
386  std::stringstream errstr;
387  errstr << "symboltable mismatch aka not implemented" << std::endl;
388  throw Exception("NameSet::RestrictSet", errstr.str(), 67);
389  }
390 #endif
391  TBaseSet<Idx>::RestrictSet(rOtherSet);
392 }
393 
394 // SymbolicName(index)
395 std::string NameSet::SymbolicName(Idx index) const {
396  return mpSymbolTable->Symbol(index);
397 }
398 
399 // SymbolicName(index, name)
400 void NameSet::SymbolicName(Idx index, const std::string& rName) {
401  FD_DC("NameSet(" << this << ")::SymbolicName(" << index << ", " << rName <<")");
402 #ifdef FAUDES_CHECKED
403  if (! Exists(index)) {
404  std::stringstream errstr;
405  errstr << "index " << index << " not in this set" << std::endl;
406  throw Exception("NameSet::SymbolicName", errstr.str(), 60);
407  }
408 #endif
409  mpSymbolTable->SetEntry(index, rName);
410 }
411 
412 // SymbolicName(name, name)
413 void NameSet::SymbolicName(const std::string& rName,
414  const std::string& rNewName) {
415  FD_DC("NameSet(" << this << ")::SymbolicName(" << rName << ", "
416  << rNewName <<")");
417 #ifdef FAUDES_CHECKED
418  if (! Exists(rName)) {
419  std::stringstream errstr;
420  errstr << "name \"" << rName << "\" not found in NameSet" << std::endl;
421  throw Exception("NameSet::Symbolic", errstr.str(), 66);
422  }
423 #endif
424  mpSymbolTable->SetEntry(Index(rName), rNewName);
425 }
426 
427 // Index(rName)
428 Idx NameSet::Index(const std::string& rName) const {
429  return mpSymbolTable->Index(rName);
430 }
431 
432 // Exists(index)
433 bool NameSet::Exists(const Idx& index) const {
434  return TBaseSet<Idx>::Exists(index);
435 }
436 
437 // Exists(rName)
438 bool NameSet::Exists(const std::string& rName) const {
439  return TBaseSet<Idx>::Exists(mpSymbolTable->Index(rName)) ;
440 }
441 
442 // Find(index) const
443 NameSet::Iterator NameSet::Find(const Idx& index) const {
444  return TBaseSet<Idx>::Find(index);
445 }
446 
447 // Find(rName) const
448 NameSet::Iterator NameSet::Find(const std::string& rName) const {
449  return TBaseSet<Idx>::Find(mpSymbolTable->Index(rName));
450 }
451 
452 
453 // operator +
454 NameSet NameSet::operator + (const NameSet& rOtherSet) const {
455  FD_DC("NameSet(" << this << ")::operator + (" << &rOtherSet << ")");
456 #ifdef FAUDES_CHECKED
457  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
458  std::stringstream errstr;
459  errstr << "symboltable mismazch aka not implemented" << std::endl;
460  throw Exception("NameSet::Operator+", errstr.str(), 67);
461  }
462 #endif
463  NameSet res;
465  res.InsertSet(*this);
466  res.InsertSet(rOtherSet);
467  return res;
468 }
469 
470 // operator -
471 NameSet NameSet::operator - (const NameSet& rOtherSet) const {
472  FD_DC("NameSet(" << this << ")::operator - (" << &rOtherSet << ")");
473 #ifdef FAUDES_CHECKED
474  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
475  std::stringstream errstr;
476  errstr << "symboltable mismazch aka not implemented" << std::endl;
477  throw Exception("NameSet::Operator-", errstr.str(), 67);
478  }
479 #endif
480  NameSet res;
482  res.InsertSet(*this);
483  res.EraseSet(rOtherSet);
484  return res;
485 }
486 
487 
488 // operator*
489 NameSet NameSet::operator * (const NameSet& rOtherSet) const {
490  FD_DC("NameSet(" << this << ")::operator * (" << &rOtherSet << ")");
491 #ifdef FAUDES_CHECKED
492  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
493  std::stringstream errstr;
494  errstr << "symboltable mismazch aka not implemented" << std::endl;
495  throw Exception("NameSet::Operator*", errstr.str(), 67);
496  }
497 #endif
498  NameSet res;
500  res.InsertSet(*this);
501  res.RestrictSet(rOtherSet);
502  return res;
503 }
504 
505 // operator <=
506 bool NameSet::operator <= (const NameSet& rOtherSet) const {
507 #ifdef FAUDES_CHECKED
508  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
509  std::stringstream errstr;
510  errstr << "symboltable mismazch aka not implemented" << std::endl;
511  throw Exception("NameSet::Operator<=", errstr.str(), 67);
512  }
513 #endif
514  return TBaseSet<Idx>::operator <= (rOtherSet);
515 }
516 
517 // operator >=
518 bool NameSet::operator >= (const NameSet& rOtherSet) const {
519 #ifdef FAUDES_CHECKED
520  if(rOtherSet.mpSymbolTable!=mpSymbolTable) {
521  std::stringstream errstr;
522  errstr << "symboltable mismazch aka not implemented" << std::endl;
523  throw Exception("NameSet::Operator>=", errstr.str(), 67);
524  }
525 #endif
526  return TBaseSet<Idx>::operator >= (rOtherSet);
527 }
528 
529 // Str(index)
530 std::string NameSet::Str(const Idx& index) const {
531  return mpSymbolTable->Symbol(index)+"#"+faudes::ToStringInteger(index);
532 }
533 
534 
535 /*
536 *********************************************************************************
537 *********************************************************************************
538 *********************************************************************************
539 
540  Misc
541 
542 *********************************************************************************
543 *********************************************************************************
544 *********************************************************************************
545 */
546 
547 
548 // RTI convenience function
549 void SetIntersection(const EventSetVector& rSetVec, EventSet& rRes) {
550  // prepare result
551  rRes.Clear();
552  // ignore empty
553  if(rSetVec.Size()==0) return;
554  // copy first
555  rRes.Assign(rSetVec.At(0));
556  // perform intersecttion
557  for(EventSetVector::Position i=1; i<rSetVec.Size(); i++)
558  SetIntersection(rSetVec.At(i),rRes,rRes);
559 }
560 
561 
562 // RTI convenience function
563 void SetUnion(const EventSetVector& rSetVec, EventSet& rRes) {
564  // prepare result
565  rRes.Clear();
566  // ignore empty
567  if(rSetVec.Size()==0) return;
568  // copy first
569  rRes.Assign(rSetVec.At(0));
570  // perform union
571  for(EventSetVector::Position i=1; i<rSetVec.Size(); i++)
572  SetUnion(rSetVec.At(i),rRes,rRes);
573 }
574 
575 
576 } // namespace faudes
577 
578 
#define FD_DC(message)
Debug: optional report on container operations.
#define FD_ERR(message)
Debug: report more errors with file/line info.
Classes NameSet, TaNameSet.
#define FAUDES_TYPE_IMPLEMENTATION_EQUAL(ftype, ctype, cbase)
Definition: cfl_types.h:904
#define FAUDES_TYPE_IMPLEMENTATION_COPY(ftype, ctype, cbase)
Definition: cfl_types.h:891
#define FAUDES_TYPE_IMPLEMENTATION_CAST(ftype, ctype, cbase)
Definition: cfl_types.h:893
#define FAUDES_TYPE_IMPLEMENTATION_ASSIGN(ftype, ctype, cbase)
Definition: cfl_types.h:896
Minimal Attribute.
virtual bool IsDefault(void) const
Test for default value.
static void Skip(TokenReader &rTr)
Skip attribute tokens.
Faudes exception class.
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
bool Exists(const Idx &rIndex) const
Test existence of index.
NameSet(void)
Constructor for NameSet referring to the static SymbolTable.
Definition: cfl_nameset.cpp:48
NameSet::Iterator Find(const Idx &rIndex) const
Find iterator for index.
void SymbolicName(Idx index, const std::string &rName)
Set new name for existing index.
virtual void DoRead(TokenReader &tr, const std::string &rLabel="", const Type *pContext=0)
Read from TokenReader, see Type::Read for public wrappers.
std::string Str(const Idx &rIndex) const
Return pretty printable symbolic name for index.
virtual void InsertSet(const NameSet &rOtherSet)
Inserts all elements of rOtherSet.
NameSet operator-(const NameSet &rOtherSet) const
Set difference operator.
bool DoEqual(const NameSet &rOtherSet) const
Test equality of configuration data.
Definition: cfl_nameset.cpp:92
bool operator<=(const NameSet &rOtherSet) const
Test for subset
NameSet operator*(const NameSet &rOtherSet) const
Set intersection operator.
SymbolTable * SymbolTablep(void) const
Get Pointer mpSymbolTable.
bool Insert(const Idx &rIndex)
Add an element by index.
NameSet operator+(const NameSet &rOtherSet) const
Set union operator.
bool operator>=(const NameSet &rOtherSet) const
Test for superset.
virtual void DoDWrite(TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
Write debug info to TokenWriter, see Type::DWrite for public wrapper.
virtual void DoXWrite(TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
Write to TokenWriter XML format, see Type::XWrite for public wrappers This function will also do the ...
void EraseSet(const NameSet &rOtherSet)
Erase elements specified by rOtherSet.
Idx Index(const std::string &rName) const
Index lookup.
void RestrictSet(const NameSet &rOtherSet)
Restrict to elements specified by rOtherSet.
virtual ~NameSet(void)
Virtual destructor.
Definition: cfl_nameset.cpp:70
virtual void DoWrite(TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
Write to TokenWriter, see Type::Write for public wrappers This function will also do the token IO of ...
SymbolTable * mpSymbolTable
Pointer to local SymbolTable.
Definition: cfl_nameset.h:428
void DoAssign(const NameSet &rSourceSet)
Assign from other name set.
Definition: cfl_nameset.cpp:83
virtual bool Erase(const Idx &rIndex)
Delete element by index.
A SymbolTable associates sybolic names with indices.
static SymbolTable * GlobalEventSymbolTablep(void)
Get Static Symboltable ref (initialize on first use pattern)
std::string Symbol(Idx index) const
Symbolic name lookup.
bool Exists(Idx index) const
Test existence of index.
void SetEntry(Idx index, const std::string &rName)
Set symbolic name for existing entry.
Idx InsEntry(Idx index, const std::string &rName)
Add new entry (aka symbolic name and index) to symboltable,.
Idx Index(const std::string &rName) const
Index lookup.
STL style set template.
Definition: cfl_baseset.h:93
Vector template.
std::vector< int >::size_type Position
convenience typedef for positions
virtual const T & At(const Position &pos) const
Access element.
A TokenReader reads sequential tokens from a file or string.
std::string FileLine(void) const
Return "filename:line".
bool Eos(const std::string &rLabel)
Peek a token and check whether it ends the specified section.
void ReadEnd(const std::string &rLabel)
Close the current section by matching the previous ReadBegin().
void ReadBegin(const std::string &rLabel)
Open a section by specified label.
bool Get(Token &token)
Get next token.
bool Peek(Token &token)
Peek next token.
A TokenWriter writes sequential tokens to a file, a string or stdout.
void Write(Token &rToken)
Write next token.
void WriteEnd(const std::string &rLabel)
Write end label.
void WriteBegin(const std::string &rLabel)
Write begin label.
Tokens model atomic data for stream IO.
Definition: cfl_token.h:53
const std::string & StringValue(void) const
Get string value of a name token.
Definition: cfl_token.cpp:177
@ Begin
<label> (begin of section)
Definition: cfl_token.h:83
bool IsString(void) const
Test token Type.
Definition: cfl_token.cpp:243
void SetString(const std::string &rName)
Initialize as String token.
Definition: cfl_token.cpp:84
bool ExistsAttributeString(const std::string &name)
Test attibute existence.
Definition: cfl_token.cpp:355
bool IsBegin(void) const
Test token Type.
Definition: cfl_token.cpp:258
void SetEmpty(const std::string &rName)
Initialize as empty-tag token.
Definition: cfl_token.cpp:105
void SetBegin(const std::string &rName)
Initialize as Begin token.
Definition: cfl_token.cpp:91
void InsAttributeString(const std::string &name, const std::string &value)
Insert named attribute with string value.
Definition: cfl_token.cpp:309
const std::string & AttributeStringValue(const std::string &name)
Access attribute value.
Definition: cfl_token.cpp:385
TokenType Type(void) const
Get token Type.
Definition: cfl_token.cpp:198
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
virtual Token XBeginTag(const std::string &rLabel="", const std::string &rFallbackLabel="") const
Definition: cfl_types.cpp:315
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
Definition: cfl_types.cpp:261
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to a string.
Definition: cfl_types.cpp:169
virtual void XWrite(const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to an XML file.
Definition: cfl_types.cpp:200
virtual Type & Assign(const Type &rSrc)
Assign configuration data from other object.
Definition: cfl_types.cpp:77
virtual Type * New(void) const
Construct on heap.
Definition: cfl_types.cpp:54
void Write(const Type *pContext=0) const
Write configuration data to console.
Definition: cfl_types.cpp:139
Idx Size(void) const
Get size of vector.
virtual bool Insert(const T &rElem)
Insert specified element.
Definition: cfl_baseset.h:1960
bool DoEqual(const TBaseSet &rOtherSet) const
test equality
Definition: cfl_baseset.h:2144
virtual const AttributeVoid * AttributeType(void) const
Attribute typeinfo.
Definition: cfl_baseset.h:2171
virtual const std::string & XElementTag(void) const
Get name of elements (used for XML IO)
Definition: cfl_baseset.h:1777
void DoAssign(const TBaseSet &rSourceSet)
assign my members
Definition: cfl_baseset.h:1261
bool Empty(void) const
Test whether if the TBaseSet is Empty.
Definition: cfl_baseset.h:1824
bool Exists(const T &rElem) const
Test existence of element.
Definition: cfl_baseset.h:2115
virtual void Clear(void)
Clear all set.
Definition: cfl_baseset.h:1902
Iterator Find(const T &rElem) const
Find element and return iterator.
Definition: cfl_baseset.h:2110
Iterator End(void) const
Iterator to the end of set.
Definition: cfl_baseset.h:1896
virtual void RestrictSet(const TBaseSet &rOtherSet)
Restrict elements given by other set.
Definition: cfl_baseset.h:2064
virtual void InsertSet(const TBaseSet &rOtherSet)
Insert elements given by rOtherSet.
Definition: cfl_baseset.h:1987
Iterator Begin(void) const
Iterator to the begin of set.
Definition: cfl_baseset.h:1891
NameSet EventSet
Convenience typedef for plain event sets.
Definition: cfl_nameset.h:531
virtual const std::string & TypeName(void) const
Get objects's type name.
Definition: cfl_baseset.h:1795
virtual const AttributeVoid & Attribute(const Idx &rElem) const
Attribute access.
Definition: cfl_baseset.h:2290
virtual bool Erase(const T &rElem)
Erase element by reference.
Definition: cfl_baseset.h:2019
bool operator<=(const TBaseSet &rOtherSet) const
Test for subset
Definition: cfl_baseset.h:2153
bool operator>=(const TBaseSet &rOtherSet) const
Test for superset.
Definition: cfl_baseset.h:2159
const std::string & Name(void) const
Return name of TBaseSet.
Definition: cfl_baseset.h:1755
void SetUnion(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB, TBaseSet< T, Cmp > &rRes)
Definition: cfl_baseset.h:1019
void SetIntersection(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB, TBaseSet< T, Cmp > &rRes)
Definition: cfl_baseset.h:1049
virtual void EraseSet(const TBaseSet &rOtherSet)
Erase elements given by other set.
Definition: cfl_baseset.h:2042
Idx Size(void) const
Get Size of TBaseSet.
Definition: cfl_baseset.h:1819
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
std::string ToStringInteger(Int number)
integer to string
Definition: cfl_helper.cpp:43

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen