summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhu, Yongsheng <yongsheng.zhu@intel.com>2010-08-25 14:12:58 +0800
committerPatrick Ohly <patrick.ohly@intel.com>2010-08-25 08:41:18 +0200
commitc8b1f3a07da6f85cdc40063488a1b4ea4b7c9bbb (patch)
tree63edd60012845431af89359fa5a65d4f02170703
parent5e864b8c65e67e9c33fd275b9926ad1c67915bd5 (diff)
client-test: avoid duplicate sources in m_localSource2Configmbc5753
do checking to avoid duplicate before pushing back a source into m_localSource2Config for TestEvolution. Virtual sources may contain many sub-sources, which might duplicate other sources.
-rw-r--r--src/client-test-app.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/client-test-app.cpp b/src/client-test-app.cpp
index fb39b6f6..8d784ba2 100644
--- a/src/client-test-app.cpp
+++ b/src/client-test-app.cpp
@@ -198,10 +198,10 @@ public:
vector<string> subs;
boost::split (subs, conf.subConfigs, boost::is_any_of(","));
BOOST_FOREACH (string sub, subs) {
- m_localSource2Config.push_back (sub);
+ pushLocalSource2Config(sub);
}
} else {
- m_localSource2Config.push_back (source);
+ pushLocalSource2Config(source);
}
}
// get configuration and set obligatory fields
@@ -437,6 +437,20 @@ private:
SyncSource *ss = SyncSource::createSource(params);
return static_cast<TestingSyncSource *>(ss);
}
+
+ // push source into localsource2config if it doesn't exist in the vector
+ void pushLocalSource2Config(const string &source) {
+ bool finded = false;
+ BOOST_FOREACH(string element, m_localSource2Config) {
+ if (boost::iequals(element, source)) {
+ finded = true;
+ break;
+ }
+ }
+ if (!finded) {
+ m_localSource2Config.push_back (source);
+ }
+ }
};
static void handler(int sig)