11 #ifndef FAUDES_HIO_CONSTRAINT_H
12 #define FAUDES_HIO_CONSTRAINT_H
44 template <
class GlobalAttr,
class StateAttr,
class EventAttr,
class TransAttr>
194 void SetY(
const std::string& rName);
218 void SetU(
const std::string& rName);
237 bool IsY(
Idx index)
const;
248 bool IsY(
const std::string& rName)
const;
259 bool IsU(
Idx index)
const;
270 bool IsU(
const std::string& rName)
const;
304 void SetQY(
const std::string& rName);
327 void ClrQY(
const std::string& rName);
356 bool IsQY(
const std::string& rName)
const;
380 void SetQU(
const std::string& rName);
403 void ClrQU(
const std::string& rName);
432 bool IsQU(
const std::string& rName)
const;
456 void SetErr(
const std::string& rName);
479 void ClrErr(
const std::string& rName);
508 bool IsErr(
const std::string& rName)
const;
537 #define THIS THioConstraint<GlobalAttr, StateAttr, EventAttr, TransAttr>
538 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
539 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
544 FD_DG(
"HioConstraint(" <<
this <<
")::HioConstraint()");
549 FD_DG(
"HioConstraint(" <<
this <<
")::HioConstraint(rOtherGen)");
554 FD_DG(
"HioConstraint(" <<
this <<
")::HioConstraint(rOtherGen)");
562 ) :
BASE(rOtherGen) {
563 FD_DG(
"HioConstraint(" <<
this <<
")::HioConstraint(rOtherGen)");
569 TEMP THIS::THioConstraint(
const std::string& rFileName) :
BASE(rFileName) {
570 FD_DG(
"HioConstraint(" <<
this <<
")::HioConstraint(rFilename) : done");
578 res->EventSymbolTablep(BASE::mpEventSymbolTable);
579 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
585 return new THIS(*
this);
591 THIS res= BASE::NewAGen();
599 EventAttr attr=BASE::EventAttribute(index);
604 TEMP bool THIS::IsY(
const std::string& rName)
const {
605 EventAttr attr=BASE::EventAttribute(rName);
611 EventAttr attr=BASE::EventAttribute(index);
616 TEMP bool THIS::IsU(
const std::string& rName)
const {
617 EventAttr attr=BASE::EventAttribute(rName);
623 FD_DG(
"HioConstraint(" <<
this <<
")::YEvents()");
625 EventSet::Iterator it;
626 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
627 if(IsY(*it)) res.
Insert(*it);
634 FD_DG(
"HioConstraint(" <<
this <<
")::UEvents()");
636 EventSet::Iterator it;
637 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
638 if(IsU(*it)) res.
Insert(*it);
647 FD_DG(
"HioConstraint(" <<
this <<
")::InsYEvent(" << index <<
")");
650 BASE::InsEvent(index,attr);
654 TEMP Idx THIS::InsYEvent(
const std::string& rName) {
655 FD_DG(
"HioConstraint(" <<
this <<
")::InsYEvent(" << rName <<
")");
658 return BASE::InsEvent(rName,attr);
663 FD_DG(
"HioConstraint(" <<
this <<
")::InsUEvent(" << index <<
")");
666 BASE::InsEvent(index,attr);
670 TEMP Idx THIS::InsUEvent(
const std::string& rName) {
671 FD_DG(
"HioConstraint(" <<
this <<
")::InsUEvent(" << rName <<
")");
674 return BASE::InsEvent(rName,attr);
679 FD_DG(
"HioConstraint(" <<
this <<
")::SetY(" << index <<
")");
680 EventAttr attr=BASE::EventAttribute(index);
682 BASE::pAlphabet->Attribute(index,attr);
686 TEMP void THIS::SetY(
const std::string& rName) {
687 FD_DG(
"HioConstraint(" <<
this <<
")::SetY(" << rName <<
")");
688 Idx index = BASE::EventIndex(rName);
694 FD_DG(
"HioConstraint(" <<
this <<
")::SetY(rEvents)");
695 EventSet::Iterator it;
696 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
703 FD_DG(
"HioConstraint(" <<
this <<
")::SetU(" << index <<
")");
704 EventAttr attr=BASE::EventAttribute(index);
706 BASE::pAlphabet->Attribute(index,attr);
710 TEMP void THIS::SetU(
const std::string& rName) {
711 FD_DG(
"HioConstraint(" <<
this <<
")::SetU(" << rName <<
")");
712 Idx index = BASE::EventIndex(rName);
718 FD_DG(
"HioConstraint(" <<
this <<
")::SetU(rEvents)");
719 EventSet::Iterator it;
720 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
731 FD_DG(
"HioConstraint(" <<
this <<
")::SetQY(" << index <<
")");
732 StateAttr attr=BASE::StateAttribute(index);
741 BASE::pStates->Attribute(index,attr);
745 TEMP void THIS::SetQY(
const std::string& rName) {
746 FD_DG(
"HioConstraint(" <<
this <<
")::SetQY(" << rName <<
")");
747 Idx index = BASE::StateIndex(rName);
753 FD_DG(
"HioConstraint(" <<
this <<
")::SetQY(rStates)");
754 StateSet::Iterator sit;
755 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
762 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQY(" << index <<
")");
763 StateAttr attr=BASE::StateAttribute(index);
765 BASE::pStates->Attribute(index,attr);
769 TEMP void THIS::ClrQY(
const std::string& rName) {
770 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQY(" << rName <<
")");
771 Idx index = BASE::StateIndex(rName);
777 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQY(rStates)");
778 StateSet::Iterator sit;
779 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
786 StateAttr attr=BASE::StateAttribute(index);
791 TEMP bool THIS::IsQY(
const std::string& rName)
const {
792 Idx index = BASE::StateIndex(rName);
798 FD_DG(
"HioConstraint(" <<
this <<
")::QYStates()");
800 StateSet::Iterator sit;
801 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
802 if(IsQY(*sit)) res.
Insert(*sit);
810 FD_DG(
"HioConstraint(" <<
this <<
")::SetQU(" << index <<
")");
811 StateAttr attr=BASE::StateAttribute(index);
820 BASE::pStates->Attribute(index,attr);
824 TEMP void THIS::SetQU(
const std::string& rName) {
825 FD_DG(
"HioConstraint(" <<
this <<
")::SetQU(" << rName <<
")");
826 Idx index = BASE::StateIndex(rName);
832 FD_DG(
"HioConstraint(" <<
this <<
")::SetQU(rStates)");
833 StateSet::Iterator sit;
834 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
841 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQU(" << index <<
")");
842 StateAttr attr=BASE::StateAttribute(index);
844 BASE::pStates->Attribute(index,attr);
848 TEMP void THIS::ClrQU(
const std::string& rName) {
849 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQU(" << rName <<
")");
850 Idx index = BASE::StateIndex(rName);
856 FD_DG(
"HioConstraint(" <<
this <<
")::ClrQU(rStates)");
857 StateSet::Iterator sit;
858 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
865 StateAttr attr=BASE::StateAttribute(index);
870 TEMP bool THIS::IsQU(
const std::string& rName)
const {
871 Idx index = BASE::StateIndex(rName);
877 FD_DG(
"HioConstraint(" <<
this <<
")::QUStates()");
879 StateSet::Iterator sit;
880 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
881 if(IsQU(*sit)) res.
Insert(*sit);
888 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(" << index <<
")");
889 StateAttr attr=BASE::StateAttribute(index);
891 BASE::pStates->Attribute(index,attr);
895 TEMP void THIS::SetErr(
const std::string& rName) {
896 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(" << rName <<
")");
897 Idx index = BASE::StateIndex(rName);
903 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(rStates)");
904 StateSet::Iterator sit;
905 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
912 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(" << index <<
")");
913 StateAttr attr=BASE::StateAttribute(index);
915 BASE::pStates->Attribute(index,attr);
919 TEMP void THIS::ClrErr(
const std::string& rName) {
920 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(" << rName <<
")");
921 Idx index = BASE::StateIndex(rName);
927 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(rStates)");
928 StateSet::Iterator sit;
929 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
936 StateAttr attr=BASE::StateAttribute(index);
941 TEMP bool THIS::IsErr(
const std::string& rName)
const {
942 Idx index = BASE::StateIndex(rName);
948 FD_DG(
"HioPlant(" <<
this <<
")::ErrStates()");
950 StateSet::Iterator sit;
951 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
952 if(IsErr(*sit)) res.
Insert(*sit);
1001 std::string& rReportStr);