- 3.0.2 models module.
joint_data_map.h
Go to the documentation of this file.
1 #ifndef IIT_CT_INVERTEDPENDULUM_JOINT_DATA_MAP_H_
2 #define IIT_CT_INVERTEDPENDULUM_JOINT_DATA_MAP_H_
3 
4 #include "declarations.h"
5 
6 namespace iit {
7 namespace ct_InvertedPendulum {
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[JOINT1] = rhs[JOINT1];
68 }
69 
70 template<typename T> inline
71 void JointDataMap<T>::assigndata(const T& value) {
72  data[JOINT1] = value;
73 }
74 
75 template<typename T> inline
76 std::ostream& operator<<(std::ostream& out, const JointDataMap<T>& map) {
77  out
78  << " Joint1 = "
79  << map[JOINT1]
80  ;
81  return out;
82 }
83 
84 }
85 }
86 #endif
JointIdentifiers
Definition: declarations.h:25
Definition: declarations.h:26
JointDataMap & operator=(const JointDataMap &rhs)
Definition: joint_data_map.h:40
Definition: joint_data_map.h:12
JointDataMap()
Definition: joint_data_map.h:16
T & operator[](JointIdentifiers which)
Definition: joint_data_map.h:56