OGS
GeoLib::LineSegment Class Referencefinal

Detailed Description

Definition at line 17 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 14 of file LineSegment.cpp.

16 : _a(a),
17 _b(b),
19 point_mem_management_by_line_segment)
20{
21}
bool _point_mem_management_by_line_segment
Definition LineSegment.h:45
GeoLib::Point * _b
Definition LineSegment.h:44
GeoLib::Point * _a
Definition LineSegment.h:43

◆ LineSegment() [2/3]

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

Definition at line 30 of file LineSegment.cpp.

31 : _a(line_segment._a),
32 _b(line_segment._b),
34 line_segment._point_mem_management_by_line_segment)
35{
36 line_segment._a = nullptr;
37 line_segment._b = nullptr;
38 line_segment._point_mem_management_by_line_segment = false;
39}

◆ LineSegment() [3/3]

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

Definition at line 23 of file LineSegment.cpp.

24 : _a(new Point(line_segment.getBeginPoint())),
25 _b(new Point(line_segment.getEndPoint())),
27{
28}
TemplateElement< PointRule1 > Point
Definition Point.h:20

◆ ~LineSegment()

GeoLib::LineSegment::~LineSegment ( )

Definition at line 41 of file LineSegment.cpp.

42{
44 {
45 delete _b;
46 delete _a;
47 }
48}

References _a, _b, and _point_mem_management_by_line_segment.

Member Function Documentation

◆ getBeginPoint() [1/2]

Point & GeoLib::LineSegment::getBeginPoint ( )

Definition at line 71 of file LineSegment.cpp.

72{
73 return *_a;
74}

References _a.

◆ getBeginPoint() [2/2]

◆ getEndPoint() [1/2]

Point & GeoLib::LineSegment::getEndPoint ( )

Definition at line 81 of file LineSegment.cpp.

82{
83 return *_b;
84}

References _b.

◆ getEndPoint() [2/2]

◆ operator=() [1/2]

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

Definition at line 52 of file LineSegment.cpp.

53{
54 _a = line_segment._a;
55 _b = line_segment._b;
57 line_segment._point_mem_management_by_line_segment;
58
59 line_segment._a = nullptr;
60 line_segment._b = nullptr;
61 line_segment._point_mem_management_by_line_segment = false;
62
63 return *this;
64}

References _a, _b, and _point_mem_management_by_line_segment.

◆ operator=() [2/2]

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

Member Data Documentation

◆ _a

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

Definition at line 43 of file LineSegment.h.

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

◆ _b

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

Definition at line 44 of file LineSegment.h.

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

◆ _point_mem_management_by_line_segment

bool GeoLib::LineSegment::_point_mem_management_by_line_segment = false
private

Definition at line 45 of file LineSegment.h.

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


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