AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
Stream.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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_STREAM_H
18#define AGX_STREAM_H
19
20
21#include <agx/Model.h>
22#include <agx/Component.h>
23#include <agxNet/FramePacket.h>
24
25namespace agx
26{
28
33 {
34 public:
35 // EventModel(const agx::Name& name);
36
37 protected:
38 // virtual ~EventModel();
39 EventModel() : Model("", nullptr) {}
40 private:
41 };
42
43
45
50 {
51 public:
55
56 // Stream(const agx::Name& name);
57
58 protected:
59 // virtual ~Stream();
60
61 private:
62 };
63
64 //---------------------------------------------------------------
65
70 {
71 public:
73
74 protected:
75 virtual ~Event();
76
77 protected:
79 };
80
81 //---------------------------------------------------------------
82
86 class AGXCORE_EXPORT Stream::DataEvent : public Event
87 {
88 public:
89
90 private:
91 };
92
93 #if 0
94 class AGXCORE_EXPORT Stream::AttributeDataEvent : public DataEvent
95 {
96 public:
97
98 private:
99 agx::UInt32 m_id;
100 agxData::Attribute *m_attribute;
101 agxData::EntityStorage *m_storage;
102 agxData::ValueRef m_value;
103 };
104 #endif
105
106 //---------------------------------------------------------------
107
111 class AGXCORE_EXPORT Stream::FunctionEvent : public Event
112 {
113 public:
116
118 // const agx::Name& getName() const;
119
121 // agx::String fullName() const;
122
126 void evaluate();
127
129 const Object *getParameter(const Name& name) const;
130
131 protected:
132 // agxData::Value *restoreParameter(const Name& name);
133 // agxData::Buffer *restoreBuffer(const Name& name);
134
135 virtual void setup() {};
136
137 private:
139 ParameterTable m_parameters;
140 Callback m_implementation;
141 TaskRef m_task; // TODO Remove
142 };
143
144
145 #if 0
146 class SetRadiusEvent : public agx::Stream::FunctionEvent
147 {
148 public:
149 SetRadiusEvent("Physics.Particle.SetRadius");
150
151 void evaluate()
152 {
153 agx::Physics::ParticleData& particle = *static_cast<agx::Physics::ParticleData *>(m_particle->getData());
154 const agx::UInt& index m_index->get<agx::UInt>();
155 const agx::Real& radius = m_radius->get<agx::Real>();
156
157 agxFn::Physics::Particle::SetRadius(particle, index, radius);
158
159 m_radiusBuffer->commit(m_index);
160 m_massBuffer->commit(m_index);
161 m_invMassBuffer->commit(m_index);
162 m_materialBuffer->commit(m_index);
163 }
164
165 protected:
166 virtual void setup()
167 {
168 m_particle = this->getParameter<agxData:EntityStorage>("particle");
169 m_index = this->getParameter<agxData::Value>("index");
170 m_radius = this->getParameter<agxData::Value>("radius");
171
172 // Implicit parameters, should not be serialized? No need to, they are part of ParticleData!
173 // m_material = this->getParameter<agxData::Value>("material");
174 // m_mass = this->getParameter<agxData::Value>("mass");
175 // m_invMass = this->getParameter<agxData::Value>("invMass");
176
177 m_radiusBuffer = m_particle->getBuffer("radius");
178 m_massBuffer = m_particle->getBuffer("mass");
179 m_invMassBuffer = m_particle->getBuffer("invMass");
180 m_materialBuffer = m_particle->getBuffer("material");
181 }
182
183 private:
184 agxData::EntityStorageRef m_particle;
185 agxData::ValueRef m_radius;
186 agxData::ValueRef m_index;
187
188 agxData::Buffer *m_radiusBuffer;
189 agxData::Buffer *m_massBuffer;
190 agxData::Buffer *m_invMassBuffer;
191 agxData::Buffer *m_materialBuffer;
192 };
193 #endif
194 //---------------------------------------------------------------
195
196 /* Implementation */
197 // AGX_FORCE_INLINE const agx::Name& Stream::FunctionEvent::getName() const { return m_model->getName(); }
198 // AGX_FORCE_INLINE const agx::String& Stream::FunctionEvent::fullName() const { return m_model->fullPath(); }
199 AGX_FORCE_INLINE const Object *Stream::FunctionEvent::getParameter(const Name& name) const
200 {
201 ParameterTable::const_iterator it = m_parameters.find(name);
202 return it != m_parameters.end() ? it->second : nullptr;
203 }
204
205}
206
207#endif /* AGX_STREAM_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXCORE_EXPORT
An abstract attribute description, part of an Entity.
Definition Attribute.h:58
Abstract representation of a data buffer.
Definition Buffer.h:56
Data storage for a collection of entity instances of a specified EntityModel.
Generalized callback, using std::function.
Definition Callback.h:54
TODO: Documentation.
Definition Stream.h:33
An event with no arguments.
Definition Event.h:90
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Definition Model.h:41
Representation of a name string.
Definition Name.h:33
agx::Object is a refcounted object with a name.
Definition Object.h:59
Base class providing referencing counted objects.
Definition Referenced.h:120
TODO: Documentation.
Definition Stream.h:50
const Object * getParameter(const Name &name) const
TODO: Common baseclass, agxData::Value -> agx::Scalar, agx::Buffer (agx::Buffer -> agx::Array<T> ?...
virtual void setup()
Definition Stream.h:135
FunctionEvent(const agxNet::StructuredMessage *message)
void evaluate()
eg 'Add'
FunctionEvent(agx::Model *kernelModel)
virtual ~Event()
agx::EventModelRef m_model
Definition Stream.h:78
#define AGX_FORCE_INLINE
Definition macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition Integer.h:32
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42