diff --git a/common/exception/ChecksumBlobSizeMismatch.hpp b/common/exception/ChecksumBlobSizeMismatch.hpp index 57864cc552474d68469bab9e00f2c56fd1632b25..f071d0a48d4e62c45c66675cc1bffdef251c89a0 100644 --- a/common/exception/ChecksumBlobSizeMismatch.hpp +++ b/common/exception/ChecksumBlobSizeMismatch.hpp @@ -32,7 +32,7 @@ public: * @param context optional context string added to the message at initialisation time * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - ChecksumBlobSizeMismatch(const std::string &context = "", const bool embedBacktrace = true) : + explicit ChecksumBlobSizeMismatch(const std::string &context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} /** diff --git a/common/exception/ChecksumTypeMismatch.hpp b/common/exception/ChecksumTypeMismatch.hpp index 2fde7c4ecdb07cd957673bc92adf7a7bd3de36a1..c122e5a852ee9130682c799c64b6e3a1a9f28c09 100644 --- a/common/exception/ChecksumTypeMismatch.hpp +++ b/common/exception/ChecksumTypeMismatch.hpp @@ -34,7 +34,7 @@ public: * @param embedBacktrace whether to embed a backtrace of where the * exception was throw in the message */ - ChecksumTypeMismatch(const std::string &context = "", const bool embedBacktrace = true) : + explicit ChecksumTypeMismatch(const std::string &context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} /** diff --git a/common/exception/ChecksumValueMismatch.hpp b/common/exception/ChecksumValueMismatch.hpp index ee5751a8e91b5c533ec41c3df2c16676d8a02d02..9dc452a8ed6e41789eef7cd89ccc96d9c261dab8 100644 --- a/common/exception/ChecksumValueMismatch.hpp +++ b/common/exception/ChecksumValueMismatch.hpp @@ -34,7 +34,7 @@ public: * @param embedBacktrace whether to embed a backtrace of where the * exception was throw in the message */ - ChecksumValueMismatch(const std::string &context = "", const bool embedBacktrace = false) : + explicit ChecksumValueMismatch(const std::string &context = "", const bool embedBacktrace = false) : Exception(context, embedBacktrace) {} /** diff --git a/common/exception/CommandLineNotParsed.hpp b/common/exception/CommandLineNotParsed.hpp index 7f8c08a7b4fdfeaf18b2e94f0139b74262e5f4e8..c0c14d2fe4e27e3125bee3fadd9d857d8cc13e69 100644 --- a/common/exception/CommandLineNotParsed.hpp +++ b/common/exception/CommandLineNotParsed.hpp @@ -27,16 +27,13 @@ namespace cta::exception { class CommandLineNotParsed : public cta::exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - CommandLineNotParsed(const std::string& context = "", const bool embedBacktrace = true) - : Exception(context, embedBacktrace) {} + explicit CommandLineNotParsed(const std::string& context = "", const bool embedBacktrace = true) : + Exception(context, embedBacktrace) {} +}; -}; // class CommandLineNotParsed - -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/EncryptionException.hpp b/common/exception/EncryptionException.hpp index 75cf0e7d6afe6fdea78f3472a35244b759e0b6b6..fe362ddbf94b7131420778a5f87588ea78964cc4 100644 --- a/common/exception/EncryptionException.hpp +++ b/common/exception/EncryptionException.hpp @@ -22,16 +22,12 @@ namespace cta::exception { /** - * Failed to dismount volume. + * Failed to dismount volume */ class EncryptionException : public cta::exception::Exception { public: - /** - * Constructor - */ - EncryptionException(const std::string& context, const bool embedBacktrace = false) - : cta::exception::Exception(context, embedBacktrace) {} + explicit EncryptionException(const std::string& context, const bool embedBacktrace = false) : + cta::exception::Exception(context, embedBacktrace) {} +}; -}; // class DismountFailed - -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/Errnum.hpp b/common/exception/Errnum.hpp index 768f8f075f5e7957acbfa35606a50f747684198d..41dc92a14712a404152be2e331b9bb1b9227e42b 100644 --- a/common/exception/Errnum.hpp +++ b/common/exception/Errnum.hpp @@ -24,7 +24,7 @@ namespace cta::exception { class Errnum : public Exception { public: explicit Errnum(std::string_view what = ""); - Errnum(int err, std::string_view what = ""); + explicit Errnum(int err, std::string_view what = ""); ~Errnum() final = default; int errorNumber() const { return m_errnum; } diff --git a/common/exception/Exception.hpp b/common/exception/Exception.hpp index 10ac798c727f72636c64b74a338a1a9f639fd070..8b0dbdc041ea53b034e33c1b1d9fb2dacf7c3d67 100644 --- a/common/exception/Exception.hpp +++ b/common/exception/Exception.hpp @@ -36,7 +36,7 @@ public: * @param context optional context string added to the message at initialisation time * @param embedBacktrace whether to embed a backtrace of where the exception was thrown */ - Exception(std::string_view context = "", bool embedBacktrace = true); + explicit Exception(std::string_view context = "", bool embedBacktrace = true); /** * Copy constructor diff --git a/common/exception/FileSizeMismatch.hpp b/common/exception/FileSizeMismatch.hpp index 0208bdd98f4236d763956d1cbe8a7e8b40835b0f..b4efb935cf7bc8febb27a71374fbc19a7475a7b2 100644 --- a/common/exception/FileSizeMismatch.hpp +++ b/common/exception/FileSizeMismatch.hpp @@ -27,20 +27,14 @@ namespace cta::catalogue { class FileSizeMismatch: public exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - FileSizeMismatch(const std::string &context = "", const bool embedBacktrace = true): - cta::exception::Exception(context, embedBacktrace) { - } + explicit FileSizeMismatch(const std::string &context = "", const bool embedBacktrace = true) : + cta::exception::Exception(context, embedBacktrace) {} - /** - * Destructor - */ ~FileSizeMismatch() override = default; }; diff --git a/common/exception/GrpcError.hpp b/common/exception/GrpcError.hpp index 444b491c460e050d277cf3de49fce1f5d52b7d85..eb5ca180191b1175dd3c92d55e947767583354b4 100644 --- a/common/exception/GrpcError.hpp +++ b/common/exception/GrpcError.hpp @@ -23,12 +23,8 @@ namespace cta::exception { class GrpcError : public cta::exception::Exception { public: - /** - * Constructor - */ - GrpcError(const std::string& context, const bool embedBacktrace = true) - : cta::exception::Exception(context, embedBacktrace) {} + explicit GrpcError(const std::string& context, const bool embedBacktrace = true) : + cta::exception::Exception(context, embedBacktrace) {} +}; -}; // class GrpcError - -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/NonRetryableError.hpp b/common/exception/NonRetryableError.hpp index daff97e12ffb039b47b57e03f29f5997922a152d..44372ca87f2a8a2a86241e34fd4942a6906393d5 100644 --- a/common/exception/NonRetryableError.hpp +++ b/common/exception/NonRetryableError.hpp @@ -22,21 +22,18 @@ namespace cta::exception { /** - * An exception class representing an application error that should not be retried. + * An exception class representing an application error that should not be retried */ class NonRetryableError : public exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - NonRetryableError(const std::string& context = "", const bool embedBacktrace = true) - : Exception(context, embedBacktrace) {} + explicit NonRetryableError(const std::string& context = "", const bool embedBacktrace = true) : + Exception(context, embedBacktrace) {} +}; -}; // class UserError - -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/NotImplementedException.hpp b/common/exception/NotImplementedException.hpp index 08a6e273282111cb3f70bd023d16b25f9622bfbf..596835836e6512c453a5abf92608090a37a55990 100644 --- a/common/exception/NotImplementedException.hpp +++ b/common/exception/NotImplementedException.hpp @@ -27,10 +27,8 @@ namespace cta::exception { */ class NotImplementedException : public cta::exception::Exception { public: - /** - * default constructor - */ - NotImplementedException(const std::string& what = "") : cta::exception::Exception() {} + explicit NotImplementedException(const std::string& what = "") : + cta::exception::Exception() {} }; -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/NullPtrException.hpp b/common/exception/NullPtrException.hpp index 945912b2be84af3d989189e1747328571d84768e..74fd13534df7cf8fdf23c63530e7db31c482ffb8 100644 --- a/common/exception/NullPtrException.hpp +++ b/common/exception/NullPtrException.hpp @@ -17,20 +17,14 @@ #pragma once -// Include Files #include "common/exception/Exception.hpp" namespace cta::exception { -/** - * Null pointer exception - */ class NullPtrException : public cta::exception::Exception { public: - /** - * default constructor - */ - NullPtrException(const std::string& context = "") : cta::exception::Exception(context) {} + explicit NullPtrException(const std::string& context = "") : + cta::exception::Exception(context) {} }; -} // namespace cta::exception +} // namespace cta::exception diff --git a/common/exception/TapeFseqMismatch.hpp b/common/exception/TapeFseqMismatch.hpp index 6a61af37f813624ed23bc59e90273c8c8bc2be9c..b364f083836d69744e714eebc6117294ee30c8a4 100644 --- a/common/exception/TapeFseqMismatch.hpp +++ b/common/exception/TapeFseqMismatch.hpp @@ -22,25 +22,19 @@ namespace cta::exception { /** - * Exception representing an unexpected mismatch between tape file sequence - * numbers. + * Exception representing an unexpected mismatch between tape file sequence numbers */ class TapeFseqMismatch: public exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - TapeFseqMismatch(const std::string &context = "", const bool embedBacktrace = true) : + explicit TapeFseqMismatch(const std::string &context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} - /** - * Destructor - */ ~TapeFseqMismatch() override = default; }; diff --git a/common/exception/UserError.hpp b/common/exception/UserError.hpp index b4a44d1ce7346a0e8181ec1cc27293b0cb1039ec..976c88cf9b0c55c3da3644e382a05d8d073e6b58 100644 --- a/common/exception/UserError.hpp +++ b/common/exception/UserError.hpp @@ -22,22 +22,20 @@ namespace cta::exception { /** - * An exception class representng a user as opposed to an application error. + * An exception class representng a user as opposed to an application error */ class UserError : public exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - UserError(const std::string& context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} + explicit UserError(const std::string& context = "", const bool embedBacktrace = true) : + Exception(context, embedBacktrace) {} +}; -}; // class UserError - -} // namespace cta::exception +} // namespace cta::exception #define CTA_GENERATE_USER_EXCEPTION_CLASS(A) class A: public cta::exception::UserError { using UserError::UserError; } diff --git a/common/exception/UserErrorWithCacheInfo.hpp b/common/exception/UserErrorWithCacheInfo.hpp index e3b788dcc2a75b5160ef83a89c1068a2ab7d199d..96b393da9a195c8adc9fe83137643f290b002fb7 100644 --- a/common/exception/UserErrorWithCacheInfo.hpp +++ b/common/exception/UserErrorWithCacheInfo.hpp @@ -22,27 +22,21 @@ namespace cta::exception { /** - * A user error together with information about how the respective cached - * value was obtained. + * A user error together with information about how the respective cached value was obtained */ class UserErrorWithCacheInfo : public exception::UserError { public: - std::string cacheInfo; - /** - * Constructor. + * Constructor * - * @param cInfo Information about how the respective cached value was - * obtained. - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param cInfo Information about how the respective cached value was obtained + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - UserErrorWithCacheInfo(const std::string &cInfo, const std::string &context = "", const bool embedBacktrace = true): - UserError(context, embedBacktrace), - cacheInfo(cInfo) { - } -}; // class UserErrorWithTimeBasedCacheInfo + explicit UserErrorWithCacheInfo(const std::string& cInfo, const std::string& context = "", const bool embedBacktrace = true) : + UserError(context, embedBacktrace), cacheInfo(cInfo) {} + + std::string cacheInfo; +}; } // namespace cta::exception diff --git a/disk/DiskFile.hpp b/disk/DiskFile.hpp index 753ad3fe24593b473771362faef4d5c7b4530d9c..69e2683e9dd66985e3af3496c1099c4769add324 100644 --- a/disk/DiskFile.hpp +++ b/disk/DiskFile.hpp @@ -48,7 +48,7 @@ namespace cta::disk { class DiskFileFactory { using Regex = cta::utils::Regex; public: - DiskFileFactory(uint16_t xrootTimeout); + explicit DiskFileFactory(uint16_t xrootTimeout); ReadFile * createReadFile(const std::string & path); WriteFile * createWriteFile(const std::string & path); private: diff --git a/disk/DiskFileImplementations.hpp b/disk/DiskFileImplementations.hpp index ca96df295681b0f6c4e02f1b680662442e44e048..cc820f8fe5cebda1c55fbd9cc63f98f6743795e4 100644 --- a/disk/DiskFileImplementations.hpp +++ b/disk/DiskFileImplementations.hpp @@ -76,7 +76,7 @@ namespace cta::disk { class XrootReadFile: public XrootBaseReadFile { public: - XrootReadFile(const std::string &xrootUrl, uint16_t timeout = 0); + explicit XrootReadFile(const std::string& xrootUrl, uint16_t timeout = 0); }; class XrootBaseWriteFile: public WriteFile { @@ -96,7 +96,7 @@ namespace cta::disk { class XrootWriteFile: public XrootBaseWriteFile { public: - XrootWriteFile(const std::string &xrootUrl, uint16_t timeout = 0); + explicit XrootWriteFile(const std::string& xrootUrl, uint16_t timeout = 0); }; //============================================================================== diff --git a/frontend/grpc/FrontendGrpcService.hpp b/frontend/grpc/FrontendGrpcService.hpp index 996ac15ecca8c2362c872bf574813f5e67a1e3f3..e8a523064319f72cf303baa769fc346598b74057 100644 --- a/frontend/grpc/FrontendGrpcService.hpp +++ b/frontend/grpc/FrontendGrpcService.hpp @@ -38,7 +38,7 @@ private: std::shared_ptr m_pubkeyCache; public: - CtaRpcImpl(const std::string& config); + explicit CtaRpcImpl(const std::string& config); FrontendService& getFrontendService() const { return *m_frontendService; } diff --git a/frontend/grpc/callback_api/ServerDefaultReactor.hpp b/frontend/grpc/callback_api/ServerDefaultReactor.hpp index 6108b5e841223f417af679bd202014bc53918e36..cb23e1c46172de4c811ad556cf5dc8a1b976e370 100644 --- a/frontend/grpc/callback_api/ServerDefaultReactor.hpp +++ b/frontend/grpc/callback_api/ServerDefaultReactor.hpp @@ -10,7 +10,7 @@ namespace cta::frontend::grpc { class DefaultWriteReactor : public ::grpc::ServerWriteReactor { public: - DefaultWriteReactor(const std::string& errMsg, ::grpc::StatusCode errCode = ::grpc::StatusCode::INVALID_ARGUMENT) { + explicit DefaultWriteReactor(const std::string& errMsg, ::grpc::StatusCode errCode = ::grpc::StatusCode::INVALID_ARGUMENT) { Finish(Status(errCode, errMsg)); } @@ -21,4 +21,4 @@ void DefaultWriteReactor::OnDone() { delete this; } -} // namespace cta::frontend::grpc \ No newline at end of file +} // namespace cta::frontend::grpc diff --git a/mediachanger/RmcProxy.hpp b/mediachanger/RmcProxy.hpp index bc1571322540d2ee96ff312ee3747384c2c32f5b..18aa75963d8943f6f7e85c34afa3d210a449739b 100644 --- a/mediachanger/RmcProxy.hpp +++ b/mediachanger/RmcProxy.hpp @@ -45,9 +45,7 @@ public: * @parm maxRqstAttempts The maximum number of attempts a retriable RMC * request should be issued. */ - RmcProxy( - const uint16_t rmcPort = RMC_PORT, - const uint32_t netTimeout = RMC_NET_TIMEOUT, + explicit RmcProxy(const uint16_t rmcPort = RMC_PORT, const uint32_t netTimeout = RMC_NET_TIMEOUT, const uint32_t maxRqstAttempts = RMC_MAX_RQST_ATTEMPTS); /** diff --git a/objectstore/ArchiveQueueAlgorithms.hpp b/objectstore/ArchiveQueueAlgorithms.hpp index c53ae9d9e62a02a04cb77f30c1c5b03d6d37a5ed..7e3ed4015af1573c11f01b084651e411570086b0 100644 --- a/objectstore/ArchiveQueueAlgorithms.hpp +++ b/objectstore/ArchiveQueueAlgorithms.hpp @@ -482,7 +482,7 @@ template<> struct ContainerTraits::PopCriteria { uint64_t files; uint64_t bytes; - PopCriteria(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar + explicit PopCriteria(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar template PopCriteria& operator-=(const PoppedElementsSummary_t &pes) { bytes -= pes.bytes; @@ -495,7 +495,7 @@ template<> struct ContainerTraits::PoppedElementsSummary { uint64_t files; uint64_t bytes; - PoppedElementsSummary(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} + explicit PoppedElementsSummary(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} bool operator< (const PopCriteria & pc) { // This returns false if bytes or files are equal but the other value is less. Is that the intended behaviour? return bytes < pc.bytes && files < pc.files; diff --git a/objectstore/ObjectOps.hpp b/objectstore/ObjectOps.hpp index 346bdf0b06f2bcf62b949d38107f6193f948d815..e0bd41b5534426091f30f971f97ef32384a74969 100644 --- a/objectstore/ObjectOps.hpp +++ b/objectstore/ObjectOps.hpp @@ -385,7 +385,7 @@ class ScopedExclusiveLock: public ScopedLock { public: ScopedExclusiveLock() = default; - ScopedExclusiveLock(ObjectOpsBase & oo, uint64_t timeout_us = 0) { + explicit ScopedExclusiveLock(ObjectOpsBase& oo, uint64_t timeout_us = 0) { lock(oo, timeout_us); } diff --git a/objectstore/RetrieveQueueAlgorithms.hpp b/objectstore/RetrieveQueueAlgorithms.hpp index 90452c5b257d559f115e96aa275ae2b596b1e7f7..a759a6092bae053ad6af5b575d5497cd77c27408 100644 --- a/objectstore/RetrieveQueueAlgorithms.hpp +++ b/objectstore/RetrieveQueueAlgorithms.hpp @@ -466,7 +466,7 @@ template<> struct ContainerTraits::PopCriteria { uint64_t files; uint64_t bytes; - PopCriteria(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar + explicit PopCriteria(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar template PopCriteria& operator-=(const PoppedElementsSummary_t &pes) { bytes -= pes.bytes; @@ -487,7 +487,7 @@ struct ContainerTraits::PoppedElementsSum uint64_t bytes; bool diskSystemFull = false; std::string fullDiskSystem; - PoppedElementsSummary(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar + explicit PoppedElementsSummary(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {} // cppcheck-suppress uninitMemberVar bool operator==(const PoppedElementsSummary &pes) const { return bytes == pes.bytes && files == pes.files; } diff --git a/rdbms/Conn.hpp b/rdbms/Conn.hpp index 9dd0913cc93fd2c448f6763a203d7ec9ba830e8b..54fae2803fb2f101673d50f49e1848685b241f9e 100644 --- a/rdbms/Conn.hpp +++ b/rdbms/Conn.hpp @@ -31,206 +31,183 @@ class ConnPool; /** * A smart database connection that will automatically return the underlying - * database connection to its parent connection pool when it goes out of scope. + * database connection to its parent connection pool when it goes out of scope */ class Conn { public: - - /** - * Constructor. - */ Conn(); /** - * Constructor. + * Constructor * - * @param connAndStmts The database connection and its pool of prepared - * statements. - * @param pool The database connection pool to which the connection - * should be returned. + * @param connAndStmts The database connection and its pool of prepared statements + * @param pool The database connection pool to which the connection should be returned */ Conn(std::unique_ptr connAndStmts, ConnPool *const pool); /** - * Deletion of the copy constructor. + * Deletion of the copy constructor */ - Conn(Conn &) = delete; + Conn(Conn&) = delete; /** - * Move constructor. + * Move constructor * - * @param other The other object. + * @param other The other object */ - Conn(Conn &&other) noexcept; + Conn(Conn&& other) noexcept; /** - * Destructor. + * Destructor * - * Returns the database connection back to its pool. + * Returns the database connection back to its pool */ ~Conn() noexcept; /** - * Returns the database connection back to its pool. + * Returns the database connection back to its pool * - * This method is idempotent. + * This method is idempotent */ void reset() noexcept; /** - * Deletion of the copy assignment operator. + * Deletion of the copy assignment operator */ - Conn &operator=(const Conn &) = delete; + Conn& operator=(const Conn&) = delete; /** - * Move assignment operator. + * Move assignment operator * - * @param rhs The object on the right-hand side of the operator. - * @return This object. + * @param rhs The object on the right-hand side of the operator + * @return This object */ - Conn &operator=(Conn &&rhs) noexcept; + Conn& operator=(Conn&& rhs) noexcept; /** - * Thrown when a requested autocommit mode is not supported. + * Thrown when a requested autocommit mode is not supported */ struct AutocommitModeNotSupported: public exception::Exception { - AutocommitModeNotSupported(const std::string &context = "", const bool embedBacktrace = true): + explicit AutocommitModeNotSupported(const std::string &context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} }; /** - * Sets the autocommit mode of the connection. + * Sets the autocommit mode of the connection * - * @param autocommitMode The autocommit mode of the connection. - * @throw AutocommitModeNotSupported If the specified autocommit mode is not - * supported. + * @param autocommitMode The autocommit mode of the connection + * @throw AutocommitModeNotSupported If the specified autocommit mode is not supported */ void setAutocommitMode(const AutocommitMode autocommitMode); /** - * Returns the autocommit mode of the connection. + * Returns the autocommit mode of the connection * - * @return The autocommit mode of the connection. + * @return The autocommit mode of the connection */ AutocommitMode getAutocommitMode() const; /** - * Creates a prepared statement. + * Creates a prepared statement * - * @param sql The SQL statement. - * @return The prepared statement. + * @param sql The SQL statement + * @return The prepared statement */ Stmt createStmt(const std::string &sql); /** - * Executes the statement. + * Executes the statement * - * @param sql The SQL statement. + * @param sql The SQL statement */ void executeNonQuery(const std::string &sql); /** - * Commits the current transaction. + * Commits the current transaction */ void commit(); /** - * Rolls back the current transaction. + * Rolls back the current transaction */ void rollback(); /** - * Returns the names of all the column and their type as a map for the given - * table in the database schema. + * Returns the names of all the column and their type as a map for the given table in the database schema * - * @param tableName The table name to get the columns. - * @return The map of types by name of all the columns for the given table in the database schema. + * @param tableName The table name to get the columns + * @return The map of types by name of all the columns for the given table in the database schema */ std::map> getColumns(const std::string &tableName) const; /** - * Returns the names of all the tables in the database schema in alphabetical - * order. + * Returns the names of all the tables in the database schema in alphabetical order * - * @return The names of all the tables in the database schema in alphabetical - * order. + * @return The names of all the tables in the database schema in alphabetical order */ std::list getTableNames() const; /** - * Returns the names of all the indices in the database schema in alphabetical - * order. + * Returns the names of all the indices in the database schema in alphabetical order * - * @return The names of all the indices in the database schema in alphabetical - * order. + * @return The names of all the indices in the database schema in alphabetical order */ std::list getIndexNames() const; /** - * Closes the underlying cached database statements and their connection. + * Closes the underlying cached database statements and their connection * - * This method should only be used in extreme cases where the closure of thei - * underlying database connection needs to be forced. + * This method should only be used in extreme cases where the closure of the + * underlying database connection needs to be forced */ void closeUnderlyingStmtsAndConn(); /** - * Returns true if this connection is open. + * Returns true if this connection is open */ bool isOpen() const; /** - * Returns the names of all the sequences in the database schema in - * alphabetical order. + * Returns the names of all the sequences in the database schema in alphabetical order * - * If the underlying database technologies does not supported sequences then - * this method simply returns an empty list. + * If the underlying database technologies does not supported sequences then this method simply returns an empty list * - * @return The names of all the sequences in the database schema in - * alphabetical order. + * @return The names of all the sequences in the database schema in alphabetical order */ std::list getSequenceNames(); /** - * Returns the names of all the triggers in the database schema in - * alphabetical order. + * Returns the names of all the triggers in the database schema in alphabetical order * - * If the underlying database technologies does not supported triggers then - * this method simply returns an empty list. + * If the underlying database technologies does not supported triggers then this method simply returns an empty list * - * @return The names of all the triggers in the database schema in - * alphabetical order. + * @return The names of all the triggers in the database schema in alphabetical order */ std::list getTriggerNames(); /** - * Returns the names of all the tables that have been set as PARALLEL - * in alphabetical order. + * Returns the names of all the tables that have been set as PARALLEL in alphabetical order * - * If the underlying database technologies does not support PARALLEL - * them this method simply returns an empty list. + * If the underlying database technologies does not support PARALLEL them this method simply returns an empty list * - * @return the names of all the tables that have been set as PARALLEL - * in alphabetical order. + * @return the names of all the tables that have been set as PARALLEL in alphabetical order */ std::list getParallelTableNames(); /** * Returns the Constraint names of a given table in the database schema * - * If the underlying database technologies does not support constraints informations - * this method simply returns an empty list. + * If the underlying database technologies does not support constraints informations this method simply returns an empty list * * @param tableName the table name to get the constraint names from - * @return the list of the names of the constraints that the given table has. + * @return the list of the names of the constraints that the given table has */ std::list getConstraintNames(const std::string &tableName); /** * Returns the stored procedure names of the database * - * If the underlying database technologies does not support stored procedures informations - * this method simply returns an empty list. + * If the underlying database technologies does not support stored procedures informations this method simply returns an empty list * * @return the list of the names of the stored procedures in the database */ @@ -239,8 +216,7 @@ public: /** * Returns the synonym names of the database * - * If the underlying database technologies does not support synonym informations - * this method simply returns an empty list. + * If the underlying database technologies does not support synonym informations this method simply returns an empty list * * @return the list of the names of the synonyms in the database */ @@ -249,8 +225,7 @@ public: /** * Returns the type names of the database * - * If the underlying database technologies does not support type informations - * this method simply returns an empty list. + * If the underlying database technologies does not support type informations this method simply returns an empty list * * @return the list of the names of the types in the database */ @@ -259,8 +234,7 @@ public: /** * Returns the view names of the database * - * If the underlying database technologies does not support type informations - * this method simply returns an empty list. + * If the underlying database technologies does not support type informations this method simply returns an empty list * * @return the list of the names of the views in the database */ @@ -278,12 +252,12 @@ public: private: /** - * The database connection and its pool of prepared statements. + * The database connection and its pool of prepared statements */ std::unique_ptr m_connAndStmts; /** - * The database connection pool to which the m_conn should be returned. + * The database connection pool to which the m_conn should be returned */ ConnPool *m_pool; diff --git a/rdbms/DBException.hpp b/rdbms/DBException.hpp index ece80029cc2317d9aed8f45b3a1775f43fecad06..77ee3df0b7c9930261e61f3c9d41419599b12120 100644 --- a/rdbms/DBException.hpp +++ b/rdbms/DBException.hpp @@ -25,24 +25,21 @@ namespace cta::rdbms { /** - * A database constraint error. + * A database constraint error */ class DBException : public cta::exception::Exception { public: /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was throw in the message */ - DBException(const std::string &context = "", const std::string &dbErrorMessage="", const bool embedBacktrace = true); + explicit DBException(const std::string& context = "", const std::string& dbErrorMessage="", const bool embedBacktrace = true); /** - * Empty Destructor, explicitely non-throwing (needed for std::exception - * inheritance) + * Empty Destructor, explicitely non-throwing (needed for std::exception inheritance) */ ~DBException() noexcept override = default; @@ -53,6 +50,6 @@ public: private: std::string rawDbErrorMessage; -}; // class DBException +}; } // namespace cta::rdbms diff --git a/rdbms/InvalidResultSet.hpp b/rdbms/InvalidResultSet.hpp index 2add76bd5065a5bfc72e9fcd3598da4b128cf205..eea2ca593e1fb171d208af8bd7ce42505c81f80c 100644 --- a/rdbms/InvalidResultSet.hpp +++ b/rdbms/InvalidResultSet.hpp @@ -32,7 +32,7 @@ public: * @param context optional context string added to the message at initialisation time * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - InvalidResultSet(const std::string &context = "", const bool embedBacktrace = true) : + explicit InvalidResultSet(const std::string &context = "", const bool embedBacktrace = true) : Exception(context, embedBacktrace) {} /** diff --git a/rdbms/NullDbValue.hpp b/rdbms/NullDbValue.hpp index 5488ed35ac46ffea686ec67c0d0176c0348f2636..2c30dda01d128e1c634279892690b87b917eb9cf 100644 --- a/rdbms/NullDbValue.hpp +++ b/rdbms/NullDbValue.hpp @@ -23,21 +23,17 @@ namespace cta::rdbms { /** * An exception class representing an unexpected encounter with a nullptr database - * value (not to be confused with a nullptr C/C++ pointer). + * value (not to be confused with a nullptr C/C++ pointer) */ class NullDbValue: public exception::Exception { public: - /** - * Constructor. + * Constructor * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message + * @param context optional context string added to the message at initialisation time + * @param embedBacktrace whether to embed a backtrace of where the exception was thrown in the message */ - NullDbValue(const std::string &context = "", const bool embedBacktrace = true); - -}; // class NullDbValue + explicit NullDbValue(const std::string& context = "", const bool embedBacktrace = true); +}; } // namespace cta::rdbms diff --git a/scheduler/rdbms/postgres/Transaction.hpp b/scheduler/rdbms/postgres/Transaction.hpp index 62e35909c16664d5c7932599477049842fcdd7f8..11e07e622f501e20db3889863dde5fcc1e68be3a 100644 --- a/scheduler/rdbms/postgres/Transaction.hpp +++ b/scheduler/rdbms/postgres/Transaction.hpp @@ -26,7 +26,7 @@ public: CTA_GENERATE_EXCEPTION_CLASS(SQLError); // Constructors - Transaction(std::unique_ptr conn, bool ownConnection = false); + explicit Transaction(std::unique_ptr conn, bool ownConnection = false); explicit Transaction(cta::rdbms::ConnPool& connPool); // Move constructor diff --git a/tapeserver/castor/tape/tapeserver/SCSI/Exception.hpp b/tapeserver/castor/tape/tapeserver/SCSI/Exception.hpp index 533a2fb6fdf14f18828b1ee0c5001a4026e14e9a..af11bf97e22b11d0e9478d127edbfd961017001d 100644 --- a/tapeserver/castor/tape/tapeserver/SCSI/Exception.hpp +++ b/tapeserver/castor/tape/tapeserver/SCSI/Exception.hpp @@ -66,7 +66,7 @@ class UnitAttentionException : public castor::tape::SCSI::Exception { */ class HostException : public cta::exception::Exception { public: - HostException(const unsigned short int host_status, const std::string& context = ""); + explicit HostException(const unsigned short int host_status, const std::string& context = ""); ~HostException() final = default; }; diff --git a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPacker.hpp b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPacker.hpp index 4d6197bd48054684998ce33457127f1bc5c76afd..8a88b8c4855bca924c42ae668633006aa953f72d 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPacker.hpp +++ b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPacker.hpp @@ -235,8 +235,8 @@ private: const std::string m_failureLog; public: - ReportLastBatchError(std::string& failureLog) - : m_failureLog(failureLog) {} + explicit ReportLastBatchError(std::string& failureLog) : + m_failureLog(failureLog) {} void execute(MigrationReportPacker& reportPacker) override; }; diff --git a/tapeserver/castor/tape/tapeserver/drive/FakeDrive.hpp b/tapeserver/castor/tape/tapeserver/drive/FakeDrive.hpp index 1e0c781f498538496caa3bf1c6ba9989ef39c5b2..73f6dc4ff56f578fabed14593d5677e9a36bac8e 100644 --- a/tapeserver/castor/tape/tapeserver/drive/FakeDrive.hpp +++ b/tapeserver/castor/tape/tapeserver/drive/FakeDrive.hpp @@ -53,9 +53,8 @@ class FakeDrive : public DriveInterface { public: std::string contentToString() noexcept; - FakeDrive(uint64_t capacity = std::numeric_limits::max(), - enum FailureMoment failureMoment = OnWrite, - bool failOnMount = false) noexcept; + explicit FakeDrive(uint64_t capacity = std::numeric_limits::max(), + enum FailureMoment failureMoment = OnWrite, bool failOnMount = false) noexcept; explicit FakeDrive(bool failOnMount) noexcept; ~FakeDrive() override = default; compressionStats getCompression() final;