OpenFrames
SubtreeTracker.hpp
Go to the documentation of this file.
1 /***********************************
2  Copyright 2018 Ravishankar Mathur
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 ***********************************/
16 
21 #ifndef _OF_SUBTREETRACKER_
22 #define _OF_SUBTREETRACKER_
23 
24 #include <OpenFrames/Export.h>
26 #include <osg/ref_ptr>
27 #include <map>
28 
29 namespace OpenFrames
30 {
31  class ReferenceFrame;
32 
44  class OF_EXPORT SubtreeTracker : public FrameTracker
45  {
46  typedef std::map<std::string, ReferenceFrame* > FrameMap;
47 
48  public:
51 
53  virtual void childAdded( ReferenceFrame* child, ReferenceFrame* parent);
54  virtual void childRemoved( ReferenceFrame* child, ReferenceFrame* parent );
55 
57  virtual void setRoot( ReferenceFrame* frame );
58 
63  virtual void rescan();
64 
66  ReferenceFrame* getFrame( const std::string& name );
67 
69  void printFrameList();
70 
71  protected:
72  virtual ~SubtreeTracker();
73 
74  // Function to add/remove all children of a frame to the frame list
75  void _addAllChildren( ReferenceFrame* frame );
76  void _removeAllChildren( ReferenceFrame* frame );
77 
78  FrameMap _frames; // All frames being tracked
79  };
80 
81 } // !namespace OpenFrames
82 
83 #endif // !define _OF_SUBTREETRACKER_
Remembers each frame of a tracked frame.
Definition: SubtreeTracker.hpp:44
This class tracks children of a reference frame.
Definition: FrameTracker.hpp:41
Definition: CoordinateAxes.hpp:29
Definition: ReferenceFrame.hpp:54