|
|
Go to the documentation of this file.
12#ifndef FAUDES_HYB_HGENERATOR_H
13#define FAUDES_HYB_HGENERATOR_H
235template < class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
621 virtual bool Valid( void) const;
684#define THIS TlhaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
685#define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
686#define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
691 FD_DG( "lhaGenerator(" << this << ")::lhaGenerator()");
696 FD_DG( "lhaGenerator(" << this << ")::lhaGenerator(rOtherGen)");
701 FD_DG( "lhaGenerator(" << this << ")::lhaGenerator(rOtherGen) with csymtab");
705TEMP THIS::TlhaGenerator( const std::string& rFileName) : BASE(rFileName) {
706 FD_DG( "lhaGenerator(" << this << ")::lhaGenerator(" << rFileName << ")");
715 res->EventSymbolTablep(BASE::mpEventSymbolTable);
716 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
730TEMP int THIS::Dimension( void) const {
731 return BASE::pGlobalAttribute->mStateSpace.Dimension();
736 return BASE::pGlobalAttribute->mStateSpace;
747 BASE::pGlobalAttribute->mStateSpace=states;
752 if(!BASE::ExistsState(stateindex)) {
753 std::stringstream errstr;
754 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
755 throw Exception( "lhaGenerator::Invariant", errstr.str(), 90);
757 return BASE::pStates->Attribute(stateindex).mInvariant;
762 if(!BASE::ExistsState(stateindex)) {
763 std::stringstream errstr;
764 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
765 throw Exception( "lhaGenerator::Invariant", errstr.str(), 90);
767 return &BASE::pStates->Attributep(stateindex)->mInvariant;
772 if(!BASE::ExistsState(stateindex)) {
773 std::stringstream errstr;
774 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
775 throw Exception( "lhaGenerator::Invariant", errstr.str(), 90);
777 if(Dimension()!=rInvariant. Dimension()) {
778 std::stringstream errstr;
779 errstr << "dimension mismatch for state index " << stateindex;
780 throw Exception( "lhaGenerator::Invariant", errstr.str(), 700);
782 BASE::pStates->Attributep(stateindex)->mInvariant=rInvariant;
787 Idx idx=BASE::StateIndex(statename);
788 return Invariant(idx);
792TEMP void THIS::Invariant( const std::string& statename, const Polyhedron& rInvariant) {
793 Idx idx=BASE::StateIndex(statename);
794 Invariant(idx,rInvariant);
801 if(!BASE::ExistsState(stateindex)) {
802 std::stringstream errstr;
803 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
804 throw Exception( "lhaGenerator::InitialConstraint", errstr.str(), 90);
806 const Polyhedron& iconstraint = BASE::pStates->Attributep(stateindex)->mInitialConstraint;
807 if(iconstraint. Dimension()==0) const_cast< Polyhedron& >(iconstraint).Dimension(Dimension());
813 if(!BASE::ExistsState(stateindex)) {
814 std::stringstream errstr;
815 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
816 throw Exception( "lhaGenerator::InitialConstraint", errstr.str(), 90);
818 Polyhedron& iconstraint = BASE::pStates->Attributep(stateindex)->mInitialConstraint;
825 if(!BASE::ExistsState(stateindex)) {
826 std::stringstream errstr;
827 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
828 throw Exception( "lhaGenerator::InitialConstraint", errstr.str(), 90);
830 if(Dimension()!=rInitialConstraint. Dimension()) {
831 std::stringstream errstr;
832 errstr << "dimension mismatch for state index " << stateindex;
833 throw Exception( "lhaGenerator::InitialConstraint", errstr.str(), 700);
835 BASE::pStates->Attributep(stateindex)->mInitialConstraint=rInitialConstraint;
839TEMP const Polyhedron& THIS::InitialConstraint( const std::string& statename) const {
840 Idx idx=BASE::StateIndex(statename);
841 return InitialConstraint(idx);
845TEMP void THIS::InitialConstraint( const std::string& statename, const Polyhedron& rInitialConstraint) {
846 Idx idx=BASE::StateIndex(statename);
847 InitialConstraint(idx,rInitialConstraint);
852 if(!BASE::ExistsState(stateindex)) {
853 std::stringstream errstr;
854 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
855 throw Exception( "lhaGenerator::Rate", errstr.str(), 90);
857 return BASE::pStates->Attribute(stateindex).mRate;
862 if(!BASE::ExistsState(stateindex)) {
863 std::stringstream errstr;
864 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
865 throw Exception( "lhaGenerator::Rate", errstr.str(), 90);
867 return &BASE::pStates->Attributep(stateindex)->mRate;
872 if(!BASE::ExistsState(stateindex)) {
873 std::stringstream errstr;
874 errstr << "state index " << stateindex << " not found in StateSet" << std::endl;
875 throw Exception( "lhaGenerator::Rate", errstr.str(), 90);
878 std::stringstream errstr;
879 errstr << "dimension mismatch for state index " << stateindex;
880 throw Exception( "lhaGenerator::Rate", errstr.str(), 700);
882 BASE::pStates->Attributep(stateindex)->mRate=rRate;
887 Idx idx=BASE::StateIndex(statename);
893 Idx idx=BASE::StateIndex(statename);
901 if(!BASE::ExistsTransition(trans)) {
902 std::stringstream errstr;
903 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
904 throw Exception( "lhaGenerator::Guard", errstr.str(), 90);
906 const Polyhedron& guard = BASE::pTransRel->Attributep(trans)->mGuard;
907 if(guard. Size()==0) const_cast< Polyhedron& >(guard).Dimension(Dimension());
913 if(!BASE::ExistsTransition(trans)) {
914 std::stringstream errstr;
915 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
916 throw Exception( "lhaGenerator::Guard", errstr.str(), 90);
918 Polyhedron& guard = BASE::pTransRel->Attributep(trans)->mGuard;
919 if(guard. Size()==0) const_cast< Polyhedron& >(guard).Dimension(Dimension());
925 if(!BASE::ExistsTransition(trans)) {
926 std::stringstream errstr;
927 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
928 throw Exception( "lhaGenerator::Guard", errstr.str(), 90);
931 std::stringstream errstr;
932 errstr << "dimension mismatch for guard at transition " << trans. Str();
933 throw Exception( "lhaGenerator::Guard", errstr.str(), 700);
935 BASE::pTransRel->Attributep(trans)->mGuard=rGuard;
941 if(!BASE::ExistsTransition(trans)) {
942 std::stringstream errstr;
943 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
944 throw Exception( "lhaGenerator::Reset", errstr.str(), 90);
946 const LinearRelation& reset = BASE::pTransRel->Attributep(trans)->mReset;
953 if(!BASE::ExistsTransition(trans)) {
954 std::stringstream errstr;
955 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
956 throw Exception( "lhaGenerator::Reset", errstr.str(), 90);
958 LinearRelation& reset = BASE::pTransRel->Attributep(trans)->mReset;
965 if(!BASE::ExistsState(trans)) {
966 std::stringstream errstr;
967 errstr << "transition " << trans. Str() << " not found in TransRel" << std::endl;
968 throw Exception( "lhaGenerator::Reset", errstr.str(), 90);
971 std::stringstream errstr;
972 errstr << "dimension mismatch for guard at transition " << trans. Str();
973 throw Exception( "lhaGenerator::Reset", errstr.str(), 700);
975 BASE::pTransRel->Attributep(trans)->mReset=rReset;
981TEMP bool THIS::Valid( void) const {
982 FD_DG( "lhaGenerator(" << this << ")::Valid()");
984 if(!BASE::Valid()) return false;
986 StateSet::Iterator sit;
987 for(sit = BASE::StatesBegin(); sit!= BASE::StatesEnd(); ++sit) {
988 if(Invariant(*sit).Dimension()!=Dimension()) return false;
991 for(tit = BASE::TransRelBegin(); tit!= BASE::TransRelEnd(); ++tit) {
992 if(Guard(*tit).Dimension()!=Dimension()) return false;
993 if(Reset(*tit).Dimension()!=Dimension()) return false;
1001TEMP bool THIS::UpdateAttributes( void) {
1002 FD_DG( "lhaGenerator(" << this << ")::UpdateAttributes()");
1009 FD_DG( "lhaGenerator(" << this << ")::DoRead(...)");
1010 std::cout << "lhaGenerator(" << this << ")::DoRead(...)";
1012 BASE::DoRead(rTr,rLabel,pContext);
1014 StateSet::Iterator sit;
1015 for(sit = BASE::StatesBegin(); sit!= BASE::StatesEnd(); ++sit) {
1016 if(Invariant(*sit).Dimension()==0) Invariantp(*sit)->Dimension(Dimension());
1017 if(Invariant(*sit).Dimension()!=Dimension()) {
1018 std::stringstream errstr;
1019 errstr << "dimension mismatch for invariant at state index " << *sit;
1020 throw Exception( "lhaGenerator::DoRead", errstr.str(), 700);
1022 if(InitialConstraint(*sit).Dimension()==0) InitialConstraintp(*sit)->Dimension(Dimension());
1023 if(InitialConstraint(*sit).Dimension()!=Dimension()) {
1024 std::stringstream errstr;
1025 errstr << "dimension mismatch for initial constraint at state index " << *sit;
1026 throw Exception( "lhaGenerator::DoRead", errstr.str(), 700);
1028 if(Rate(*sit).Dimension()==0) Ratep(*sit)->Dimension(Dimension());
1029 if(Rate(*sit).Dimension()!=Dimension()) {
1030 std::stringstream errstr;
1031 errstr << "dimension mismatch for rate at state index " << *sit;
1032 throw Exception( "lhaGenerator::DoRead", errstr.str(), 700);
1036 for(tit = BASE::TransRelBegin(); tit!= BASE::TransRelEnd(); ++tit) {
1037 if(Guard(*tit).Dimension()==0) Guardp(*tit)->Dimension(Dimension());
1038 if(Guard(*tit).Dimension()!=Dimension()) {
1039 std::stringstream errstr;
1040 errstr << "dimension mismatch for guard transition index " << tit->Str();
1041 throw Exception( "lhaGenerator::DoRead", errstr.str(), 700);
1043 if(Reset(*tit).Dimension()==0) Resetp(*tit)->Dimension(Dimension());
1044 if(Reset(*tit).Dimension()!=Dimension()) {
1045 std::stringstream errstr;
1046 errstr << "dimension mismatch for reset transition index " << tit->Str();
1047 throw Exception( "lhaGenerator::DoRead", errstr.str(), 700);
1054 this->DoXWrite(rTw,rLabel,pContext);
bool Identity(void) const
int Dimension(void) const
int Dimension(void) const
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
virtual TaGenerator & Copy(const Type &rSrc)
virtual bool UpdateAttributes(void)
TlhaGenerator * NewCpy(void) const
virtual bool Valid(void) const
virtual void DoRead(TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
const Polyhedron & Rate(Idx idx) const
const Polyhedron & InitialConstraint(Idx idx) const
Polyhedron * Guardp(const Transition &rTrans)
virtual const Type * Cast(const Type *pOther) const
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
int Dimension(void) const
const Polyhedron & StateSpace(void) const
TlhaGenerator * New(void) const
Polyhedron * InitialConstraintp(Idx idx)
virtual TlhaGenerator & operator=(const TlhaGenerator &rOtherGen)
const Polyhedron & Guard(const Transition &rTrans) const
Polyhedron * Ratep(Idx idx)
const Polyhedron & Invariant(Idx idx) const
const LinearRelation & Reset(const Transition &rTrans) const
LinearRelation * Resetp(const Transition &rTrans)
Polyhedron * Invariantp(Idx idx)
std::string Str(void) const
TaIndexSet< AttributeLhaState > LhaStateSet
TaTransSet< AttributeLhaTrans > LhaTransSet
TlhaGenerator< AttributeLhaGlobal, AttributeLhaState, AttributeCFlags, AttributeLhaTrans > LinearHybridAutomaton
libFAUDES 2.34d
--- 2026.03.11
--- c++ api documentaion by doxygen
|