diff --git a/ctx_aut.hh b/ctx_aut.hh index 7c81aa1..8bf03ba 100644 --- a/ctx_aut.hh +++ b/ctx_aut.hh @@ -40,6 +40,7 @@ class CtxAut void showTransitions(void); void pushContextEntity(Entity entity_id); void setOptions(Options *opts) { this->opts = opts; } + size_t statesCount(void) { return states_ids.size(); } private: RctSys *parent_rctsys; diff --git a/rs.cc b/rs.cc index 240f0f2..acb04ff 100644 --- a/rs.cc +++ b/rs.cc @@ -172,14 +172,12 @@ void RctSys::showInitialStates(void) void RctSys::printSystem(void) { - showInitialStates(); + if (!usingContextAutomaton()) + showInitialStates(); showActionEntities(); showReactions(); - if (ctx_aut != nullptr) - { - ctx_aut->printAutomaton(); - } + if (ctx_aut != nullptr) ctx_aut->printAutomaton(); } void RctSys::ctxAutEnable(void) diff --git a/rs.hh b/rs.hh index a2a7bdd..513a4bf 100644 --- a/rs.hh +++ b/rs.hh @@ -76,6 +76,7 @@ class RctSys void ctxAutPushNamedContextEntity(std::string entity_name); bool initStatesDefined(void) { return initStates.size() != 0; } + bool usingContextAutomaton(void) { return ctx_aut != nullptr; } private: Reactions reactions; diff --git a/symrs.cc b/symrs.cc index 302f4e4..e4c03e9 100644 --- a/symrs.cc +++ b/symrs.cc @@ -320,7 +320,7 @@ void SymRS::encodeInitStates(void) if (opts->part_tr_rel) assert(partTrans != nullptr); #endif - + initStates = new BDD(BDD_FALSE); for (auto state = rs->initStates.begin(); diff --git a/types.hh b/types.hh new file mode 100644 index 0000000..87b0e86 --- /dev/null +++ b/types.hh @@ -0,0 +1,41 @@ +/* + Copyright (c) 2018 + Artur Meski + + Reuse of the code or its part for any purpose + without the author's permission is strictly prohibited. +*/ + +#ifndef RS_TYPES_HH +#define RS_TYPES_HH + +#include +#include +#include +#include + +typedef unsigned int Entity; +typedef std::set Entities; +struct Reaction { + Entities rctt; + Entities inhib; + Entities prod; +}; +typedef std::vector Reactions; +typedef std::vector EntitiesByIds; +typedef std::map EntitiesByName; +typedef std::set EntitiesSets; + +typedef unsigned int State; +typedef std::vector StatesById; +typedef std::map StatesByName; + +struct Transition { + State src_state; + Entities ctx; + State dst_state; +}; + +typedef std::vector Transitions; + +#endif