mtc_attributes.cpp
Go to the documentation of this file.
1 /** @file mtc_attributes.cpp
2 
3 Implements the color representation for single states in multitasking
4 automata as state attributes
5 
6 */
7 
8 /* FAU Discrete Event Systems Library (libfaudes)
9 
10  Copyright (C) 2008 Matthias Singer
11  Exclusive copyright is granted to Klaus Schmidt
12 
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License as published by the Free Software Foundation; either
16  version 2.1 of the License, or (at your option) any later version.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26 
27 
28 #include "mtc_attributes.h"
29 
30 namespace faudes {
31 
32 // faudes type
33 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeColoredState,AttributeFlags)
34 
35 // assignment
36 void AttributeColoredState::DoAssign(const AttributeColoredState& rSrcAttr) {
37  // call base (incl virtual clear)
38  AttributeFlags::DoAssign(rSrcAttr);
39  // no additional members
40  ColorSymTab(rSrcAttr.mpColorSymbolTable);
41  mColors=rSrcAttr.mColors;
42 }
43 
45  // call base
46  if(!AttributeFlags::DoEqual(rOther)) return false;
47  // my data
48  if(mColors!=rOther.mColors) return false;
49  // pass
50  return true;
51 }
52 
53 
54 
55 //Write(rTw);
56 void AttributeColoredState::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
57  if(IsDefault()) return;
58  mColors.Write(rTw,"Colors");
59 }
60 //Write(rTw);
61 void AttributeColoredState::DoXWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
62  if(IsDefault()) return;
63  FD_WARN("XXXXXXX");
64  mColors.XWrite(rTw,"Colors");
65 }
66 
67 // DoRead(rTr)
68 void AttributeColoredState::DoRead(TokenReader& rTr,const std::string& rLabel, const Type* pContext) {
69  FD_DC("AttributeColoredState(" << this << ")::Read(tr)");
70  mColors.Clear();
71  Token token;
72  rTr.Peek(token);
73  if(!token.IsBegin("Colors")) return;
74  mColors.Read(rTr,"Colors");
75 }
76 
77 // Begin()
78 NameSet::Iterator AttributeColoredState::ColorsBegin() const {
79  return mColors.Begin();
80 }
81 
82 // End()
83 NameSet::Iterator AttributeColoredState::ColorsEnd() const{
84  return mColors.End();
85 }
86 
87 // ColorSymTab(pSymTab)
89  mColors.ColorSymbolTablep(pSymTab);
90 }
91 
92 // ColorSymTabp()
94  return mColors.SymbolTablep();
95 }
96 
97 } // namespace faudes

libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen