mark constructors explicit

This commit is contained in:
Arne Morten Kvarving 2023-05-16 10:50:01 +02:00
parent cb394ed19c
commit 6553e8d0b7
28 changed files with 33 additions and 33 deletions

View File

@ -112,7 +112,7 @@ public:
Color3f(); Color3f();
Color3f(float r, float g, float b); Color3f(float r, float g, float b);
Color3f(const Color3f& other); Color3f(const Color3f& other);
Color3f(ColorIdent colorIdent); explicit Color3f(ColorIdent colorIdent);
explicit Color3f(const Color3ub& other); explicit Color3f(const Color3ub& other);
Color3f& operator=(const Color3f& rhs); Color3f& operator=(const Color3f& rhs);
@ -158,7 +158,7 @@ public:
Color3ub(); Color3ub();
Color3ub(ubyte r, ubyte g, ubyte b); Color3ub(ubyte r, ubyte g, ubyte b);
Color3ub(const Color3ub& other); Color3ub(const Color3ub& other);
Color3ub(ColorIdent colorIdent); explicit Color3ub(ColorIdent colorIdent);
explicit Color3ub(const Color3f& other); explicit Color3ub(const Color3f& other);
Color3ub& operator=(const Color3ub& rhs); Color3ub& operator=(const Color3ub& rhs);

View File

@ -60,7 +60,7 @@ public:
}; };
public: public:
DebugTimer(const char* prefix, OperationMode operationMode = NORMAL); explicit DebugTimer(const char* prefix, OperationMode operationMode = NORMAL);
~DebugTimer(); ~DebugTimer();
void restart(const char* msg = NULL); void restart(const char* msg = NULL);

View File

@ -52,7 +52,7 @@ class Flags
public: public:
inline Flags(); inline Flags();
inline Flags(const Flags& other); inline Flags(const Flags& other);
inline Flags(FlagEnum flag); explicit inline Flags(FlagEnum flag);
inline Flags& operator=(const Flags& rhs); inline Flags& operator=(const Flags& rhs);
inline Flags& operator=(FlagEnum flag); inline Flags& operator=(FlagEnum flag);

View File

@ -99,7 +99,7 @@ class ref
public: public:
ref(T* object = NULL); ref(T* object = NULL);
ref(const ref& other); ref(const ref& other);
template<typename T2> ref(const ref<T2>& other); template<typename T2> explicit ref(const ref<T2>& other);
~ref(); ~ref();
ref& operator=(T* rhs); ref& operator=(T* rhs);
@ -150,7 +150,7 @@ class cref
public: public:
cref(const T* object = NULL); cref(const T* object = NULL);
cref(const cref& other); cref(const cref& other);
template<typename T2> cref(const cref<T2>& other); template<typename T2> explicit cref(const cref<T2>& other);
~cref(); ~cref();
cref& operator=(const T* rhs); cref& operator=(const T* rhs);

View File

