From fd6e65e7d7fb0663427e2d13ef10ad88ac3cdd44 Mon Sep 17 00:00:00 2001 From: Roland Jax Date: Sun, 28 Sep 2014 21:01:51 +0200 Subject: [PATCH] class CYCData: methode addCommands added. --- src/cycdata.cpp | 20 +++++++++++++------- src/cycdata.h | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/cycdata.cpp b/src/cycdata.cpp index ee6e512d..06918466 100644 --- a/src/cycdata.cpp +++ b/src/cycdata.cpp @@ -27,13 +27,7 @@ extern LogInstance& L; CYCData::CYCData(EBusLoop* ebusloop, Commands* commands) : m_ebusloop(ebusloop), m_commands(commands), m_stop(false) { - for (size_t index = 0; index < commands->size(); index++) { - if (strcasecmp((*m_commands)[index][0].c_str(),"cyc") == 0) { - Command* cmd = new Command(index, (*m_commands)[index]); - m_cycDB.insert(pair_t(index, cmd)); - } - } - + addCommands(m_commands); } CYCData::~CYCData() @@ -139,3 +133,15 @@ void CYCData::storeData(int index, std::string data) } } +void CYCData::addCommands(Commands* commands) +{ + for (size_t index = 0; index < commands->size(); index++) { + if (strcasecmp((*m_commands)[index][0].c_str(),"cyc") == 0) { + Command* cmd = new Command(index, (*m_commands)[index]); + m_cycDB.insert(pair_t(index, cmd)); + } + } + + L.log(cyc, trace, "%d cycle commands added", m_cycDB.size()); +} + diff --git a/src/cycdata.h b/src/cycdata.h index b1843c35..949a3d33 100644 --- a/src/cycdata.h +++ b/src/cycdata.h @@ -43,6 +43,8 @@ public: std::string getData(int index); + void addCommands(Commands* commands); + private: EBusLoop* m_ebusloop; Commands* m_commands;