11 #ifndef FAUDES_IOS_SYSTEM_H
12 #define FAUDES_IOS_SYSTEM_H
33 template <
class GlobalAttr,
class StateAttr,
class EventAttr,
class TransAttr>
150 void InsOutputEvent(
Idx index);
163 Idx InsOutputEvent(
const std::string& rName);
173 void InsInputEvent(
Idx index);
187 Idx InsInputEvent(
const std::string& rName);
214 void OutputEvents(
const EventSet& rEventSet);
226 bool OutputEvent(
Idx index)
const;
238 bool OutputEvent(
const std::string& rName)
const;
248 void SetOutputEvent(
Idx index);
258 void SetOutputEvent(
const std::string& rName);
268 void SetOutputEvent(
const EventSet& rEventSet);
278 void ClrOutputEvent(
Idx index);
288 void ClrOutputEvent(
const std::string& rName);
298 void ClrOutputEvent(
const EventSet& rEventSet);
320 void InputEvents(
const EventSet& rEventSet);
333 bool InputEvent(
Idx index)
const;
346 bool InputEvent(
const std::string& rName)
const;
356 void SetInputEvent(
Idx index);
366 void SetInputEvent(
const std::string& rName);
376 void SetInputEvent(
const EventSet& rEventSet);
386 void ClrInputEvent(
Idx index);
396 void ClrInputEvent(
const std::string& rName);
406 void ClrInputEvent(
const EventSet& rEventSet);
433 void OutputStates(
const StateSet& rStateSet);
445 bool OutputState(
Idx index)
const;
457 bool OutputState(
const std::string& rName)
const;
467 void SetOutputState(
Idx index);
477 void SetOutputState(
const std::string& rName);
487 void SetOutputState(
const StateSet& rStateSet);
497 void ClrOutputState(
Idx index);
507 void ClrOutputState(
const std::string& rName);
517 void ClrOutputState(
const StateSet& rStateSet);
539 void InputStates(
const StateSet& rStateSet);
552 bool InputState(
Idx index)
const;
565 bool InputState(
const std::string& rName)
const;
575 void SetInputState(
Idx index);
585 void SetInputState(
const std::string& rName);
595 void SetInputState(
const StateSet& rStateSet);
605 void ClrInputState(
Idx index);
615 void ClrInputState(
const std::string& rName);
625 void ClrInputState(
const StateSet& rStateSet);
647 void ErrorStates(
const StateSet& rStateSet);
659 bool ErrorState(
Idx index)
const;
671 bool ErrorState(
const std::string& rName)
const;
681 void SetErrorState(
Idx index);
691 void SetErrorState(
const std::string& rName);
701 void SetErrorState(
const StateSet& rStateSet);
711 void ClrErrorState(
Idx index);
721 void ClrErrorState(
const std::string& rName);
731 void ClrErrorState(
const StateSet& rStateSet);
747 virtual bool UpdateAttributes(
void);
780 #define THIS TioGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
781 #define BASE TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
782 #define TEMP template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr>
791 TEMP THIS::~TioGenerator(
void) {
796 TEMP THIS::TioGenerator(
const std::string& rFileName) :
BASE(rFileName) {
817 res->EventSymbolTablep(BASE::mpEventSymbolTable);
818 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
819 res->mReindexOnWrite=BASE::mReindexOnWrite;
825 return new THIS(*
this);
831 THIS res= BASE::NewAGen();
837 FD_DIO(
"IoSystem(" <<
this <<
")::InsOutputEvent(" << index <<
")");
840 BASE::InsEvent(index,attr);
844 TEMP Idx THIS::InsOutputEvent(
const std::string& rName) {
848 return BASE::InsEvent(rName,attr);
856 BASE::InsEvent(index,attr);
860 TEMP Idx THIS::InsInputEvent(
const std::string& rName) {
864 return BASE::InsEvent(rName,attr);
873 res.
Name(
"OutputEvents");
874 EventSet::Iterator eit;
875 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
876 if(OutputEvent(*eit)) res.
Insert(*eit);
883 EventSet::Iterator eit;
884 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
885 if(rEventSet.
Exists(*eit)) SetOutputEvent(*eit);
886 else ClrOutputEvent(*eit);
890 TEMP bool THIS::OutputEvent(
Idx index)
const {
891 return BASE::EventAttribute(index).Output();
895 TEMP bool THIS::OutputEvent(
const std::string& rName)
const {
896 return BASE::EventAttribute(rName).Output();
902 EventAttr attr=BASE::EventAttribute(index);
904 BASE::pAlphabet->Attribute(index,attr);
908 TEMP void THIS::SetOutputEvent(
const std::string& rName) {
910 Idx index = BASE::EventIndex(rName);
911 SetOutputEvent(index);
917 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
918 SetOutputEvent(*eit);
925 EventAttr attr=BASE::EventAttribute(index);
927 BASE::pAlphabet->Attribute(index,attr);
931 TEMP void THIS::ClrOutputEvent(
const std::string& rName) {
933 Idx index = BASE::EventIndex(rName);
934 ClrOutputEvent(index);
940 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
941 ClrOutputEvent(*eit);
949 res.
Name(
"InputEvents");
950 EventSet::Iterator eit;
951 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
952 if(InputEvent(*eit)) res.
Insert(*eit);
959 EventSet::Iterator eit;
960 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
961 if(rEventSet.
Exists(*eit)) SetInputEvent(*eit);
962 else ClrInputEvent(*eit);
968 return BASE::EventAttribute(index).Input();
972 TEMP bool THIS::InputEvent(
const std::string& rName)
const {
973 return BASE::EventAttribute(rName).Input();
979 EventAttr attr=BASE::EventAttribute(index);
981 BASE::pAlphabet->Attribute(index,attr);
985 TEMP void THIS::SetInputEvent(
const std::string& rName) {
987 Idx index = BASE::EventIndex(rName);
988 SetInputEvent(index);
994 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
1002 EventAttr attr=BASE::EventAttribute(index);
1004 BASE::pAlphabet->Attribute(index,attr);
1008 TEMP void THIS::ClrInputEvent(
const std::string& rName) {
1010 Idx index = BASE::EventIndex(rName);
1011 ClrInputEvent(index);
1017 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
1018 ClrInputEvent(*eit);
1026 res.
Name(
"OutputStates");
1027 StateSet::Iterator sit;
1028 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1029 if(OutputState(*sit)) res.
Insert(*sit);
1035 FD_DIO(
"IoSystem(" <<
this <<
")::OutputStates(" << rStateSet.
Name() <<
")");
1036 StateSet::Iterator sit;
1037 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1038 if(rStateSet.
Exists(*sit)) SetOutputState(*sit);
1039 else ClrOutputState(*sit);
1044 return BASE::StateAttribute(index).Output();
1048 TEMP bool THIS::OutputState(
const std::string& rName)
const {
1049 Idx index = BASE::StateIndex(rName);
1050 return BASE::StateAttribute(index).Output();
1056 StateAttr attr=BASE::StateAttribute(index);
1058 BASE::pStates->Attribute(index,attr);
1062 TEMP void THIS::SetOutputState(
const std::string& rName) {
1064 Idx index = BASE::StateIndex(rName);
1065 SetOutputState(index);
1071 for(StateSet::Iterator eit=rStateSet.
Begin(); eit!=rStateSet.
End(); eit++)
1072 SetOutputState(*eit);
1079 StateAttr attr=BASE::StateAttribute(index);
1081 BASE::pStates->Attribute(index,attr);
1085 TEMP void THIS::ClrOutputState(
const std::string& rName) {
1087 Idx index = BASE::StateIndex(rName);
1088 ClrOutputState(index);
1094 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1095 ClrOutputState(*sit);
1103 res.
Name(
"InputStates");
1104 StateSet::Iterator sit;
1105 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1106 if(InputState(*sit)) res.
Insert(*sit);
1113 StateSet::Iterator sit;
1114 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1115 if(rStateSet.
Exists(*sit)) SetInputState(*sit);
1116 else ClrInputState(*sit);
1121 return BASE::StateAttribute(index).Input();
1125 TEMP bool THIS::InputState(
const std::string& rName)
const {
1126 Idx index = BASE::StateIndex(rName);
1127 return BASE::StateAttribute(index).Input();
1133 StateAttr attr=BASE::StateAttribute(index);
1135 BASE::pStates->Attribute(index,attr);
1139 TEMP void THIS::SetInputState(
const std::string& rName) {
1141 Idx index = BASE::StateIndex(rName);
1142 SetInputState(index);
1148 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1149 SetInputState(*sit);
1156 StateAttr attr=BASE::StateAttribute(index);
1158 BASE::pStates->Attribute(index,attr);
1162 TEMP void THIS::ClrInputState(
const std::string& rName) {
1164 Idx index = BASE::StateIndex(rName);
1165 ClrInputState(index);
1171 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1172 ClrInputState(*sit);
1182 res.
Name(
"ErrorStates");
1183 StateSet::Iterator sit;
1184 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1185 if(ErrorState(*sit)) res.
Insert(*sit);
1192 StateSet::Iterator sit;
1193 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1194 if(rStateSet.
Exists(*sit)) SetErrorState(*sit);
1195 else ClrErrorState(*sit);
1200 return BASE::StateAttribute(index).Error();
1204 TEMP bool THIS::ErrorState(
const std::string& rName)
const {
1205 Idx index = BASE::StateIndex(rName);
1206 return BASE::StateAttribute(index).Error();
1212 StateAttr attr=BASE::StateAttribute(index);
1214 BASE::pStates->Attribute(index,attr);
1218 TEMP void THIS::SetErrorState(
const std::string& rName) {
1220 Idx index = BASE::StateIndex(rName);
1221 SetErrorState(index);
1227 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1228 SetErrorState(*sit);
1235 StateAttr attr=BASE::StateAttribute(index);
1237 BASE::pStates->Attribute(index,attr);
1241 TEMP void THIS::ClrErrorState(
const std::string& rName) {
1243 Idx index = BASE::StateIndex(rName);
1244 ClrErrorState(index);
1250 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1251 ClrErrorState(*sit);
1256 TEMP bool THIS::UpdateAttributes(
void) {
Idx Insert(void)
Insert new index to set.
Set of indices with symbolic names.
bool Exists(const Idx &rIndex) const
Test existence of index.
bool Insert(const Idx &rIndex)
Add an element by index.
Generator with specified attribute types.
Generator with I/O-system attributes.
Base class of all FAUDES generators.
Includes all libFAUDES headers, no plugins.
bool Exists(const T &rElem) const
Test existence of element.
Iterator End(void) const
Iterator to the end of set.
Iterator Begin(void) const
Iterator to the begin of set.
const std::string & Name(void) const
Return name of TBaseSet.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
TioGenerator< AttributeVoid, AttributeIosState, AttributeIosEvent, AttributeVoid > IoSystem