@ -108,7 +108,7 @@ public:
using MemberCallbackAndActiveFlag = std::pair<MemberCallback, bool>; using MemberCallbackAndActiveFlag = std::pair<MemberCallback, bool>;
public: public:
Signal( const SignalEmitter* emitter ) explicit Signal( const SignalEmitter* emitter )
: m_emitter( emitter ) : m_emitter( emitter )
{ {
m_emitter->addEmittedSignal( this ); m_emitter->addEmittedSignal( this );

View File

@ -34,7 +34,7 @@ namespace Opm {
typedef std::vector< DeckItem >::const_iterator const_iterator; typedef std::vector< DeckItem >::const_iterator const_iterator;
DeckRecord() = default; DeckRecord() = default;
DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true ); explicit DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
static DeckRecord serializationTestObject(); static DeckRecord serializationTestObject();

View File

@ -38,7 +38,7 @@ namespace Opm {
class DeckTree { class DeckTree {
public: public:
DeckTree() = default; DeckTree() = default;
DeckTree(const std::string&); explicit DeckTree(const std::string&);
const std::string& parent(const std::string& fname) const; const std::string& parent(const std::string& fname) const;
bool includes(const std::string& parent_file, const std::string& include_file) const; bool includes(const std::string& parent_file, const std::string& include_file) const;

View File

@ -33,7 +33,7 @@ public:
struct Iterator : public storage_type::iterator { struct Iterator : public storage_type::iterator {
Iterator(storage_type::const_iterator inner_iter) : explicit Iterator(storage_type::const_iterator inner_iter) :
inner(inner_iter) inner(inner_iter)
{} {}

View File

@ -124,7 +124,7 @@ namespace Opm {
AquiferCT() = default; AquiferCT() = default;
AquiferCT(const TableManager& tables, const Deck& deck); AquiferCT(const TableManager& tables, const Deck& deck);
AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data); explicit AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
void loadFromRestart(const RestartIO::RstAquifer& rst, void loadFromRestart(const RestartIO::RstAquifer& rst,
const TableManager& tables); const TableManager& tables);

View File

@ -75,7 +75,7 @@ namespace Opm {
/// EclipseGrid ignores ACTNUM in Deck, and therefore needs ACTNUM /// EclipseGrid ignores ACTNUM in Deck, and therefore needs ACTNUM
/// explicitly. If a null pointer is passed, every cell is active. /// explicitly. If a null pointer is passed, every cell is active.
EclipseGrid(const Deck& deck, const int * actnum = nullptr); explicit EclipseGrid(const Deck& deck, const int * actnum = nullptr);
static bool hasGDFILE(const Deck& deck); static bool hasGDFILE(const Deck& deck);
static bool hasCylindricalKeywords(const Deck& deck); static bool hasCylindricalKeywords(const Deck& deck);

View File

@ -28,7 +28,7 @@ namespace Opm {
class PlymaxTable : public SimpleTable { class PlymaxTable : public SimpleTable {
public: public:
PlymaxTable( const DeckRecord& record ); explicit PlymaxTable(const DeckRecord& record);
const TableColumn& getPolymerConcentrationColumn() const; const TableColumn& getPolymerConcentrationColumn() const;
const TableColumn& getMaxPolymerConcentrationColumn() const; const TableColumn& getMaxPolymerConcentrationColumn() const;

View File

@ -23,13 +23,13 @@
namespace Opm { namespace Opm {
class DeckReckord; class DeckRecord;
class PlyrockTable : public SimpleTable { class PlyrockTable : public SimpleTable {
public: public:
// This is not really a table; every column has only one element. // This is not really a table; every column has only one element.
PlyrockTable( const DeckRecord& record ); explicit PlyrockTable(const DeckRecord& record);
// since this keyword is not necessarily monotonic, it cannot be evaluated! // since this keyword is not necessarily monotonic, it cannot be evaluated!
//using SimpleTable::evaluate; //using SimpleTable::evaluate;

View File

@ -30,7 +30,7 @@ namespace Opm {
class KeywordGenerator { class KeywordGenerator {
public: public:
KeywordGenerator(bool verbose); explicit KeywordGenerator(bool verbose);
static void ensurePath( const std::string& file_name); static void ensurePath( const std::string& file_name);
static std::string endTest(); static std::string endTest();

View File

@ -42,7 +42,7 @@ class State {
struct RunState { struct RunState {
RunState() = default; RunState() = default;
RunState(std::time_t sim_time) explicit RunState(std::time_t sim_time)
: run_count(1) : run_count(1)
, last_run(sim_time) , last_run(sim_time)
{} {}

View File

@ -121,7 +121,7 @@ public:
}; };
CompletedCells() = default; CompletedCells() = default;
CompletedCells(const GridDims& dims); explicit CompletedCells(const GridDims& dims);
CompletedCells(std::size_t nx, std::size_t ny, std::size_t nz); CompletedCells(std::size_t nx, std::size_t ny, std::size_t nz);
const Cell& get(std::size_t i, std::size_t j, std::size_t k) const; const Cell& get(std::size_t i, std::size_t j, std::size_t k) const;
std::pair<bool, Cell&> try_get(std::size_t i, std::size_t j, std::size_t k); std::pair<bool, Cell&> try_get(std::size_t i, std::size_t j, std::size_t k);

View File

@ -31,7 +31,7 @@ class GasLiftGroup {
public: public:
GasLiftGroup() = default; GasLiftGroup() = default;
GasLiftGroup(const std::string& name) : explicit GasLiftGroup(const std::string& name) :
m_name(name) m_name(name)
{} {}

View File

@ -111,7 +111,7 @@ public:
GuideRateModel::Target target { GuideRateModel::Target::NONE }; GuideRateModel::Target target { GuideRateModel::Target::NONE };
}; };
GuideRate(const Schedule& schedule); explicit GuideRate(const Schedule& schedule);
void setSerializationTestData(); void setSerializationTestData();

View File

@ -35,7 +35,7 @@ namespace Opm {
class AutoICD : public SICD { class AutoICD : public SICD {
public: public:
AutoICD() = default; AutoICD() = default;
AutoICD(const DeckRecord& record); explicit AutoICD(const DeckRecord& record);
static AutoICD serializationTestObject(); static AutoICD serializationTestObject();

View File

@ -90,7 +90,7 @@ namespace Opm {
const double x_in, const double x_in,
const double y_in); const double y_in);
Segment(const RestartIO::RstSegment& rst_segment); explicit Segment(const RestartIO::RstSegment& rst_segment);
static Segment serializationTestObject(); static Segment serializationTestObject();

View File

@ -30,7 +30,7 @@ namespace Network {
class Node { class Node {
public: public:
Node() = default; Node() = default;
Node(const std::string& name); explicit Node(const std::string& name);
const std::string& name() const; const std::string& name() const;
const std::optional<double>& terminal_pressure() const; const std::optional<double>& terminal_pressure() const;

View File

@ -38,7 +38,7 @@ class UDQState
{ {
public: public:
UDQState() = default; UDQState() = default;
UDQState(double undefined); explicit UDQState(double undefined);
bool has(const std::string& key) const; bool has(const std::string& key) const;
void load_rst(const RestartIO::RstState& rst_state); void load_rst(const RestartIO::RstState& rst_state);

View File

@ -28,7 +28,7 @@ namespace Opm {
struct WellInjectionControls { struct WellInjectionControls {
public: public:
WellInjectionControls(int controls_arg) : explicit WellInjectionControls(int controls_arg) :
controls(controls_arg) controls(controls_arg)
{} {}

View File

@ -28,7 +28,7 @@ namespace Opm {
struct WellProductionControls { struct WellProductionControls {
public: public:
WellProductionControls(int controls_arg) : explicit WellProductionControls(int controls_arg) :
controls(controls_arg) controls(controls_arg)
{ {
} }

View File

@ -27,8 +27,8 @@ namespace Opm {
class Dimension { class Dimension {
public: public:
Dimension(); Dimension();
Dimension(double SIfactor, explicit Dimension(double SIfactor,
double SIoffset = 0.0); double SIoffset = 0.0);
static Dimension serializationTestObject(); static Dimension serializationTestObject();

View File

@ -56,7 +56,7 @@ struct Vector{
public: public:
ERsm(const std::string& fname); explicit ERsm(const std::string& fname);
const std::vector<TimeStampUTC>& dates() const; const std::vector<TimeStampUTC>& dates() const;
const std::vector<double>& days() const; const std::vector<double>& days() const;

View File

@ -39,8 +39,8 @@ struct RstAction {
Quantity() = default; Quantity() = default;
Quantity(const std::string * zacn, double sacn_value); Quantity(const std::string * zacn, double sacn_value);
Quantity(const std::string& quantity); explicit Quantity(const std::string& quantity);
Quantity(double value); explicit Quantity(double value);
}; };

View File

@ -264,7 +264,7 @@ void AquiferCT::loadFromRestart(const RestartIO::RstAquifer& rst,
AquiferCT AquiferCT::serializationTestObject() AquiferCT AquiferCT::serializationTestObject()
{ {
return { { AQUCT_data::serializationTestObject() } }; return AquiferCT{ { AQUCT_data::serializationTestObject() } };
} }
std::size_t AquiferCT::size() const { std::size_t AquiferCT::size() const {

View File

@ -136,7 +136,7 @@ namespace {
parseContext.handleError(ParseContext::PARSE_EXTRA_DATA , msg_format, location, errors); parseContext.handleError(ParseContext::PARSE_EXTRA_DATA , msg_format, location, errors);
} }
return { std::move( items ), false }; return DeckRecord{ std::move( items ), false };
} }
bool ParserRecord::equal(const ParserRecord& other) const { bool ParserRecord::equal(const ParserRecord& other) const {