Virtual Testbed
Ship dynamics simulator for extreme conditions
iges/entity.hh
1 #ifndef VTESTBED_IGES_ENTITY_HH
2 #define VTESTBED_IGES_ENTITY_HH
3 
4 #include <iosfwd>
5 #include <memory>
6 #include <vector>
7 
8 #include <vtestbed/iges/directory_entry.hh>
9 #include <vtestbed/iges/section.hh>
10 #include <vtestbed/iges/types.hh>
11 
12 namespace vtb {
13 
14  namespace iges {
15 
17  struct Entity {
18 
19  Directory_entry _entry;
20 
21  Entity() = default;
22  virtual ~Entity() = default;
23 
24  inline explicit
25  Entity(Entity_type type) {
26  this->_entry.type(static_cast<Integer>(type));
27  }
28 
29  inline explicit
30  Entity(Directory_entry entry):
31  _entry{entry} {}
32 
33  inline const Directory_entry&
34  entry() const noexcept {
35  return this->_entry;
36  }
37 
38  inline Directory_entry&
39  entry() noexcept {
40  return this->_entry;
41  }
42 
43  inline Entity_type
44  type() const noexcept {
45  return static_cast<Entity_type>(this->_entry.type());
46  }
47 
48  void
49  write(iges_ostream& out) const;
50 
51  protected:
52 
53  virtual void
54  parameters(iges_ostream& out) const {}
55 
56  };
57 
58  inline iges_ostream&
59  operator<<(iges_ostream& out, const Entity& rhs) {
60  rhs.write(out);
61  return out;
62  }
63 
64  typedef std::shared_ptr<Entity> Pointer;
65  typedef std::vector<Pointer> Entity_container;
66 
67  }
68 
69 }
70 
71 #endif // vim:filetype=cpp
Directory section entry.
Base class for entities.
Definition: iges/entity.hh:17
Main namespace.
Definition: convert.hh:9
Output stream that automatically wraps text for IGES files.
Definition: stream.hh:143