mtc_attributes.cpp

Go to the documentation of this file.
00001 /** @file mtc_attributes.cpp
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 #include "mtc_attributes.h"
00029 
00030 namespace faudes {
00031 
00032 // faudes type
00033 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeColoredState,AttributeFlags)
00034 
00035 // assignment
00036 void AttributeColoredState::DoAssign(const AttributeColoredState& rSrcAttr) { 
00037   // call base (incl virtual clear)
00038   AttributeFlags::DoAssign(rSrcAttr);
00039   // no additional members
00040   ColorSymTab(rSrcAttr.mpColorSymbolTable); 
00041   mColors=rSrcAttr.mColors;
00042 }
00043 
00044 bool AttributeColoredState::DoEqual(const AttributeColoredState& rOther) const {
00045   // call base
00046   if(!AttributeFlags::DoEqual(rOther)) return false;
00047   // my data
00048   if(mColors!=rOther.mColors) return false;
00049   // pass
00050   return true;
00051 }
00052 
00053 
00054 
00055 //Write(rTw);
00056 void AttributeColoredState::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00057   if(IsDefault()) return;
00058   mColors.Write(rTw,"Colors");
00059 }
00060 //Write(rTw);
00061 void AttributeColoredState::DoXWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00062   if(IsDefault()) return;
00063   FD_WARN("XXXXXXX"); 
00064   mColors.XWrite(rTw,"Colors");
00065 }
00066 
00067 // DoRead(rTr)
00068 void  AttributeColoredState::DoRead(TokenReader& rTr,const std::string& rLabel, const Type* pContext) {
00069   FD_DC("AttributeColoredState(" << this << ")::Read(tr)");
00070   mColors.Clear();
00071   Token token;
00072   rTr.Peek(token);
00073   if(!token.IsBegin("Colors")) return;
00074   mColors.Read(rTr,"Colors");
00075 }
00076 
00077 // Begin()
00078 NameSet::Iterator AttributeColoredState::ColorsBegin() const {
00079   return mColors.Begin();
00080 }
00081 
00082 // End()
00083 NameSet::Iterator AttributeColoredState::ColorsEnd() const{
00084   return mColors.End();
00085 }
00086 
00087 // ColorSymTab(pSymTab)
00088 void AttributeColoredState::ColorSymTab(SymbolTable *pSymTab) {
00089   mColors.ColorSymbolTablep(pSymTab);
00090 }
00091 
00092 // ColorSymTabp()
00093 SymbolTable *AttributeColoredState::ColorSymTabp(void) const {
00094   return mColors.SymbolTablep();
00095 }
00096 
00097 } // namespace faudes

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