MeVisLab Toolbox Reference
mlRasterFunctionList.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_RASTER_FUNCTION_LIST_H
14 #define ML_RASTER_FUNCTION_LIST_H
15 
16 
18 
19 // This class maintains a list of raster functions.
20 // It uses an stl vector to manage the list.
21 // The class is derived from Base to have a common base class
22 // for some classes and to have the possibility to add persistence
23 // to the object later.
24 
25 //ML-includes
26 #include "mlBaseInit.h"
27 #include "mlRasterFunction.h"
28 
29 ML_START_NAMESPACE
30 
31 //--------------------------------------------------------------------------------
33 //--------------------------------------------------------------------------------
35 
36 public:
39 
41  ~RasterFunctionList() override {};
42 
44  //virtual std::vector<RasterFunction> &getList() { return objects; }
45 
47  virtual size_t getListSize()
48  { return objects.size(); }
49 
51  virtual void setListElement(size_t idx, const RasterFunction &elem)
52  { objects[idx]=elem; }
53 
55  virtual void appendToList(const RasterFunction &elem)
56  { objects.push_back(elem); }
57 
59  virtual const RasterFunction &getListElement(size_t idx)
60  { return objects[idx]; }
61 
63  std::string persistentState() const override { return {}; }
64 
65  void setPersistentState(const std::string& /*state*/) override { }
66 
67 #if ML_DEPRECATED_SINCE(3,5,0)
68  [[nodiscard]][[deprecated]] char* getPersistentState() const override { return nullptr; }
69 
71  [[deprecated]] void setPersistentState(const char* /*state*/) override { }
72 
74  [[deprecated]]void clearPersistentState(char* /*state*/) const override { }
75 #endif
79 
82  void setValue(MLssize_t index, const RasterFunction& obj);
83 
85  void removeValue(MLssize_t index = -1);
86 
88  void clear();
89 
90 private:
91 
92  //--------------------------------------------------------------------------------
95  //--------------------------------------------------------------------------------
97 
99  std::vector<RasterFunction> objects;
100 };
101 
102 ML_END_NAMESPACE
103 
104 #endif // of __mlRasterFunctionList_H
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition: mlBase.h:62
virtual void setPersistentState(const std::string &state)
Restores the object's internal state from a string that had been previously generated using persisten...
virtual void clearPersistentState(char *) const
Disposes a string previously allocated by getPersistentState().
Definition: mlBase.h:123
virtual char * getPersistentState() const
Returns a C string describing the object's internal state.
Definition: mlBase.h:115
Base object class to handle a list of raster functions.
void clear()
Clears the inner list.
std::string persistentState() const override
Persistence support. Still unimplemented, only for later usage.
virtual void appendToList(const RasterFunction &elem)
Permits access to the list of raster functions.
void setPersistentState(const std::string &) override
Restores the object's internal state from a string that had been previously generated using persisten...
RasterFunction * getPtr(MLssize_t index=-1)
Returns pointer to the RasterFunction at given index index.
RasterFunctionList()
Constructor. It does nothing, i.e. an empty list is created.
void setValue(MLssize_t index, const RasterFunction &obj)
Sets new raster function obj at index index, index -1 sets the last element.
void removeValue(MLssize_t index=-1)
Remove RasterFunction from list. If index is -1 the last element is removed.
virtual const RasterFunction & getListElement(size_t idx)
Permits access to the list of raster functions.
virtual void setListElement(size_t idx, const RasterFunction &elem)
Permits access to the list of raster functions.
~RasterFunctionList() override
Destructor. It removes all handled raster functions and the list.
virtual size_t getListSize()
Permits access to the list of raster functions.
Base object to handle implicit or explicit functions to draw into subimages.
#define MLBASEEXPORT
defined Header file mlBaseInit.h
Definition: mlBaseInit.h:22
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
SSIZE_T MLssize_t
The signed ML size type which is a signed 32 bit size_t on 32 bit platforms and 64 bit one on 64 bit ...
Definition: mlTypeDefs.h:654