|
| 1 | +/*! |
| 2 | + * \file OxStartPointCalculatorDefault2Dims.h |
| 3 | + * \author Konrad Werys |
| 4 | + * \date 2018/08/10 |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef Tomato_OXSTARTPOINTCALCULATORDefault2Dims_H |
| 8 | +#define Tomato_OXSTARTPOINTCALCULATORDefault2Dims_H |
| 9 | + |
| 10 | +#include "OxStartPointCalculator.h" |
| 11 | + |
| 12 | +namespace Ox { |
| 13 | + |
| 14 | + /** |
| 15 | + * \class StartPointCalculatorDefault2Dims |
| 16 | + * \brief |
| 17 | + * \details |
| 18 | + * @tparam MeasureType |
| 19 | + */ |
| 20 | + template< typename MeasureType > |
| 21 | + class StartPointCalculatorDefault2Dims : public StartPointCalculator<MeasureType>{ |
| 22 | + |
| 23 | + public: |
| 24 | + |
| 25 | + /** |
| 26 | + * the most important function of this class |
| 27 | + * @return success/failure |
| 28 | + */ |
| 29 | + virtual int calculateStartPoint(){ |
| 30 | + setStartPointToDefault(); |
| 31 | + return 0; // EXIT_SUCCESS |
| 32 | + }; |
| 33 | + |
| 34 | + int setStartPointToDefault(){ |
| 35 | + this->getCalculatedStartPoint()[0] = _DefaultStartPoint[0]; |
| 36 | + this->getCalculatedStartPoint()[1] = _DefaultStartPoint[1]; |
| 37 | + |
| 38 | + return 0; // EXIT_SUCCESS |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * \brief constructor |
| 43 | + */ |
| 44 | + StartPointCalculatorDefault2Dims() : StartPointCalculator<MeasureType>(){ |
| 45 | + this->_nDims = 2; |
| 46 | + |
| 47 | + _DefaultStartPoint[0] = 100; |
| 48 | + _DefaultStartPoint[1] = 1000; |
| 49 | + |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * \brief copy constructor |
| 54 | + */ |
| 55 | + StartPointCalculatorDefault2Dims(const StartPointCalculatorDefault2Dims &old){ |
| 56 | + this->setAllPointersToNull(); |
| 57 | + |
| 58 | + _DefaultStartPoint[0] = old._DefaultStartPoint[0]; |
| 59 | + _DefaultStartPoint[1] = old._DefaultStartPoint[1]; |
| 60 | + this->_nSamples = old._nSamples; |
| 61 | + this->_nDims = old._nDims; |
| 62 | + }; |
| 63 | + |
| 64 | + /** |
| 65 | + * cloning |
| 66 | + * @return |
| 67 | + */ |
| 68 | + virtual StartPointCalculator<MeasureType> *newByCloning() { return new StartPointCalculatorDefault2Dims<MeasureType>(*this); } |
| 69 | + |
| 70 | + /** |
| 71 | + * \brief do not forget about the virtual destructor, see |
| 72 | + * https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors |
| 73 | + */ |
| 74 | + virtual ~StartPointCalculatorDefault2Dims(){}; |
| 75 | + |
| 76 | + protected: |
| 77 | + MeasureType _DefaultStartPoint[2]; |
| 78 | + |
| 79 | + }; |
| 80 | +} //namespace Ox |
| 81 | + |
| 82 | +#endif //Tomato_OXStartPointCalculatorDefault2Dims_H |
0 commit comments