AGX Dynamics  2.35.0.1
StatisticsTrack.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, is copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_STATISTICSTRACK_H
18 #define AGX_STATISTICSTRACK_H
19 
20 #include <agx/Statistics.h>
21 #include <agx/Clock.h>
22 #include <agxData/FrameIO.h>
23 
24 namespace agxSDK
25 {
27 }
28 
29 namespace agx
30 {
32  {
33  public:
35 
36 
37  virtual agxData::Frame *readFrame() override;
38 
39  protected:
41 
42  private:
43  class DataBinding : public agxData::Frame::DataBinding
44  {
45  public:
46  DataBinding(const agx::Path& internalPath, const agx::Path& externalPath, Statistics::AbstractData *data = nullptr);
47 
48  Statistics::AbstractData *getData();
49  void setData(Statistics::AbstractData *data);
50 
51  protected:
52  virtual ~DataBinding();
53 
54  private:
56  };
57 
58  virtual agxData::Frame::DataBinding *createDataBinding(const agx::Path& internalPath, const agx::Path& externalPath) override;
59  void updateCallback(Clock *clock);
60 
61  private:
62  agxSDK::SimulationRef m_simulation;
63  ClockRef m_clock;
64  Statistics *m_statistics;
65  TaskRef m_updateTask;
66  mutable agx::Block m_clockBlock;
67  mutable agx::Block m_readerBlock;
68  Clock::TickEvent::CallbackType m_updateCallback;
69  };
70 
71 }
72 
73 
74 #endif /* AGX_STATISTICSTRACK_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
The FrameReader reads frames from an external source.
Definition: FrameIO.h:127
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Block synchronization primitive.
Clock class keeps representation of virtual/simulated time.
Definition: Clock.h:38
T CallbackType
Definition: Event.h:37
Representation of a path, a list of name components.
Definition: Path.h:34
StatisticsFrameReader(agxSDK::Simulation *simulation, Clock *clock, Statistics *statistics=Statistics::instance())
virtual agxData::Frame * readFrame() override
Reads the next frame from the stream and moves the stream forward one frame.
Base statistics gathering class.
Definition: Statistics.h:99
AbstractData(const char *name, const agxData::Format *format)
static Statistics * instance()
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.