OGS
GeoLib::LineSegment Class Referencefinal

Detailed Description

Definition at line 11 of file LineSegment.h.

#include <LineSegment.h>

Collaboration diagram for GeoLib::LineSegment:
[legend]

Public Member Functions

 LineSegment (GeoLib::Point *const a, GeoLib::Point *const b, bool point_mem_management_by_line_segment=false)
 LineSegment (LineSegment &&line_segment)
 LineSegment (LineSegment const &line_segment)
 ~LineSegment ()
LineSegmentoperator= (LineSegment const &rhs)
LineSegmentoperator= (LineSegment &&line_segment)
GeoLib::Point const & getBeginPoint () const
GeoLib::PointgetBeginPoint ()
GeoLib::Point const & getEndPoint () const
GeoLib::PointgetEndPoint ()

Private Attributes

GeoLib::Point_a = nullptr
GeoLib::Point_b = nullptr
bool _point_mem_management_by_line_segment = false

Constructor & Destructor Documentation

◆ LineSegment() [1/3]

GeoLib::LineSegment::LineSegment ( GeoLib::Point *const a,
GeoLib::Point *const b,
bool point_mem_management_by_line_segment = false )

Constructs a line segment given by its begin and end points.

Remarks
The main purpose of class LineSegment is the use within a polyline. For this reason the memory is not managed per default. But the user has the freedom to hand over the responsibility for the mem management of the points to the object.

Definition at line 8 of file LineSegment.cpp.

10 : _a(a),
11 _b(b),
13 point_mem_management_by_line_segment)
14{
15}
bool _point_mem_management_by_line_segment
Definition LineSegment.h:39
GeoLib::Point * _b
Definition LineSegment.h:38
GeoLib::Point * _a
Definition LineSegment.h:37

References _a, _b, and _point_mem_management_by_line_segment.

Referenced by LineSegment(), LineSegment(), operator=(), and operator=().

◆ LineSegment() [2/3]

GeoLib::LineSegment::LineSegment ( LineSegment && line_segment)

Definition at line 24 of file LineSegment.cpp.

25 : _a(line_segment._a),
26 _b(line_segment._b),
28 line_segment._point_mem_management_by_line_segment)
29{
30 line_segment._a = nullptr;
31 line_segment._b = nullptr;
32 line_segment._point_mem_management_by_line_segment = false;
33}

References LineSegment(), _a, _b, and _point_mem_management_by_line_segment.

◆ LineSegment() [3/3]

GeoLib::LineSegment::LineSegment ( LineSegment const & line_segment)

Definition at line 17 of file LineSegment.cpp.

18 : _a(new Point(line_segment.getBeginPoint())),
19 _b(new Point(line_segment.getEndPoint())),
21{
22}
TemplateElement< PointRule1 > Point

References LineSegment(), _a, _b, _point_mem_management_by_line_segment, getBeginPoint(), and getEndPoint().

◆ ~LineSegment()

GeoLib::LineSegment::~LineSegment ( )

Definition at line 35 of file LineSegment.cpp.

36{
38 {
39 delete _b;
40 delete _a;
41 }
42}

References _a, _b, and _point_mem_management_by_line_segment.

Member Function Documentation

◆ getBeginPoint() [1/2]

Point & GeoLib::LineSegment::getBeginPoint ( )

Definition at line 65 of file LineSegment.cpp.

66{
67 return *_a;
68}

References _a.

◆ getBeginPoint() [2/2]

◆ getEndPoint() [1/2]

Point & GeoLib::LineSegment::getEndPoint ( )

Definition at line 75 of file LineSegment.cpp.

76{
77 return *_b;
78}

References _b.

◆ getEndPoint() [2/2]

◆ operator=() [1/2]

LineSegment & GeoLib::LineSegment::operator= ( LineSegment && line_segment)

Definition at line 46 of file LineSegment.cpp.

47{
48 _a = line_segment._a;
49 _b = line_segment._b;
51 line_segment._point_mem_management_by_line_segment;
52
53 line_segment._a = nullptr;
54 line_segment._b = nullptr;
55 line_segment._point_mem_management_by_line_segment = false;
56
57 return *this;
58}

References LineSegment(), _a, _b, and _point_mem_management_by_line_segment.

◆ operator=() [2/2]

LineSegment & GeoLib::LineSegment::operator= ( LineSegment const & rhs)
default

References LineSegment().

Member Data Documentation

◆ _a

GeoLib::Point* GeoLib::LineSegment::_a = nullptr
private

◆ _b

GeoLib::Point* GeoLib::LineSegment::_b = nullptr
private

◆ _point_mem_management_by_line_segment

bool GeoLib::LineSegment::_point_mem_management_by_line_segment = false
private

Definition at line 39 of file LineSegment.h.

Referenced by LineSegment(), LineSegment(), LineSegment(), ~LineSegment(), and operator=().


The documentation for this class was generated from the following files: