[Positioner] Use nullptr instead of NULL
This commit is contained in:
parent
92db007d6b
commit
f35215388b
|
@ -35,7 +35,7 @@ protected:
|
|||
void reorder_coordinates(void) ;
|
||||
|
||||
public:
|
||||
Area(const Building *const _building = NULL,
|
||||
Area(const Building *const _building = nullptr,
|
||||
const std::string &_name = "Unnamed area",
|
||||
const Point3D &p1 = Point3D(0,0,0),
|
||||
const Point3D &p2 = Point3D(0,0,0)) ;
|
||||
|
|
|
@ -33,14 +33,14 @@ using namespace std ;
|
|||
/**
|
||||
* @param _point The coordinates of the reference point to generate.
|
||||
* @param _cp1 The first capture point (receiver) to use the measurements
|
||||
* of to generate the reference points; it cannot be NULL.
|
||||
* of to generate the reference points; it cannot be null.
|
||||
* @param _cp2 The second receiver capture point (optional).
|
||||
*/
|
||||
AutocalibrationLine::AutocalibrationLine(
|
||||
const Point3D &_point,
|
||||
const CapturePoint *const _cp1, const CapturePoint *const _cp2):
|
||||
Autocalibration(_point), cp1(_cp1), cp2(_cp2),
|
||||
trx_cp(NULL), trx_rp(NULL)
|
||||
trx_cp(nullptr), trx_rp(nullptr)
|
||||
{
|
||||
assert(cp1) ;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void AutocalibrationLine::sort_reference_cps()
|
|||
Stock::get_reference_point(ref->second.get_coordinates()) ;
|
||||
const vector<CalibrationRequest*> &ref_cr = ref_rp.get_requests() ;
|
||||
/* Search for the first measurement made by RX in ref_rp */
|
||||
const Measurement *rx_measurement = NULL ;
|
||||
const Measurement *rx_measurement = nullptr ;
|
||||
const string &rx_mac = rx->second.get_mac_addr() ;
|
||||
for (auto cr = ref_cr.begin() ; cr != ref_cr.end() ; ++cr)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ void AutocalibrationLine::compute_multi_packet_ss()
|
|||
const vector<CalibrationRequest*> &ref_cr = trx_rp->get_requests() ;
|
||||
|
||||
/* Search for the first measurement made by RX in trx_rp */
|
||||
const Measurement *rx_measurement = NULL ;
|
||||
const Measurement *rx_measurement = nullptr ;
|
||||
vector<CalibrationRequest*>::const_iterator cr ;
|
||||
const string &rx_mac = rx->second.get_mac_addr() ;
|
||||
for (cr = ref_cr.begin() ; cr != ref_cr.end() ; ++cr)
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
public:
|
||||
AutocalibrationLine(const Point3D &_point,
|
||||
const CapturePoint *const _cp1,
|
||||
const CapturePoint *const _cp2 = NULL) ;
|
||||
const CapturePoint *const _cp2 = nullptr) ;
|
||||
} ;
|
||||
|
||||
#endif // _OWLPS_POSITIONING_AUTOCALIBRATIONLINE_HH_
|
||||
|
|
|
@ -187,7 +187,7 @@ void AutocalibrationMesh::compute_multi_packet_ss()
|
|||
const vector<CalibrationRequest*> &ref1_cr = ref1_rp.get_requests() ;
|
||||
|
||||
/* Search for the first measurement made by RX in ref1_rp */
|
||||
const Measurement *rx_measurement = NULL ;
|
||||
const Measurement *rx_measurement = nullptr ;
|
||||
vector<CalibrationRequest*>::const_iterator cr ;
|
||||
const string &rx_mac = rx->second.get_mac_addr() ;
|
||||
for (cr = ref1_cr.begin() ; cr != ref1_cr.end() ; ++cr)
|
||||
|
|
|
@ -50,7 +50,7 @@ Building::~Building()
|
|||
|
||||
|
||||
/**
|
||||
* If `area` is NULL, nothing is done.
|
||||
* If `area` is null, nothing is done.
|
||||
* If `area` is a pointer to an Area that is already stored in #areas,
|
||||
* nothing is done.
|
||||
* If `area` has the same name as (but is not identical to) an Area that
|
||||
|
|
|
@ -107,7 +107,7 @@ inline void Building::set_name(const std::string &_name)
|
|||
|
||||
|
||||
/**
|
||||
* @param wp A pointer to the Waypoint to add. If `wp` is NULL,
|
||||
* @param wp A pointer to the Waypoint to add. If `wp` is null,
|
||||
* nothing will be added.
|
||||
*/
|
||||
inline void Building::add_waypoint(Waypoint *const wp)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
CalibrationRequest::CalibrationRequest(const uint_fast8_t _type):
|
||||
reference_point(NULL), direction(Direction())
|
||||
reference_point(nullptr), direction(Direction())
|
||||
{
|
||||
type = _type ;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void CalibrationRequest::reference_point_backward_link() const
|
|||
void CalibrationRequest::clear()
|
||||
{
|
||||
Request::clear() ;
|
||||
reference_point = NULL ;
|
||||
reference_point = nullptr ;
|
||||
direction.clear() ;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
direction(source.direction) {}
|
||||
|
||||
CalibrationRequest(const Request &source,
|
||||
ReferencePoint *const _reference_point = NULL,
|
||||
ReferencePoint *const _reference_point = nullptr,
|
||||
const Direction &_direction = Direction(),
|
||||
const uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using boost::bad_lexical_cast ;
|
|||
|
||||
CSVStringReader::
|
||||
CSVStringReader(const std::string &_str, const char _separator):
|
||||
separator(_separator), current_token(NULL), current_field_nb(0)
|
||||
separator(_separator), current_token(nullptr), current_field_nb(0)
|
||||
{
|
||||
set_str(_str) ;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
|||
|
||||
public:
|
||||
CSVStringReader(const char _separator = ';'):
|
||||
separator(_separator), current_token(NULL), current_field_nb(0) {}
|
||||
separator(_separator), current_token(nullptr), current_field_nb(0) {}
|
||||
|
||||
CSVStringReader(const std::string &_str, const char _separator = ';') ;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
|||
|
||||
public:
|
||||
FRBHMBasic(void):
|
||||
PositioningAlgorithm("FRBHMBasic"), closest_in_ss(NULL) {}
|
||||
PositioningAlgorithm("FRBHMBasic"), closest_in_ss(nullptr) {}
|
||||
~FRBHMBasic(void) {}
|
||||
|
||||
/** @name Operations */
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace std ;
|
|||
|
||||
|
||||
Input::Input():
|
||||
medium(NULL)
|
||||
medium(nullptr)
|
||||
{
|
||||
initialise_input_medium() ;
|
||||
initialise_log_media() ;
|
||||
|
|
|
@ -78,7 +78,7 @@ void InputMedium::clear_current_request()
|
|||
else
|
||||
{
|
||||
delete current_request ;
|
||||
current_request = NULL ;
|
||||
current_request = nullptr ;
|
||||
current_request = new Request() ;
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void InputMedium::current_request_to_calibration_request(
|
|||
}
|
||||
|
||||
Request *tmp = current_request ;
|
||||
current_request = NULL ;
|
||||
current_request = nullptr ;
|
||||
current_request =
|
||||
new CalibrationRequest(*tmp,
|
||||
const_cast<ReferencePoint*>(reference_point),
|
||||
|
|
|
@ -101,7 +101,7 @@ bool InputUDPSocket::fill_current_request()
|
|||
// Read the main request data
|
||||
owl_request request ;
|
||||
ssize_t nread = recvfrom(sockfd, &request, sizeof(request), 0,
|
||||
NULL, NULL) ;
|
||||
nullptr, nullptr) ;
|
||||
if (nread <= 0)
|
||||
{
|
||||
cerr << "InputUDPSocket: No request received!" << endl ;
|
||||
|
@ -181,7 +181,7 @@ bool InputUDPSocket::fill_current_request()
|
|||
for (int i = 0 ; i < request.nb_info ; ++i)
|
||||
{
|
||||
nread = recvfrom(sockfd, &request_info, sizeof(request_info), 0,
|
||||
NULL, NULL) ;
|
||||
nullptr, nullptr) ;
|
||||
if (nread <= 0)
|
||||
{
|
||||
cerr << "No request info received!" << endl ;
|
||||
|
|
|
@ -115,7 +115,7 @@ void Measurement::merge(const Measurement &source)
|
|||
|
||||
|
||||
/**
|
||||
* - #cp is not deleted, only initialised to NULL.
|
||||
* - #cp is not deleted, only initialised to nullptr.
|
||||
* - #ss_list is cleared.
|
||||
* - average and variance variables are reset to 0.
|
||||
*/
|
||||
|
@ -129,7 +129,7 @@ void Measurement::clear()
|
|||
variance_mw_m2 = 0 ;
|
||||
variance_dbm_m2 = 0 ;
|
||||
variance_size = 0 ;
|
||||
cp = NULL ;
|
||||
cp = nullptr ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
|
||||
|
||||
public:
|
||||
Measurement(const CapturePoint *const _cp = NULL):
|
||||
Measurement(const CapturePoint *const _cp = nullptr):
|
||||
cp(_cp), average_dbm(0),
|
||||
average_mw(0), variance_mw(0), variance_dbm(0),
|
||||
variance_mw_m2(0), variance_dbm_m2(0), variance_size(0) {}
|
||||
|
|
|
@ -49,9 +49,9 @@ int main(const int argc, const char **const argv)
|
|||
action.sa_flags = 0 ;
|
||||
sigemptyset(&action.sa_mask) ;
|
||||
action.sa_handler = owl_sigint_handler ;
|
||||
sigaction(SIGINT, &action, NULL) ;
|
||||
sigaction(SIGINT, &action, nullptr) ;
|
||||
action.sa_handler = owl_sigterm_handler ;
|
||||
sigaction(SIGTERM, &action, NULL) ;
|
||||
sigaction(SIGTERM, &action, nullptr) ;
|
||||
|
||||
/* Run! */
|
||||
Positioning positioning ;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
Result RealPosition::compute(const Request &request)
|
||||
{
|
||||
const Point3D *coordinates = NULL ;
|
||||
const Point3D *coordinates = nullptr ;
|
||||
|
||||
const CalibrationRequest *calibration_request =
|
||||
dynamic_cast<const CalibrationRequest*>(&request) ;
|
||||
|
|
|
@ -124,7 +124,7 @@ std::vector<CalibrationRequest*>& ReferencePoint::get_requests() const
|
|||
|
||||
/**
|
||||
* @param r A pointer to the CalibrationRequest to add. If it is
|
||||
* NULL, nothing will be done.
|
||||
* null, nothing will be done.
|
||||
* The memory pointed by this pointer must not be deallocated before
|
||||
* the ReferencePoint destruction (do *not* pass a pointer to a local
|
||||
* variable!).
|
||||
|
|
|
@ -32,7 +32,7 @@ Request::Request(
|
|||
):
|
||||
type(OWL_REQUEST_UNDEFINED), nb_packets(1),
|
||||
mobile(_mobile), time_sent(_time_sent),
|
||||
measurements(_measurements), real_position(NULL)
|
||||
measurements(_measurements), real_position(nullptr)
|
||||
{
|
||||
received_now() ;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ Request::Request(
|
|||
Request::Request(const unordered_map<string, Measurement>
|
||||
&_measurements):
|
||||
type(OWL_REQUEST_UNDEFINED), nb_packets(1),
|
||||
mobile(NULL), measurements(_measurements), real_position(NULL)
|
||||
mobile(nullptr), measurements(_measurements), real_position(nullptr)
|
||||
{
|
||||
received_now() ;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ Request::Request(
|
|||
const unordered_map<string, Measurement> &_measurements
|
||||
):
|
||||
type(OWL_REQUEST_UNDEFINED), nb_packets(1),
|
||||
mobile(NULL), time_sent(_time_sent),
|
||||
measurements(_measurements), real_position(NULL)
|
||||
mobile(nullptr), time_sent(_time_sent),
|
||||
measurements(_measurements), real_position(nullptr)
|
||||
{
|
||||
received_now() ;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ Request::Request(const Request &source):
|
|||
type(source.type), nb_packets(source.nb_packets),
|
||||
mobile(source.mobile), time_sent(source.time_sent),
|
||||
time_received(source.time_received),
|
||||
measurements(source.measurements), real_position(NULL)
|
||||
measurements(source.measurements), real_position(nullptr)
|
||||
{
|
||||
if (source.real_position)
|
||||
real_position = new Point3D(*source.real_position) ;
|
||||
|
@ -86,7 +86,7 @@ Request::~Request()
|
|||
|
||||
/**
|
||||
* @param mac_receiver The MAC address of the receiver CP.
|
||||
* @returns A pointer on the found measurement, or NULL if no
|
||||
* @returns A pointer on the found measurement, or nullptr if no
|
||||
* measurement was made by this CP.
|
||||
*/
|
||||
const Measurement*
|
||||
|
@ -95,7 +95,7 @@ Request::get_measurement(const string &mac_receiver) const
|
|||
auto m = measurements.find(mac_receiver) ;
|
||||
if (m != measurements.end())
|
||||
return &m->second ;
|
||||
return NULL ;
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ inline void Request::clear_real_position()
|
|||
if (real_position)
|
||||
{
|
||||
delete real_position ;
|
||||
real_position = NULL ;
|
||||
real_position = nullptr ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,8 @@ void Request::set_real_position(const Point3D &_real_position)
|
|||
/**
|
||||
* - #nb_packets is set to 1 (this is the default value when
|
||||
* constructing a Request).
|
||||
* - #mobile is NULLified, but the value it pointed to is not deleted.
|
||||
* - #mobile is set to nullptr, but the value it pointed to is not
|
||||
* deleted.
|
||||
* - The fields of #time_sent and #time_received are initialised to 0.
|
||||
* - #measurements is cleared.
|
||||
*/
|
||||
|
@ -133,7 +134,7 @@ void Request::clear()
|
|||
{
|
||||
type = OWL_REQUEST_UNDEFINED ;
|
||||
nb_packets = 1 ;
|
||||
mobile = NULL ;
|
||||
mobile = nullptr ;
|
||||
time_sent.clear() ;
|
||||
time_received.clear() ;
|
||||
measurements.clear() ;
|
||||
|
@ -195,7 +196,7 @@ bool Request::operator==(const Request &source) const
|
|||
else if (real_position && source.real_position)
|
||||
real_position_equal = *real_position == *source.real_position ;
|
||||
else
|
||||
real_position_equal = false ; // one of the two is NULL
|
||||
real_position_equal = false ; // one of the two is null
|
||||
|
||||
return
|
||||
real_position_equal &&
|
||||
|
|
|
@ -66,7 +66,7 @@ protected:
|
|||
using measurements_list = std::unordered_map<std::string, Measurement> ;
|
||||
|
||||
public:
|
||||
Request(const Mobile *const _mobile = NULL,
|
||||
Request(const Mobile *const _mobile = nullptr,
|
||||
const Timestamp &_time_sent = Timestamp(),
|
||||
const std::unordered_map<std::string, Measurement>
|
||||
&_measurements = measurements_list()) ;
|
||||
|
|
|
@ -36,7 +36,7 @@ protected:
|
|||
float error ;
|
||||
|
||||
public:
|
||||
Result(const Request *const _request = NULL,
|
||||
Result(const Request *const _request = nullptr,
|
||||
const std::string &_algorithm = "UnknownAlgorithm"):
|
||||
request(_request), algorithm(_algorithm), error(-1) {}
|
||||
Result(const Request *const _request, const std::string &_algorithm,
|
||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
|||
std::vector<Result> results ;
|
||||
|
||||
public:
|
||||
ResultList(const Request *const _request = NULL,
|
||||
ResultList(const Request *const _request = nullptr,
|
||||
const std::vector<Result> &_results = std::vector<Result>()):
|
||||
request(_request), results(_results) {}
|
||||
ResultList(const ResultList &source):
|
||||
|
|
|
@ -94,7 +94,7 @@ const Building& Stock::get_building(const string &name)
|
|||
|
||||
/**
|
||||
* @returns A pointer to the first Area in which `point` was found.
|
||||
* @returns NULL if `point` does not belong to any Area.
|
||||
* @returns nullptr if `point` does not belong to any Area.
|
||||
*/
|
||||
const Area* Stock::in_which_area_is(const Point3D &point)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ const Area* Stock::in_which_area_is(const Point3D &point)
|
|||
return a->second ;
|
||||
}
|
||||
|
||||
return NULL ;
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,7 +323,7 @@ double Stock::cp_matrix_get_ss(const std::string &mac_transmitter,
|
|||
|
||||
/**
|
||||
* @returns A const pointer to the CP `coord` is the coordinates of.
|
||||
* @returns NULL if `coord` is not the coordinates of any CP.
|
||||
* @returns nullptr if `coord` is not the coordinates of any CP.
|
||||
*/
|
||||
const CapturePoint* Stock::is_cp_coordinate(const Point3D &coord)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ const CapturePoint* Stock::is_cp_coordinate(const Point3D &coord)
|
|||
if (cp->second.get_coordinates() == coord)
|
||||
return &cp->second ;
|
||||
|
||||
return NULL ;
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -497,7 +497,7 @@ void Stock::generate_reference_points_line()
|
|||
CSVStringReader path_parser(path_csv) ;
|
||||
Point3D p ;
|
||||
vector<Point3D> read_points ;
|
||||
const CapturePoint *cp1 = NULL ;
|
||||
const CapturePoint *cp1 = nullptr ;
|
||||
|
||||
// Read points until the first CP coordinate
|
||||
while (path_parser.read_point3d(p))
|
||||
|
@ -533,7 +533,7 @@ void Stock::generate_reference_points_line()
|
|||
}
|
||||
|
||||
// Read the next points and generate the RPs
|
||||
const CapturePoint *cp2 = NULL ;
|
||||
const CapturePoint *cp2 = nullptr ;
|
||||
while (path_parser.read_point3d(p))
|
||||
{
|
||||
cp2 = Stock::is_cp_coordinate(p) ;
|
||||
|
@ -566,7 +566,7 @@ void Stock::generate_reference_points_line()
|
|||
}
|
||||
|
||||
cp1 = cp2 ;
|
||||
cp2 = NULL ;
|
||||
cp2 = nullptr ;
|
||||
}
|
||||
|
||||
// Generate the last RPs (after the last RP)
|
||||
|
|
|
@ -73,7 +73,7 @@ private:
|
|||
static void generate_interpolated_reference_points(
|
||||
const Point3D &start, const Point3D &end,
|
||||
const CapturePoint *const cp1,
|
||||
const CapturePoint *const cp2 = NULL) ;
|
||||
const CapturePoint *const cp2 = nullptr) ;
|
||||
/// Generates reference points according to a list
|
||||
static void generate_reference_points_list(void) ;
|
||||
/// Generates a single reference point
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
{
|
||||
// Default constructor
|
||||
Area a1 ;
|
||||
Area a2(NULL, "Unnamed area", Point3D(0,0,0), Point3D(0,0,0)) ;
|
||||
Area a2(nullptr, "Unnamed area", Point3D(0,0,0), Point3D(0,0,0)) ;
|
||||
TS_ASSERT_EQUALS(a1, a2) ;
|
||||
|
||||
// Copy constructor
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
// Default constructor
|
||||
Measurement m00 ;
|
||||
std::map<pkt_id_t, ss_t> vi1 ;
|
||||
Measurement m01(NULL) ;
|
||||
Measurement m01(nullptr) ;
|
||||
m01.add_ss_list(vi1) ;
|
||||
TS_ASSERT_EQUALS(m00, m01) ;
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
{
|
||||
// Default constructor
|
||||
Result result1 ;
|
||||
Result result2(NULL) ;
|
||||
Result result3(NULL, "UnknownAlgorithm") ;
|
||||
Result result2(nullptr) ;
|
||||
Result result3(nullptr, "UnknownAlgorithm") ;
|
||||
TS_ASSERT_EQUALS(result1, result2) ;
|
||||
TS_ASSERT_EQUALS(result1, result3) ;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
output_file.close() ;
|
||||
|
||||
std::string line ;
|
||||
TextFileReader *textfilereader = NULL ;
|
||||
TextFileReader *textfilereader = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
textfilereader = new TextFileReader(test_file_name)) ;
|
||||
TS_ASSERT(textfilereader->read_line(line)) ;
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
void test_textfilewriter(void)
|
||||
{
|
||||
TextFileWriter *textfilewriter = NULL ;
|
||||
TextFileWriter *textfilewriter = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
textfilewriter = new TextFileWriter(test_file_name)) ;
|
||||
TS_ASSERT(textfilewriter->write_text("Hello\nWorld\n")) ;
|
||||
|
|
|
@ -73,11 +73,11 @@ public:
|
|||
|
||||
void test_areas(void)
|
||||
{
|
||||
Building *building1 = NULL ;
|
||||
Building *building1 = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
building1 = const_cast<Building*>(
|
||||
&Stock::get_building("My building"))) ;
|
||||
Building *building2 = NULL ;
|
||||
Building *building2 = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
building2 = const_cast<Building*>(
|
||||
&Stock::get_building("Building #2"))) ;
|
||||
|
@ -107,11 +107,11 @@ public:
|
|||
|
||||
void test_waypoints(void)
|
||||
{
|
||||
Building *building1 = NULL ;
|
||||
Building *building1 = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
building1 = const_cast<Building*>(
|
||||
&Stock::get_building("My building"))) ;
|
||||
Building *building2 = NULL ;
|
||||
Building *building2 = nullptr ;
|
||||
TS_ASSERT_THROWS_NOTHING(
|
||||
building2 = const_cast<Building*>(
|
||||
&Stock::get_building("Building #2"))) ;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
{
|
||||
// Default constructor
|
||||
Waypoint wp00 ;
|
||||
Waypoint wp01(NULL, 0, 0, 0) ;
|
||||
Waypoint wp01(nullptr, 0, 0, 0) ;
|
||||
TS_ASSERT_EQUALS(wp00, wp01) ;
|
||||
|
||||
// Copy constructor
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
Point3D p0(5, 3, 8) ;
|
||||
Waypoint wp4(p0) ;
|
||||
TS_ASSERT_EQUALS(p0, wp4) ;
|
||||
Waypoint wp5(NULL, p0) ;
|
||||
Waypoint wp5(nullptr, p0) ;
|
||||
TS_ASSERT_EQUALS(wp4, wp5) ;
|
||||
|
||||
// 3-float array constructor
|
||||
|
@ -76,12 +76,12 @@ public:
|
|||
void test_operators(void)
|
||||
{
|
||||
// ==
|
||||
Waypoint wp1(NULL, 42, 21, 19) ;
|
||||
Waypoint wp2(NULL, 42, 21, 19) ;
|
||||
Waypoint wp1(nullptr, 42, 21, 19) ;
|
||||
Waypoint wp2(nullptr, 42, 21, 19) ;
|
||||
TS_ASSERT_EQUALS(wp1, wp2) ;
|
||||
|
||||
// !=
|
||||
Waypoint wp3(NULL, 1, 4, 7) ;
|
||||
Waypoint wp3(nullptr, 1, 4, 7) ;
|
||||
TS_ASSERT(wp1 != wp3) ;
|
||||
|
||||
// =
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace std ;
|
|||
|
||||
|
||||
TrilaterationAlgorithm::TrilaterationAlgorithm():
|
||||
request(NULL)
|
||||
request(nullptr)
|
||||
{
|
||||
// Will be changed when other trilateration methods will be
|
||||
// implemented.
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace std ;
|
|||
|
||||
/**
|
||||
* @param _b A pointer to the (first) Building to add to #buildings.
|
||||
* If it is NULL, #buildings will remain empty.
|
||||
* If it is null, #buildings will remain empty.
|
||||
* @param _x X coordinate.
|
||||
* @param _y Y coordinate.
|
||||
* @param _z Z coordinate.
|
||||
|
@ -42,7 +42,7 @@ Waypoint::Waypoint(Building *const _b,
|
|||
|
||||
/**
|
||||
* @param _b A pointer to the (first) Building to add to #buildings.
|
||||
* If it is NULL, #buildings will remain empty.
|
||||
* If it is null, #buildings will remain empty.
|
||||
* @param p Coordinates of the Waypoint.
|
||||
*/
|
||||
Waypoint::Waypoint(Building *const _b, const Point3D &p): Point3D(p)
|
||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
|||
std::unordered_set<Building*> buildings ;
|
||||
|
||||
public:
|
||||
Waypoint(Building *const _b = NULL, const float _x = 0,
|
||||
Waypoint(Building *const _b = nullptr, const float _x = 0,
|
||||
const float _y = 0, const float _z = 0) ;
|
||||
|
||||
Waypoint(Building *const _b, const Point3D &p) ;
|
||||
|
@ -84,13 +84,13 @@ public:
|
|||
|
||||
/**
|
||||
* @returns A pointer to the first Building associated with the Waypoint
|
||||
* (i.e. the first element of #buildings). If #buildings is empty, NULL
|
||||
* is returned.
|
||||
* (i.e. the first element of #buildings). If #buildings is empty,
|
||||
* nullptr is returned.
|
||||
*/
|
||||
inline Building* Waypoint::get_1st_building() const
|
||||
{
|
||||
if (buildings.empty())
|
||||
return NULL ;
|
||||
return nullptr ;
|
||||
return *buildings.begin() ;
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ Waypoint::get_buildings() const
|
|||
|
||||
|
||||
/**
|
||||
* @param _b A pointer to the Building to add. If it is
|
||||
* NULL, nothing will be done.
|
||||
* @param _b A pointer to the Building to add. If it is null, nothing
|
||||
* will be done.
|
||||
* The memory pointed by this pointer must not be deallocated before
|
||||
* the Waypoint destruction (do *not* pass a pointer to a local
|
||||
* variable!).
|
||||
|
|
Loading…
Reference in New Issue