AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
SimulationParameter.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_SIMULATIONPARAMETER_H
18#define AGX_SIMULATIONPARAMETER_H
19
20#include <agxSDK/agxSDK.h>
21
22#include <agx/Referenced.h>
23#include <agx/Name.h>
24#include <agxData/Format.h>
25#include <agxData/Value.h>
26
27namespace agxSDK
28{
29 class Simulation;
30
34 {
35 public:
37
38 const agx::Name& getName() const;
40
41 void setName(const agx::Name& name);
42 void setDescription(const agx::String& description);
43
44 virtual const agxData::Format *getFormat() const = 0;
45 virtual const agxData::Value *getValue() const = 0;
46 virtual void setValue(agxData::Value *value) = 0;
47 virtual bool hasSetter() const = 0;
48 virtual bool hasGetter() const = 0;
49
50
52
53 protected:
55
56 friend class Simulation;
57 virtual void addNotification(agxSDK::Simulation *simulation);
58 virtual void removeNotification(agxSDK::Simulation *simulation);
59
60 private:
61 agxSDK::Simulation *m_simulation;
62 agx::Name m_name;
63 agx::String m_description;
64 };
65
66 template <typename T>
68 {
69 public:
70 SimulationParameterT(const agx::Name& name, const T& initialValue = T());
71
72
73 virtual void set(const T& value);
74 virtual const T& get() const;
75
76 virtual const agxData::Format *getFormat() const override;
77 virtual const agxData::Value *getValue() const override;
78 virtual void setValue(agxData::Value *value) override;
79 virtual bool hasSetter() const override;
80 virtual bool hasGetter() const override;
81
82
83 protected:
84 virtual ~SimulationParameterT();
85
86 private:
88 };
89
90
91 /* Implementation */
92 template <typename T>
94 {
95 m_value = new agxData::ValueT<T>(name, initialValue);
96 }
97
98
99 template <typename T>
101 {
102
103 }
104
105 template <typename T>
107 {
108 return m_value->get();
109 }
110
111 template <typename T>
112 void SimulationParameterT<T>::set(const T& value)
113 {
114 m_value->set(value);
115 }
116
117 template <typename T>
119 {
120 return m_value.get();
121 }
122
123 template <typename T>
125 {
126 set(value->get<T>());
127 }
128
129 template <typename T>
131 return true;
132 }
133
134 template <typename T>
136 return true;
137 }
138
139 template <typename T>
141 {
142 return m_value->getFormat();
143 }
144
145}
146
147#endif //AGX_SIMULATIONPARAMETER_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
A format is an implementation of a agxData::Type.
Definition: Format.h:64
Templated value-reference.
Definition: Value.h:263
Templated value.
Definition: Value.h:237
Abstract representation of a value.
Definition: Value.h:49
const T & get() const
Definition: Value.h:331
virtual const agxData::Value * getValue() const override
virtual void setValue(agxData::Value *value) override
virtual const agxData::Format * getFormat() const override
SimulationParameterT(const agx::Name &name, const T &initialValue=T())
virtual bool hasGetter() const override
virtual void set(const T &value)
virtual const T & get() const
virtual bool hasSetter() const override
void setDescription(const agx::String &description)
agxSDK::Simulation * getSimulation()
virtual const agxData::Format * getFormat() const =0
virtual bool hasGetter() const =0
virtual bool hasSetter() const =0
virtual void removeNotification(agxSDK::Simulation *simulation)
void setName(const agx::Name &name)
const agx::String & getDescription() const
virtual void addNotification(agxSDK::Simulation *simulation)
virtual const agxData::Value * getValue() const =0
SimulationParameter(const agx::Name &name)
const agx::Name & getName() const
virtual void setValue(agxData::Value *value)=0
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:131
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:120
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31