- 3.0.2 models module.
joint_data_map.h
Go to the documentation of this file.
1 #ifndef IIT_CT_HYA_JOINT_DATA_MAP_H_
2 #define IIT_CT_HYA_JOINT_DATA_MAP_H_
3 
4 #include "declarations.h"
5 
6 namespace iit {
7 namespace ct_HyA {
8 
12 template<typename T> class JointDataMap {
13 private:
14  T data[jointsCount];
15 public:
17  JointDataMap(const T& defaultValue);
18  JointDataMap(const JointDataMap& rhs);
19  JointDataMap& operator=(const JointDataMap& rhs);
20  JointDataMap& operator=(const T& rhs);
21  T& operator[](JointIdentifiers which);
22  const T& operator[](JointIdentifiers which) const;
23 private:
24  void copydata(const JointDataMap& rhs);
25  void assigndata(const T& rhs);
26 };
27 
28 template<typename T> inline
30  assigndata(value);
31 }
32 
33 template<typename T> inline
35 {
36  copydata(rhs);
37 }
38 
39 template<typename T> inline
41 {
42  if(&rhs != this) {
43  copydata(rhs);
44  }
45  return *this;
46 }
47 
48 template<typename T> inline
50 {
51  assigndata(value);
52  return *this;
53 }
54 
55 template<typename T> inline
57  return data[j];
58 }
59 
60 template<typename T> inline
62  return data[j];
63 }
64 
65 template<typename T> inline
66 void JointDataMap<T>::copydata(const JointDataMap& rhs) {
67  data[SAA] = rhs[SAA];
68  data[SFE] = rhs[SFE];
69  data[HR] = rhs[HR];
70  data[EFE] = rhs[EFE];
71  data[WR] = rhs[WR];
72  data[WFE] = rhs[WFE];
73 }
74 
75 template<typename T> inline
76 void JointDataMap<T>::assigndata(const T& value) {
77  data[SAA] = value;
78  data[SFE] = value;
79  data[HR] = value;
80  data[EFE] = value;
81  data[WR] = value;
82  data[WFE] = value;
83 }
84 
85 template<typename T> inline
86 std::ostream& operator<<(std::ostream& out, const JointDataMap<T>& map) {
87  out
88  << " SAA = "
89  << map[SAA]
90  << " SFE = "
91  << map[SFE]
92  << " HR = "
93  << map[HR]
94  << " EFE = "
95  << map[EFE]
96  << " WR = "
97  << map[WR]
98  << " WFE = "
99  << map[WFE]
100  ;
101  return out;
102 }
103 
104 }
105 }
106 #endif
JointIdentifiers
Definition: declarations.h:26
Definition: joint_data_map.h:12
Definition: derivativeIvState.hpp:21
Definition: declarations.h:27
Definition: declarations.h:30
JointDataMap()
Definition: joint_data_map.h:16
T & operator[](JointIdentifiers which)
Definition: joint_data_map.h:56
JointDataMap & operator=(const JointDataMap &rhs)
Definition: joint_data_map.h:40
Definition: declarations.h:29
Definition: declarations.h:31
Definition: declarations.h:28
Definition: declarations.h:32