AGX Dynamics  2.37.3.2
ComponentVisitor.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are 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_COMPONENTVISITOR_H
18 #define AGX_COMPONENTVISITOR_H
19 
20 #include <agx/Callback.h>
21 
22 #ifdef _MSC_VER
23 # pragma warning(push)
24 # pragma warning(disable: 4251) // warning C4251: class X needs to have dll-interface to be used by clients of class Y
25 #endif
26 
27 
28 namespace agx
29 {
30 
31  class Object;
32  class Component;
33 
38  {
39  public:
40  virtual void visit( agx::Object* ) {}
41  virtual void visit( agx::Component* comp );
42  virtual ~ComponentVisitor() {}
43  };
44 
49  {
50  public:
52 
53  CallbackComponentVisitor( TraverseCallback callback );
54 
55  virtual void visit( agx::Object* obj );
56  virtual void visit( agx::Component* comp );
57 
59 
60  private:
61  TraverseCallback m_callback;
62  };
63 }
64 
65 
66 #ifdef _MSC_VER
67 # pragma warning(pop)
68 #endif
69 
70 
71 #endif
72 
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:38
virtual void visit(agx::Object *)
ComponentVisitor which applies a callback function on each visited node.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Callback1< Object * > TraverseCallback
Base class for ComponentVisitors.
#define AGXCORE_EXPORT
agx::Object is a refcounted object with a name.
Definition: Object.h:58