Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryParameterizedCommand.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef BERRYPARAMETERIZEDCOMMAND_H_
18 #define BERRYPARAMETERIZEDCOMMAND_H_
19 
20 #include <berryObject.h>
21 #include <berryMacros.h>
22 
25 
26 #include <list>
27 #include <map>
28 
29 namespace berry
30 {
31 
32 struct IParameter;
33 class Command;
34 class Parameterization;
35 
45 { //implements Comparable {
46 
47 public:
48 
50 
51 
56  static const int INDEX_PARAMETER_ID; // = 0;
57 
64  static const int INDEX_PARAMETER_NAME; // = 1;
65 
72  static const int INDEX_PARAMETER_VALUE_NAME; // = 2;
73 
79  static const int INDEX_PARAMETER_VALUE_VALUE; // = 3;
80 
93  const QList<Parameterization>& parameterizations);
94 
95  bool operator<(const Object* object) const override;
96 
97  bool operator==(const Object* object) const override;
98 
121  Object::Pointer ExecuteWithChecks(const Object::ConstPointer& trigger,
122  const Object::Pointer& applicationContext);
123 
130  SmartPointer<Command> GetCommand() const;
131 
138  QString GetId() const;
139 
149  QString GetName() const;
150 
159  QHash<QString, QString> GetParameterMap() const;
160 
161  uint HashCode() const override;
162 
219  QString Serialize();
220 
221  QString ToString() const override;
222 
244  static QList<ParameterizedCommand::Pointer>
245  GenerateCombinations(const SmartPointer<Command> command);
246 
259  static ParameterizedCommand::Pointer GenerateCommand(const SmartPointer<Command> command,
260  const QHash<QString, Object::Pointer>& parameters);
261 
262 private:
263 
268  static const uint HASH_CODE_NOT_COMPUTED; // = 0;
269 
273  static const uint HASH_FACTOR; // = 89;
274 
278  static const uint HASH_INITIAL;
279 
296  static QString Escape(const QString& rawText);
297 
311  static QList<QList<Parameterization> > ExpandParameters(unsigned int startIndex,
312  const QList<SmartPointer<IParameter> >& parameters);
313 
318  const SmartPointer<Command> command;
319 
324  mutable uint hashCode;
325 
330  QList<Parameterization> parameterizations;
331 
332  mutable QString name;
333 
334 };
335 
336 }
337 
338 #endif /* BERRYPARAMETERIZEDCOMMAND_H_ */
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:78
Implements transparent reference counting.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
#define berryObjectMacro(...)
Definition: berryMacros.h:37
unsigned int uint
static std::string GetName(std::string fileName, std::string suffix)