C++ main module for mmsd Package  1.0
LAP_View.h
Go to the documentation of this file.
1 #ifndef LAP_View_H
2 #define LAP_View_H
3 
4 
5 #include "LAP_Object.h"
6 #include "CORE_Integer.h"
7 
14 class LAP_View : public virtual LAP_Object {
15  SP_OBJECT(LAP_View);
16 
17 private:
18 
19  //next view element
20  tLVectorIncrement mIncrement;
21  //first element view
22  tLVectorIndex mStart;
23  //last element view
24  tLVectorIndex mEnd;
25 
26 
27  // ASSOCIATIONS
28 
29 public:
30  // METHODS
31 
32  // CONSTRUCTORS
33 
35  LAP_View(void) {
36  mIncrement=1;
37  mStart=0;
38  mEnd=0;
39  };
40 
41 
42 
43 
44  // DESTRUCTORS
45 
46 
49  virtual ~LAP_View() {
50  };
51 
52 
53 public:
54 
55  // CONSTRUCTOR
58  inline static SP::LAP_View New() {
59  SP::LAP_View p(new LAP_View(),LAP_View::Delete());
60  p->setThis(p);
61  return p;
62  };
67  inline static SP::LAP_View New(const tLVectorIndex & start,const tLVectorIndex& end,const tLVectorIndex& increment) {
68  SP::LAP_View p(new LAP_View(),LAP_View::Delete());
69  p->setThis(p);
70  p->setView(start,end,increment);
71  return p;
72  };
73 
74  // SET methods
75 
78  inline void copy(const LAP_View& v) {
79  mIncrement=v.getIncrement();
80  mStart=v.getStart();
81  mEnd=v.getEnd();
82  }
83 
84 
88  inline void setView(const tLVectorIndex& start,
89  const tLVectorIndex& end,
90  const tLVectorIndex& inc) {
91 
93  setView(start,end);
94  };
95 
99  inline void setView(const tLVectorIndex& start,
100  const tLVectorIndex& end) {
101  ASSERT_IN(start<=end);
102  mStart=start;
103  mEnd=end;
104  };
107  inline void setLVectorIncrement(const tLVectorIncrement& inc) {
108  ASSERT_IN(inc>0);
109  mIncrement=inc;
110  };
111 
114  inline void reset() {
115  mStart=0;
116  mEnd=0;
117  mIncrement=1;
118  }
119 
120  // GET methods
121 
122 
125  inline const tLVectorIncrement& getIncrement() const {
126  return mIncrement;
127  };
130  inline const tLVectorIndex& getStart() const {
131  return mStart;
132  };
135  inline const tLVectorIndex& getEnd() const {
136  return mEnd;
137  };
138 
141  inline tLVectorIndex getSize() const {
142  return ((mEnd-mStart)/mIncrement) ;
143  };
144  // OTHERS Methods
145 
148  virtual tString toString() const {
149  return CORE_Integer::toString(mStart)+":"+CORE_Integer::toString(mEnd)+":"+CORE_Integer::toString(mIncrement);
150  }
151 
152 };
153 #endif
DEFINE_SPTR(LAP_View)
This class is a view of a pointer.
Definition: LAP_View.h:14
void setView(const tLVectorIndex &start, const tLVectorIndex &end)
set the view limits the element considered are in [start,end[
Definition: LAP_View.h:99
LAP_View(void)
create an object
Definition: LAP_View.h:35
const tLVectorIndex & getStart() const
get the start index of the first element in [start,end[
Definition: LAP_View.h:130
void setView(const tLVectorIndex &start, const tLVectorIndex &end, const tLVectorIndex &inc)
set the the view the element considered are in [start,end[ with increment inc
Definition: LAP_View.h:88
void setLVectorIncrement(const tLVectorIncrement &inc)
set the increment of the view
Definition: LAP_View.h:107
const tLVectorIncrement & getIncrement() const
get increment
Definition: LAP_View.h:125
static SP::LAP_View New(const tLVectorIndex &start, const tLVectorIndex &end, const tLVectorIndex &increment)
Definition: LAP_View.h:67
This class is the base class of all lapack objects.
Definition: LAP_Object.h:17
void copy(const LAP_View &v)
copy
Definition: LAP_View.h:78
void reset()
reset
Definition: LAP_View.h:114
virtual ~LAP_View()
destroy an object.
Definition: LAP_View.h:49
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:142
#define tLVectorIndex
Definition: lapack_types.h:13
#define tString
Definition: types.h:49
static SP::LAP_View New()
Definition: LAP_View.h:58
#define tLVectorIncrement
Definition: lapack_types.h:16
virtual tString toString() const
turn into string
Definition: LAP_View.h:148
const tLVectorIndex & getEnd() const
get the end index of the last element in [start,end[
Definition: LAP_View.h:135
tLVectorIndex getSize() const
Definition: LAP_View.h:141
#define ASSERT_IN(a)
Definition: types.h:96
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106