[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 ;
|
||||
|
||||
public:
|
||||
Autocalibration(const Point3D &_point): point(_point) {}
|
||||
explicit Autocalibration(const Point3D &_point): point(_point) {}
|
||||
|
||||
/// Generates a single reference point
|
||||
void generate_reference_point(void) ;
|
||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
|||
const float point_dst) ;
|
||||
|
||||
public:
|
||||
AutocalibrationMesh(const Point3D &_point): Autocalibration(_point) {}
|
||||
explicit AutocalibrationMesh(const Point3D &_point): Autocalibration(_point) {}
|
||||
} ;
|
||||
|
||||
#endif // _OWLPS_POSITIONING_AUTOCALIBRATIONMESH_HH_
|
||||
|
|
|
@ -34,7 +34,7 @@ protected:
|
|||
std::unordered_set<Waypoint*> waypoints ;
|
||||
|
||||
public:
|
||||
Building(const std::string &_name = "Unnamed building"):
|
||||
explicit Building(const std::string &_name = "Unnamed building"):
|
||||
name(_name) {}
|
||||
|
||||
Building(const Building &source):
|
||||
|
|
|
@ -30,7 +30,8 @@ protected:
|
|||
Direction direction ;
|
||||
|
||||
public:
|
||||
CalibrationRequest(const uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
||||
explicit CalibrationRequest(const uint_fast8_t _type
|
||||
= OWL_REQUEST_AUTOCALIBRATION);
|
||||
|
||||
CalibrationRequest(const CalibrationRequest &source):
|
||||
Request(source), reference_point(source.reference_point),
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
frequency(PosUtil::wifi_channel_to_hz(channel)),
|
||||
friis_index(0) {}
|
||||
|
||||
CapturePoint(const WifiDevice &source):
|
||||
explicit CapturePoint(const WifiDevice &source):
|
||||
WifiDevice(source), coordinates(Point3D()), frequency(0),
|
||||
friis_index(0) {}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
|||
void process_device_line(void) ;
|
||||
|
||||
public:
|
||||
CapturePointsReaderCSV(const std::string &file_name) ;
|
||||
explicit CapturePointsReaderCSV(const std::string &file_name);
|
||||
|
||||
~CapturePointsReaderCSV(void) {}
|
||||
} ;
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
void print_error_cast(void) const ;
|
||||
|
||||
public:
|
||||
CSVStringReader(const char _separator = ';'):
|
||||
explicit CSVStringReader(const char _separator = ';'):
|
||||
separator(_separator), current_token(nullptr), current_field_nb(0) {}
|
||||
|
||||
CSVStringReader(const std::string &_str, const char _separator = ';') ;
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
//@}
|
||||
|
||||
public:
|
||||
InputCSV(const std::string &filename):
|
||||
explicit InputCSV(const std::string &filename):
|
||||
file(filename) {}
|
||||
|
||||
~InputCSV(void) {}
|
||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
|||
TextFileWriter file ;
|
||||
|
||||
public:
|
||||
InputLogCSV(const std::string &filename):
|
||||
explicit InputLogCSV(const std::string &filename):
|
||||
file(filename) {}
|
||||
|
||||
/** @name Operations */
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
//@}
|
||||
|
||||
public:
|
||||
InputUDPSocket(const uint_fast16_t _port) ;
|
||||
explicit InputUDPSocket(const uint_fast16_t _port);
|
||||
|
||||
~InputUDPSocket(void) ;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
|
||||
|
||||
public:
|
||||
Measurement(const CapturePoint *const _cp = nullptr):
|
||||
explicit 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) {}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
WifiDevice(_ip_addr, _mac_addr, _antenna_gain, _trx_power),
|
||||
last_request(nullptr) {}
|
||||
|
||||
Mobile(const WifiDevice &wd):
|
||||
explicit Mobile(const WifiDevice &wd):
|
||||
WifiDevice(wd), last_request(nullptr) {}
|
||||
|
||||
Mobile(const Mobile &m) ;
|
||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
|||
void process_device_line(void) ;
|
||||
|
||||
public:
|
||||
MobilesReaderCSV(const std::string &file_name) ;
|
||||
explicit MobilesReaderCSV(const std::string &file_name);
|
||||
|
||||
~MobilesReaderCSV(void) {}
|
||||
} ;
|
||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
|||
TextFileWriter file ;
|
||||
|
||||
public:
|
||||
OutputCSV(const std::string &filename):
|
||||
explicit OutputCSV(const std::string &filename):
|
||||
file(filename) {}
|
||||
|
||||
void write(const Result &result) ;
|
||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
|||
std::ostream &output_stream ;
|
||||
|
||||
public:
|
||||
OutputTerminal(std::ostream &_output_stream = std::cout):
|
||||
explicit OutputTerminal(std::ostream &_output_stream = std::cout):
|
||||
output_stream(_output_stream) {}
|
||||
|
||||
void write(const Result &result) ;
|
||||
|
|
|
@ -39,10 +39,10 @@ public:
|
|||
Point3D(const Point3D &source):
|
||||
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]) {}
|
||||
|
||||
Point3D(const std::string &source) ;
|
||||
explicit Point3D(const std::string &source);
|
||||
|
||||
virtual ~Point3D(void) {}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
|||
std::string explanation ;
|
||||
|
||||
public:
|
||||
posexcept(const std::string &_explanation = "") throw():
|
||||
explicit posexcept(const std::string &_explanation = "") throw():
|
||||
explanation(_explanation) {}
|
||||
|
||||
~posexcept(void) throw() {}
|
||||
|
@ -46,28 +46,28 @@ public:
|
|||
class cannot_merge: public posexcept
|
||||
{
|
||||
public:
|
||||
cannot_merge(const std::string &_explanation) throw() ;
|
||||
explicit cannot_merge(const std::string &_explanation) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class element_already_exists: public posexcept
|
||||
{
|
||||
public:
|
||||
element_already_exists(const std::string &_explanation) throw() ;
|
||||
explicit element_already_exists(const std::string &_explanation) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class element_not_found: public posexcept
|
||||
{
|
||||
public:
|
||||
element_not_found(const std::string &_explanation) throw() ;
|
||||
explicit element_not_found(const std::string &_explanation) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class autocalibration_error: public posexcept
|
||||
{
|
||||
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
|
||||
{
|
||||
public:
|
||||
missing_configuration(const std::string &_explanation) throw() ;
|
||||
explicit missing_configuration(const std::string &_explanation) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class bad_configuration: public posexcept
|
||||
{
|
||||
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
|
||||
{
|
||||
public:
|
||||
malformed_input_data(const std::string &_explanation) throw() ;
|
||||
explicit malformed_input_data(const std::string &_explanation) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class bad_direction: public posexcept
|
||||
{
|
||||
public:
|
||||
bad_direction(const char direction) throw() ;
|
||||
explicit bad_direction(const char direction) throw();
|
||||
} ;
|
||||
|
||||
|
||||
class bad_channel: public posexcept
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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 ;
|
||||
|
||||
public:
|
||||
PositioningAlgorithm(const std::string &_name = "UnknownAlgorithm"):
|
||||
explicit PositioningAlgorithm(const std::string &_name = "UnknownAlgorithm"):
|
||||
name(_name) {}
|
||||
virtual ~PositioningAlgorithm(void) {}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ public:
|
|||
const std::unordered_map<std::string, Measurement>
|
||||
&_measurements = measurements_list()) ;
|
||||
|
||||
Request(const std::unordered_map<std::string, Measurement>
|
||||
&_measurements) ;
|
||||
explicit Request(const std::unordered_map<std::string, Measurement>
|
||||
&_measurements);
|
||||
|
||||
Request(const Timestamp &_time_sent,
|
||||
const std::unordered_map<std::string, Measurement>
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
// 3-float array constructor
|
||||
float coord[3] = {1, 2, 3} ;
|
||||
ReferencePoint rp3(coord) ;
|
||||
ReferencePoint rp3((Point3D(coord))) ;
|
||||
TS_ASSERT_EQUALS(rp1, rp3) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
// 3-float array constructor
|
||||
float coord[3] = {5, 3, 8} ;
|
||||
Waypoint wp3(coord) ;
|
||||
Waypoint wp3((Point3D(coord))) ;
|
||||
TS_ASSERT_EQUALS(wp3, wp4) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
bool eof_close(void) ;
|
||||
|
||||
public:
|
||||
TextFileReader(const std::string &_file_name) ;
|
||||
explicit TextFileReader(const std::string &_file_name);
|
||||
virtual ~TextFileReader(void) ;
|
||||
|
||||
/** @name Operations */
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
std::streambuf *file_buf ;
|
||||
|
||||
public:
|
||||
TextFileWriter(const std::string &_file_name) ;
|
||||
explicit TextFileWriter(const std::string &_file_name);
|
||||
virtual ~TextFileWriter(void) ;
|
||||
|
||||
bool write_text(const std::string &text) ;
|
||||
|
|
|
@ -62,11 +62,11 @@ protected:
|
|||
|
||||
public:
|
||||
Timestamp(void) ;
|
||||
Timestamp(const struct timespec &source) ;
|
||||
explicit Timestamp(const struct timespec &source);
|
||||
Timestamp(const owl_timestamp &source) ;
|
||||
Timestamp(const uint_fast32_t source_s, const uint_fast32_t source_ns) ;
|
||||
/// 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(void) {}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
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) {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue