mtc_attributes.h

Go to the documentation of this file.
00001 /** @file mtc_attributes.h
00002 
00003 Implements the color representation for single states in multitasking
00004 automata as state attributes
00005 
00006 */
00007 
00008 /* FAU Discrete Event Systems Library (libfaudes)
00009 
00010    Copyright (C) 2008  Matthias Singer
00011    Exclusive copyright is granted to Klaus Schmidt
00012 
00013    This library is free software; you can redistribute it and/or
00014    modify it under the terms of the GNU Lesser General Public
00015    License as published by the Free Software Foundation; either
00016    version 2.1 of the License, or (at your option) any later version.
00017 
00018    This library is distributed in the hope that it will be useful,
00019    but WITHOUT ANY WARRANTY; without even the implied warranty of
00020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021    Lesser General Public License for more details.
00022 
00023    You should have received a copy of the GNU Lesser General Public
00024    License along with this library; if not, write to the Free Software
00025    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00026 
00027 
00028 #ifndef MTC_ATTRIBUTES_H
00029 
00030 #include "corefaudes.h"
00031 #include "mtc_colorset.h"
00032 
00033 namespace faudes {
00034 
00035 /**
00036  * 
00037  * State attributes for multitasking automata
00038  *
00039  * @ingroup MultitaskingPlugin
00040  */
00041 class AttributeColoredState : public AttributeFlags {
00042 
00043 FAUDES_TYPE_DECLARATION(Void,AttributeColoredState,AttributeFlags)
00044 
00045 
00046   public:
00047 
00048     /** Default constructor */
00049    AttributeColoredState(void) : AttributeFlags() {
00050       mpColorSymbolTable=mColors.SymbolTablep(); };
00051 
00052     virtual ~AttributeColoredState(void) {};
00053 
00054     /**
00055     * Test for default value
00056     *
00057     * @return
00058     *   True for defaultvalue
00059     */
00060     bool  IsDefault(void) const {return (mColors.Empty() && (mFlags==mDefFlags)); };
00061 
00062    /**
00063     * Iterator for first entry in mColors
00064     */
00065     NameSet::Iterator ColorsBegin() const;
00066 
00067    /**
00068     * Iterator for last entry in mColors 
00069     */
00070     NameSet::Iterator ColorsEnd() const;
00071 
00072     /**
00073      * Read access to color set
00074      *
00075      * @return
00076      *   Reference to attribute data
00077      */
00078     const ColorSet& Colors(void) const { return mColors;};
00079 
00080 
00081     /**
00082      * Writable access to color set
00083      *
00084      * @return
00085      *   Reference to attribute data
00086      */
00087     ColorSet& Colors(void) { return mColors;};
00088 
00089     /**
00090      * Set the color set
00091      *
00092      * @param rColors
00093      *   New color set
00094      */
00095     void Colors(const ColorSet& rColors) { mColors=rColors;};
00096 
00097     /**
00098     * Set pointer to color symbol table
00099     *
00100     * @param pSymTab
00101     *   New color symbol table
00102     */
00103     void ColorSymTab(SymbolTable *pSymTab);
00104 
00105     /**
00106     * Get pointer to color symbol table
00107     *
00108     * @return
00109     *   Pointer to current color symbol table
00110     */
00111     SymbolTable *ColorSymTabp(void) const;
00112 
00113 protected:
00114 
00115     /** Colorset */
00116     ColorSet mColors;
00117 
00118    /** Pointer to colorsymboltable */
00119     SymbolTable* mpColorSymbolTable;
00120 
00121   /**
00122    * Assignment method. 
00123    *
00124    * @param rSrcAttr
00125    *    Source to assign from
00126    */
00127    virtual void DoAssign(const AttributeColoredState& rSrcAttr);
00128 
00129 
00130   /**
00131    * Test equality of configuration data.
00132    *
00133    * @param rOther 
00134    *    Other attribute to compare with.
00135    * @return 
00136    *   True on match.
00137    */
00138   virtual bool DoEqual(const AttributeColoredState& rOther) const;
00139 
00140    /**
00141     * Write attributes to tokenwriter
00142     *
00143     * @param rTw
00144     *   Tokenreader to write to
00145     * @param rLabel
00146     *   Section to write
00147     * @param pContext
00148     *   Write context to provide contextual information
00149     *
00150     * @exception Exception
00151     *   I/O errors
00152     */
00153     virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
00154 
00155    /**
00156     * Write attributes to tokenwriter
00157     *
00158     * @param rTw
00159     *   Tokenreader to write to
00160     * @param rLabel
00161     *   Section to write
00162     * @param pContext
00163     *   Write context to provide contextual information
00164     *
00165     * @exception Exception
00166     *   I/O errors
00167     */
00168     virtual void DoXWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
00169 
00170     /**
00171     * Read attributes from tokenreader
00172     *
00173     * @param rTr
00174     *   Tokenreader to read from
00175     * @param rLabel
00176     *   Section to read
00177     * @param pContext
00178     *   Read context to provide contextual information
00179     *
00180     * @exception Exception
00181     *   Thrown on file format errors (ids 50, 51)
00182     */
00183     virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
00184 
00185 
00186 
00187 }; // class AttributeColoredState
00188 
00189 } // namespace faudes
00190 
00191 #define MTC_ATTRIBUTES_H
00192 #endif

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen