mtc_colorset.hGo to the documentation of this file.00001 /** @file mtc_colorset.h 00002 00003 Implements color sets for multitasking automata 00004 00005 */ 00006 00007 /* FAU Discrete Event Systems Library (libfaudes) 00008 00009 Copyright (C) 2008 Matthias Singer 00010 Exclusive copyright is granted to Klaus Schmidt 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00025 00026 00027 #ifndef FAUDES_MTCCOLORSET_H 00028 #define FAUDES_MTCCOLORSET_H 00029 00030 #include "corefaudes.h" 00031 00032 00033 namespace faudes { 00034 00035 /** 00036 * Container for colors: this is a NameSet with its own static symboltable 00037 * 00038 * @ingroup MultitaskingPlugin 00039 */ 00040 00041 class ColorSet : public NameSet { 00042 00043 FAUDES_TYPE_DECLARATION(ColorSet,ColorSet,NameSet) 00044 00045 public: 00046 00047 /** 00048 * Constructor for ColorSet with static ColorSymbolTable. 00049 */ 00050 ColorSet(void) : NameSet() { 00051 mpSymbolTable= &msSymbolTable; NameSet::Name("Colors"); 00052 FD_DC("ColorSet("<<this<<")::ColorSet() with colorsymtab "<< SymbolTablep()); 00053 }; 00054 00055 /** 00056 * Constructor for ColorSet with specified symbol table. 00057 */ 00058 ColorSet(SymbolTable *pSymTab) : NameSet() { 00059 mpSymbolTable= pSymTab; NameSet::Name("Colors"); 00060 FD_DC("ColorSet("<<this<<")::ColorSet() with colorsymtab "<< SymbolTablep()); 00061 }; 00062 00063 /** 00064 * Constructor for ColorSet with static ColorSymbolTable. 00065 * This version reads a file with given label to find the colors 00066 * inside the file. 00067 * 00068 * @param rFilename 00069 * Filename 00070 * @param rLabel 00071 * Token label for the colors in the file; default value "Colors" 00072 */ 00073 ColorSet(const std::string& rFilename, const std::string& rLabel = "Colors") : NameSet() 00074 { mpSymbolTable= &msSymbolTable; NameSet::Read(rFilename,rLabel);}; 00075 00076 /* Destructor, virtual */ 00077 virtual ~ColorSet(void) {}; 00078 00079 /** 00080 * Get pointer to static ColorSymbolTable 00081 * 00082 * @return 00083 * Pointer to static ColorSymbolTable 00084 */ 00085 static SymbolTable* StaticSymbolTablep(void); 00086 00087 /** 00088 * Reset pointer mpSymbolTable 00089 * 00090 * @param pSymTab 00091 * Pointer to new symbol table 00092 */ 00093 void ColorSymbolTablep(SymbolTable *pSymTab); 00094 00095 /** 00096 * Set intersection operator 00097 * 00098 * @return 00099 * Intersection ColorSet 00100 */ 00101 ColorSet operator * (const ColorSet& rOtherSet) const; 00102 00103 /** 00104 * Set union operator 00105 * 00106 * @return 00107 * Union Set 00108 */ 00109 ColorSet operator + (const ColorSet& rOtherSet) const; 00110 00111 /** 00112 * Set difference operator 00113 * 00114 * @return 00115 * Difference ColorSet 00116 */ 00117 ColorSet operator - (const ColorSet& rOtherSet) const; 00118 00119 /** Test for subset 00120 */ 00121 bool operator <= (const ColorSet& rOtherSet) const; 00122 00123 /** Test for superset 00124 */ 00125 bool operator >= (const ColorSet& rOtherSet) const; 00126 00127 protected: 00128 00129 /** Static global symbol table for color names */ 00130 static SymbolTable msSymbolTable; 00131 00132 /** 00133 * Assign from other color set. 00134 * 00135 * @param rSourceSet 00136 * Destination to copy from 00137 * @return 00138 * ref to this set 00139 */ 00140 virtual void DoAssign(const ColorSet& rSourceSet); 00141 00142 }; // end class ColorSet 00143 00144 } // namespace faudes 00145 00146 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |