MeVisLab Toolbox Reference
mlCurveList.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_CURVE_LIST_H
14#define ML_CURVE_LIST_H
15
16
19
20// Classes:
21// - CurveList: A list of ref-counted CurveData object pointers.
22
23// ML includes
24#include <mlRefCountedBase.h>
25#include <mlModuleIncludes.h>
26#include <mlTreeNode.h>
27#include "mlBaseInit.h"
28
29
30#include "mlCurveData.h"
31
32
33ML_START_NAMESPACE
34
35
36// ------------------------------------------------------------------
37// Base object class CurveList
38
42// ------------------------------------------------------------------
44{
45protected:
47 ~CurveList() override = default;
48
49public:
50
51 // --------------------------------------------
53 // --------------------------------------------
55
59 CurveList (const CurveList &curveList, bool deepCopyArg = false);
60
62 CurveList &operator = (const CurveList &srcCurveList);
63
64 MLBASEEXPORT friend bool operator==(const CurveList& x, const CurveList& y);
65 MLBASEEXPORT friend bool operator!=(const CurveList& x, const CurveList& y);
66
68 void clear();
69
71 void reserve(size_t n);
72
74
75
76 // --------------------------------------------
78 // --------------------------------------------
80
82 const std::vector<CurveDataPtr> &getCurveList ();
83
86 CurveDataPtr getCurveData(MLssize_t index);
89 CurveDataPtr takeCurve(MLssize_t index);
91 void appendCurve(CurveDataPtr curve);
93 void insertCurve(MLssize_t index, CurveDataPtr curve);
95 void removeCurves(size_t index, size_t count);
96
98
99
100 // --------------------------------------------
102 // --------------------------------------------
104
107
109 double getXMin() const;
111 double getXMax() const;
113 double getYMin() const;
115 double getYMax() const;
117 void getXYRange(double *xMin, double *xMax, double *yMin, double *yMax) const;
118
120
123 void addStateToTree(TreeNode* parent) const override;
124 // Set current version number
127 void readStateFromTree(TreeNode* parent) override;
129
130 CurveList* deepCopy() const override { return new CurveList(*this, /*deepCopy=*/true); };
131
132
133protected:
134
136 std::vector<CurveDataPtr> _curveList;
137
138private:
141};
142
144
145
146ML_END_NAMESPACE
147
148
149#endif
150// __mlCurveList_H
void clear()
Clear list of CurveData objects, Objects are automatically deleted if the last reference is gone.
~CurveList() override=default
Destructor shouldn't be called directly anymore, always use the CurveListPtr smart-pointer.
CurveList()
Default constructor.
void addStateToTree(TreeNode *parent) const override
CurveList(const CurveList &curveList, bool deepCopyArg=false)
Copy constructor. The curve objects are only copied if deepCopy is set to true.
double getYMin() const
Get overall minimum Y data value.
double getYMax() const
Get overall maximum Y data value.
void readStateFromTree(TreeNode *parent) override
Implement import functionality (as used by the LoadBase module):
MLssize_t getNumCurves() const
Get number of curve objects.
void appendCurve(CurveDataPtr curve)
Append CurveData object.
CurveList * deepCopy() const override
double getXMin() const
Get overall minimum X data value.
CurveDataPtr takeCurve(MLssize_t index)
void insertCurve(MLssize_t index, CurveDataPtr curve)
Insert CurveData object at index. index is automatically clamped to the valid range.
MLBASEEXPORT friend bool operator==(const CurveList &x, const CurveList &y)
const std::vector< CurveDataPtr > & getCurveList()
Access vector of CurveData pointers directly.
double getXMax() const
Get overall maximum X data value.
std::vector< CurveDataPtr > _curveList
List of curve object pointers.
void reserve(size_t n)
Reserve entries in curve list (for optimization).
ML_SET_ADDSTATE_VERSION(1)
MLBASEEXPORT friend bool operator!=(const CurveList &x, const CurveList &y)
void getXYRange(double *xMin, double *xMax, double *yMin, double *yMax) const
Get overall X and Y value ranges (NULL pointers are allowed).
CurveDataPtr getCurveData(MLssize_t index)
void removeCurves(size_t index, size_t count)
Remove a range of CurveData. The range is automatically restricted to the valid range of elements.
RefCountedBase()
Constructor.
#define MLBASEEXPORT
defined Header file mlBaseInit.h
Definition mlBaseInit.h:22
#define ML_REFCOUNTED_PTR(CLASSNAME)
Macro that defines convenience Ptr/ConstPtr typedefs to be used instead of intrusive_ptr templates.
#define ML_CLASS_HEADER(className)
SSIZE_T MLssize_t
The signed ML size type that is a signed 32-bit size_t on 32-bit platforms and 64-bit one on 64-bit p...
Definition mlTypeDefs.h:565