Isis 3 Programmer Reference
GroupedStatistics.cpp
1 #include "GroupedStatistics.h"
2 #include "Statistics.h"
3 
4 #include <QMap>
5 #include <QVector>
6 #include <QString>
7 
8 namespace Isis {
9 
12  groupedStats = NULL;
14  }
15 
16 
23  groupedStats = NULL;
25  }
26 
27 
30  if(groupedStats) {
31  delete groupedStats;
32  groupedStats = NULL;
33  }
34  }
35 
36 
45  void GroupedStatistics::AddStatistic(const QString &statType, const
46  double &newStat) {
47  (*groupedStats)[statType].AddData(newStat);
48  }
49 
50 
60  const Statistics &GroupedStatistics::GetStatistics(const QString &statType)
61  const {
63  i = groupedStats->constFind(statType);
64 
65  if(i == groupedStats->constEnd()) {
66  QString msg = statType;
67  msg += " passed to GetStats but does not exist within the map";
69  }
70 
71  return i.value();
72  }
73 
74 
82  const {
83  QVector< QString > statTypes;
84 
85  // for each key in the groupedStats QMap add the key to a vector
87  while(i != groupedStats->constEnd()) {
88  statTypes.push_back(i.key());
89  i++;
90  }
91 
92  return statTypes;
93  }
94 
95 
102  & other) {
103  delete groupedStats;
104  groupedStats = NULL;
105 
107 
108  return *this;
109  }
110 }
const Statistics & GetStatistics(const QString &statType) const
Get statistics for a given type of data.
~GroupedStatistics()
destroy a GroupedStatistics object
GroupedStatistics()
construct a GroupedStatistics object
Grouped Statistics.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
const QVector< QString > GetStatisticTypes() const
Return a list of all the different statistic tyes that this GroupedStatistics has.
GroupedStatistics & operator=(const GroupedStatistics &other)
Assign a GroupedStatistics with another GroupedStatistics using =.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QMap< QString, Statistics > * groupedStats
Map from statistic type to Statistics object.
void AddStatistic(const QString &statType, const double &newStat)
Add a new data entry for a given type of data.