Robotics Library  0.7.0
Model.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef RL_SG_MODEL_H
28 #define RL_SG_MODEL_H
29 
30 #include <string>
31 #include <vector>
32 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
33 #include <rl/math/Transform.h>
34 
35 namespace rl
36 {
37  namespace sg
38  {
39  class Body;
40  class Scene;
41 
42  class Model
43  {
44  public:
45  typedef ::std::vector<Body*>::iterator Iterator;
46 
47  Model(Scene* scene);
48 
49  virtual ~Model();
50 
51  virtual void add(Body* body);
52 
53  Iterator begin();
54 
55  virtual Body* create() = 0;
56 
57  Iterator end();
58 
59  Body* getBody(const ::std::size_t& i) const;
60 
61  virtual ::std::string getName() const;
62 
63  ::std::size_t getNumBodies() const;
64 
65  Scene* getScene() const;
66 
67  virtual void remove(Body* body);
68 
69  virtual void setName(const ::std::string& name);
70 
71  protected:
72  ::std::vector<Body*> bodies;
73 
75 
76  private:
77  ::std::string name;
78  };
79  }
80 }
81 
82 #endif // RL_SG_MODEL_H
rl::sg::Model::begin
Iterator begin()
Definition: Model.cpp:58
rl::sg::Model::getBody
Body * getBody(const ::std::size_t &i) const
Definition: Model.cpp:70
rl::sg::Model::end
Iterator end()
Definition: Model.cpp:64
rl::sg::Model::getName
virtual ::std::string getName() const
Definition: Model.cpp:76
rl::sg::Model::setName
virtual void setName(const ::std::string &name)
Definition: Model.cpp:105
rl::sg::Model::Iterator
::std::vector< Body * >::iterator Iterator
Definition: Model.h:45
rl::sg::Body
Definition: Body.h:45
rl::sg::Model::name
::std::string name
Definition: Model.h:77
rl::sg::Model::~Model
virtual ~Model()
Definition: Model.cpp:47
rl::sg::Model::create
virtual Body * create()=0
rl::sg::Model
Definition: Model.h:43
rl::sg::Model::remove
virtual void remove(Body *body)
Definition: Model.cpp:94
rl::sg::Model::add
virtual void add(Body *body)
Definition: Model.cpp:52
rl::sg::Model::getNumBodies
::std::size_t getNumBodies() const
Definition: Model.cpp:82
rl::sg::Model::bodies
::std::vector< Body * > bodies
Definition: Model.h:72
rl::sg::Model::getScene
Scene * getScene() const
Definition: Model.cpp:88
rl::sg::Model::scene
Scene * scene
Definition: Model.h:74
rl::sg::Scene
Definition: Scene.h:45
Transform.h
rl::sg::Model::Model
Model(Scene *scene)
Definition: Model.cpp:40
rl
Robotics Library.
Definition: AnalogInput.cpp:30