diff --git a/rs.cc b/rs.cc index 1f22c00..5df678a 100644 --- a/rs.cc +++ b/rs.cc @@ -101,6 +101,16 @@ Process RctSys::getProcessID(std::string processName) return processes_names[processName]; } +std::string RctSys::getProcessName(Process processID) +{ + if (processID < processes_ids.size()) + return processes_ids[processID]; + else + { + FERROR("No such process ID: " << processID); + } +} + void RctSys::pushReactant(std::string entityName) { if (!hasEntity(entityName)) @@ -155,12 +165,20 @@ std::string RctSys::entitiesToStr(const Entities &entities) void RctSys::showReactions(void) { cout << "# Reactions:" << endl; - for (auto r = reactions.begin(); r != reactions.end(); ++r) - { - cout << " * (R={" << entitiesToStr(r->rctt) << "}," - << "I={" << entitiesToStr(r->inhib) << "}," - << "P={" << entitiesToStr(r->prod) << "})" << endl; - } + + for (unsigned int proc_id = 0; proc_id < processes_ids.size(); ++proc_id) + { + cout << endl; + cout << " . proc = \"" << getProcessName(proc_id) << "\":" << endl; + for (const auto &r : proc_reactions[proc_id]) + { + cout << " * (R={" << entitiesToStr(r.rctt) << "}," + << "I={" << entitiesToStr(r.inhib) << "}," + << "P={" << entitiesToStr(r.prod) << "})" << endl; + } + + } + cout << endl; } void RctSys::pushStateEntity(std::string entityName) diff --git a/rs.hh b/rs.hh index 3b48d63..350d336 100644 --- a/rs.hh +++ b/rs.hh @@ -43,6 +43,7 @@ class RctSys void addProcess(std::string processName); bool hasProcess(std::string processName); Process getProcessID(std::string processName); + std::string getProcessName(Process processID); void addReactionForCurrentProcess(Reaction reaction);