16 #ifndef SURGSIM_DATASTRUCTURES_NAMEDDATA_H 17 #define SURGSIM_DATASTRUCTURES_NAMEDDATA_H 28 namespace DataStructures
38 static const char*
const BUTTON_0 =
"button0";
39 static const char*
const BUTTON_1 =
"button1";
40 static const char*
const BUTTON_2 =
"button2";
41 static const char*
const BUTTON_3 =
"button3";
42 static const char*
const BUTTON_4 =
"button4";
43 static const char*
const TOOLDOF =
"toolDof";
45 static const char*
const POSE =
"pose";
46 static const char*
const INPUT_POSE =
"inputPose";
48 static const char*
const ANGULAR_VELOCITY =
"angularVelocity";
49 static const char*
const LINEAR_VELOCITY =
"linearVelocity";
50 static const char*
const INPUT_ANGULAR_VELOCITY =
"inputAngularVelocity";
51 static const char*
const INPUT_LINEAR_VELOCITY =
"inputLinearVelocity";
53 static const char*
const FORCE =
"force";
54 static const char*
const TORQUE =
"torque";
56 static const char*
const DAMPER_JACOBIAN =
"damperJacobian";
57 static const char*
const SPRING_JACOBIAN =
"springJacobian";
59 static const char*
const IS_HOMED =
"isHomed";
60 static const char*
const IS_ORIENTATION_HOMED =
"isOrientationHomed";
61 static const char*
const IS_POSITION_HOMED =
"isPositionHomed";
63 static const char*
const DIGITAL_INPUT_PREFIX =
"digitalInput";
64 static const char*
const DIGITAL_OUTPUT_PREFIX =
"digitalOutput";
65 static const char*
const TIMER_INPUT_PREFIX =
"timerInput";
66 static const char*
const TIMER_OUTPUT_PREFIX =
"timerOutput";
67 static const char*
const ANALOG_INPUT_PREFIX =
"analogInput";
68 static const char*
const ANALOG_OUTPUT_PREFIX =
"analogOutput";
70 static const char*
const PROJECTION_MATRIX =
"projectionMatix";
71 static const char*
const LEFT_PROJECTION_MATRIX =
"leftProjectionMatix";
72 static const char*
const RIGHT_PROJECTION_MATRIX =
"rightProjectionMatix";
74 static const char*
const KEY =
"key";
101 template <
typename T>
112 inline explicit NamedData(std::shared_ptr<const IndexDirectory> directory);
118 inline explicit NamedData(
const std::vector<std::string>& names);
177 inline std::shared_ptr<const IndexDirectory> getDirectory()
const;
182 inline int getIndex(
const std::string& name)
const;
187 inline std::string getName(
int index)
const;
194 inline bool hasEntry(
int index)
const;
201 inline bool hasEntry(
const std::string& name)
const;
210 inline bool hasData(
int index)
const;
219 inline bool hasData(
const std::string& name)
const;
229 inline bool get(
int index, T* value)
const;
239 inline bool get(
const std::string& name, T* value)
const;
247 inline bool set(
int index,
const T& value);
256 inline bool set(
int index, T&& value);
264 inline bool set(
const std::string& name,
const T& value);
273 inline bool set(
const std::string& name, T&& value);
279 inline bool reset(
int index);
285 inline bool reset(
const std::string& name);
288 inline void resetAll();
293 inline size_t size()
const;
298 inline int getNumEntries()
const;
304 template <
typename N>
305 void copy(
const NamedData<N>& source,
const NamedDataCopyMap& map);
310 void cacheIndex(
const std::string& name,
int* index)
const;
330 #endif // SURGSIM_DATASTRUCTURES_NAMEDDATA_H Definition: CompoundShapeToGraphics.cpp:29
A templated dictionary in which data can be accessed by name or index, with immutable names & indices...
Definition: NamedData.h:102
std::vector< T > m_data
The array of values.
Definition: NamedData.h:317
std::unordered_map< int, int > NamedDataCopyMap
The type used for copying values between two NamedData objects that cannot assign to each other...
Definition: NamedData.h:32
std::vector< bool > m_isDataValid
The array storing whether the data is currently valid.
Definition: NamedData.h:320
bool isValid(float value)
Check if a float value is valid.
Definition: Valid-inl.h:98
The header that provides the assertion API.
std::shared_ptr< const IndexDirectory > m_directory
The mapping between names and indices.
Definition: NamedData.h:314