cfl_indexset.h
Go to the documentation of this file.
1 /** @file cfl_indexset.h @brief Classes IndexSet, TaIndexSet */
2 
3 
4 /* FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2006 Bernd Opitz
7  Copyright (C) 2007 Thomas Moor
8  Exclusive copyright is granted to Klaus Schmidt
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 
25 
26 #ifndef FAUDES_INDEXSET_H
27 #define FAUDES_INDEXSET_H
28 
29 #include "cfl_definitions.h"
30 #include "cfl_exception.h"
31 #include "cfl_attrmap.h"
32 #include "cfl_symboltable.h"
33 #include "cfl_registry.h"
34 #include "cfl_basevector.h"
35 #include <algorithm>
36 
37 
38 namespace faudes {
39 
40 
41 
42 /** @addtogroup ContainerClasses */
43 /** @{*/
44 
45 // Forward declaration for the attributed version of indexset
46 template<class Attr> class TaIndexSet;
47 
48 /**
49  * Set of indices. This class is built on top of the faudes version
50  * TBaseSet of STL sets. It provides the essentials of the STL interface
51  * and inherits the standard token IO interface from Type, so you may
52  * use Read and Write for file/string/console IO.
53  *
54  * IndexSet is used as common base for TaIndexSet (indices with attributes),
55  * NameSet (indices with symbolic names) and TaNameSet (indices with
56  * attributes and symbolic names).
57  *
58  * The index of value 0 is reserved to indicate the invalid index. If the macro FAUDES_CHECKED
59  * is defined, the attempt to insert an index 0 triggers an exception (id 61). Invalid
60  * iterators throw an exception (id 62) when used as an argument to a IndexSet function.
61  *
62  * Technically, file IO is done by TaIndexSet functions. This requires a copy and for
63  * that reason may be reimplemented in a future versions.
64  * The format is demonstrated by the following example
65  * of a set with name "MySet" consisting of indices 17, 25, 26, 27, 28, 40:
66  * \code
67  * <Myset>
68  * 17
69  * <Consecutive> 25 4 </Consecutive>
70  * 40
71  * </MySet>
72  * \endcode
73  * Theere is a minimum number of consecutive indices for the use of the consecutive
74  * section defined in definitions.h.
75  *
76  */
77 
78 class FAUDES_API IndexSet : public TBaseSet<Idx> {
79 
81 
82 public:
83 
84  /**
85  * We implement "protected privacy for template classes" by friendship.
86  * This is used for the pragmatic implemention conversion constructors.
87  */
88  template<class Attr> friend class TaIndexSet;
89 
90 
91  /**
92  * Constructor.
93  */
94  IndexSet(void);
95 
96  /**
97  * Copy-constructor.
98  */
99  IndexSet(const IndexSet& rOtherSet);
100 
101  /**
102  * Copy-constructor.
103  */
104  IndexSet(const TBaseSet<Idx>& rOtherSet);
105 
106  /**
107  * Construct from file. Uses the Read(TokenReader&, const std::string&) function to read.
108  * a IndexSet from section rLabel in file rFilename.
109  *
110  * @param rFilename
111  * Name of file to read
112  * @param rLabel
113  * Section to read
114  *
115  * @exception Exception
116  * - IO Errors (id 1)
117  * - Token mismatch (id 50, 51, 52)
118  */
119  IndexSet(const std::string& rFilename, const std::string& rLabel = "");
120 
121  /**
122  * Virtual destructor
123  */
124  virtual ~IndexSet(void) {};
125 
126  /**
127  * Get maximum index used in this set (0 for emptyset)
128  *
129  * @return
130  * max indices
131  */
132  Idx MaxIndex(void) const;
133 
134  /**
135  * Test whether index is not 0
136  * @param rIndex
137  * Index to test
138  * @return
139  * True if idx!=0
140  */
141  bool Valid(const Idx& rIndex) const;
142 
143  /**
144  * Iterators on indexset.
145  */
147 
148  /**
149  * Insert new index to set
150  *
151  * @return
152  * New index
153  */
154  Idx Insert(void);
155 
156  /**
157  * Insert specified index
158  *
159  * @param rIndex
160  * Index to insert
161  * @return
162  * True if index was new to set
163  */
164  bool Insert(const Idx& rIndex);
165 
166  /**
167  * Compute an Idx type signature for a Set. The value is computed by
168  * summing up the product of every index with an integer starting at
169  * 1 (for the first index) and ending at Size() (for the last index).
170  *
171  * @return
172  * Idx type set signature
173  */
174  Idx Signature(void) const;
175 
176  /**
177  * Return pretty printable index.
178  *
179  * @param rIndex
180  * Index to print
181  *
182  * @return
183  * String
184  */
185  std::string Str(const Idx& rIndex) const {return ToStringInteger(rIndex); };
186 
187  protected:
188 
189  /**
190  * Assign my members. This method maintains attributes
191  * provided that the type can be appropriately casted.
192  *
193  * @param rSource
194  * Source to copy from
195  * @return
196  * Ref to this set
197  */
198  void DoAssign(const IndexSet& rSource);
199 
200  /**
201  * Write to TokenWriter, see Type::Write for public wrappers.
202  * Appends the IndexSet to
203  * TokenWriter. This will write a section with label as specified that holds
204  * integer tokens to represent the IndexSet. For non-default attribute values,
205  * the respective index is followed by the attribute value. The latter may
206  * consist of sections (or tokens different from integer or string) to allow
207  * for transparent reading; see AttributeVoid and AttributeFlags. Example for
208  * a set with name "MySet" consisting of indices 17, 25, 40, where index 25 has a
209  * nontrivial attribute attached:
210  * \code
211  * <Myset>
212  * 17
213  * 25 <AValue> "Some Value" </AValue>
214  * 40
215  * </MySet>
216  * \endcode
217  *
218  * @param tw
219  * Reference to TokenWriter
220  * @param rLabel
221  * Label of section to write, defaults to name of set or "IndexSet"
222  * @param pContext
223  * Write context to provide contextual information
224  *
225  * @exception Exception
226  * - IO errors (id 2)
227  */
228  virtual void DoWrite(TokenWriter& tw, const std::string& rLabel="", const Type* pContext=0) const;
229 
230  /**
231  * Write to TokenWriter, see Type::Write for public wrappers. Appends the IndexSet to
232  * TokenWriter using XML format.
233  *
234  * @param tw
235  * Reference to TokenWriter
236  * @param rLabel
237  * Label of section to write, defaults to name of set or "IndexSet"
238  * @param pContext
239  * Write context to provide contextual information
240  *
241  * @exception Exception
242  * - IO errors (id 2)
243  */
244  virtual void DoXWrite(TokenWriter& tw, const std::string& rLabel="", const Type* pContext=0) const;
245 
246  /**
247  * Read from TokenReader, see Type::Read for public wrappers.
248  * This method invokes TokenReader::ReadBegin() to seek the specified
249  * section, reads subsequent integer tokens as indexes, and calls matching TokenReader::ReadEnd().
250  * If no section is specified, the section is assumed to start at the current position
251  * of the token stream. If the current position is no begin token,
252  * the section "IndexSet" is read.
253  * When used by a derived class with attributes, attributes are read, too.
254  *
255  * @param rTr
256  * Reference to tokenreader
257  * @param rLabel
258  * Section to read, defaults to current begin label or else "IndexSet"
259  * @param pContext
260  * Read context to provide contextual information
261  *
262  * @exception Exception
263  * - IO errors (id 1)
264  * - token mismatch (id 50, 51, 52)
265  */
266  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
267 
268 };
269 
270 /* convenience typedef for stateset */
272 
273 
274 /**
275  * Convenience typedef for vectors og generators
276  * \ingroup GeneratorClasses
277  */
279 
280 
281 /**
282  * Set of indices with attributes. A TaIndexSet<Attr> is a template derived from IndexSet,
283  * such that each set element has an Attribute of class Attr.
284  * The template parameter Attr must provide basic functions for file IO and must define a default
285  * value, see AttributeVoid and AttributeFlags for an examples.
286  * Attributes are maintained by an STL map to associate indices
287  * with attributes different from the default value. Thus, attributes with default value
288  * do not take up any memeory.
289  *
290  * @param mAttributeMap
291  * STL map of type std::map<Idx,Attr> to hold attributes
292  *
293  * The copy constructor copies attributes; the methods InsertSet(), EraseSet() and
294  * RestrictSet() maintain attributes; all other set operations derived from IndexSet
295  * either return a IndexSet (no attributes) or set all attributes to the dafault value.
296  * To set or get an attribute of an index that does not exist in the set is considered
297  * as an error and triggers an exception (id 60) when the macro FAUDES_CHECKED is defined.
298  *
299  * The format for token IO is demonstrated by the following example
300  * of a set with name "MySet" consisting of indices 17, 25, 40, where index 25 has a
301  * nontrivial attribute attached:
302  * \code
303  * <Myset>
304  * 17
305  * 25 <AValue> "Some Value" </AValue>
306  * 40
307  * </MySet>
308  * \endcode
309  * Note that attributes may be either subsections or tokens of type different from integer and string.
310  * This is to allow reading a token stream to a class with incompatible (or no) attributes.
311  */
312 
313 
314 
315 template<class Attr>
316 class FAUDES_API TaIndexSet : public IndexSet, public TAttrMap<Idx,Attr> {
317 
319 
320 public:
321 
322  /**
323  * We implement "protected privacy for template classes" by friendship.
324  * This is used for the pragmatic implemention conversion constructors.
325  */
326  friend class IndexSet;
327 
328 
329  /**
330  * Constructor.
331  */
332  TaIndexSet(void);
333 
334  /**
335  * Copy-constructor (from TaIndexSet, incl attributes)
336  */
337  TaIndexSet(const TaIndexSet& rOtherSet);
338 
339  /**
340  * Copy-constructor (from IndexSet, sets attributes to default)
341  */
342  TaIndexSet(const IndexSet& rOtherSet);
343 
344  /**
345  * Construct from file.
346  * This constructor uses the Read(TokenReader&, const std::string&) function to read.
347  *
348  * @param rFilename
349  * Name of file
350  * @param rLabel
351  * Section for the set in file
352  *
353  * @exception Exception
354  * - IO errors (id 1)
355  * - token mismatch (id 50, 51, 52)
356  */
357  TaIndexSet(const std::string& rFilename, const std::string& rLabel = "");
358 
359  /**
360  * Virtual destructor
361  */
362  virtual ~TaIndexSet(void) {};
363 
364  /** Relaxed assignment method. Maintain attributes provided they can be casted.
365  *
366  * @param rSrc
367  * Source from which to assign
368  * @return
369  * Ref to this set
370  */
371  virtual TaIndexSet& Assign(const TBaseSet<Idx>& rSrc);
372 
373  /** Relaxed assignment operator. Maintain attributes provided they can be casted.
374  *
375  * @param rSrc
376  * Source from which to assign
377  * @return
378  * Ref to this set
379  */
380  virtual TaIndexSet& operator=(const IndexSet& rSrc) { return Assign(rSrc); };
381 
382  /**
383  * Iterators on indexset.
384  */
385  using IndexSet::Iterator;
386 
387  /**
388  * Insert new index to set using default attribute.
389  *
390  * @return
391  * New index
392  */
393  Idx Insert(void);
394 
395  /**
396  * Insert new index with attribute.
397  * If the index allready exists, the
398  * attribute is overwritten by rAttr.
399  *
400  * @param rAttr
401  * Specify attribute of new element
402  * @return
403  * new index
404  */
405  Idx Insert(const Attr& rAttr);
406 
407  /**
408  * Insert element. If the element exists, the attribute is maintained.
409  * If the element does not exist, it is inserted with default attribute.
410  *
411  * @param rIndex
412  * Index to specify element
413  * @return
414  * True if element was new to set
415  */
416  bool Insert(const Idx& rIndex);
417 
418  /**
419  * Insert element with attribute.
420  *
421  * @param rIndex
422  * Index to specify element
423  * @param attr
424  * Specify attribute of (new) element
425  * @return
426  * True if element was new to set
427  */
428  bool Insert(const Idx& rIndex, const Attr& attr);
429 
430  /**
431  * Inserts elements of rOtherSet.
432  *
433  * Attributes of this set are maintained, newly inserted elements attain the
434  * attribute from rOtherSet if it can be casted appropriately.
435  *
436  *
437  * @param rOtherSet
438  * Other IndexSet
439  */
440  virtual void InsertSet(const IndexSet& rOtherSet);
441 
442  /**
443  * Inserts elements of rOtherSet.
444  *
445  * This variant uses a runtime cast to access attributes.
446  *
447  * @param rOtherSet
448  * Other IndexSet
449  * @exception Exception
450  * - cast failed (id 67)
451  */
452  virtual void InsertSet(const TBaseSet<Idx>& rOtherSet);
453 
454 
455  /**
456  * Erase Element (incl its attribute)
457  *
458  * @param rIndex
459  * Index to specify element
460  * @return
461  * True if element used to exist
462  */
463  bool Erase(const Idx& rIndex);
464 
465 
466  /**
467  * Erase element by iterator (incl attribute)
468  *
469  * @param pos
470  * Iterator to specify element
471  * @return
472  * Iterator to next element or End()
473  */
474  IndexSet::Iterator Erase(const Iterator& pos);
475 
476 
477  /**
478  * Erase elements given by other set.
479  *
480  * This function ignores the attributes of the other set
481  * and maintains the attributes of the remaining elements in this set.
482  *
483  * @param rOtherSet
484  * Elements to erase
485  */
486  void EraseSet(const IndexSet& rOtherSet);
487 
488  /**
489  * Erase elements given by other set.
490  *
491  * This variant uses a runtime cast to access attributes.
492  *
493  * @param rOtherSet
494  * Other IndexSet
495  * @exception Exception
496  * - cast failed (id 67)
497  */
498  virtual void EraseSet(const TBaseSet<Idx>& rOtherSet);
499 
500  /**
501  * Restrict to specified subset.
502  *
503  * Erases any elements no in the specified set. This function
504  * ignores the attributes of the other set and maintains the attributes
505  * of the remaining elements in this set.
506  *
507  * @param rOtherSet
508  * Elements to erase
509  */
510  void RestrictSet(const IndexSet& rOtherSet);
511 
512  /**
513  * Restrict to specified subset.
514  *
515  * This variant uses a runtime cast to access attributes.
516  *
517  * @param rOtherSet
518  * Other IndexSet
519  * @exception Exception
520  * - cast failed (id 67)
521  */
522  virtual void RestrictSet(const TBaseSet<Idx>& rOtherSet);
523 
524 
525  /** resolve ambiguities from attribute interface ("using" wont do the job)*/
526  const Attr* AttributeType(void) const { return TAttrMap<Idx,Attr>::AttributeType(); };
527  Attr* Attributep(const Idx& rElem) { return TAttrMap<Idx,Attr>::Attributep(rElem); };
528  const Attr& Attribute(const Idx& rElem) const { return TAttrMap<Idx,Attr>::Attribute(rElem); };
529  void Attribute(const Idx& rElem, const Attr& rAttr) { return TAttrMap<Idx,Attr>::Attribute(rElem,rAttr); };
530  void Attribute(const Idx& rElem, const Type& rAttr) { return TAttrMap<Idx,Attr>::Attribute(rElem,rAttr); };
531  void AttributeTry(const Idx& rElem, const Type& rAttr) { return TAttrMap<Idx,Attr>::AttributeTry(rElem,rAttr); };
532 
533 
534  protected:
535 
536  /**
537  * Assign my members. This method maintains attributes.
538  *
539  * @param rSource
540  * Source to copy from
541  * @return
542  * Ref to this set
543  */
544  void DoAssign(const TaIndexSet& rSource);
545 
546 
547 };
548 
549 /** Convenience Macro */
550 //template<class Attr> typedef TaStateSet<class Attr> TaIndexSet<class Attr>
551 #define TaStateSet TaIndexSet
552 
553 
554 
555 
556 /** @} doxygen group */
557 
558 
559 /*
560 *************************************************************************************
561 *************************************************************************************
562  Implementation
563 *************************************************************************************
564 *************************************************************************************
565 */
566 
567 
568 // std faudes type
569 FAUDES_TYPE_TIMPLEMENTATION(Void,TaIndexSet<Attr>,IndexSet,template<class Attr>)
570 
571 
572 // TaIndexSet()
573 template<class Attr>
575  IndexSet(),
576  TAttrMap<Idx,Attr>(this)
577 {
578  FD_DC("TaIndexSet(" << this << ")::TaIndexSet()");
579 }
580 
581 // TaIndexSet(rOtherSet)
582 template<class Attr>
584  IndexSet(),
585  TAttrMap<Idx,Attr>(this)
586 {
587  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(rOtherSet " << &rOtherSet << ")");
588  // copy my members
589  DoAssign(rOtherSet);
590 }
591 
592 // TaIndexSet(rOtherSet)
593 template<class Attr>
595  IndexSet(),
596  TAttrMap<Idx,Attr>(this)
597 {
598  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(rOtherSet " << &rOtherSet << ")");
599  // copy my members
600  Assign(rOtherSet);
601 }
602 
603 
604 // File constructor
605 template<class Attr>
606  TaIndexSet<Attr>::TaIndexSet(const std::string& rFilename, const std::string& rLabel) :
607  IndexSet(),
608  TAttrMap<Idx,Attr>(this)
609 {
610  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(" << rFilename << ")");
611  Read(rFilename, rLabel);
612 }
613 
614 
615 // DoAssign (attributes known and match)
616 template<class Attr>
618  FD_DC("TaIndexSet(" << this << ")::DoAssign( [a] " << &rSourceSet<<")");
619  // call base incl attributes
620  IndexSet::DoAssign(rSourceSet);
621 }
622 
623 // Relaxed Assign()
624 template<class Attr>
626  FD_DC("TaIndexSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
627  FD_DC("TaIndexSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
628  FD_DC("TaIndexSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
629 #ifdef FAUDES_CHECKED
630  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rSourceSet);
631  if(!iset) {
632  std::stringstream errstr;
633  errstr << "cannot cast to indexset" << std::endl;
634  throw Exception("TaIndexSet::InsertSet", errstr.str(), 67);
635  }
636 #endif
637  // call attribute smart base
639  // done
640  return *this;
641 }
642 
643 
644 
645 // Insert()
646 template<class Attr>
648  FD_DC("TaIndexSet(" << this << ")::Insert()");
649  Idx index=MaxIndex()+1;
651  return index;
652 }
653 
654 //Insert(idx)
655 template<class Attr>
656 bool TaIndexSet<Attr>::Insert(const Idx& rIndex) {
657  FD_DC("TaIndexSet(" << this << ")::Insert("<< rIndex <<")");
658  return TAttrMap<Idx,Attr>::Insert(rIndex);
659 }
660 
661 // Insert(attr)
662 template<class Attr>
663 Idx TaIndexSet<Attr>::Insert(const Attr& attr) {
664  FD_DC("TaIndexSet(" << this << ")::Insert(" << attr.ToString() << ")");
665  Idx index = Insert();
666  if(!attr.IsDefault()) {
667  TAttrMap<Idx,Attr>::Attribute(index,attr);
668  }
669  return index;
670 }
671 
672 //Insert(idx,attr)
673 template<class Attr>
674 bool TaIndexSet<Attr>::Insert(const Idx& rIndex, const Attr& attr) {
675  FD_DC("TaIndexSet(" << this << ")::Insert("<< rIndex <<",attr)");
676  return TAttrMap<Idx,Attr>::Insert(rIndex,attr);
677 }
678 
679 
680 // InsertSet(set)
681 template<class Attr>
682 void TaIndexSet<Attr>::InsertSet(const IndexSet& rOtherSet) {
683  FD_DC("TaIndexSet(" << this << ")::InsertSet(" << &rOtherSet << ")");
685 }
686 
687 //InsertSet(set)
688 template<class Attr>
690 #ifdef FAUDES_CHECKED
691  FD_DC("TaIndexSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
692  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
693  if(!iset) {
694  std::stringstream errstr;
695  errstr << "cannot cast to indexset" << std::endl;
696  throw Exception("TaIndexSet::InsertSet", errstr.str(), 67);
697  }
698 #endif
700 }
701 
702 //Erase(idx)
703 template<class Attr>
704 bool TaIndexSet<Attr>::Erase(const Idx& rIndex) {
705  return TAttrMap<Idx,Attr>::Erase(rIndex);
706 }
707 
708 //Erase(pos)
709 template<class Attr>
710 typename IndexSet::Iterator TaIndexSet<Attr>::Erase(const Iterator& pos) {
711  return TAttrMap<Idx,Attr>::Erase(pos);
712 }
713 
714 
715 //EraseSet(set)
716 template<class Attr>
717 void TaIndexSet<Attr>::EraseSet(const IndexSet& rOtherSet) {
718  FD_DC("TaIndexSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
719  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
720 }
721 
722 //EraseSet(set)
723 template<class Attr>
725 #ifdef FAUDES_CHECKED
726  FD_DC("TaIndexSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
727  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
728  if(!iset) {
729  std::stringstream errstr;
730  errstr << "cannot cast to indexset" << std::endl;
731  throw Exception("TaIndexSet::EraseSet", errstr.str(), 67);
732  }
733 #endif
734  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
735 }
736 
737 //RestrictSet(set)
738 template<class Attr>
739 void TaIndexSet<Attr>::RestrictSet(const IndexSet& rOtherSet) {
740  FD_DC("TaIndexSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
741  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
742 }
743 
744 //RestrictSet(set)
745 template<class Attr>
747 #ifdef FAUDES_CHECKED
748  FD_DC("TaIndexSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
749  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
750  if(!iset) {
751  std::stringstream errstr;
752  errstr << "cannot cast to indexset" << std::endl;
753  throw Exception("TaIndexSet::RestrictSet", errstr.str(), 67);
754  }
755 #endif
757 }
758 
759 
760 
761 
762 } // namespace faudes
763 
764 
765 
766 #endif
767 
Class TAttrMap.
Class TBaseVector.
Compiletime options.
#define FD_DC(message)
Debug: optional report on container operations.
Class Exception.
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
Runtime interface, registry for faudes-types and functions.
Class SymbolTable.
#define FAUDES_TYPE_TDECLARATION(ftype, ctype, cbase)
faudes type declaration macro, template version
Definition: cfl_types.h:878
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
#define FAUDES_TYPE_TIMPLEMENTATION(ftype, ctype, cbase, ctemp)
faudes type implementation macros, overall
Definition: cfl_types.h:972
Faudes exception class.
Set of indices.
Definition: cfl_indexset.h:78
virtual ~IndexSet(void)
Virtual destructor.
Definition: cfl_indexset.h:124
void DoAssign(const IndexSet &rSource)
Assign my members.
std::string Str(const Idx &rIndex) const
Return pretty printable index.
Definition: cfl_indexset.h:185
Signature of a Function.
Attribute interface for TBaseSet.
Definition: cfl_attrmap.h:52
const Attr & Attribute(const T &rElem) const
Get attribute by element.
Definition: cfl_attrmap.h:464
Attr * Attributep(const T &rElem)
Get attribute reference by element.
Definition: cfl_attrmap.h:446
void AttributeTry(const T &rElem, const Type &attr)
Set attribute.
Definition: cfl_attrmap.h:499
bool Erase(const T &rElem)
Erase Element (incl its attribute)
Definition: cfl_attrmap.h:369
void EraseSet(const TBaseSet< T, Cmp > &rOtherSet)
Erase elements given by other set.
Definition: cfl_attrmap.h:386
void InsertSet(const TBaseSet< T, Cmp > &rOtherSet)
Inserts elements from rOtherSet.
Definition: cfl_attrmap.h:340
void RestrictSet(const TBaseSet< T, Cmp > &rOtherSet)
Restrict to specified subset.
Definition: cfl_attrmap.h:409
void AssignWithAttributes(const TBaseSet< T, Cmp > &rSourceSet)
Copy from a TBaseSet to the associated TBaseSet, with attributes, provided that they can be casted ac...
Definition: cfl_attrmap.h:292
bool Insert(const T &rElem)
Insert element.
Definition: cfl_attrmap.h:323
const Attr * AttributeType(void) const
Attribute typeinfo.
Definition: cfl_attrmap.h:438
STL style set template.
Definition: cfl_baseset.h:93
Vector template.
Set of indices with attributes.
Definition: cfl_indexset.h:316
bool Erase(const Idx &rIndex)
Erase Element (incl its attribute)
Definition: cfl_indexset.h:704
TaIndexSet(const std::string &rFilename, const std::string &rLabel="")
Construct from file.
Definition: cfl_indexset.h:606
Idx Insert(void)
Insert new index to set using default attribute.
Definition: cfl_indexset.h:647
const Attr * AttributeType(void) const
resolve ambiguities from attribute interface ("using" wont do the job)
Definition: cfl_indexset.h:526
TaIndexSet(const IndexSet &rOtherSet)
Copy-constructor (from IndexSet, sets attributes to default)
Definition: cfl_indexset.h:594
const Attr & Attribute(const Idx &rElem) const
Definition: cfl_indexset.h:528
Attr * Attributep(const Idx &rElem)
Definition: cfl_indexset.h:527
TaIndexSet(void)
Constructor.
Definition: cfl_indexset.h:574
virtual void InsertSet(const IndexSet &rOtherSet)
Inserts elements of rOtherSet.
Definition: cfl_indexset.h:682
virtual TaIndexSet & Assign(const TBaseSet< Idx > &rSrc)
Relaxed assignment method.
Definition: cfl_indexset.h:625
virtual void EraseSet(const TBaseSet< Idx > &rOtherSet)
Erase elements given by other set.
Definition: cfl_indexset.h:724
bool Insert(const Idx &rIndex)
Insert element.
Definition: cfl_indexset.h:656
void Attribute(const Idx &rElem, const Type &rAttr)
Definition: cfl_indexset.h:530
void AttributeTry(const Idx &rElem, const Type &rAttr)
Attribute access.
Definition: cfl_indexset.h:531
void EraseSet(const IndexSet &rOtherSet)
Erase elements given by other set.
Definition: cfl_indexset.h:717
Idx Insert(const Attr &rAttr)
Insert new index with attribute.
Definition: cfl_indexset.h:663
void RestrictSet(const IndexSet &rOtherSet)
Restrict to specified subset.
Definition: cfl_indexset.h:739
void Attribute(const Idx &rElem, const Attr &rAttr)
Definition: cfl_indexset.h:529
virtual void InsertSet(const TBaseSet< Idx > &rOtherSet)
Inserts elements of rOtherSet.
Definition: cfl_indexset.h:689
TaIndexSet(const TaIndexSet &rOtherSet)
Copy-constructor (from TaIndexSet, incl attributes)
Definition: cfl_indexset.h:583
virtual TaIndexSet & operator=(const IndexSet &rSrc)
Relaxed assignment operator.
Definition: cfl_indexset.h:380
void DoAssign(const TaIndexSet &rSource)
Assign my members.
Definition: cfl_indexset.h:617
IndexSet::Iterator Erase(const Iterator &pos)
Erase element by iterator (incl attribute)
Definition: cfl_indexset.h:710
bool Insert(const Idx &rIndex, const Attr &attr)
Insert element with attribute.
Definition: cfl_indexset.h:674
virtual ~TaIndexSet(void)
Virtual destructor.
Definition: cfl_indexset.h:362
virtual void RestrictSet(const TBaseSet< Idx > &rOtherSet)
Restrict to specified subset.
Definition: cfl_indexset.h:746
A TokenReader reads sequential tokens from a file or string.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
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
IndexSet StateSet
Definition: cfl_indexset.h:271
TBaseVector< IndexSet > IndexSetVector
Convenience typedef for vectors og generators.
Definition: cfl_indexset.h:278
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