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, 2024 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 
80 public:
81 
83 
87 
88  /**
89  * We implement "protected privacy for template classes" by friendship.
90  * This is used for the pragmatic implemention conversion constructors.
91  */
92  template<class Attr> friend class TaIndexSet;
93 
94 
95  /**
96  * Constructor.
97  */
98  IndexSet(void);
99 
100  /**
101  * Copy-constructor.
102  */
103  IndexSet(const IndexSet& rOtherSet);
104 
105  /**
106  * Copy-constructor.
107  */
108  IndexSet(const TBaseSet<Idx>& rOtherSet);
109 
110  /**
111  * Construct from file. Uses the Read(TokenReader&, const std::string&) function to read.
112  * a IndexSet from section rLabel in file rFilename.
113  *
114  * @param rFilename
115  * Name of file to read
116  * @param rLabel
117  * Section to read
118  *
119  * @exception Exception
120  * - IO Errors (id 1)
121  * - Token mismatch (id 50, 51, 52)
122  */
123  IndexSet(const std::string& rFilename, const std::string& rLabel = "");
124 
125  /**
126  * Virtual destructor
127  */
128  virtual ~IndexSet(void) {};
129 
130  /**
131  * Get maximum index used in this set (0 for emptyset)
132  *
133  * @return
134  * max indices
135  */
136  Idx MaxIndex(void) const;
137 
138  /**
139  * Test whether index is not 0
140  * @param rIndex
141  * Index to test
142  * @return
143  * True if idx!=0
144  */
145  bool Valid(const Idx& rIndex) const;
146 
147  /**
148  * Iterators on indexset.
149  */
151 
152  /**
153  * Insert new index to set
154  *
155  * @return
156  * New index
157  */
158  Idx Insert(void);
159 
160  /**
161  * Insert specified index
162  *
163  * @param rIndex
164  * Index to insert
165  * @return
166  * True if index was new to set
167  */
168  bool Insert(const Idx& rIndex);
169 
170  /**
171  * Compute an Idx type signature for a Set. The value is computed by
172  * summing up the product of every index with an integer starting at
173  * 1 (for the first index) and ending at Size() (for the last index).
174  *
175  * @return
176  * Idx type set signature
177  */
178  Idx Signature(void) const;
179 
180  /**
181  * Return pretty printable index.
182  *
183  * @param rIndex
184  * Index to print
185  *
186  * @return
187  * String
188  */
189  std::string Str(const Idx& rIndex) const {return ToStringInteger(rIndex); };
190 
191  protected:
192 
193  /**
194  * Assign my members. This method maintains attributes
195  * provided that the type can be appropriately casted.
196  *
197  * @param rSource
198  * Source to copy from
199  */
200  void DoAssign(const IndexSet& rSource);
201 
202  /**
203  * Write to TokenWriter, see Type::Write for public wrappers.
204  * Appends the IndexSet to
205  * TokenWriter. This will write a section with label as specified that holds
206  * integer tokens to represent the IndexSet. For non-default attribute values,
207  * the respective index is followed by the attribute value. The latter may
208  * consist of sections (or tokens different from integer or string) to allow
209  * for transparent reading; see AttributeVoid and AttributeFlags. Example for
210  * a set with name "MySet" consisting of indices 17, 25, 40, where index 25 has a
211  * nontrivial attribute attached:
212  * \code
213  * <Myset>
214  * 17
215  * 25 <AValue> "Some Value" </AValue>
216  * 40
217  * </MySet>
218  * \endcode
219  *
220  * @param tw
221  * Reference to TokenWriter
222  * @param rLabel
223  * Label of section to write, defaults to name of set or "IndexSet"
224  * @param pContext
225  * Write context to provide contextual information
226  *
227  * @exception Exception
228  * - IO errors (id 2)
229  */
230  virtual void DoWrite(TokenWriter& tw, const std::string& rLabel="", const Type* pContext=0) const;
231 
232  /**
233  * Write to TokenWriter, see Type::Write for public wrappers. Appends the IndexSet to
234  * TokenWriter using XML format.
235  *
236  * @param tw
237  * Reference to TokenWriter
238  * @param rLabel
239  * Label of section to write, defaults to name of set or "IndexSet"
240  * @param pContext
241  * Write context to provide contextual information
242  *
243  * @exception Exception
244  * - IO errors (id 2)
245  */
246  virtual void DoXWrite(TokenWriter& tw, const std::string& rLabel="", const Type* pContext=0) const;
247 
248  /**
249  * Read from TokenReader, see Type::Read for public wrappers.
250  * This method invokes TokenReader::ReadBegin() to seek the specified
251  * section, reads subsequent integer tokens as indexes, and calls matching TokenReader::ReadEnd().
252  * If no section is specified, the section is assumed to start at the current position
253  * of the token stream. If the current position is no begin token,
254  * the section "IndexSet" is read.
255  * When used by a derived class with attributes, attributes are read, too.
256  *
257  * @param rTr
258  * Reference to tokenreader
259  * @param rLabel
260  * Section to read, defaults to current begin label or else "IndexSet"
261  * @param pContext
262  * Read context to provide contextual information
263  *
264  * @exception Exception
265  * - IO errors (id 1)
266  * - token mismatch (id 50, 51, 52)
267  */
268  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
269 
270 };
271 
272 /* convenience typedef for stateset */
274 
275 
276 /**
277  * Convenience typedef for vectors og generators
278  * \ingroup GeneratorClasses
279  */
281 
282 
283 /**
284  * Set of indices with attributes. A TaIndexSet<Attr> is a template derived from IndexSet,
285  * such that each set element has an Attribute of class Attr.
286  * The template parameter Attr must provide basic functions for file IO and must define a default
287  * value, see AttributeVoid and AttributeFlags for an examples.
288  * Attributes are maintained by an STL map to associate indices
289  * with attributes different from the default value. Thus, attributes with default value
290  * do not take up any memeory.
291  *
292  * @param mAttributeMap
293  * STL map of type std::map<Idx,Attr> to hold attributes
294  *
295  * The copy constructor copies attributes; the methods InsertSet(), EraseSet() and
296  * RestrictSet() maintain attributes; all other set operations derived from IndexSet
297  * either return a IndexSet (no attributes) or set all attributes to the dafault value.
298  * To set or get an attribute of an index that does not exist in the set is considered
299  * as an error and triggers an exception (id 60) when the macro FAUDES_CHECKED is defined.
300  *
301  * The format for token IO is demonstrated by the following example
302  * of a set with name "MySet" consisting of indices 17, 25, 40, where index 25 has a
303  * nontrivial attribute attached:
304  * \code
305  * <Myset>
306  * 17
307  * 25 <AValue> "Some Value" </AValue>
308  * 40
309  * </MySet>
310  * \endcode
311  * Note that attributes may be either subsections or tokens of type different from integer and string.
312  * This is to allow reading a token stream to a class with incompatible (or no) attributes.
313  */
314 
315 
316 
317 template<class Attr>
318 class FAUDES_TAPI TaIndexSet : public IndexSet, public TAttrMap<Idx,Attr> {
319 
320 public:
321 
323 
324  using IndexSet::operator=;
325  using IndexSet::operator==;
326  using IndexSet::operator!=;
327 
328 
329  /**
330  * We implement "protected privacy for template classes" by friendship.
331  * This is used for the pragmatic implemention conversion constructors.
332  */
333  friend class IndexSet;
334 
335 
336  /**
337  * Constructor.
338  */
339  TaIndexSet(void);
340 
341  /**
342  * Copy-constructor (from TaIndexSet, incl attributes)
343  */
344  TaIndexSet(const TaIndexSet& rOtherSet);
345 
346  /**
347  * Copy-constructor (from IndexSet, sets attributes to default)
348  */
349  TaIndexSet(const IndexSet& rOtherSet);
350 
351  /**
352  * Construct from file.
353  * This constructor uses the Read(TokenReader&, const std::string&) function to read.
354  *
355  * @param rFilename
356  * Name of file
357  * @param rLabel
358  * Section for the set in file
359  *
360  * @exception Exception
361  * - IO errors (id 1)
362  * - token mismatch (id 50, 51, 52)
363  */
364  TaIndexSet(const std::string& rFilename, const std::string& rLabel = "");
365 
366  /**
367  * Virtual destructor
368  */
369  virtual ~TaIndexSet(void) {};
370 
371  /** Relaxed assignment method. Maintain attributes provided they can be casted.
372  *
373  * @param rSrc
374  * Source from which to assign
375  * @return
376  * Ref to this set
377  */
378  virtual TaIndexSet& Assign(const TBaseSet<Idx>& rSrc);
379 
380  /** Relaxed assignment operator. Maintain attributes provided they can be casted.
381  *
382  * @param rSrc
383  * Source from which to assign
384  * @return
385  * Ref to this set
386  */
387  virtual TaIndexSet& operator=(const IndexSet& rSrc) { return Assign(rSrc); };
388 
389  /**
390  * Iterators on indexset.
391  */
392  using IndexSet::Iterator;
393 
394  /**
395  * Insert new index to set using default attribute.
396  *
397  * @return
398  * New index
399  */
400  Idx Insert(void);
401 
402  /**
403  * Insert new index with attribute.
404  * If the index allready exists, the
405  * attribute is overwritten by rAttr.
406  *
407  * @param rAttr
408  * Specify attribute of new element
409  * @return
410  * new index
411  */
412  Idx Insert(const Attr& rAttr);
413 
414  /**
415  * Insert element. If the element exists, the attribute is maintained.
416  * If the element does not exist, it is inserted with default attribute.
417  *
418  * @param rIndex
419  * Index to specify element
420  * @return
421  * True if element was new to set
422  */
423  bool Insert(const Idx& rIndex);
424 
425  /**
426  * Insert element with attribute.
427  *
428  * @param rIndex
429  * Index to specify element
430  * @param attr
431  * Specify attribute of (new) element
432  * @return
433  * True if element was new to set
434  */
435  bool Insert(const Idx& rIndex, const Attr& attr);
436 
437  /**
438  * Inserts elements of rOtherSet.
439  *
440  * Attributes of this set are maintained, newly inserted elements attain the
441  * attribute from rOtherSet if it can be casted appropriately.
442  *
443  *
444  * @param rOtherSet
445  * Other IndexSet
446  */
447  virtual void InsertSet(const IndexSet& rOtherSet);
448 
449  /**
450  * Inserts elements of rOtherSet.
451  *
452  * This variant uses a runtime cast to access attributes.
453  *
454  * @param rOtherSet
455  * Other IndexSet
456  * @exception Exception
457  * - cast failed (id 67)
458  */
459  virtual void InsertSet(const TBaseSet<Idx>& rOtherSet);
460 
461 
462  /**
463  * Erase Element (incl its attribute)
464  *
465  * @param rIndex
466  * Index to specify element
467  * @return
468  * True if element used to exist
469  */
470  bool Erase(const Idx& rIndex);
471 
472 
473  /**
474  * Erase element by iterator (incl attribute)
475  *
476  * @param pos
477  * Iterator to specify element
478  * @return
479  * Iterator to next element or End()
480  */
481  IndexSet::Iterator Erase(const Iterator& pos);
482 
483 
484  /**
485  * Erase elements given by other set.
486  *
487  * This function ignores the attributes of the other set
488  * and maintains the attributes of the remaining elements in this set.
489  *
490  * @param rOtherSet
491  * Elements to erase
492  */
493  void EraseSet(const IndexSet& rOtherSet);
494 
495  /**
496  * Erase elements given by other set.
497  *
498  * This variant uses a runtime cast to access attributes.
499  *
500  * @param rOtherSet
501  * Other IndexSet
502  * @exception Exception
503  * - cast failed (id 67)
504  */
505  virtual void EraseSet(const TBaseSet<Idx>& rOtherSet);
506 
507  /**
508  * Restrict to specified subset.
509  *
510  * Erases any elements no in the specified set. This function
511  * ignores the attributes of the other set and maintains the attributes
512  * of the remaining elements in this set.
513  *
514  * @param rOtherSet
515  * Elements to erase
516  */
517  void RestrictSet(const IndexSet& rOtherSet);
518 
519  /**
520  * Restrict to specified subset.
521  *
522  * This variant uses a runtime cast to access attributes.
523  *
524  * @param rOtherSet
525  * Other IndexSet
526  * @exception Exception
527  * - cast failed (id 67)
528  */
529  virtual void RestrictSet(const TBaseSet<Idx>& rOtherSet);
530 
531 
532  /** resolve ambiguities from attribute interface ("using" wont do the job)*/
533  const Attr* AttributeType(void) const { return TAttrMap<Idx,Attr>::AttributeType(); };
534  Attr* Attributep(const Idx& rElem) { return TAttrMap<Idx,Attr>::Attributep(rElem); };
535  const Attr& Attribute(const Idx& rElem) const { return TAttrMap<Idx,Attr>::Attribute(rElem); };
536  void Attribute(const Idx& rElem, const Attr& rAttr) { return TAttrMap<Idx,Attr>::Attribute(rElem,rAttr); };
537  void Attribute(const Idx& rElem, const Type& rAttr) { return TAttrMap<Idx,Attr>::Attribute(rElem,rAttr); };
538  void AttributeTry(const Idx& rElem, const Type& rAttr) { return TAttrMap<Idx,Attr>::AttributeTry(rElem,rAttr); };
539 
540 
541  protected:
542 
543  /**
544  * Assign my members. This method maintains attributes.
545  *
546  * @param rSource
547  * Source to copy from
548  */
549  void DoAssign(const TaIndexSet& rSource);
550 
551 
552 };
553 
554 /** Convenience Macro (pre C++11) */
555 //#define TaStateSet TaIndexSet //
556 /** Convenience Typedef (C++11) */
557 template <class Attr> using TaStateSet = TaIndexSet<Attr>;
558 
559 
560 /** @} doxygen group */
561 
562 
563 /*
564 *************************************************************************************
565 *************************************************************************************
566  Implementation
567 *************************************************************************************
568 *************************************************************************************
569 */
570 
571 
572 // std faudes type
573 FAUDES_TYPE_TIMPLEMENTATION(Void,TaIndexSet<Attr>,IndexSet,template<class Attr>)
574 
575 
576 // TaIndexSet()
577 template<class Attr>
579  IndexSet(),
580  TAttrMap<Idx,Attr>(this)
581 {
582  FD_DC("TaIndexSet(" << this << ")::TaIndexSet()");
583 }
584 
585 // TaIndexSet(rOtherSet)
586 template<class Attr>
588  IndexSet(),
589  TAttrMap<Idx,Attr>(this)
590 {
591  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(rOtherSet " << &rOtherSet << ")");
592  // copy my members
593  DoAssign(rOtherSet);
594 }
595 
596 // TaIndexSet(rOtherSet)
597 template<class Attr>
599  IndexSet(),
600  TAttrMap<Idx,Attr>(this)
601 {
602  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(rOtherSet " << &rOtherSet << ")");
603  // copy my members
604  Assign(rOtherSet);
605 }
606 
607 
608 // File constructor
609 template<class Attr>
610  TaIndexSet<Attr>::TaIndexSet(const std::string& rFilename, const std::string& rLabel) :
611  IndexSet(),
612  TAttrMap<Idx,Attr>(this)
613 {
614  FD_DC("TaIndexSet(" << this << ")::TaIndexSet(" << rFilename << ")");
615  Read(rFilename, rLabel);
616 }
617 
618 
619 // DoAssign (attributes known and match)
620 template<class Attr>
622  FD_DC("TaIndexSet(" << this << ")::DoAssign( [a] " << &rSourceSet<<")");
623  // call base incl attributes
624  IndexSet::DoAssign(rSourceSet);
625 }
626 
627 // Relaxed Assign()
628 template<class Attr>
630  FD_DC("TaIndexSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
631  FD_DC("TaIndexSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
632  FD_DC("TaIndexSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
633 #ifdef FAUDES_CHECKED
634  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rSourceSet);
635  if(!iset) {
636  std::stringstream errstr;
637  errstr << "cannot cast to indexset" << std::endl;
638  throw Exception("TaIndexSet::InsertSet", errstr.str(), 67);
639  }
640 #endif
641  // call attribute smart base
643  // done
644  return *this;
645 }
646 
647 
648 
649 // Insert()
650 template<class Attr>
652  FD_DC("TaIndexSet(" << this << ")::Insert()");
653  Idx index=MaxIndex()+1;
655  return index;
656 }
657 
658 //Insert(idx)
659 template<class Attr>
660 bool TaIndexSet<Attr>::Insert(const Idx& rIndex) {
661  FD_DC("TaIndexSet(" << this << ")::Insert("<< rIndex <<")");
662  return TAttrMap<Idx,Attr>::Insert(rIndex);
663 }
664 
665 // Insert(attr)
666 template<class Attr>
667 Idx TaIndexSet<Attr>::Insert(const Attr& attr) {
668  FD_DC("TaIndexSet(" << this << ")::Insert(" << attr.ToString() << ")");
669  Idx index = Insert();
670  if(!attr.IsDefault()) {
671  TAttrMap<Idx,Attr>::Attribute(index,attr);
672  }
673  return index;
674 }
675 
676 //Insert(idx,attr)
677 template<class Attr>
678 bool TaIndexSet<Attr>::Insert(const Idx& rIndex, const Attr& attr) {
679  FD_DC("TaIndexSet(" << this << ")::Insert("<< rIndex <<",attr)");
680  return TAttrMap<Idx,Attr>::Insert(rIndex,attr);
681 }
682 
683 
684 // InsertSet(set)
685 template<class Attr>
686 void TaIndexSet<Attr>::InsertSet(const IndexSet& rOtherSet) {
687  FD_DC("TaIndexSet(" << this << ")::InsertSet(" << &rOtherSet << ")");
689 }
690 
691 //InsertSet(set)
692 template<class Attr>
694 #ifdef FAUDES_CHECKED
695  FD_DC("TaIndexSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
696  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
697  if(!iset) {
698  std::stringstream errstr;
699  errstr << "cannot cast to indexset" << std::endl;
700  throw Exception("TaIndexSet::InsertSet", errstr.str(), 67);
701  }
702 #endif
704 }
705 
706 //Erase(idx)
707 template<class Attr>
708 bool TaIndexSet<Attr>::Erase(const Idx& rIndex) {
709  return TAttrMap<Idx,Attr>::Erase(rIndex);
710 }
711 
712 //Erase(pos)
713 template<class Attr>
714 typename IndexSet::Iterator TaIndexSet<Attr>::Erase(const Iterator& pos) {
715  return TAttrMap<Idx,Attr>::Erase(pos);
716 }
717 
718 
719 //EraseSet(set)
720 template<class Attr>
721 void TaIndexSet<Attr>::EraseSet(const IndexSet& rOtherSet) {
722  FD_DC("TaIndexSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
723  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
724 }
725 
726 //EraseSet(set)
727 template<class Attr>
729 #ifdef FAUDES_CHECKED
730  FD_DC("TaIndexSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
731  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
732  if(!iset) {
733  std::stringstream errstr;
734  errstr << "cannot cast to indexset" << std::endl;
735  throw Exception("TaIndexSet::EraseSet", errstr.str(), 67);
736  }
737 #endif
738  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
739 }
740 
741 //RestrictSet(set)
742 template<class Attr>
743 void TaIndexSet<Attr>::RestrictSet(const IndexSet& rOtherSet) {
744  FD_DC("TaIndexSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
745  TAttrMap<Idx,Attr>::EraseSet(rOtherSet);
746 }
747 
748 //RestrictSet(set)
749 template<class Attr>
751 #ifdef FAUDES_CHECKED
752  FD_DC("TaIndexSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
753  const IndexSet* iset = dynamic_cast<const IndexSet*>(&rOtherSet);
754  if(!iset) {
755  std::stringstream errstr;
756  errstr << "cannot cast to indexset" << std::endl;
757  throw Exception("TaIndexSet::RestrictSet", errstr.str(), 67);
758  }
759 #endif
761 }
762 
763 
764 
765 
766 } // namespace faudes
767 
768 
769 
770 #endif
771 
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:80
#define FAUDES_TAPI
Definition: cfl_platform.h:83
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:128
void DoAssign(const IndexSet &rSource)
Assign my members.
std::string Str(const Idx &rIndex) const
Return pretty printable index.
Definition: cfl_indexset.h:189
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:98
Vector template.
Set of indices with attributes.
Definition: cfl_indexset.h:318
bool Erase(const Idx &rIndex)
Erase Element (incl its attribute)
Definition: cfl_indexset.h:708
TaIndexSet(const std::string &rFilename, const std::string &rLabel="")
Construct from file.
Definition: cfl_indexset.h:610
Idx Insert(void)
Insert new index to set using default attribute.
Definition: cfl_indexset.h:651
const Attr * AttributeType(void) const
resolve ambiguities from attribute interface ("using" wont do the job)
Definition: cfl_indexset.h:533
TaIndexSet(const IndexSet &rOtherSet)
Copy-constructor (from IndexSet, sets attributes to default)
Definition: cfl_indexset.h:598
const Attr & Attribute(const Idx &rElem) const
Definition: cfl_indexset.h:535
Attr * Attributep(const Idx &rElem)
Definition: cfl_indexset.h:534
TaIndexSet(void)
Constructor.
Definition: cfl_indexset.h:578
virtual void InsertSet(const IndexSet &rOtherSet)
Inserts elements of rOtherSet.
Definition: cfl_indexset.h:686
virtual TaIndexSet & Assign(const TBaseSet< Idx > &rSrc)
Relaxed assignment method.
Definition: cfl_indexset.h:629
virtual void EraseSet(const TBaseSet< Idx > &rOtherSet)
Erase elements given by other set.
Definition: cfl_indexset.h:728
bool Insert(const Idx &rIndex)
Insert element.
Definition: cfl_indexset.h:660
void Attribute(const Idx &rElem, const Type &rAttr)
Definition: cfl_indexset.h:537
void AttributeTry(const Idx &rElem, const Type &rAttr)
Attribute access.
Definition: cfl_indexset.h:538
void EraseSet(const IndexSet &rOtherSet)
Erase elements given by other set.
Definition: cfl_indexset.h:721
Idx Insert(const Attr &rAttr)
Insert new index with attribute.
Definition: cfl_indexset.h:667
void RestrictSet(const IndexSet &rOtherSet)
Restrict to specified subset.
Definition: cfl_indexset.h:743
void Attribute(const Idx &rElem, const Attr &rAttr)
Definition: cfl_indexset.h:536
virtual void InsertSet(const TBaseSet< Idx > &rOtherSet)
Inserts elements of rOtherSet.
Definition: cfl_indexset.h:693
TaIndexSet(const TaIndexSet &rOtherSet)
Copy-constructor (from TaIndexSet, incl attributes)
Definition: cfl_indexset.h:587
virtual TaIndexSet & operator=(const IndexSet &rSrc)
Relaxed assignment operator.
Definition: cfl_indexset.h:387
void DoAssign(const TaIndexSet &rSource)
Assign my members.
Definition: cfl_indexset.h:621
IndexSet::Iterator Erase(const Iterator &pos)
Erase element by iterator (incl attribute)
Definition: cfl_indexset.h:714
bool Insert(const Idx &rIndex, const Attr &attr)
Insert element with attribute.
Definition: cfl_indexset.h:678
virtual ~TaIndexSet(void)
Virtual destructor.
Definition: cfl_indexset.h:369
virtual void RestrictSet(const TBaseSet< Idx > &rOtherSet)
Restrict to specified subset.
Definition: cfl_indexset.h:750
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:273
TBaseVector< IndexSet > IndexSetVector
Convenience typedef for vectors og generators.
Definition: cfl_indexset.h:280
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_utils.cpp:43

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen