Chemical Data Processing Library C++ API - Version 1.4.0
Object3D.hpp
Go to the documentation of this file.
1 /*
2  * Object3D.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_OBJECT3D_HPP
30 #define CDPL_VIS_OBJECT3D_HPP
31 
32 #include <vector>
33 #include <memory>
34 
35 #include <boost/iterator/indirect_iterator.hpp>
36 
37 #include "CDPL/Vis/APIPrefix.hpp"
39 
40 
41 namespace CDPL
42 {
43 
44  namespace Vis
45  {
46 
57  {
58 
59 
60 
61  public:
65  typedef std::shared_ptr<Object3D> SharedPointer;
66 
67  private:
68  typedef std::vector<SharedPointer> Object3DList;
69  typedef boost::indirect_iterator<Object3DList::iterator, Object3D> Object3DIterator;
70  typedef boost::indirect_iterator<Object3DList::const_iterator, const Object3D> ConstObject3DIterator;
71 
72  public:
77 
82  Object3D(const Object3D& obj);
83 
87  virtual ~Object3D() {}
88 
94  Object3D& operator=(const Object3D& obj);
95 
99  void clear();
100 
105  std::size_t getNumSubObjects() const;
106 
111  ConstObject3DIterator getSubObjectsBegin() const;
112 
117  Object3DIterator getSubObjectsBegin();
118 
123  ConstObject3DIterator getSubObjectsEnd() const;
124 
129  Object3DIterator getSubObjectsEnd();
130 
135  ConstObject3DIterator begin() const;
136 
141  Object3DIterator begin();
142 
147  ConstObject3DIterator end() const;
148 
153  Object3DIterator end();
154 
161  const Object3D& getSubObject(std::size_t idx) const;
162 
169  Object3D& getSubObject(std::size_t idx);
170 
176 
183 
189  void removeSubObject(std::size_t idx);
190 
199  Object3DIterator removeSubObject(const Object3DIterator& it);
200 
201  private:
202  Object3DList subObjects;
203  };
204  } // namespace Vis
205 } // namespace CDPL
206 
207 #endif // CDPL_VIS_OBJECT3D_HPP
Definition of class CDPL::Base::PropertyContainer.
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Base class providing methods for the storage and lookup of object properties.
Definition: PropertyContainer.hpp:75
Hierarchical 3D scene object that owns a list of nested sub-objects and inherits its property bag fro...
Definition: Object3D.hpp:57
ConstObject3DIterator getSubObjectsBegin() const
Returns a constant iterator pointing to the beginning of the sub-objects.
const Object3D & getSubObject(std::size_t idx) const
Returns a const reference to the sub-object at index idx.
Object3D & getSubObject(std::size_t idx)
Returns a non-const reference to the sub-object at index idx.
virtual ~Object3D()
Virtual destructor.
Definition: Object3D.hpp:87
std::shared_ptr< Object3D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Object3D instances.
Definition: Object3D.hpp:65
Object3DIterator getSubObjectsEnd()
Returns a mutable iterator pointing to the end of the sub-objects.
Object3D(const Object3D &obj)
Constructs a copy of the Object3D instance obj.
ConstObject3DIterator end() const
Returns a constant iterator pointing to the end of the sub-objects.
Object3D()
Default constructor.
Object3DIterator begin()
Returns a mutable iterator pointing to the beginning of the sub-objects.
Object3DIterator getSubObjectsBegin()
Returns a mutable iterator pointing to the beginning of the sub-objects.
Object3D & operator=(const Object3D &obj)
Assignment operator.
ConstObject3DIterator getSubObjectsEnd() const
Returns a constant iterator pointing to the end of the sub-objects.
std::size_t getNumSubObjects() const
Returns the number of sub-objects directly owned by this object.
void removeSubObject(std::size_t idx)
Removes the sub-object at index idx.
Object3D & addSubObject()
Creates a new empty sub-object and appends it to the sub-object list.
void clear()
Removes all sub-objects and clears all properties of this object.
ConstObject3DIterator begin() const
Returns a constant iterator pointing to the beginning of the sub-objects.
Object3D & addSubObject(const SharedPointer &object)
Appends the supplied object to the sub-object list.
Object3DIterator removeSubObject(const Object3DIterator &it)
Removes the sub-object specified by the iterator it.
Object3DIterator end()
Returns a mutable iterator pointing to the end of the sub-objects.
The namespace of the Chemical Data Processing Library.