- 3.0.2 models module.
link_data_map.h
Go to the documentation of this file.
1 #ifndef IIT_CT_HYA_LINK_DATA_MAP_H_
2 #define IIT_CT_HYA_LINK_DATA_MAP_H_
3 
4 #include "declarations.h"
5 
6 namespace iit {
7 namespace ct_HyA {
8 
12 template<typename T> class LinkDataMap {
13 private:
14  T data[linksCount];
15 public:
16  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
17 
19  LinkDataMap(const T& defaultValue);
20  LinkDataMap(const LinkDataMap& rhs);
21  LinkDataMap& operator=(const LinkDataMap& rhs);
22  LinkDataMap& operator=(const T& rhs);
23  T& operator[](LinkIdentifiers which);
24  const T& operator[](LinkIdentifiers which) const;
25 private:
26  void copydata(const LinkDataMap& rhs);
27  void assigndata(const T& commonValue);
28 };
29 
30 template<typename T> inline
31 LinkDataMap<T>::LinkDataMap(const T& value) {
32  assigndata(value);
33 }
34 
35 template<typename T> inline
37 {
38  copydata(rhs);
39 }
40 
41 template<typename T> inline
43 {
44  if(&rhs != this) {
45  copydata(rhs);
46  }
47  return *this;
48 }
49 
50 template<typename T> inline
52 {
53  assigndata(value);
54  return *this;
55 }
56 
57 template<typename T> inline
59  return data[l];
60 }
61 
62 template<typename T> inline
64  return data[l];
65 }
66 
67 template<typename T> inline
68 void LinkDataMap<T>::copydata(const LinkDataMap& rhs) {
69  data[HYABASE] = rhs[HYABASE];
70  data[SHOULDER_AA] = rhs[SHOULDER_AA];
71  data[SHOULDER_FE] = rhs[SHOULDER_FE];
72  data[HUMERUS_R] = rhs[HUMERUS_R];
73  data[ELBOW_FE] = rhs[ELBOW_FE];
74  data[WRIST_R] = rhs[WRIST_R];
75  data[WRIST_FE] = rhs[WRIST_FE];
76 }
77 
78 template<typename T> inline
79 void LinkDataMap<T>::assigndata(const T& value) {
80  data[HYABASE] = value;
81  data[SHOULDER_AA] = value;
82  data[SHOULDER_FE] = value;
83  data[HUMERUS_R] = value;
84  data[ELBOW_FE] = value;
85  data[WRIST_R] = value;
86  data[WRIST_FE] = value;
87 }
88 
89 template<typename T> inline
90 std::ostream& operator<<(std::ostream& out, const LinkDataMap<T>& map) {
91  out
92  << " HyABase = "
93  << map[HYABASE]
94  << " Shoulder_AA = "
95  << map[SHOULDER_AA]
96  << " Shoulder_FE = "
97  << map[SHOULDER_FE]
98  << " Humerus_R = "
99  << map[HUMERUS_R]
100  << " Elbow_FE = "
101  << map[ELBOW_FE]
102  << " Wrist_R = "
103  << map[WRIST_R]
104  << " Wrist_FE = "
105  << map[WRIST_FE]
106  ;
107  return out;
108 }
109 
110 }
111 }
112 #endif
Definition: derivativeIvState.hpp:21
Definition: declarations.h:39
Definition: declarations.h:42
Definition: link_data_map.h:12
Definition: declarations.h:41
Definition: declarations.h:38
LinkDataMap & operator=(const LinkDataMap &rhs)
Definition: link_data_map.h:42
LinkIdentifiers
Definition: declarations.h:35
Definition: declarations.h:37
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LinkDataMap()
Definition: link_data_map.h:18
Definition: declarations.h:40
T & operator[](LinkIdentifiers which)
Definition: link_data_map.h:58
Definition: declarations.h:36