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

libFAUDES 2.33b --- 2025.05.07 --- c++ api documentaion by doxygen