MeVisLab Toolbox Reference
mlImagePropertyExtensionContainer.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_IMAGE_PROPERTY_EXTENSION_CONTAINER_H
14 #define ML_IMAGE_PROPERTY_EXTENSION_CONTAINER_H
15 
20 
22 
23 ML_UTILS_START_NAMESPACE
24 
26 class RuntimeType;
28 
29 //-------------------------------------------------------------------------
35 //-------------------------------------------------------------------------
37 public:
38 
39  //-------------------------------------------------------------------
42  //-------------------------------------------------------------------
45 
48 
50  ImagePropertyExtensionContainer(const ImagePropertyExtensionContainer& imagePropertyExtensionContainer);
51 
54 
58  bool operator==(const ImagePropertyExtensionContainer& imagePropertyExtensionContainer) const;
59 
64  bool operator!=(const ImagePropertyExtensionContainer& imagePropertyExtensionContainer) const;
65 
67 
68 
69 
70  //-------------------------------------------------------------------
73  //-------------------------------------------------------------------
74 
76  size_t getNumEntries() const;
77 
81  ImagePropertyExtension* getEntry(size_t position);
82 
86  const ImagePropertyExtension* getEntry(size_t position) const;
87 
89 
90 
91  //-------------------------------------------------------------------
94  //-------------------------------------------------------------------
97  int findEntry(const ImagePropertyExtension* entry) const;
98 
101  int findFirstEntryOfType(const RuntimeType* runtimeType) const;
102 
107 
111  const ImagePropertyExtension* getFirstEntryOfType(const RuntimeType* runtimeType) const;
112 
117 
121 
123  size_t getNumEntriesOfType(const RuntimeType* runtimeType) const;
124 
126 
127 
128  //-------------------------------------------------------------------
131  //-------------------------------------------------------------------
132 
134  void clear();
135 
140  bool removeEntry(size_t position);
141 
145  bool removeEntry(const ImagePropertyExtension* propertyExtension);
146 
148  void removeEntriesOfType(const RuntimeType* runtimeType);
149 
151 
152 
153  //-------------------------------------------------------------------
156  //-------------------------------------------------------------------
157 
160  void append(ImagePropertyExtension* propertyExtension);
161 
166 
168 
171  void getValueAsString(std::string &valueAsString) const;
172 
173 protected:
174 
177 
178 
179 private:
180 
182  ImagePropertyExtensionVector _propExtensions;
183 
184 };
185 
186 ML_UTILS_END_NAMESPACE
187 
188 
189 //-----------------------------------------------------------------------------------
190 // Stream output for std::ostream
191 //-----------------------------------------------------------------------------------
192 namespace std {
193 
195  ML_UTILS_EXPORT ostream& operator<<(ostream& s, const ML_NAMESPACE::ImagePropertyExtensionContainer &ipContainer);
196 
197 }
198 
199 #endif //of __mlImagePropertyExtensionContainer_H
200 
201 
202 
This class is a container for extended image properties derived from ImagePropertyExtension.
ImagePropertyExtension * appendClone(const ImagePropertyExtension &propertyExtension)
Appends a clone of the PropertyExtension object propertyExtension at the end of the container and ret...
ImagePropertyExtensionContainer(const ImagePropertyExtensionContainer &imagePropertyExtensionContainer)
Copy constructor from an existing ImagePropertyExtensionContainer object.
const ImagePropertyExtension * getEntry(size_t position) const
Returns the entry in container at index position (const version).
ImagePropertyExtension * getEntry(size_t position)
Returns the entry in container at index position (non-const version).
void removeEntriesOfType(const RuntimeType *runtimeType)
Removes all entries from the container which are of type runtimeType.
int findFirstEntryOfType(const RuntimeType *runtimeType) const
Searches for the first entry with RuntimeType runtimeType and returns its index.
void clear()
Removes all entries from the container.
bool removeEntry(size_t position)
Erases the entry at the given position from the container and deletes the corresponding PropertyExten...
const ImagePropertyExtension * getFirstEntryOfType(const RuntimeType *runtimeType) const
Returns the first entry in container with runtime type runtimeType (const version).
bool operator!=(const ImagePropertyExtensionContainer &imagePropertyExtensionContainer) const
Returns true if *this and \ imagePropertyExtensionContainer are not identical, otherwise false.
size_t getNumEntriesOfType(const RuntimeType *runtimeType) const
Returns the number of property extensions of type runtimeType in the container.
ImagePropertyExtensionContainer()
Constructor which builds an empty container.
void append(ImagePropertyExtension *propertyExtension)
Appends the PropertyExtension object \ propertyExtension at the end of the container.
virtual ~ImagePropertyExtensionContainer()
Destructor.
int findEntry(const ImagePropertyExtension *entry) const
Searches for an entry referring to the specified entry and returns its index.
size_t getNumEntries() const
Returns the number of property extensions in the container.
ImagePropertyExtensionContainer & operator=(const ImagePropertyExtensionContainer &imagePropertyExtensionContainer)
Assignment operator from an existing ImagePropertyExtension object, produces a copy.
ImagePropertyExtensionVector cloneEntriesOfType(const RuntimeType *runtimeType) const
Returns a vector of clones of all property extensions of type runtimeType in container.
bool operator==(const ImagePropertyExtensionContainer &imagePropertyExtensionContainer) const
Returns true if *this and imagePropertyExtensionContainer are identical, otherwise false.
bool removeEntry(const ImagePropertyExtension *propertyExtension)
Erases the entry referring to specified propertyExtension from the container and deletes the correspo...
ImagePropertyExtensionVector getEntriesOfType(const RuntimeType *runtimeType)
Returns a vector of all property extensions of type runtimeType in the container.
void getValueAsString(std::string &valueAsString) const
Conversion to string providing the same result as returned by operator<<.
void appendClones(const ImagePropertyExtensionContainer &container)
Appends clones of entries of container to the container.
ImagePropertyExtension * getFirstEntryOfType(const RuntimeType *runtimeType)
Returns the first entry in the container with runtime type runtimeType (non-const version).
Base class from which one can derive own image properties.
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
Definition: mlRuntimeType.h:53
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator "<<" for stream output of Field objects.
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
Definition: mlUtilities.h:20
std::vector< ImagePropertyExtension * > ImagePropertyExtensionVector
Define the STL container type of ImagePropertyExtension objects.