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)
Debug: optional report on container operations.
#define FAUDES_TYPE_IMPLEMENTATION(ftype, ctype, cbase)
faudes type implementation macros, overall
Definition: cfl_types.h:946
State attributes for multitasking automata.
NameSet::Iterator ColorsEnd() const
Iterator for last entry in mColors.
virtual void DoRead(TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
Read attributes from tokenreader.
void ColorSymTab(SymbolTable *pSymTab)
Set pointer to color symbol table.
virtual void DoXWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
Write attributes to tokenwriter.
SymbolTable * ColorSymTabp(void) const
Get pointer to color symbol table.
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
Write attributes to tokenwriter.
NameSet::Iterator ColorsBegin() const
Iterator for first entry in mColors.
bool IsDefault(void) const
Test for default value.
virtual bool DoEqual(const AttributeColoredState &rOther) const
Test equality of configuration data.
bool DoEqual(const AttributeFlags &rOther) const
Test equality of configuration data.
void DoAssign(const AttributeFlags &rSrcAttr)
Assignment method.
void ColorSymbolTablep(SymbolTable *pSymTab)
Reset pointer mpSymbolTable.
SymbolTable * SymbolTablep(void) const
Get Pointer mpSymbolTable.
A SymbolTable associates sybolic names with indices.
A TokenReader reads sequential tokens from a file or string.
bool Peek(Token &token)
Peek next token.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Tokens model atomic data for stream IO.
Definition: cfl_token.h:53
bool IsBegin(void) const
Test token Type.
Definition: cfl_token.cpp:258
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
Definition: cfl_types.cpp:261
virtual void XWrite(const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to an XML file.
Definition: cfl_types.cpp:200
void Write(const Type *pContext=0) const
Write configuration data to console.
Definition: cfl_types.cpp:139
virtual void Clear(void)
Clear all set.
Definition: cfl_baseset.h:1902
Iterator End(void) const
Iterator to the end of set.
Definition: cfl_baseset.h:1896
Iterator Begin(void) const
Iterator to the begin of set.
Definition: cfl_baseset.h:1891
Color attributes for states.
libFAUDES resides within the namespace faudes.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen