Locus No Pilotus
Project of four first grade MIPT DAFE/RSE students (for engineering practical work in the second semester) in Qt C++
Loading...
Searching...
No Matches
lib::TrappyLine Class Reference

Линия опасного перелета More...

#include <trappy_line.h>

Inheritance diagram for lib::TrappyLine:
Collaboration diagram for lib::TrappyLine:

Public Member Functions

 TrappyLine ()=default
 
 TrappyLine (const TrappyLine &)=default
 
 TrappyLine (std::pair< Target *, Target * > targets)
 
 TrappyLine (Target *first_target, Target *second_target)
 
 TrappyLine (TrappyLine &&)=default
 
virtual unsigned short GetId () const
 Возвращает значение ид. объекта внутри файла
 
QJsonObject GetJsonInfo () const override
 
std::pair< Target, TargetGetTargets () const
 
std::pair< Target *, Target * > & GetTargetsPtrs ()
 
const std::pair< Target *, Target * > & GetTargetsPtrs () const
 
bool IsChanged (const QJsonObject &trappy_line_obj) const override
 
TrappyLineoperator= (const TrappyLine &)=default
 
TrappyLineoperator= (TrappyLine &&)=default
 
bool operator== (const TrappyLine &) const
 
virtual void SetId (unsigned short id)
 Устанавливает значение ид. объекта внутри файла
 
void SetJsonInfo (const QJsonObject &) override
 
void SetTargets (std::pair< Target *, Target * > targets)
 
void SetTargets (Target *first_target, Target *second_target)
 

Private Member Functions

void CheckErrorValues () const override
 

Private Attributes

unsigned short id_ {USHRT_MAX}
 Идентификатор объекта внутри файла
 
std::pair< Target *, Target * > targets_
 

Detailed Description

Линия опасного перелета

Constructor & Destructor Documentation

◆ TrappyLine() [1/5]

lib::TrappyLine::TrappyLine ( )
default

◆ TrappyLine() [2/5]

lib::TrappyLine::TrappyLine ( Target * first_target,
Target * second_target )
inline
18 : targets_{std::make_pair(first_target, second_target)} {}
std::pair< Target *, Target * > targets_
Definition trappy_line.h:50

◆ TrappyLine() [3/5]

lib::TrappyLine::TrappyLine ( std::pair< Target *, Target * > targets)
inline
19: targets_{targets} {}

◆ TrappyLine() [4/5]

lib::TrappyLine::TrappyLine ( const TrappyLine & )
default

◆ TrappyLine() [5/5]

lib::TrappyLine::TrappyLine ( TrappyLine && )
default

Member Function Documentation

◆ CheckErrorValues()

void lib::TrappyLine::CheckErrorValues ( ) const
inlineoverrideprivatevirtual
Exceptions
td::runtime_errorкласс не содержит проверяемых данных

Implements lib::JSONable.

45 {
46 throw std::runtime_error("dev: no checkable error values in TrappyLines");
47 }

◆ GetId()

virtual unsigned short lib::JSONable::GetId ( ) const
inlinevirtualinherited

Возвращает значение ид. объекта внутри файла

Returns
unsigned short: идентификатор объекта внутри файла
26{ return id_; }
unsigned short id_
Идентификатор объекта внутри файла
Definition base.h:40
Here is the caller graph for this function:

◆ GetJsonInfo()

QJsonObject lib::TrappyLine::GetJsonInfo ( ) const
overridevirtual

Implements lib::JSONable.

9 {
10 QVariantMap trappy_line_map;
11
12 trappy_line_map.insert("Id", GetId());
13 trappy_line_map.insert("Id_P1", targets_.first->GetId());
14 trappy_line_map.insert("Id_P2", targets_.second->GetId());
15
16 return QJsonObject::fromVariantMap(trappy_line_map);
17}
virtual unsigned short GetId() const
Возвращает значение ид. объекта внутри файла
Definition base.h:26
Here is the call graph for this function:

◆ GetTargets()

std::pair< Target, Target > lib::TrappyLine::GetTargets ( ) const
27 {
28 if (targets_.first == nullptr || targets_.second == nullptr)
29 throw std::runtime_error("dev: target is nullptr");
30
31 return std::make_pair(*targets_.first, *targets_.second);
32}
Here is the caller graph for this function:

◆ GetTargetsPtrs() [1/2]

std::pair< Target *, Target * > & lib::TrappyLine::GetTargetsPtrs ( )
inline
38{ return targets_; }
Here is the caller graph for this function:

◆ GetTargetsPtrs() [2/2]

const std::pair< Target *, Target * > & lib::TrappyLine::GetTargetsPtrs ( ) const
inline
39{ return targets_; }

◆ IsChanged()

bool lib::TrappyLine::IsChanged ( const QJsonObject & trappy_line_obj) const
overridevirtual

Implements lib::JSONable.

19 {
20 unsigned short id1 =
21 static_cast<unsigned short>(trappy_line_obj.value("Id_P1").toInt());
22 unsigned short id2 =
23 static_cast<unsigned short>(trappy_line_obj.value("Id_P2").toInt());
24 return id1 != targets_.first->GetId() || id2 != targets_.second->GetId();
25}
Here is the caller graph for this function:

◆ operator=() [1/2]

TrappyLine & lib::TrappyLine::operator= ( const TrappyLine & )
default

◆ operator=() [2/2]

TrappyLine & lib::TrappyLine::operator= ( TrappyLine && )
default

◆ operator==()

bool lib::TrappyLine::operator== ( const TrappyLine & tr_line) const
34 {
35 return targets_.first == tr_line.GetTargetsPtrs().first &&
36 targets_.second == tr_line.GetTargetsPtrs().second;
37}
Here is the call graph for this function:

◆ SetId()

virtual void lib::JSONable::SetId ( unsigned short id)
inlinevirtualinherited

Устанавливает значение ид. объекта внутри файла

Parameters
idновый идентификатор объекта
32{ id_ = id; }
Here is the caller graph for this function:

◆ SetJsonInfo()

void lib::TrappyLine::SetJsonInfo ( const QJsonObject & )
inlineoverridevirtual

Implements lib::JSONable.

28{}

◆ SetTargets() [1/2]

void lib::TrappyLine::SetTargets ( std::pair< Target *, Target * > targets)
inline
34{ targets_ = targets; }

◆ SetTargets() [2/2]

void lib::TrappyLine::SetTargets ( Target * first_target,
Target * second_target )
inline
31 {
32 targets_ = std::make_pair(first_target, second_target);
33 }
Here is the caller graph for this function:

Member Data Documentation

◆ id_

unsigned short lib::JSONable::id_ {USHRT_MAX}
privateinherited

Идентификатор объекта внутри файла

40{USHRT_MAX};

◆ targets_

std::pair<Target*, Target*> lib::TrappyLine::targets_
private

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