Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_wires_drawer.h
Go to the documentation of this file.
1 /* Author(s): F. Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-02-07
4  * Last modified: 2015-02-07
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Base class for all shape drawer in wires mode
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_I_WIRES_DRAWER_H
17 #define GEOMTOOLS_I_WIRES_DRAWER_H 1
18 
19 // Standard library:
20 #include <iostream>
21 
22 // Third party:
23 // - Boost:
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/cstdint.hpp>
26 
27 // This project:
28 #include <geomtools/utils.h>
30 
31 namespace geomtools {
32 
33  /*
35  class cached_wires_drawer
36  {
37  public:
38 
40  cached_wires_drawer(i_wires_3d_rendering & renderer_);
41 
43  virtual ~cached_wires_drawer();
44 
46  virtual void generate_wires_self(std::list<polyline_3d> & wires_,
47  uint32_t options_ = 0) const;
48 
50  void clear_wires();
51 
53  void update_wires();
54 
56  bool has_wires() const;
57 
59  const std::list<polyline_3d> & get_wires() const;
60 
61  private:
62 
63  i_wires_3d_rendering * _renderer_; //!< handle to an external renderer
64  uint32_t _options_; //!< Current rendering options
65  boost::scoped_ptr<std::list<polyline_3d> > _cached_wires_; //!< Cached wires collection
66 
67  };
68  */
69 
71  template <class T>
73  {
74  public:
75 
76  // Type aliases:
77  typedef T object_type;
78  typedef T * pointer_type;
79  typedef const T * const_pointer_type;
80  typedef T & reference_type;
81  typedef const T & const_reference_type;
82 
85  {
86  return;
87  }
88 
91  {
92  set_address(object_);
93  return;
94  }
95 
97  virtual ~i_wires_drawer()
98  {
99  return;
100  }
101 
103  bool has_address() const
104  {
105  return _address_ != 0;
106  }
107 
110  {
111  _address_ = &object_;
112  return;
113  }
114 
117  {
118  _address_ = 0;
119  return;
120  }
121 
124  {
125  return *_address_;
126  }
127 
128  protected:
129 
131 
132  };
133 
134 } // end of namespace geomtools
135 
136 #endif // GEOMTOOLS_I_WIRES_DRAWER_H
137 
138 /*
139 ** Local Variables: --
140 ** mode: c++ --
141 ** c-file-style: "gnu" --
142 ** tab-width: 2 --
143 ** End: --
144 */
T & reference_type
Definition: i_wires_drawer.h:80
bool has_address() const
Check the validity of the address.
Definition: i_wires_drawer.h:103
const_reference_type get() const
Return a non mutable reference to the object.
Definition: i_wires_drawer.h:123
i_wires_drawer()
Default constructor.
Definition: i_wires_drawer.h:84
const T * const_pointer_type
Definition: i_wires_drawer.h:79
T * pointer_type
Definition: i_wires_drawer.h:78
A box volume with a spherical extrusion.
Definition: spherical_extrusion_box_model.h:40
void reset_address()
Reset the address of the external object.
Definition: i_wires_drawer.h:116
const T & const_reference_type
Definition: i_wires_drawer.h:81
i_wires_drawer(const_reference_type object_)
Constructor.
Definition: i_wires_drawer.h:90
brief Abstract interface for objects that can describe themselves as a collection of polylines for 3D...
Definition: i_wires_3d_rendering.h:39
virtual ~i_wires_drawer()
Destructor.
Definition: i_wires_drawer.h:97
const_pointer_type _address_
Reference to an external object.
Definition: i_wires_drawer.h:130
void set_address(const_reference_type object_)
Set the address of the external object.
Definition: i_wires_drawer.h:109
Base class for all shape drawer objects in wires mode.
Definition: i_wires_drawer.h:72
T object_type
Definition: i_wires_drawer.h:77
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39