Mercurial > hg > svcore
comparison transform/Transform.h @ 400:78dd9b35559b
* transform operator<
author | Chris Cannam |
---|---|
date | Thu, 03 Apr 2008 08:30:25 +0000 |
parents | 370aa9714ef5 |
children | 4c000e196bf1 |
comparison
equal
deleted
inserted
replaced
399:0f0f08c22552 | 400:78dd9b35559b |
---|---|
19 #include "base/XmlExportable.h" | 19 #include "base/XmlExportable.h" |
20 #include "base/Window.h" | 20 #include "base/Window.h" |
21 #include "base/RealTime.h" | 21 #include "base/RealTime.h" |
22 | 22 |
23 #include <QString> | 23 #include <QString> |
24 | |
25 #include <map> | |
24 | 26 |
25 typedef QString TransformId; | 27 typedef QString TransformId; |
26 | 28 |
27 class QXmlAttributes; | 29 class QXmlAttributes; |
28 | 30 |
53 | 55 |
54 /** | 56 /** |
55 * Compare two Transforms. They only compare equal if every data | 57 * Compare two Transforms. They only compare equal if every data |
56 * element matches. | 58 * element matches. |
57 */ | 59 */ |
58 bool operator==(const Transform &); | 60 bool operator==(const Transform &) const; |
61 | |
62 /** | |
63 * Order two Transforms, so that they can be used as keys in | |
64 * containers. | |
65 */ | |
66 bool operator<(const Transform &) const; | |
59 | 67 |
60 void setIdentifier(TransformId id); | 68 void setIdentifier(TransformId id); |
61 TransformId getIdentifier() const; | 69 TransformId getIdentifier() const; |
62 | 70 |
63 enum Type { FeatureExtraction, RealTimeEffect }; | 71 enum Type { FeatureExtraction, RealTimeEffect }; |
137 | 145 |
138 static void parseIdentifier | 146 static void parseIdentifier |
139 (QString identifier, | 147 (QString identifier, |
140 QString &type, QString &soName, QString &label, QString &output); | 148 QString &type, QString &soName, QString &label, QString &output); |
141 | 149 |
150 template <typename A, typename B> | |
151 bool mapLessThan(const std::map<A, B> &a, const std::map<A, B> &b) const { | |
152 // Return true if a is "less than" b. Ordering doesn't have | |
153 // to be meaningful, just consistent. | |
154 typename std::map<A, B>::const_iterator i; | |
155 typename std::map<A, B>::const_iterator j; | |
156 for (i = a.begin(), j = b.begin(); i != a.end(); ++i) { | |
157 if (j == b.end()) return false; // a is longer than b | |
158 if (i->first != j->first) return i->first < j->first; | |
159 if (i->second != j->second) return i->second < j->second; | |
160 } | |
161 if (j != b.end()) return true; // a is shorter than b | |
162 return false; // equal | |
163 } | |
164 | |
142 ParameterMap m_parameters; | 165 ParameterMap m_parameters; |
143 ConfigurationMap m_configuration; | 166 ConfigurationMap m_configuration; |
144 QString m_pluginVersion; | 167 QString m_pluginVersion; |
145 QString m_program; | 168 QString m_program; |
146 size_t m_stepSize; | 169 size_t m_stepSize; |