11 #ifndef FAUDES_IOS_SYSTEM_H
12 #define FAUDES_IOS_SYSTEM_H
33 template <
class GlobalAttr,
class StateAttr,
class EventAttr,
class TransAttr>
361 bool InputEvent(
const std::string& rName)
const;
580 bool InputState(
const std::string& rName)
const;
686 bool ErrorState(
const std::string& rName)
const;
795 #define THIS TioGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
796 #define BASE TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
797 #define TEMP template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr>
806 TEMP THIS::~TioGenerator(
void) {
811 TEMP THIS::TioGenerator(
const std::string& rFileName) :
BASE(rFileName) {
832 res->EventSymbolTablep(BASE::mpEventSymbolTable);
833 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
834 res->mReindexOnWrite=BASE::mReindexOnWrite;
840 return new THIS(*
this);
846 THIS res= BASE::NewAGen();
852 FD_DIO(
"IoSystem(" <<
this <<
")::InsOutputEvent(" << index <<
")");
855 BASE::InsEvent(index,attr);
859 TEMP Idx THIS::InsOutputEvent(
const std::string& rName) {
863 return BASE::InsEvent(rName,attr);
871 BASE::InsEvent(index,attr);
875 TEMP Idx THIS::InsInputEvent(
const std::string& rName) {
879 return BASE::InsEvent(rName,attr);
888 res.
Name(
"OutputEvents");
889 EventSet::Iterator eit;
890 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
891 if(OutputEvent(*eit)) res.
Insert(*eit);
898 EventSet::Iterator eit;
899 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
900 if(rEventSet.
Exists(*eit)) SetOutputEvent(*eit);
901 else ClrOutputEvent(*eit);
905 TEMP bool THIS::OutputEvent(
Idx index)
const {
906 return BASE::EventAttribute(index).Output();
910 TEMP bool THIS::OutputEvent(
const std::string& rName)
const {
911 return BASE::EventAttribute(rName).Output();
917 EventAttr attr=BASE::EventAttribute(index);
919 BASE::pAlphabet->Attribute(index,attr);
923 TEMP void THIS::SetOutputEvent(
const std::string& rName) {
925 Idx index = BASE::EventIndex(rName);
926 SetOutputEvent(index);
932 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
933 SetOutputEvent(*eit);
940 EventAttr attr=BASE::EventAttribute(index);
942 BASE::pAlphabet->Attribute(index,attr);
946 TEMP void THIS::ClrOutputEvent(
const std::string& rName) {
948 Idx index = BASE::EventIndex(rName);
949 ClrOutputEvent(index);
955 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
956 ClrOutputEvent(*eit);
964 res.
Name(
"InputEvents");
965 EventSet::Iterator eit;
966 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
967 if(InputEvent(*eit)) res.
Insert(*eit);
974 EventSet::Iterator eit;
975 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
976 if(rEventSet.
Exists(*eit)) SetInputEvent(*eit);
977 else ClrInputEvent(*eit);
983 return BASE::EventAttribute(index).Input();
987 TEMP bool THIS::InputEvent(
const std::string& rName)
const {
988 return BASE::EventAttribute(rName).Input();
994 EventAttr attr=BASE::EventAttribute(index);
996 BASE::pAlphabet->Attribute(index,attr);
1000 TEMP void THIS::SetInputEvent(
const std::string& rName) {
1002 Idx index = BASE::EventIndex(rName);
1003 SetInputEvent(index);
1009 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
1010 SetInputEvent(*eit);
1017 EventAttr attr=BASE::EventAttribute(index);
1019 BASE::pAlphabet->Attribute(index,attr);
1023 TEMP void THIS::ClrInputEvent(
const std::string& rName) {
1025 Idx index = BASE::EventIndex(rName);
1026 ClrInputEvent(index);
1032 for(EventSet::Iterator eit=rEventSet.
Begin(); eit!=rEventSet.
End(); eit++)
1033 ClrInputEvent(*eit);
1041 res.
Name(
"OutputStates");
1042 StateSet::Iterator sit;
1043 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1044 if(OutputState(*sit)) res.
Insert(*sit);
1050 FD_DIO(
"IoSystem(" <<
this <<
")::OutputStates(" << rStateSet.
Name() <<
")");
1051 StateSet::Iterator sit;
1052 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1053 if(rStateSet.
Exists(*sit)) SetOutputState(*sit);
1054 else ClrOutputState(*sit);
1059 return BASE::StateAttribute(index).Output();
1063 TEMP bool THIS::OutputState(
const std::string& rName)
const {
1064 Idx index = BASE::StateIndex(rName);
1065 return BASE::StateAttribute(index).Output();
1071 StateAttr attr=BASE::StateAttribute(index);
1073 BASE::pStates->Attribute(index,attr);
1077 TEMP void THIS::SetOutputState(
const std::string& rName) {
1079 Idx index = BASE::StateIndex(rName);
1080 SetOutputState(index);
1086 for(StateSet::Iterator eit=rStateSet.
Begin(); eit!=rStateSet.
End(); eit++)
1087 SetOutputState(*eit);
1094 StateAttr attr=BASE::StateAttribute(index);
1096 BASE::pStates->Attribute(index,attr);
1100 TEMP void THIS::ClrOutputState(
const std::string& rName) {
1102 Idx index = BASE::StateIndex(rName);
1103 ClrOutputState(index);
1109 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1110 ClrOutputState(*sit);
1118 res.
Name(
"InputStates");
1119 StateSet::Iterator sit;
1120 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1121 if(InputState(*sit)) res.
Insert(*sit);
1128 StateSet::Iterator sit;
1129 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1130 if(rStateSet.
Exists(*sit)) SetInputState(*sit);
1131 else ClrInputState(*sit);
1136 return BASE::StateAttribute(index).Input();
1140 TEMP bool THIS::InputState(
const std::string& rName)
const {
1141 Idx index = BASE::StateIndex(rName);
1142 return BASE::StateAttribute(index).Input();
1148 StateAttr attr=BASE::StateAttribute(index);
1150 BASE::pStates->Attribute(index,attr);
1154 TEMP void THIS::SetInputState(
const std::string& rName) {
1156 Idx index = BASE::StateIndex(rName);
1157 SetInputState(index);
1163 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1164 SetInputState(*sit);
1171 StateAttr attr=BASE::StateAttribute(index);
1173 BASE::pStates->Attribute(index,attr);
1177 TEMP void THIS::ClrInputState(
const std::string& rName) {
1179 Idx index = BASE::StateIndex(rName);
1180 ClrInputState(index);
1186 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1187 ClrInputState(*sit);
1197 res.
Name(
"ErrorStates");
1198 StateSet::Iterator sit;
1199 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1200 if(ErrorState(*sit)) res.
Insert(*sit);
1207 StateSet::Iterator sit;
1208 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1209 if(rStateSet.
Exists(*sit)) SetErrorState(*sit);
1210 else ClrErrorState(*sit);
1215 return BASE::StateAttribute(index).Error();
1219 TEMP bool THIS::ErrorState(
const std::string& rName)
const {
1220 Idx index = BASE::StateIndex(rName);
1221 return BASE::StateAttribute(index).Error();
1227 StateAttr attr=BASE::StateAttribute(index);
1229 BASE::pStates->Attribute(index,attr);
1233 TEMP void THIS::SetErrorState(
const std::string& rName) {
1235 Idx index = BASE::StateIndex(rName);
1236 SetErrorState(index);
1242 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1243 SetErrorState(*sit);
1250 StateAttr attr=BASE::StateAttribute(index);
1252 BASE::pStates->Attribute(index,attr);
1256 TEMP void THIS::ClrErrorState(
const std::string& rName) {
1258 Idx index = BASE::StateIndex(rName);
1259 ClrErrorState(index);
1265 for(StateSet::Iterator sit=rStateSet.
Begin(); sit!=rStateSet.
End(); sit++)
1266 ClrErrorState(*sit);
1271 TEMP bool THIS::UpdateAttributes(
void) {