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  * Copy-onstructor for ColorSet
65  */
66  ColorSet(const ColorSet& rSourceSet) : NameSet() {
67  DoAssign(rSourceSet);
68  FD_DC("ColorSet("<<this<<")::ColorSet(rSourceSetr) with colorsymtab "<< SymbolTablep());
69  };
70 
71  /**
72  * Constructor for ColorSet with static ColorSymbolTable.
73  * This version reads a file with given label to find the colors
74  * inside the file.
75  *
76  * @param rFilename
77  * Filename
78  * @param rLabel
79  * Token label for the colors in the file; default value "Colors"
80  */
81  ColorSet(const std::string& rFilename, const std::string& rLabel = "Colors") : NameSet()
82  { mpSymbolTable= &msSymbolTable; NameSet::Read(rFilename,rLabel);};
83 
84  /* Destructor, virtual */
85  virtual ~ColorSet(void) {};
86 
87  /**
88  * Get pointer to static ColorSymbolTable
89  *
90  * @return
91  * Pointer to static ColorSymbolTable
92  */
93  static SymbolTable* StaticSymbolTablep(void);
94 
95  /**
96  * Reset pointer mpSymbolTable
97  *
98  * @param pSymTab
99  * Pointer to new symbol table
100  */
101  void ColorSymbolTablep(SymbolTable *pSymTab);
102 
103  /**
104  * Set intersection operator
105  *
106  * @return
107  * Intersection ColorSet
108  */
109  ColorSet operator * (const ColorSet& rOtherSet) const;
110 
111  /**
112  * Set union operator
113  *
114  * @return
115  * Union Set
116  */
117  ColorSet operator + (const ColorSet& rOtherSet) const;
118 
119  /**
120  * Set difference operator
121  *
122  * @return
123  * Difference ColorSet
124  */
125  ColorSet operator - (const ColorSet& rOtherSet) const;
126 
127  /** Test for subset
128  */
129  bool operator <= (const ColorSet& rOtherSet) const;
130 
131  /** Test for superset
132  */
133  bool operator >= (const ColorSet& rOtherSet) const;
134 
135  protected:
136 
137  /** Static global symbol table for color names */
139 
140  /**
141  * Assign from other color set.
142  *
143  * @param rSourceSet
144  * Destination to copy from
145  * @return
146  * ref to this set
147  */
148  virtual void DoAssign(const ColorSet& rSourceSet);
149 
150 }; // end class ColorSet
151 
152 } // namespace faudes
153 
154 #endif
#define FD_DC(message)
Debug: optional report on container operations.
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:80
#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:85
ColorSet(const std::string &rFilename, const std::string &rLabel="Colors")
Constructor for ColorSet with static ColorSymbolTable.
Definition: mtc_colorset.h:81
ColorSet(SymbolTable *pSymTab)
Constructor for ColorSet with specified symbol table.
Definition: mtc_colorset.h:58
ColorSet(const ColorSet &rSourceSet)
Copy-onstructor for ColorSet.
Definition: mtc_colorset.h:66
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:138
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:1764
libFAUDES resides within the namespace faudes.

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