]> Devoid-pointer.net GitWeb - anyanka.git/commitdiff
Eradicate unordered_maps, round 2
authorMichal Maly <madcatxster@devoid-pointer.net>
Sat, 2 Aug 2014 07:48:27 +0000 (09:48 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sat, 2 Aug 2014 07:50:48 +0000 (09:50 +0200)
datamanager.cpp
singlerundata.h

index 6175aba6fb2a065063b4fb27c64cac246b2df737..74fdbea584720cf85ea9f4b5645217bfba08c749 100644 (file)
@@ -688,12 +688,10 @@ void DataManager::onSingleRunSelected(const QString& key)
 
   std::shared_ptr<SingleRunData> srdata = m_activeSequence->selectedRun();
   emit cleanDashboard();
-  std::vector<std::string> allKeys = srdata->allKeys();
-  std::vector<std::string>::const_reverse_iterator rit = allKeys.crbegin();
-  qDebug() << QString::fromStdString(*rit);
-  while (rit != allKeys.crend()) {
-    showOneSignal(srdata->controllerAt(*rit));
-    rit++;
+  SignalControllersMap::iterator it = srdata->ctrls_begin();
+  while (it != srdata->ctrls_end()) {
+    showOneSignal(it->second);
+    it++;
   }
 
   emit setSingleRunInfo(srdata->methodName(), srdata->operatorName(), srdata->sampleInfo(), srdata->date().toString() +" "+ srdata->time().toString());
index 24197177ada2d7c0b6448b8cf61003300e2a90b7..b27cb4bd8d305de3a0e6e19d1a7478bf3c50db22 100644 (file)
@@ -31,8 +31,8 @@
 #include <QtCore/QObject>
 #include <QtCore/QTime>
 
-typedef std::unordered_map<std::string, std::shared_ptr<SignalController>> SignalControllersMap;
-typedef std::unordered_map<std::string, std::shared_ptr<Signal>> SignalsMap;
+typedef std::map<std::string, std::shared_ptr<SignalController>> SignalControllersMap;
+typedef std::map<std::string, std::shared_ptr<Signal>> SignalsMap;
 
 class SingleRunData : public QObject
 {
@@ -45,9 +45,11 @@ public:
   const SignalControllersMap& allControllers() const { return m_ctrls; }
   std::vector<std::string> allKeys() const;
   const SignalsMap& allSignals() const { return m_signals; }
+  SignalControllersMap::iterator ctrls_begin() { return m_ctrls.begin(); }
   std::shared_ptr<SignalController> controllerAt(const std::string& key);
   QDate date() const { return m_date; }
   QString dirName() const { return m_dirName; }
+  SignalControllersMap::iterator ctrls_end() { return m_ctrls.end(); }
   QString methodName() const { return m_methodName; }
   QString operatorName() const { return m_operatorName; }
   void readUserDataFromJSON();