Virtual Testbed
Ship dynamics simulator for extreme conditions
src
vtestbed
stl
solid.hh
1
#ifndef VTESTBED_STL_SOLID_HH
2
#define VTESTBED_STL_SOLID_HH
3
4
#include <istream>
5
#include <ostream>
6
#include <string>
7
8
#include <vtestbed/geometry/polyhedron.hh>
9
10
namespace
vtb
{
11
13
namespace
stl {
14
15
template
<
class
T>
16
class
Solid
{
17
18
public
:
19
using
polyhedron_type
=
vtb::geometry::Polyhedron<T>
;
20
21
private
:
22
std::string
_name;
23
polyhedron_type
_polyhedron;
24
25
public
:
26
27
Solid
() =
default
;
28
~
Solid
() =
default
;
29
Solid
(
const
Solid
&) =
default
;
30
Solid
& operator=(
const
Solid
&) =
default
;
31
Solid
(
Solid
&&) =
default
;
32
Solid
& operator=(
Solid
&&) =
default
;
33
34
inline
explicit
35
Solid
(
const
polyhedron_type
& polyhedron):
36
_polyhedron(polyhedron) {}
37
38
inline
explicit
39
Solid
(
polyhedron_type
&& polyhedron):
40
_polyhedron(std::move(polyhedron)) {}
41
42
inline
void
clear() { this->_polyhedron.clear(); }
43
inline
const
std::string
& name()
const
{
return
this->_name; }
44
inline
void
name(
const
std::string
& rhs) { this->_name = rhs; }
45
inline
const
polyhedron_type
& polyhedron()
const
{
return
this->_polyhedron; }
46
inline
polyhedron_type
& polyhedron() {
return
this->_polyhedron; }
47
48
void
write(
std::ostream
& out)
const
;
49
void
read(
std::istream
& in);
50
51
};
52
53
template
<
class
T>
54
inline
std::ostream
&
55
operator<<(
std::ostream
& out,
const
Solid<T>
& rhs) {
56
rhs.write(out);
57
return
out;
58
}
59
60
template
<
class
T>
61
inline
std::istream
&
62
operator>>(
std::istream
& in, Solid<T>& rhs) {
63
rhs.read(in);
64
return
in;
65
}
66
67
}
68
69
}
70
71
#endif // vim:filetype=cpp
vtb::stl::Solid
Definition:
solid.hh:16
std::istream
std::string
vtb
Main namespace.
Definition:
convert.hh:9
vtb::geometry::Polyhedron< T >
std::ostream
Generated by
1.8.15