mtc_colorset.h
Go to the documentation of this file.
1 /** @file mtc_colorset.h
2 
3 Implements color sets for multitasking automata
4 
5 */
6 
7 /* FAU Discrete Event Systems Library (libfaudes)
8 
9  Copyright (C) 2008 Matthias Singer
10  Exclusive copyright is granted to Klaus Schmidt
11 
12  This library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU Lesser General Public
14  License as published by the Free Software Foundation; either
15  version 2.1 of the License, or (at your option) any later version.
16 
17  This library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  Lesser General Public License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public
23  License along with this library; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 
27 #ifndef FAUDES_MTCCOLORSET_H
28 #define FAUDES_MTCCOLORSET_H
29 
30 #include "corefaudes.h"
31 
32 
33 namespace faudes {
34 
35 /**
36  * Container for colors: this is a NameSet with its own static symboltable
37  *
38  * @ingroup MultitaskingPlugin
39  */
40 
41 class FAUDES_API ColorSet : public NameSet {
42 
44 
45  public:
46 
47  /**
48  * Constructor for ColorSet with static ColorSymbolTable.
49  */
50  ColorSet(void) : NameSet() {
51  mpSymbolTable= &msSymbolTable; NameSet::Name("Colors");
52  FD_DC("ColorSet("<<this<<")::ColorSet() with colorsymtab "<< SymbolTablep());
53  };
54 
55  /**
56  * Constructor for ColorSet with specified symbol table.
57  */
58  ColorSet(SymbolTable *pSymTab) : NameSet() {
59  mpSymbolTable= pSymTab; NameSet::Name("Colors");
60  FD_DC("ColorSet("<<this<<")::ColorSet() with colorsymtab "<< SymbolTablep());
61  };
62 
63  /**
64  * Constructor for ColorSet with static ColorSymbolTable.
65  * This version reads a file with given label to find the colors
66  * inside the file.
67  *
68  * @param rFilename
69  * Filename
70  * @param rLabel
71  * Token label for the colors in the file; default value "Colors"
72  */
73  ColorSet(const std::string& rFilename, const std::string& rLabel = "Colors") : NameSet()
74  { mpSymbolTable= &msSymbolTable; NameSet::Read(rFilename,rLabel);};
75 
76  /* Destructor, virtual */
77  virtual ~ColorSet(void) {};
78 
79  /**
80  * Get pointer to static ColorSymbolTable
81  *
82  * @return
83  * Pointer to static ColorSymbolTable
84  */
85  static SymbolTable* StaticSymbolTablep(void);
86 
87  /**
88  * Reset pointer mpSymbolTable
89  *
90  * @param pSymTab
91  * Pointer to new symbol table
92  */
93  void ColorSymbolTablep(SymbolTable *pSymTab);
94 
95  /**
96  * Set intersection operator
97  *
98  * @return
99  * Intersection ColorSet
100  */
101  ColorSet operator * (const ColorSet& rOtherSet) const;
102 
103  /**
104  * Set union operator
105  *
106  * @return
107  * Union Set
108  */
109  ColorSet operator + (const ColorSet& rOtherSet) const;
110 
111  /**
112  * Set difference operator
113  *
114  * @return
115  * Difference ColorSet
116  */
117  ColorSet operator - (const ColorSet& rOtherSet) const;
118 
119  /** Test for subset
120  */
121  bool operator <= (const ColorSet& rOtherSet) const;
122 
123  /** Test for superset
124  */
125  bool operator >= (const ColorSet& rOtherSet) const;
126 
127  protected:
128 
129  /** Static global symbol table for color names */
131 
132  /**
133  * Assign from other color set.
134  *
135  * @param rSourceSet
136  * Destination to copy from
137  * @return
138  * ref to this set
139  */
140  virtual void DoAssign(const ColorSet& rSourceSet);
141 
142 }; // end class ColorSet
143 
144 } // namespace faudes
145 
146 #endif
#define FD_DC(message)
Debug: optional report on container operations.
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
Container for colors: this is a NameSet with its own static symboltable.
Definition: mtc_colorset.h:41
virtual ~ColorSet(void)
Definition: mtc_colorset.h:77
ColorSet(const std::string &rFilename, const std::string &rLabel="Colors")
Constructor for ColorSet with static ColorSymbolTable.
Definition: mtc_colorset.h:73
ColorSet(SymbolTable *pSymTab)
Constructor for ColorSet with specified symbol table.
Definition: mtc_colorset.h:58
ColorSet(void)
Constructor for ColorSet with static ColorSymbolTable.
Definition: mtc_colorset.h:50
static SymbolTable msSymbolTable
Static global symbol table for color names.
Definition: mtc_colorset.h:130
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
A SymbolTable associates sybolic names with indices.
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
Includes all libFAUDES headers, no plugins.
const std::string & Name(void) const
Return name of TBaseSet.
Definition: cfl_baseset.h:1755
libFAUDES resides within the namespace faudes.

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