[Positioner] Use explicit constructors
Wherever it's possible without further code change, mark one-argument constructors as explicit.
This commit is contained in:
parent
c4180419e0
commit
6c17646cc3
|
@ -56,7 +56,7 @@ protected:
|
||||||
virtual bool compute_single_packet_ss(pkt_id_t pkt_id) = 0 ;
|
virtual bool compute_single_packet_ss(pkt_id_t pkt_id) = 0 ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Autocalibration(const Point3D &_point): point(_point) {}
|
explicit Autocalibration(const Point3D &_point): point(_point) {}
|
||||||
|
|
||||||
/// Generates a single reference point
|
/// Generates a single reference point
|
||||||
void generate_reference_point(void) ;
|
void generate_reference_point(void) ;
|
||||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
||||||
const float point_dst) ;
|
const float point_dst) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutocalibrationMesh(const Point3D &_point): Autocalibration(_point) {}
|
explicit AutocalibrationMesh(const Point3D &_point): Autocalibration(_point) {}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif // _OWLPS_POSITIONING_AUTOCALIBRATIONMESH_HH_
|
#endif // _OWLPS_POSITIONING_AUTOCALIBRATIONMESH_HH_
|
||||||
|
|
|
@ -34,7 +34,7 @@ protected:
|
||||||
std::unordered_set<Waypoint*> waypoints ;
|
std::unordered_set<Waypoint*> waypoints ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Building(const std::string &_name = "Unnamed building"):
|
explicit Building(const std::string &_name = "Unnamed building"):
|
||||||
name(_name) {}
|
name(_name) {}
|
||||||
|
|
||||||
Building(const Building &source):
|
Building(const Building &source):
|
||||||
|
|
|
@ -30,7 +30,8 @@ protected:
|
||||||
Direction direction ;
|
Direction direction ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CalibrationRequest(const uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
explicit CalibrationRequest(const uint_fast8_t _type
|
||||||
|
= OWL_REQUEST_AUTOCALIBRATION);
|
||||||
|
|
||||||
CalibrationRequest(const CalibrationRequest &source):
|
CalibrationRequest(const CalibrationRequest &source):
|
||||||
Request(source), reference_point(source.reference_point),
|
Request(source), reference_point(source.reference_point),
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
frequency(PosUtil::wifi_channel_to_hz(channel)),
|
frequency(PosUtil::wifi_channel_to_hz(channel)),
|
||||||
friis_index(0) {}
|
friis_index(0) {}
|
||||||
|
|
||||||
CapturePoint(const WifiDevice &source):
|
explicit CapturePoint(const WifiDevice &source):
|
||||||
WifiDevice(source), coordinates(Point3D()), frequency(0),
|
WifiDevice(source), coordinates(Point3D()), frequency(0),
|
||||||
friis_index(0) {}
|
friis_index(0) {}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
||||||
void process_device_line(void) ;
|
void process_device_line(void) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CapturePointsReaderCSV(const std::string &file_name) ;
|
explicit CapturePointsReaderCSV(const std::string &file_name);
|
||||||
|
|
||||||
~CapturePointsReaderCSV(void) {}
|
~CapturePointsReaderCSV(void) {}
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
||||||
void print_error_cast(void) const ;
|
void print_error_cast(void) const ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSVStringReader(const char _separator = ';'):
|
explicit CSVStringReader(const char _separator = ';'):
|
||||||
separator(_separator), current_token(nullptr), current_field_nb(0) {}
|
separator(_separator), current_token(nullptr), current_field_nb(0) {}
|
||||||
|
|
||||||
CSVStringReader(const std::string &_str, const char _separator = ';') ;
|
CSVStringReader(const std::string &_str, const char _separator = ';') ;
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputCSV(const std::string &filename):
|
explicit InputCSV(const std::string &filename):
|
||||||
file(filename) {}
|
file(filename) {}
|
||||||
|
|
||||||
~InputCSV(void) {}
|
~InputCSV(void) {}
|
||||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
||||||
TextFileWriter file ;
|
TextFileWriter file ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputLogCSV(const std::string &filename):
|
explicit InputLogCSV(const std::string &filename):
|
||||||
file(filename) {}
|
file(filename) {}
|
||||||
|
|
||||||
/** @name Operations */
|
/** @name Operations */
|
||||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputUDPSocket(const uint_fast16_t _port) ;
|
explicit InputUDPSocket(const uint_fast16_t _port);
|
||||||
|
|
||||||
~InputUDPSocket(void) ;
|
~InputUDPSocket(void) ;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Measurement(const CapturePoint *const _cp = nullptr):
|
explicit Measurement(const CapturePoint *const _cp = nullptr):
|
||||||
cp(_cp), average_dbm(0),
|
cp(_cp), average_dbm(0),
|
||||||
average_mw(0), variance_mw(0), variance_dbm(0),
|
average_mw(0), variance_mw(0), variance_dbm(0),
|
||||||
variance_mw_m2(0), variance_dbm_m2(0), variance_size(0) {}
|
variance_mw_m2(0), variance_dbm_m2(0), variance_size(0) {}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power),
|
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power),
|
||||||
last_request(nullptr) {}
|
last_request(nullptr) {}
|
||||||
|
|
||||||
Mobile(const WifiDevice &wd):
|
explicit Mobile(const WifiDevice &wd):
|
||||||
WifiDevice(wd), last_request(nullptr) {}
|
WifiDevice(wd), last_request(nullptr) {}
|
||||||
|
|
||||||
Mobile(const Mobile &m) ;
|
Mobile(const Mobile &m) ;
|
||||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
||||||
void process_device_line(void) ;
|
void process_device_line(void) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MobilesReaderCSV(const std::string &file_name) ;
|
explicit MobilesReaderCSV(const std::string &file_name);
|
||||||
|
|
||||||
~MobilesReaderCSV(void) {}
|
~MobilesReaderCSV(void) {}
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
||||||
TextFileWriter file ;
|
TextFileWriter file ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutputCSV(const std::string &filename):
|
explicit OutputCSV(const std::string &filename):
|
||||||
file(filename) {}
|
file(filename) {}
|
||||||
|
|
||||||
void write(const Result &result) ;
|
void write(const Result &result) ;
|
||||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
||||||
std::ostream &output_stream ;
|
std::ostream &output_stream ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutputTerminal(std::ostream &_output_stream = std::cout):
|
explicit OutputTerminal(std::ostream &_output_stream = std::cout):
|
||||||
output_stream(_output_stream) {}
|
output_stream(_output_stream) {}
|
||||||
|
|
||||||
void write(const Result &result) ;
|
void write(const Result &result) ;
|
||||||
|
|
|
@ -39,10 +39,10 @@ public:
|
||||||
Point3D(const Point3D &source):
|
Point3D(const Point3D &source):
|
||||||
x(source.x), y(source.y), z(source.z) {}
|
x(source.x), y(source.y), z(source.z) {}
|
||||||
|
|
||||||
Point3D(const float source[3]):
|
explicit Point3D(const float source[3]):
|
||||||
x(source[0]), y(source[1]), z(source[2]) {}
|
x(source[0]), y(source[1]), z(source[2]) {}
|
||||||
|
|
||||||
Point3D(const std::string &source) ;
|
explicit Point3D(const std::string &source);
|
||||||
|
|
||||||
virtual ~Point3D(void) {}
|
virtual ~Point3D(void) {}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
||||||
std::string explanation ;
|
std::string explanation ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
posexcept(const std::string &_explanation = "") throw():
|
explicit posexcept(const std::string &_explanation = "") throw():
|
||||||
explanation(_explanation) {}
|
explanation(_explanation) {}
|
||||||
|
|
||||||
~posexcept(void) throw() {}
|
~posexcept(void) throw() {}
|
||||||
|
@ -46,28 +46,28 @@ public:
|
||||||
class cannot_merge: public posexcept
|
class cannot_merge: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cannot_merge(const std::string &_explanation) throw() ;
|
explicit cannot_merge(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class element_already_exists: public posexcept
|
class element_already_exists: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
element_already_exists(const std::string &_explanation) throw() ;
|
explicit element_already_exists(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class element_not_found: public posexcept
|
class element_not_found: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
element_not_found(const std::string &_explanation) throw() ;
|
explicit element_not_found(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class autocalibration_error: public posexcept
|
class autocalibration_error: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
autocalibration_error(const std::string &_explanation) throw() ;
|
explicit autocalibration_error(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ public:
|
||||||
class missing_configuration: public posexcept
|
class missing_configuration: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
missing_configuration(const std::string &_explanation) throw() ;
|
explicit missing_configuration(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class bad_configuration: public posexcept
|
class bad_configuration: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bad_configuration(const std::string &_explanation) throw() ;
|
explicit bad_configuration(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,21 +96,21 @@ public:
|
||||||
class malformed_input_data: public posexcept
|
class malformed_input_data: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
malformed_input_data(const std::string &_explanation) throw() ;
|
explicit malformed_input_data(const std::string &_explanation) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class bad_direction: public posexcept
|
class bad_direction: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bad_direction(const char direction) throw() ;
|
explicit bad_direction(const char direction) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class bad_channel: public posexcept
|
class bad_channel: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bad_channel(const unsigned long channel) throw() ;
|
explicit bad_channel(const unsigned long channel) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,14 +128,14 @@ public:
|
||||||
class error_opening_input_file: public posexcept
|
class error_opening_input_file: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
error_opening_input_file(const std::string &file_name) throw() ;
|
explicit error_opening_input_file(const std::string &file_name) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
class error_opening_output_file: public posexcept
|
class error_opening_output_file: public posexcept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
error_opening_output_file(const std::string &file_name) throw() ;
|
explicit error_opening_output_file(const std::string &file_name) throw();
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
||||||
const std::string name ;
|
const std::string name ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PositioningAlgorithm(const std::string &_name = "UnknownAlgorithm"):
|
explicit PositioningAlgorithm(const std::string &_name = "UnknownAlgorithm"):
|
||||||
name(_name) {}
|
name(_name) {}
|
||||||
virtual ~PositioningAlgorithm(void) {}
|
virtual ~PositioningAlgorithm(void) {}
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ public:
|
||||||
const std::unordered_map<std::string, Measurement>
|
const std::unordered_map<std::string, Measurement>
|
||||||
&_measurements = measurements_list()) ;
|
&_measurements = measurements_list()) ;
|
||||||
|
|
||||||
Request(const std::unordered_map<std::string, Measurement>
|
explicit Request(const std::unordered_map<std::string, Measurement>
|
||||||
&_measurements) ;
|
&_measurements);
|
||||||
|
|
||||||
Request(const Timestamp &_time_sent,
|
Request(const Timestamp &_time_sent,
|
||||||
const std::unordered_map<std::string, Measurement>
|
const std::unordered_map<std::string, Measurement>
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
// 3-float array constructor
|
// 3-float array constructor
|
||||||
float coord[3] = {1, 2, 3} ;
|
float coord[3] = {1, 2, 3} ;
|
||||||
ReferencePoint rp3(coord) ;
|
ReferencePoint rp3((Point3D(coord))) ;
|
||||||
TS_ASSERT_EQUALS(rp1, rp3) ;
|
TS_ASSERT_EQUALS(rp1, rp3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
// 3-float array constructor
|
// 3-float array constructor
|
||||||
float coord[3] = {5, 3, 8} ;
|
float coord[3] = {5, 3, 8} ;
|
||||||
Waypoint wp3(coord) ;
|
Waypoint wp3((Point3D(coord))) ;
|
||||||
TS_ASSERT_EQUALS(wp3, wp4) ;
|
TS_ASSERT_EQUALS(wp3, wp4) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
||||||
bool eof_close(void) ;
|
bool eof_close(void) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextFileReader(const std::string &_file_name) ;
|
explicit TextFileReader(const std::string &_file_name);
|
||||||
virtual ~TextFileReader(void) ;
|
virtual ~TextFileReader(void) ;
|
||||||
|
|
||||||
/** @name Operations */
|
/** @name Operations */
|
||||||
|
|
|
@ -33,7 +33,7 @@ private:
|
||||||
std::streambuf *file_buf ;
|
std::streambuf *file_buf ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextFileWriter(const std::string &_file_name) ;
|
explicit TextFileWriter(const std::string &_file_name);
|
||||||
virtual ~TextFileWriter(void) ;
|
virtual ~TextFileWriter(void) ;
|
||||||
|
|
||||||
bool write_text(const std::string &text) ;
|
bool write_text(const std::string &text) ;
|
||||||
|
|
|
@ -62,11 +62,11 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Timestamp(void) ;
|
Timestamp(void) ;
|
||||||
Timestamp(const struct timespec &source) ;
|
explicit Timestamp(const struct timespec &source);
|
||||||
Timestamp(const owl_timestamp &source) ;
|
Timestamp(const owl_timestamp &source) ;
|
||||||
Timestamp(const uint_fast32_t source_s, const uint_fast32_t source_ns) ;
|
Timestamp(const uint_fast32_t source_s, const uint_fast32_t source_ns) ;
|
||||||
/// Constructs a Timsestamp from a value in milliseconds (deprecated)
|
/// Constructs a Timsestamp from a value in milliseconds (deprecated)
|
||||||
Timestamp(const uint64_t source) ;
|
explicit Timestamp(const uint64_t source);
|
||||||
Timestamp(const Timestamp &source) ;
|
Timestamp(const Timestamp &source) ;
|
||||||
|
|
||||||
~Timestamp(void) {}
|
~Timestamp(void) {}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
Waypoint(Building *const _b, const Point3D &p) ;
|
Waypoint(Building *const _b, const Point3D &p) ;
|
||||||
|
|
||||||
Waypoint(const Point3D &p): Point3D(p) {}
|
explicit Waypoint(const Point3D &p): Point3D(p) {}
|
||||||
|
|
||||||
Waypoint(const Waypoint &wp): Point3D(wp), buildings(wp.buildings) {}
|
Waypoint(const Waypoint &wp): Point3D(wp), buildings(wp.buildings) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue