libFAUDES

Sections

Index

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(AttributeColoredState,AttributeFlags,)
00034 
00035 // assignment
00036 AttributeColoredState& 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   return *this;
00043 }
00044 
00045 bool AttributeColoredState::DoEqual(const AttributeColoredState& rOther) const {
00046   // call base
00047   if(!AttributeFlags::DoEqual(rOther)) return false;
00048   // my data
00049   if(mColors!=rOther.mColors) return false;
00050   // pass
00051   return true;
00052 }
00053 
00054 
00055 
00056 //Write(rTw);
00057 void AttributeColoredState::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00058   if(IsDefault()) return;
00059   mColors.Write(rTw);
00060 }
00061 
00062 // DoRead(rTr)
00063 void  AttributeColoredState::DoRead(TokenReader& rTr,const std::string& rLabel, const Type* pContext) {
00064   FD_DC("AttributeColoredState(" << this << ")::Read(tr)");
00065   mColors.Clear();
00066   Token token;
00067   rTr.Peek(token);
00068   if(token.Type()!=Token::Begin)  return;
00069   if(token.StringValue()!="Colors") return;
00070   mColors.Read(rTr,"Colors");
00071 }
00072 
00073 // Begin()
00074 NameSet::Iterator AttributeColoredState::ColorsBegin() const {
00075   return mColors.Begin();
00076 }
00077 
00078 // End()
00079 NameSet::Iterator AttributeColoredState::ColorsEnd() const{
00080   return mColors.End();
00081 }
00082 
00083 // ColorSymTab(pSymTab)
00084 void AttributeColoredState::ColorSymTab(SymbolTable *pSymTab) {
00085   mColors.ColorSymbolTablep(pSymTab);
00086 }
00087 
00088 // ColorSymTabp()
00089 SymbolTable *AttributeColoredState::ColorSymTabp(void) const {
00090   return mColors.SymbolTablep();
00091 }
00092 
00093 } // namespace faudes

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6