From 838f7141990f0ea5c9c1b83eaaf6f2cd4233f5a5 Mon Sep 17 00:00:00 2001 From: Dusan Figala Date: Fri, 14 Apr 2023 15:16:19 +0200 Subject: [PATCH] Format source files --- src/eckit/cmd/StartCmd.cc | 7 +- src/eckit/cmd/StopCmd.cc | 2 +- src/eckit/compat/Inited.h | 6 +- src/eckit/config/LibEcKit.cc | 5 +- src/eckit/config/LibEcKit.h | 1 - src/eckit/config/Resource.h | 9 +- src/eckit/container/BSPTree.h | 6 +- src/eckit/container/BTree.cc | 70 +++++----- src/eckit/container/BTree.h | 3 +- src/eckit/container/Cache.h | 6 +- src/eckit/container/CacheLRU.h | 3 +- src/eckit/container/CacheManager.h | 2 +- src/eckit/container/ClassExtent.h | 3 +- src/eckit/container/DenseMap.h | 11 +- src/eckit/container/DenseSet.h | 5 +- src/eckit/container/KDTree.h | 6 +- src/eckit/container/MappedArray.h | 3 +- src/eckit/container/Queue.h | 7 +- src/eckit/container/Recycler.h | 3 +- src/eckit/container/SharedMemArray.h | 3 +- src/eckit/container/bsptree/BSPHyperPlane.h | 3 +- src/eckit/container/sptree/SPIterator.h | 3 +- src/eckit/container/sptree/SPNodeInfo.h | 6 +- src/eckit/container/sptree/SPNodeQueue.h | 3 +- src/eckit/container/sptree/SPTree.h | 3 +- src/eckit/container/sptree/SPValue.h | 6 +- src/eckit/exception/Exceptions.cc | 6 +- src/eckit/exception/Exceptions.h | 2 +- src/eckit/filesystem/BasePathName.h | 16 +-- src/eckit/filesystem/BasePathNameT.h | 9 +- src/eckit/filesystem/FileSystemSize.h | 3 +- src/eckit/filesystem/LocalFileManager.h | 3 +- src/eckit/filesystem/LocalPathName.cc | 6 +- src/eckit/filesystem/LocalPathName.h | 19 ++- src/eckit/filesystem/PathName.h | 2 +- src/eckit/filesystem/PathNameFactory.cc | 6 +- src/eckit/filesystem/StdDir.h | 4 +- src/eckit/filesystem/TmpDir.h | 2 +- src/eckit/filesystem/URI.h | 6 +- src/eckit/filesystem/URIManager.cc | 3 +- src/eckit/geometry/EllipsoidOfRevolution.cc | 2 +- src/eckit/geometry/Point2.h | 12 +- src/eckit/geometry/Point3.h | 12 +- src/eckit/geometry/polygon/LonLatPolygon.h | 5 +- src/eckit/io/AutoCloser.h | 3 +- src/eckit/io/BufferList.h | 6 +- src/eckit/io/BufferedHandle.h | 3 +- src/eckit/io/DataHandle.cc | 4 +- src/eckit/io/DataHandle.h | 8 +- src/eckit/io/EmptyHandle.h | 3 +- src/eckit/io/Length.h | 6 +- src/eckit/io/MoverTransfer.cc | 6 +- src/eckit/io/Offset.h | 6 +- src/eckit/io/PeekHandle.h | 4 +- src/eckit/io/SeekableHandle.h | 3 +- src/eckit/io/SharedBuffer.h | 6 +- src/eckit/io/SharedHandle.h | 2 +- src/eckit/io/StatsHandle.h | 2 +- src/eckit/io/StdFile.h | 3 +- src/eckit/io/StdPipe.h | 3 +- src/eckit/io/TeeHandle.cc | 3 +- src/eckit/io/URLHandle.h | 5 +- src/eckit/io/cluster/ClusterNode.cc | 4 +- src/eckit/io/cluster/ClusterNodes.cc | 13 +- src/eckit/io/cluster/ClusterNodes.h | 2 +- src/eckit/io/cluster/NodeInfo.cc | 3 +- src/eckit/io/cluster/NodeInfo.h | 2 +- src/eckit/linalg/LinearAlgebra.h | 2 +- src/eckit/linalg/Tensor.h | 40 +++--- .../linalg/dense/LinearAlgebraGeneric.cc | 3 +- src/eckit/log/BigNum.h | 3 +- src/eckit/log/Bytes.cc | 2 +- src/eckit/log/Channel.h | 3 +- src/eckit/log/CodeLocation.h | 6 +- src/eckit/log/Colour.cc | 4 +- src/eckit/log/FileTarget.h | 2 +- src/eckit/log/JSON.h | 17 +-- src/eckit/log/Log.h | 6 +- src/eckit/log/Plural.h | 3 +- src/eckit/log/ResourceUsage.h | 6 +- src/eckit/log/Seconds.h | 2 +- src/eckit/log/TraceTimer.h | 6 +- src/eckit/memory/Builder.h | 18 ++- src/eckit/memory/Counted.h | 3 +- src/eckit/memory/NonCopyable.h | 2 +- src/eckit/memory/OnlyMovable.h | 4 +- src/eckit/memory/Owned.h | 3 +- src/eckit/memory/ScopedPtr.h | 3 +- src/eckit/memory/SharedPtr.h | 9 +- src/eckit/message/Decoder.cc | 4 +- src/eckit/message/Decoder.h | 3 +- src/eckit/message/Message.h | 8 +- src/eckit/message/MessageContent.h | 4 +- src/eckit/message/Reader.cc | 4 +- src/eckit/message/Reader.h | 1 - src/eckit/message/Splitter.cc | 2 +- src/eckit/message/Splitter.h | 8 +- src/eckit/mpi/Comm.cc | 16 +-- src/eckit/mpi/Comm.h | 84 +++++++----- src/eckit/mpi/Group.cc | 16 +-- src/eckit/mpi/Group.h | 55 ++++---- src/eckit/mpi/Parallel.cc | 23 ++-- src/eckit/mpi/Parallel.h | 23 ++-- src/eckit/mpi/ParallelGroup.h | 32 ++--- src/eckit/mpi/Serial.cc | 9 +- src/eckit/mpi/Serial.h | 14 +- src/eckit/mpi/SerialData.h | 4 +- src/eckit/net/Connector.h | 8 +- src/eckit/net/HttpHeader.h | 3 +- src/eckit/net/IPAddress.h | 3 +- src/eckit/net/NetService.cc | 6 +- src/eckit/net/SocketOptions.cc | 4 +- src/eckit/net/TCPServer.h | 2 +- src/eckit/net/TCPSocket.cc | 16 +-- src/eckit/net/TCPSocket.h | 2 +- src/eckit/net/TCPStream.h | 3 +- src/eckit/option/EckitTool.h | 29 ++--- src/eckit/os/AutoUmask.h | 3 +- src/eckit/os/SharedInt.h | 2 +- src/eckit/parser/YAMLParser.cc | 13 +- src/eckit/persist/Isa.h | 3 +- src/eckit/runtime/Dispatcher.h | 3 +- src/eckit/runtime/Metrics.h | 2 +- src/eckit/runtime/Monitor.h | 9 +- src/eckit/runtime/Pipe.h | 3 +- src/eckit/runtime/ProducerConsumer.h | 6 +- src/eckit/runtime/TaskInfo.h | 2 +- src/eckit/serialisation/FstreamStream.h | 3 +- src/eckit/serialisation/HandleStream.h | 3 +- src/eckit/serialisation/IfstreamStream.h | 3 +- src/eckit/sql/Environment.h | 3 +- src/eckit/sql/SQLColumn.h | 6 +- src/eckit/sql/SQLDatabase.h | 4 +- src/eckit/sql/SQLDistinctOutput.h | 7 +- src/eckit/sql/SQLIterator.h | 3 +- src/eckit/sql/SQLSelect.cc | 6 +- src/eckit/sql/SQLSession.h | 2 +- src/eckit/sql/SQLTable.h | 5 +- src/eckit/sql/expression/SQLExpression.h | 4 +- src/eckit/sql/expression/SQLExpressions.h | 10 +- .../sql/expression/function/FunctionFactory.h | 3 +- .../sql/expression/function/FunctionTDIFF.h | 2 +- src/eckit/sql/type/SQLBitfield.h | 2 +- src/eckit/sql/type/SQLType.h | 1 - src/eckit/system/Library.h | 8 +- src/eckit/system/LibraryManager.cc | 6 +- src/eckit/system/LibraryManager.h | 4 +- src/eckit/system/MemoryInfo.h | 2 +- src/eckit/system/Plugin.h | 4 +- src/eckit/testing/Test.h | 36 ++--- src/eckit/thread/AutoLock.h | 18 ++- src/eckit/thread/Mutex.h | 1 - src/eckit/thread/Once.h | 3 +- src/eckit/thread/ThreadSingleton.h | 9 +- src/eckit/types/Coord.h | 6 +- src/eckit/types/Date.h | 9 +- src/eckit/types/FloatCompare.cc | 2 +- src/eckit/types/Fraction.h | 29 +++-- src/eckit/types/Grid.h | 3 +- src/eckit/types/SemanticVersion.h | 15 +-- src/eckit/types/Types.h | 3 +- src/eckit/utils/ByteSwap.h | 4 +- src/eckit/utils/Compressor.h | 8 +- src/eckit/utils/EnumBitmask.h | 54 ++++---- src/eckit/utils/Hash.h | 3 +- src/eckit/utils/HyperCube.h | 3 +- src/eckit/utils/Optional.h | 10 +- src/eckit/utils/Tokenizer.h | 3 - src/eckit/utils/xxHashing.h | 1 - src/eckit/value/BoolContent.cc | 2 +- src/eckit/value/Expression.h | 18 ++- src/eckit/value/Params.h | 15 ++- src/eckit/value/Properties.h | 2 +- src/eckit/value/Value.h | 2 +- src/eckit/web/Html.h | 72 ++++++---- src/eckit/web/Url.h | 3 +- src/sandbox/memsharedlimit.cc | 4 +- src/sandbox/mpiobjsend.cc | 2 +- src/sandbox/shint.cc | 2 +- src/sandbox/tcp_server_forked.cc | 2 +- src/sandbox/tcp_server_threaded.cc | 2 +- tests/container/test_cachemanager.cc | 8 +- tests/container/test_queue.cc | 4 +- tests/filesystem/test_localpathname.cc | 2 +- tests/io/test_base64.cc | 2 +- tests/io/test_compress.cc | 2 +- tests/linalg/test_la_tensor.cc | 57 ++++---- tests/log/test_log.cc | 19 ++- tests/memory/test_counted.cc | 32 +++-- tests/mpi/eckit_test_mpi.cc | 123 +++++++++--------- tests/mpi/eckit_test_mpi_objserialisation.cc | 2 +- tests/sql/test_select.cc | 2 +- tests/testing/test_testing.cc | 8 +- tests/types/test_cache.cc | 2 +- tests/utils/test_byteswap.cc | 52 ++++++-- tests/utils/test_compressor.cc | 2 +- tests/utils/test_hashing.cc | 6 +- tests/utils/test_optional.cc | 16 +-- tests/utils/test_translator.cc | 16 +-- 199 files changed, 988 insertions(+), 786 deletions(-) diff --git a/src/eckit/cmd/StartCmd.cc b/src/eckit/cmd/StartCmd.cc index 3a52741d4..f6e1efdbd 100644 --- a/src/eckit/cmd/StartCmd.cc +++ b/src/eckit/cmd/StartCmd.cc @@ -75,8 +75,9 @@ void StartCmd::execute(std::istream&, std::ostream& out, CmdArg& args) { start(out, *i); } - if(wait){ - ::sleep(1);} + if (wait) { + ::sleep(1); + } for (size_t j = 0; j < info.size(); j++) { if (info[j].busy(true)) { @@ -89,8 +90,6 @@ void StartCmd::execute(std::istream&, std::ostream& out, CmdArg& args) { if (!wait || names.size() == 0) { break; } - - } if (wait && names.size() > 0) { std::ostringstream oss; diff --git a/src/eckit/cmd/StopCmd.cc b/src/eckit/cmd/StopCmd.cc index 8644c9ad3..7bbc89c90 100644 --- a/src/eckit/cmd/StopCmd.cc +++ b/src/eckit/cmd/StopCmd.cc @@ -62,7 +62,7 @@ void StopCmd::execute(std::istream&, std::ostream& out, CmdArg& args) { for (size_t j = 0; j < info.size(); j++) { if (info[j].busy(true) && (all || app == info[j].application())) { - if(non_stoppable.find(info[j].application()) != non_stoppable.end()) { + if (non_stoppable.find(info[j].application()) != non_stoppable.end()) { continue; } if (info[j].pid() != getpid()) { diff --git a/src/eckit/compat/Inited.h b/src/eckit/compat/Inited.h index 336e4730d..f8e71fd5b 100644 --- a/src/eckit/compat/Inited.h +++ b/src/eckit/compat/Inited.h @@ -25,8 +25,10 @@ namespace eckit { template class Inited { public: - Inited() : value_(0) {} - Inited(const T& v) : value_(v) {} + Inited() : + value_(0) {} + Inited(const T& v) : + value_(v) {} ~Inited() {} diff --git a/src/eckit/config/LibEcKit.cc b/src/eckit/config/LibEcKit.cc index 6fcdbba9c..d7f9610ab 100644 --- a/src/eckit/config/LibEcKit.cc +++ b/src/eckit/config/LibEcKit.cc @@ -19,9 +19,9 @@ #include "eckit/config/LibEcKit.h" +#include "eckit/config/Resource.h" #include "eckit/eckit_version.h" #include "eckit/thread/AutoLock.h" -#include "eckit/config/Resource.h" namespace eckit { @@ -30,8 +30,7 @@ namespace eckit { REGISTER_LIBRARY(LibEcKit); LibEcKit::LibEcKit() : - Library("eckit"), abort_handler_(&(::abort)), dontDeregisterFactories_(false) -{ + Library("eckit"), abort_handler_(&(::abort)), dontDeregisterFactories_(false) { // can't use Resource here (too early in the initialisation) dontDeregisterFactories_ = (::getenv("ECKIT_DONT_DEREGISTER_FACTORIES") != nullptr); } diff --git a/src/eckit/config/LibEcKit.h b/src/eckit/config/LibEcKit.h index 9786cffbf..dda44a5b1 100644 --- a/src/eckit/config/LibEcKit.h +++ b/src/eckit/config/LibEcKit.h @@ -50,4 +50,3 @@ class LibEcKit : public eckit::system::Library { //---------------------------------------------------------------------------------------------------------------------- } // namespace eckit - diff --git a/src/eckit/config/Resource.h b/src/eckit/config/Resource.h index 822f7706c..a7cfbe925 100644 --- a/src/eckit/config/Resource.h +++ b/src/eckit/config/Resource.h @@ -30,11 +30,13 @@ class Resource : public ResourceBase { public: // methods // Standalone - Resource(const std::string& str, const T& value) : ResourceBase(nullptr, str), value_(value) {} + Resource(const std::string& str, const T& value) : + ResourceBase(nullptr, str), value_(value) {} // Part of a configurable - Resource(Configurable* owner, const std::string& str, const T& value) : ResourceBase(owner, str), value_(value) {} + Resource(Configurable* owner, const std::string& str, const T& value) : + ResourceBase(owner, str), value_(value) {} Resource(const std::string& str, const std::string& value, bool) : ResourceBase(nullptr, str), value_(eckit::Translator()(value)) {} @@ -68,7 +70,8 @@ std::ostream& operator<<(std::ostream& os, const Resource& r) { template class LibResource : public ResourceBase { public: // methods - LibResource(const std::string& str, const T& value) : ResourceBase(nullptr, str), value_(value) {} + LibResource(const std::string& str, const T& value) : + ResourceBase(nullptr, str), value_(value) {} operator const T&() const { const_cast*>(this)->init(); diff --git a/src/eckit/container/BSPTree.h b/src/eckit/container/BSPTree.h index 814573c6b..a2fa2c27d 100644 --- a/src/eckit/container/BSPTree.h +++ b/src/eckit/container/BSPTree.h @@ -28,7 +28,8 @@ class BSPTreeX : public SPTree > { Partition partition_; public: - BSPTreeX(Alloc& alloc) : SPTree >(alloc) {} + BSPTreeX(Alloc& alloc) : + SPTree >(alloc) {} /// Container must be a random access @@ -45,7 +46,8 @@ class BSPTreeMemory : public BSPTreeX, Partition> { KDMemory alloc_; public: - BSPTreeMemory() : BSPTreeX, Partition>(alloc_) {} + BSPTreeMemory() : + BSPTreeX, Partition>(alloc_) {} }; template diff --git a/src/eckit/container/BTree.cc b/src/eckit/container/BTree.cc index c7d2bcb46..1b56497ac 100644 --- a/src/eckit/container/BTree.cc +++ b/src/eckit/container/BTree.cc @@ -8,9 +8,9 @@ * does it submit to any jurisdiction. */ -#include #include -#ifdef __linux__ +#include +#ifdef __linux__ #include #ifndef ENOTSUPP #define ENOTSUPP 524 @@ -662,24 +662,23 @@ void BTree::unlock() { template void BTree::flock() { - if (::flock(file_.fileno(), readOnly_ ? LOCK_EX : LOCK_SH) < 0) - { + if (::flock(file_.fileno(), readOnly_ ? LOCK_EX : LOCK_SH) < 0) { bool skip = false; - #ifdef ENOTSUP - if (errno == ENOTSUP) { - skip = true; - } - #endif - #ifdef ENOTSUPP - if (errno == ENOTSUPP) { - skip = true; - } - #endif - #ifdef EOPNOTSUPP - if (errno == EOPNOTSUPP) { - skip = true; - } - #endif +#ifdef ENOTSUP + if (errno == ENOTSUP) { + skip = true; + } +#endif +#ifdef ENOTSUPP + if (errno == ENOTSUPP) { + skip = true; + } +#endif +#ifdef EOPNOTSUPP + if (errno == EOPNOTSUPP) { + skip = true; + } +#endif if (!skip) { std::stringstream ss; ss << "Error " << Log::syserr << " locking " << path_; @@ -691,24 +690,23 @@ void BTree::flock() { template void BTree::funlock() { - if (::flock(file_.fileno(), LOCK_UN) < 0) - { + if (::flock(file_.fileno(), LOCK_UN) < 0) { bool skip = false; - #ifdef ENOTSUP - if (errno == ENOTSUP) { - skip = true; - } - #endif - #ifdef ENOTSUPP - if (errno == ENOTSUPP) { - skip = true; - } - #endif - #ifdef EOPNOTSUPP - if (errno == EOPNOTSUPP) { - skip = true; - } - #endif +#ifdef ENOTSUP + if (errno == ENOTSUP) { + skip = true; + } +#endif +#ifdef ENOTSUPP + if (errno == ENOTSUPP) { + skip = true; + } +#endif +#ifdef EOPNOTSUPP + if (errno == EOPNOTSUPP) { + skip = true; + } +#endif if (!skip) { std::stringstream ss; ss << "Error " << Log::syserr << " unlocking " << path_; diff --git a/src/eckit/container/BTree.h b/src/eckit/container/BTree.h index 99d8d7c03..a15ff4530 100644 --- a/src/eckit/container/BTree.h +++ b/src/eckit/container/BTree.h @@ -232,7 +232,8 @@ class BTree : private NonCopyable { time_t last_; bool dirty_; - _PageInfo(Page* page = 0) : page_(page), count_(0), last_(time(nullptr)), dirty_(false) {} + _PageInfo(Page* page = 0) : + page_(page), count_(0), last_(time(nullptr)), dirty_(false) {} }; typedef std::map Cache; diff --git a/src/eckit/container/Cache.h b/src/eckit/container/Cache.h index a1ef37f56..e55661339 100644 --- a/src/eckit/container/Cache.h +++ b/src/eckit/container/Cache.h @@ -36,7 +36,8 @@ class Cache : private NonCopyable { public: // types struct Entry { - Entry(const V& v) : v_(v), expired_(false), hits_(0) { + Entry(const V& v) : + v_(v), expired_(false), hits_(0) { gettimeofday(&age_, 0); last_ = age_; } @@ -134,7 +135,8 @@ class Cache : private NonCopyable { //----------------------------------------------------------------------------- template -Cache::Cache() : storage_() {} +Cache::Cache() : + storage_() {} template Cache::~Cache() { diff --git a/src/eckit/container/CacheLRU.h b/src/eckit/container/CacheLRU.h index 3292c48f9..32589aa61 100644 --- a/src/eckit/container/CacheLRU.h +++ b/src/eckit/container/CacheLRU.h @@ -38,7 +38,8 @@ class CacheLRU : private NonCopyable { key_type key_; value_type value_; - Entry(const key_type& k, const value_type& v) : key_(k), value_(v) {} + Entry(const key_type& k, const value_type& v) : + key_(k), value_(v) {} friend std::ostream& operator<<(std::ostream& s, const Entry& e) { s << "key=" << e.key_; diff --git a/src/eckit/container/CacheManager.h b/src/eckit/container/CacheManager.h index c057148d9..adcc94743 100644 --- a/src/eckit/container/CacheManager.h +++ b/src/eckit/container/CacheManager.h @@ -126,7 +126,7 @@ class CacheManager : public CacheManagerBase { class CacheContentCreator { public: - virtual ~CacheContentCreator() = default; + virtual ~CacheContentCreator() = default; virtual void create(const PathName&, value_type& value, bool& saved) = 0; }; diff --git a/src/eckit/container/ClassExtent.h b/src/eckit/container/ClassExtent.h index 629cddd8b..b077209d5 100644 --- a/src/eckit/container/ClassExtent.h +++ b/src/eckit/container/ClassExtent.h @@ -223,7 +223,8 @@ void ClassExtent::callAll(void (T::*proc)(P1&, P2&), P1& arg1, P2& arg2) { } template -ClassExtent::Extent::Extent() : inited_(true) {} +ClassExtent::Extent::Extent() : + inited_(true) {} template ClassExtent::Extent::~Extent() { diff --git a/src/eckit/container/DenseMap.h b/src/eckit/container/DenseMap.h index 2f342892f..3555c6a92 100644 --- a/src/eckit/container/DenseMap.h +++ b/src/eckit/container/DenseMap.h @@ -27,20 +27,21 @@ namespace eckit { template class DenseMap { -public: // types - typedef K key_type; ///< key type - typedef V value_type; ///< value type +public: // types + typedef K key_type; ///< key type + typedef V value_type; ///< value type typedef std::pair item_type; ///< (key, value) item type -private: // types +private: // types typedef std::deque store_t; public: // methods typedef typename store_t::iterator iterator; typedef typename store_t::const_iterator const_iterator; - DenseMap() : sorted_(true) {} + DenseMap() : + sorted_(true) {} ~DenseMap() {} diff --git a/src/eckit/container/DenseSet.h b/src/eckit/container/DenseSet.h index adc5a9342..342daead2 100644 --- a/src/eckit/container/DenseSet.h +++ b/src/eckit/container/DenseSet.h @@ -29,7 +29,7 @@ class DenseSet { public: // types typedef V value_type; ///< value type -private: // types +private: // types typedef std::vector store_t; public: // methods @@ -38,7 +38,8 @@ class DenseSet { typedef typename store_t::const_iterator iterator; typedef typename store_t::const_iterator const_iterator; - DenseSet(size_t s = 0) : sorted_(true) { + DenseSet(size_t s = 0) : + sorted_(true) { if (s > 0) reserve(s); } diff --git a/src/eckit/container/KDTree.h b/src/eckit/container/KDTree.h index 11901618a..dfce64867 100644 --- a/src/eckit/container/KDTree.h +++ b/src/eckit/container/KDTree.h @@ -32,7 +32,8 @@ class KDTreeX : public SPTree > { typedef typename SPTreeType::Payload Payload; public: - KDTreeX(Alloc& alloc) : SPTreeType(alloc) {} + KDTreeX(Alloc& alloc) : + SPTreeType(alloc) {} /// ITER must be a random access iterator /// WARNING: container is changed (sorted) @@ -76,7 +77,8 @@ class KDTreeMemory : public KDTreeX > { typedef typename KDTree::Payload Payload; public: - KDTreeMemory() : KDTree(alloc_) {} + KDTreeMemory() : + KDTree(alloc_) {} }; template diff --git a/src/eckit/container/MappedArray.h b/src/eckit/container/MappedArray.h index 738d95cd6..8f9effd5c 100644 --- a/src/eckit/container/MappedArray.h +++ b/src/eckit/container/MappedArray.h @@ -74,7 +74,8 @@ class MappedArray : private NonCopyable { uint32_t version_; uint32_t headerSize_; uint32_t elemSize_; - Header() : version_(mapped_array_version()), headerSize_(sizeof(Header)), elemSize_(sizeof(T)) {} + Header() : + version_(mapped_array_version()), headerSize_(sizeof(Header)), elemSize_(sizeof(T)) {} void validate() { ASSERT(version_ == mapped_array_version()); ASSERT(headerSize_ == sizeof(Header)); diff --git a/src/eckit/container/Queue.h b/src/eckit/container/Queue.h index 36881c8ef..3773017ac 100644 --- a/src/eckit/container/Queue.h +++ b/src/eckit/container/Queue.h @@ -40,13 +40,14 @@ template class Queue { public: // public - Queue(size_t max) : max_(max), interrupt_(nullptr), closed_(false) { ASSERT(max > 0); } + Queue(size_t max) : + max_(max), interrupt_(nullptr), closed_(false) { ASSERT(max > 0); } - Queue(const Queue&) = delete; + Queue(const Queue&) = delete; Queue& operator=(const Queue&) = delete; // n.b. cannot move object with std::condition_variable - Queue(Queue&& rhs) = delete; + Queue(Queue&& rhs) = delete; Queue& operator=(Queue&& rhs) = delete; size_t maxSize() const { return max_; } diff --git a/src/eckit/container/Recycler.h b/src/eckit/container/Recycler.h index df3359420..e475e3fae 100644 --- a/src/eckit/container/Recycler.h +++ b/src/eckit/container/Recycler.h @@ -133,7 +133,8 @@ class Recycler { //----------------------------------------------------------------------------- template -Recycler::Recycler(const PathName& path) : path_(path), fd_(-1) { +Recycler::Recycler(const PathName& path) : + path_(path), fd_(-1) { path_.dirName().mkdir(); fd_ = ::open(path_.localPath(), O_RDWR | O_CREAT, 0777); if (fd_ < 0) { diff --git a/src/eckit/container/SharedMemArray.h b/src/eckit/container/SharedMemArray.h index c73a17b07..2e6ffc662 100644 --- a/src/eckit/container/SharedMemArray.h +++ b/src/eckit/container/SharedMemArray.h @@ -74,7 +74,8 @@ class SharedMemArray : private NonCopyable { uint32_t version_; uint32_t headerSize_; uint32_t elemSize_; - Header() : version_(shared_mem_array_version()), headerSize_(sizeof(Header)), elemSize_(sizeof(T)) {} + Header() : + version_(shared_mem_array_version()), headerSize_(sizeof(Header)), elemSize_(sizeof(T)) {} void validate() { ASSERT(version_ == shared_mem_array_version()); ASSERT(headerSize_ == sizeof(Header)); diff --git a/src/eckit/container/bsptree/BSPHyperPlane.h b/src/eckit/container/bsptree/BSPHyperPlane.h index 916cee2d7..f1a27127d 100644 --- a/src/eckit/container/bsptree/BSPHyperPlane.h +++ b/src/eckit/container/bsptree/BSPHyperPlane.h @@ -22,7 +22,8 @@ class BSPHyperPlane { double d_; public: - BSPHyperPlane() : normal_(), d_() {} + BSPHyperPlane() : + normal_(), d_() {} BSPHyperPlane(const Point& normal, const Point& point) : normal_(Point::normalize(normal)), d_(-Point::dot(normal_, point)) {} diff --git a/src/eckit/container/sptree/SPIterator.h b/src/eckit/container/sptree/SPIterator.h index fe25dfaf3..328df217c 100644 --- a/src/eckit/container/sptree/SPIterator.h +++ b/src/eckit/container/sptree/SPIterator.h @@ -32,7 +32,8 @@ class SPIterator { public: - SPIterator(Alloc& alloc, Ptr ptr) : alloc_(alloc), ptr_(ptr) { + SPIterator(Alloc& alloc, Ptr ptr) : + alloc_(alloc), ptr_(ptr) { // std::cout << "SPIterator " << ptr << std::endl; Node* node = alloc_.convert(ptr_, (Node*)0); if (node) { diff --git a/src/eckit/container/sptree/SPNodeInfo.h b/src/eckit/container/sptree/SPNodeInfo.h index d80291e7a..8525dbbc4 100644 --- a/src/eckit/container/sptree/SPNodeInfo.h +++ b/src/eckit/container/sptree/SPNodeInfo.h @@ -42,9 +42,11 @@ struct SPNodeInfo { double distance_; public: - SPNodeInfo() : node_(0), id_(0), distance_(0) {} + SPNodeInfo() : + node_(0), id_(0), distance_(0) {} - SPNodeInfo(const Node* node, ID id, double distance) : node_(node), id_(id), distance_(distance) {} + SPNodeInfo(const Node* node, ID id, double distance) : + node_(node), id_(id), distance_(distance) {} ID id() const { return id_; } diff --git a/src/eckit/container/sptree/SPNodeQueue.h b/src/eckit/container/sptree/SPNodeQueue.h index 050141b2f..82a1f80fa 100644 --- a/src/eckit/container/sptree/SPNodeQueue.h +++ b/src/eckit/container/sptree/SPNodeQueue.h @@ -49,7 +49,8 @@ class SPNodeQueue { std::priority_queue queue_; public: - SPNodeQueue(size_t k) : k_(k) {} + SPNodeQueue(size_t k) : + k_(k) {} void push(Node* n, ID id, double d) { NodeInfo info(n, id, d); diff --git a/src/eckit/container/sptree/SPTree.h b/src/eckit/container/sptree/SPTree.h index 92b4abb9c..94aa2b043 100644 --- a/src/eckit/container/sptree/SPTree.h +++ b/src/eckit/container/sptree/SPTree.h @@ -47,7 +47,8 @@ class SPTree { typedef std::pair value_type; public: - SPTree(Alloc& alloc) : alloc_(alloc), root_(0) {} + SPTree(Alloc& alloc) : + alloc_(alloc), root_(0) {} ~SPTree() { alloc_.deleteNode(root_, (Node*)0); } diff --git a/src/eckit/container/sptree/SPValue.h b/src/eckit/container/sptree/SPValue.h index a93a75ed2..5e0caa1bf 100644 --- a/src/eckit/container/sptree/SPValue.h +++ b/src/eckit/container/sptree/SPValue.h @@ -24,10 +24,12 @@ class SPValue { Payload payload_; public: - SPValue(const Point& point, const Payload& payload) : point_(point), payload_(payload) {} + SPValue(const Point& point, const Payload& payload) : + point_(point), payload_(payload) {} template - SPValue(const V& v) : point_(v.point()), payload_(v.payload()) {} + SPValue(const V& v) : + point_(v.point()), payload_(v.payload()) {} const Point& point() const { return point_; } const Payload& payload() const { return payload_; } diff --git a/src/eckit/exception/Exceptions.cc b/src/eckit/exception/Exceptions.cc index 841e9f1c0..7c903581c 100644 --- a/src/eckit/exception/Exceptions.cc +++ b/src/eckit/exception/Exceptions.cc @@ -205,8 +205,7 @@ AssertionFailed::AssertionFailed(const char* msg, const CodeLocation& loc) { } -void handle_assert(const std::string& msg, const CodeLocation& loc) -{ +void handle_assert(const std::string& msg, const CodeLocation& loc) { std::ostringstream s; s << "Assertion failed: " << msg << " in " << loc.func() << ", line " << loc.line() << " of " << loc.file(); @@ -258,7 +257,8 @@ NotImplemented::NotImplemented(const std::string& s, const eckit::CodeLocation& << BackTrace::dump() << std::endl; } -NotImplemented::NotImplemented(const CodeLocation& loc) : NotImplemented("", loc) {} +NotImplemented::NotImplemented(const CodeLocation& loc) : + NotImplemented("", loc) {} UserError::UserError(const std::string& r, const CodeLocation& loc) : Exception(std::string("UserError: ") + r, loc) {} diff --git a/src/eckit/exception/Exceptions.h b/src/eckit/exception/Exceptions.h index 6e8240644..64a844667 100644 --- a/src/eckit/exception/Exceptions.h +++ b/src/eckit/exception/Exceptions.h @@ -320,7 +320,7 @@ class OutOfMemory : public Exception { #define PANIC(a) ::eckit::Panic((a), #a, Here()) #define NOTIMP throw ::eckit::NotImplemented(Here()) -#define ASSERT(a) static_cast(0), (a) ? (void)0 : ::eckit::Assert(!(a), #a, __FILE__, __LINE__, __func__) +#define ASSERT(a) static_cast(0), (a) ? (void)0 : ::eckit::Assert(!(a), #a, __FILE__, __LINE__, __func__) #define ASSERT_MSG(a, m) static_cast(0), (a) ? (void)0 : ::eckit::Assert(!(a), m, __FILE__, __LINE__, __func__) #define CHECK_CALL_NOLOG(a) ::eckit::PanicNoLog(a, #a, Here()) diff --git a/src/eckit/filesystem/BasePathName.h b/src/eckit/filesystem/BasePathName.h index fa8fb1f0a..2ab412823 100644 --- a/src/eckit/filesystem/BasePathName.h +++ b/src/eckit/filesystem/BasePathName.h @@ -59,14 +59,14 @@ class BasePathName : protected NonCopyable { virtual void match(std::vector&, bool) const = 0; virtual void reserve(const Length&) const = 0; - virtual BasePathName* unique() const = 0; - virtual const char* type() const = 0; - virtual BasePathName* dirName() const = 0; - virtual BasePathName* fullName() const = 0; - virtual BasePathName* orphanName() const = 0; - virtual BasePathName* checkClusterNode() const = 0; - virtual BasePathName* baseName(bool) const = 0; - virtual std::string extension() const = 0; + virtual BasePathName* unique() const = 0; + virtual const char* type() const = 0; + virtual BasePathName* dirName() const = 0; + virtual BasePathName* fullName() const = 0; + virtual BasePathName* orphanName() const = 0; + virtual BasePathName* checkClusterNode() const = 0; + virtual BasePathName* baseName(bool) const = 0; + virtual std::string extension() const = 0; virtual std::string hash(const std::string& method) const = 0; virtual std::string clusterName() const = 0; diff --git a/src/eckit/filesystem/BasePathNameT.h b/src/eckit/filesystem/BasePathNameT.h index 328f788ea..7d354d843 100644 --- a/src/eckit/filesystem/BasePathNameT.h +++ b/src/eckit/filesystem/BasePathNameT.h @@ -27,11 +27,14 @@ class BasePathNameT : public BasePathName { public: // -- Contructors - BasePathNameT(const T& path) : path_(path) {} + BasePathNameT(const T& path) : + path_(path) {} - BasePathNameT(const char* path, bool tildeIsUserHome = false) : path_(path, tildeIsUserHome) {} + BasePathNameT(const char* path, bool tildeIsUserHome = false) : + path_(path, tildeIsUserHome) {} - BasePathNameT(const std::string& path, bool tildeIsUserHome = false) : path_(path, tildeIsUserHome) {} + BasePathNameT(const std::string& path, bool tildeIsUserHome = false) : + path_(path, tildeIsUserHome) {} protected: // -- Methods diff --git a/src/eckit/filesystem/FileSystemSize.h b/src/eckit/filesystem/FileSystemSize.h index 642b19f4e..1830ca81e 100644 --- a/src/eckit/filesystem/FileSystemSize.h +++ b/src/eckit/filesystem/FileSystemSize.h @@ -17,7 +17,8 @@ namespace eckit { struct FileSystemSize { unsigned long long available; unsigned long long total; - FileSystemSize() : available(0), total(0) {} + FileSystemSize() : + available(0), total(0) {} }; //----------------------------------------------------------------------------- diff --git a/src/eckit/filesystem/LocalFileManager.h b/src/eckit/filesystem/LocalFileManager.h index 0580fc3e4..28dc1117e 100644 --- a/src/eckit/filesystem/LocalFileManager.h +++ b/src/eckit/filesystem/LocalFileManager.h @@ -35,7 +35,8 @@ class LocalFileManager : public URIManager { virtual PathName path(const URI& uri) const override; public: - LocalFileManager(const std::string& name) : URIManager(name) {} + LocalFileManager(const std::string& name) : + URIManager(name) {} }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/eckit/filesystem/LocalPathName.cc b/src/eckit/filesystem/LocalPathName.cc index eae796cae..88febc1c8 100644 --- a/src/eckit/filesystem/LocalPathName.cc +++ b/src/eckit/filesystem/LocalPathName.cc @@ -136,7 +136,7 @@ static void readOffsiteFileSystems() { while (in.getline(line, sizeof(line))) { std::vector s; parse(line, s); - if(s.size() == 1 and s[0].size() > 0) { + if (s.size() == 1 and s[0].size() > 0) { offsiteFileSystems.push_back(s[0]); } } @@ -274,8 +274,8 @@ bool LocalPathName::available() const { bool LocalPathName::offsite() const { pthread_once(&once, init); - for(const auto& fs : offsiteFileSystems) { - if(path_.find(fs) == 0) { + for (const auto& fs : offsiteFileSystems) { + if (path_.find(fs) == 0) { return true; } } diff --git a/src/eckit/filesystem/LocalPathName.h b/src/eckit/filesystem/LocalPathName.h index 2157a8520..83c609772 100644 --- a/src/eckit/filesystem/LocalPathName.h +++ b/src/eckit/filesystem/LocalPathName.h @@ -42,11 +42,18 @@ class LocalPathName { friend std::ostream& operator<<(std::ostream& s, const LocalPathName& p) { return s << p.path_; } - LocalPathName(const char* p = "/", bool tildeIsUserHome = false, bool skipTildeExpansion = false) : path_(parsePath(p)) - { if (!skipTildeExpansion) tidy(tildeIsUserHome, skipTildeExpansion); } - LocalPathName(const std::string& p, bool tildeIsUserHome = false, bool skipTildeExpansion = false) : path_(parsePath(p)) - { if (!skipTildeExpansion) tidy(tildeIsUserHome, skipTildeExpansion); } - LocalPathName(const LocalPathName& p) : path_(p.path_) {} + LocalPathName(const char* p = "/", bool tildeIsUserHome = false, bool skipTildeExpansion = false) : + path_(parsePath(p)) { + if (!skipTildeExpansion) + tidy(tildeIsUserHome, skipTildeExpansion); + } + LocalPathName(const std::string& p, bool tildeIsUserHome = false, bool skipTildeExpansion = false) : + path_(parsePath(p)) { + if (!skipTildeExpansion) + tidy(tildeIsUserHome, skipTildeExpansion); + } + LocalPathName(const LocalPathName& p) : + path_(p.path_) {} // Assignment @@ -135,7 +142,7 @@ class LocalPathName { /// Return the hash digest of the file /// @param method - specifies the hash method to use (default xxHash) /// @return the hash digest - std::string hash(const std::string& method="xxh64") const; + std::string hash(const std::string& method = "xxh64") const; /// Check if path exists /// @return true if the path exists diff --git a/src/eckit/filesystem/PathName.h b/src/eckit/filesystem/PathName.h index f67a7d0bf..851990d9c 100644 --- a/src/eckit/filesystem/PathName.h +++ b/src/eckit/filesystem/PathName.h @@ -214,7 +214,7 @@ class PathName { void hash(Hash&) const; /// Hash a path as in-place as possible. Returns the hash digest - std::string hash(const std::string& method="xxh64") const; + std::string hash(const std::string& method = "xxh64") const; /// Get child files and directories /// @param files vector to be filled with child files of path diff --git a/src/eckit/filesystem/PathNameFactory.cc b/src/eckit/filesystem/PathNameFactory.cc index 6b8a8fe7b..50ec5e894 100644 --- a/src/eckit/filesystem/PathNameFactory.cc +++ b/src/eckit/filesystem/PathNameFactory.cc @@ -10,12 +10,11 @@ #include "eckit/filesystem/PathNameFactory.h" +#include "eckit/config/LibEcKit.h" #include "eckit/filesystem/BasePathNameT.h" #include "eckit/filesystem/LocalPathName.h" #include "eckit/thread/AutoLock.h" #include "eckit/thread/StaticMutex.h" -#include "eckit/config/LibEcKit.h" -#include "eckit/filesystem/LocalPathName.h" namespace eckit { @@ -61,7 +60,8 @@ void PathNameFactoryImpl::enregister(const std::string& name, const PathNameBuil void PathNameFactoryImpl::deregister(const PathNameBuilderBase* builder) { - if(LibEcKit::instance().dontDeregisterFactories()) return; + if (LibEcKit::instance().dontDeregisterFactories()) + return; AutoLock lock(static_mutex_); diff --git a/src/eckit/filesystem/StdDir.h b/src/eckit/filesystem/StdDir.h index a5ce0c7bd..e94911646 100644 --- a/src/eckit/filesystem/StdDir.h +++ b/src/eckit/filesystem/StdDir.h @@ -29,8 +29,8 @@ class StdDir : private NonCopyable { private: // members DIR* d_; struct dirent buf; - -public : // methods + +public: // methods StdDir(const char* d); StdDir(const eckit::LocalPathName& p); diff --git a/src/eckit/filesystem/TmpDir.h b/src/eckit/filesystem/TmpDir.h index 948ba4c05..ea45c040c 100644 --- a/src/eckit/filesystem/TmpDir.h +++ b/src/eckit/filesystem/TmpDir.h @@ -24,7 +24,7 @@ namespace eckit { class TmpDir : public PathName, private NonCopyable { public: - TmpDir(const char* base=nullptr); + TmpDir(const char* base = nullptr); TmpDir(TmpDir&& rhs); diff --git a/src/eckit/filesystem/URI.h b/src/eckit/filesystem/URI.h index df9fa39e2..9da70a657 100644 --- a/src/eckit/filesystem/URI.h +++ b/src/eckit/filesystem/URI.h @@ -89,13 +89,11 @@ class URI { std::string asRawString() const; bool operator!=(const URI& other) const { - return scheme_ != other.scheme_ || name_ != other.name_ || user_ != other.user_ || host_ != other.host_ || - port_ != other.port_ || queryValues_ != other.queryValues_ || fragment_ != other.fragment_; + return scheme_ != other.scheme_ || name_ != other.name_ || user_ != other.user_ || host_ != other.host_ || port_ != other.port_ || queryValues_ != other.queryValues_ || fragment_ != other.fragment_; } bool operator==(const URI& other) const { - return scheme_ == other.scheme_ && name_ == other.name_ && user_ == other.user_ && host_ == other.host_ && - port_ == other.port_ && queryValues_ == other.queryValues_ && fragment_ == other.fragment_; + return scheme_ == other.scheme_ && name_ == other.name_ && user_ == other.user_ && host_ == other.host_ && port_ == other.port_ && queryValues_ == other.queryValues_ && fragment_ == other.fragment_; } protected: // methods diff --git a/src/eckit/filesystem/URIManager.cc b/src/eckit/filesystem/URIManager.cc index fbf0f0dfc..97925c25b 100644 --- a/src/eckit/filesystem/URIManager.cc +++ b/src/eckit/filesystem/URIManager.cc @@ -45,7 +45,8 @@ class URIManagerRegistry { /// Removes an entry from the registry /// @pre Must exist void deregister(const std::string& name) { - if(LibEcKit::instance().dontDeregisterFactories()) return; + if (LibEcKit::instance().dontDeregisterFactories()) + return; AutoLock lockme(mutex_); ASSERT(map_.find(name) != map_.end()); map_.erase(name); diff --git a/src/eckit/geometry/EllipsoidOfRevolution.cc b/src/eckit/geometry/EllipsoidOfRevolution.cc index ddbeef73c..ddcacae5f 100644 --- a/src/eckit/geometry/EllipsoidOfRevolution.cc +++ b/src/eckit/geometry/EllipsoidOfRevolution.cc @@ -12,7 +12,7 @@ #include #include -//#include // for std::numeric_limits +// #include // for std::numeric_limits #include #include "eckit/exception/Exceptions.h" diff --git a/src/eckit/geometry/Point2.h b/src/eckit/geometry/Point2.h index 56a495753..88a3d6cf4 100644 --- a/src/eckit/geometry/Point2.h +++ b/src/eckit/geometry/Point2.h @@ -22,13 +22,17 @@ class Point2 : public eckit::geometry::KPoint<2> { typedef KPoint<2> BasePoint; public: - Point2() : BasePoint() {} + Point2() : + BasePoint() {} - Point2(const BasePoint& p) : BasePoint(p) {} + Point2(const BasePoint& p) : + BasePoint(p) {} - Point2(const double* p) : BasePoint(p) {} + Point2(const double* p) : + BasePoint(p) {} - Point2(double x, double y) : BasePoint() { + Point2(double x, double y) : + BasePoint() { x_[XX] = x; x_[YY] = y; } diff --git a/src/eckit/geometry/Point3.h b/src/eckit/geometry/Point3.h index caef7c900..ad0937c86 100644 --- a/src/eckit/geometry/Point3.h +++ b/src/eckit/geometry/Point3.h @@ -15,13 +15,17 @@ class Point3 : public eckit::geometry::KPoint<3> { typedef KPoint<3> BasePoint; public: - Point3() : BasePoint() {} + Point3() : + BasePoint() {} - Point3(const BasePoint& p) : BasePoint(p) {} + Point3(const BasePoint& p) : + BasePoint(p) {} - Point3(const double* p) : BasePoint(p) {} + Point3(const double* p) : + BasePoint(p) {} - Point3(double x, double y, double z) : BasePoint() { + Point3(double x, double y, double z) : + BasePoint() { x_[XX] = x; x_[YY] = y; x_[ZZ] = z; diff --git a/src/eckit/geometry/polygon/LonLatPolygon.h b/src/eckit/geometry/polygon/LonLatPolygon.h index 0df321931..3d9e9bbf6 100644 --- a/src/eckit/geometry/polygon/LonLatPolygon.h +++ b/src/eckit/geometry/polygon/LonLatPolygon.h @@ -33,8 +33,9 @@ class LonLatPolygon : protected std::vector { explicit LonLatPolygon(const container_type& points, bool includePoles = true); - template - LonLatPolygon(Point2Iterator begin, Point2Iterator end, bool includePoles = true) : LonLatPolygon(container_type(begin, end), includePoles) {} + template + LonLatPolygon(Point2Iterator begin, Point2Iterator end, bool includePoles = true) : + LonLatPolygon(container_type(begin, end), includePoles) {} LonLatPolygon(const LonLatPolygon&) = default; LonLatPolygon(LonLatPolygon&&) = default; diff --git a/src/eckit/io/AutoCloser.h b/src/eckit/io/AutoCloser.h index 451751835..3c9843676 100644 --- a/src/eckit/io/AutoCloser.h +++ b/src/eckit/io/AutoCloser.h @@ -24,7 +24,8 @@ class AutoCloser { T& obj_; public: // methods - AutoCloser(T& obj) : obj_(obj) {} + AutoCloser(T& obj) : + obj_(obj) {} /// Assume that close() can throw /// Otherwise we could test the interface with: diff --git a/src/eckit/io/BufferList.h b/src/eckit/io/BufferList.h index 565462bc6..96412be76 100644 --- a/src/eckit/io/BufferList.h +++ b/src/eckit/io/BufferList.h @@ -28,8 +28,7 @@ namespace eckit { class BufferList : public OnlyMovable { -public: // methods - +public: // methods void append(Buffer&& buf); size_t count() const { return buffers_.size(); } @@ -39,8 +38,7 @@ class BufferList : public OnlyMovable { /// @post count() == 0 and size() == 0 Buffer consolidate(); -private: // members - +private: // members std::list buffers_; }; diff --git a/src/eckit/io/BufferedHandle.h b/src/eckit/io/BufferedHandle.h index d1e07f670..8bb6c5b55 100644 --- a/src/eckit/io/BufferedHandle.h +++ b/src/eckit/io/BufferedHandle.h @@ -72,10 +72,9 @@ class BufferedHandle : public DataHandle, public HandleHolder { bool read_; Offset position_; bool opened_; - + virtual std::string title() const override; virtual void collectMetrics(const std::string& what) const override; - }; //----------------------------------------------------------------------------- diff --git a/src/eckit/io/DataHandle.cc b/src/eckit/io/DataHandle.cc index 61ca78dc0..062e0634d 100644 --- a/src/eckit/io/DataHandle.cc +++ b/src/eckit/io/DataHandle.cc @@ -209,7 +209,7 @@ Length DataHandle::copyTo(DataHandle& other, long bufsize, Length maxsize, Trans AutoClose closer1(*this); Length toRead = ((maxsize != -1) ? std::min(estimate, maxsize) : estimate); - + other.openForWrite(toRead); watcher.toHandleOpened(); AutoClose closer2(other); @@ -217,7 +217,7 @@ Length DataHandle::copyTo(DataHandle& other, long bufsize, Length maxsize, Trans Length total = 0; long length = -1; - while ((toRead <= Length(0) || total < toRead) && (length = read(buffer, toRead <= Length(0) ? bufsize : std::min(bufsize, (long) (toRead-total)))) > 0) { + while ((toRead <= Length(0) || total < toRead) && (length = read(buffer, toRead <= Length(0) ? bufsize : std::min(bufsize, (long)(toRead - total)))) > 0) { if (other.write((const char*)buffer, length) != length) { throw WriteError(name() + " into " + other.name()); diff --git a/src/eckit/io/DataHandle.h b/src/eckit/io/DataHandle.h index c93261c5c..24f34cb49 100644 --- a/src/eckit/io/DataHandle.h +++ b/src/eckit/io/DataHandle.h @@ -35,7 +35,8 @@ class RestartTransfer { Offset from_; public: - RestartTransfer(const Offset& from) : from_(from) {} + RestartTransfer(const Offset& from) : + from_(from) {} const Offset& from() const { return from_; } }; @@ -133,7 +134,7 @@ class DataHandle : public Streamable { virtual void cost(std::map&, bool) const; virtual std::string title() const; virtual std::string metricsTag() const; - virtual void collectMetrics(const std::string& what) const; // Tag for metrics collection + virtual void collectMetrics(const std::string& what) const; // Tag for metrics collection // This is the MD5 of the Handle, not the data it points to @@ -167,7 +168,8 @@ class AutoClose { DataHandle& handle_; public: - AutoClose(DataHandle& handle) : handle_(handle) {} + AutoClose(DataHandle& handle) : + handle_(handle) {} ~AutoClose() noexcept(false); }; diff --git a/src/eckit/io/EmptyHandle.h b/src/eckit/io/EmptyHandle.h index c0eb16c44..e32075ae0 100644 --- a/src/eckit/io/EmptyHandle.h +++ b/src/eckit/io/EmptyHandle.h @@ -26,7 +26,8 @@ class EmptyHandle : public DataHandle { public: // -- Contructors EmptyHandle() {} - EmptyHandle(Stream& s) : DataHandle(s) {} + EmptyHandle(Stream& s) : + DataHandle(s) {} // -- Destructor diff --git a/src/eckit/io/Length.h b/src/eckit/io/Length.h index 2641af69e..2799a788e 100644 --- a/src/eckit/io/Length.h +++ b/src/eckit/io/Length.h @@ -47,8 +47,10 @@ class Length { // -- Contructors - Length(long long l = 0) : value_(l) {} - Length(const Length& other) : value_(other.value_) {} + Length(long long l = 0) : + value_(l) {} + Length(const Length& other) : + value_(other.value_) {} #include "eckit/io/Length.b" diff --git a/src/eckit/io/MoverTransfer.cc b/src/eckit/io/MoverTransfer.cc index b638209b9..66e1a1c07 100644 --- a/src/eckit/io/MoverTransfer.cc +++ b/src/eckit/io/MoverTransfer.cc @@ -67,10 +67,12 @@ Length MoverTransfer::transfer(DataHandle& from, DataHandle& to) { if (ClusterNodes::available("mover", it->first)) { if (!ClusterNodes::lookUp("mover", it->first).supportsAttributes(moverAttributes)) { cost.erase(it++); - } else { + } + else { ++it; } - } else { + } + else { cost.erase(it++); } } diff --git a/src/eckit/io/Offset.h b/src/eckit/io/Offset.h index 958f2305a..08c731f7f 100644 --- a/src/eckit/io/Offset.h +++ b/src/eckit/io/Offset.h @@ -49,8 +49,10 @@ class Offset { friend Stream& operator>>(Stream& s, Offset& x); // Offset(fpos_t); <- To implement - Offset(value_t l = 0) : value_(l) {} - Offset(const Offset& other) : value_(other.value_) {} + Offset(value_t l = 0) : + value_(l) {} + Offset(const Offset& other) : + value_(other.value_) {} #include "eckit/io/Offset.b" diff --git a/src/eckit/io/PeekHandle.h b/src/eckit/io/PeekHandle.h index 0e22e7a5a..63666b61e 100644 --- a/src/eckit/io/PeekHandle.h +++ b/src/eckit/io/PeekHandle.h @@ -68,9 +68,9 @@ class PeekHandle : public DataHandle, public HandleHolder { virtual Length size() override; virtual std::string title() const override; - virtual void collectMetrics( const std::string& what) const override; // Tag for metrics collection + virtual void collectMetrics(const std::string& what) const override; // Tag for metrics collection -private: // members +private: // members std::deque peek_; }; diff --git a/src/eckit/io/SeekableHandle.h b/src/eckit/io/SeekableHandle.h index eb1fe8fa1..4b440dc32 100644 --- a/src/eckit/io/SeekableHandle.h +++ b/src/eckit/io/SeekableHandle.h @@ -68,8 +68,7 @@ class SeekableHandle : public DataHandle { size_t position_; virtual std::string title() const override; - virtual void collectMetrics( const std::string& what) const override; // Tag for metrics collection - + virtual void collectMetrics(const std::string& what) const override; // Tag for metrics collection }; //----------------------------------------------------------------------------- diff --git a/src/eckit/io/SharedBuffer.h b/src/eckit/io/SharedBuffer.h index f84a862ea..679af495a 100644 --- a/src/eckit/io/SharedBuffer.h +++ b/src/eckit/io/SharedBuffer.h @@ -31,7 +31,8 @@ namespace eckit { class CountedBuffer : public eckit::Buffer, public eckit::Counted { public: // methods - CountedBuffer(size_t size) : Buffer(size) {} + CountedBuffer(size_t size) : + Buffer(size) {} }; //---------------------------------------------------------------------------------------------------------------------- @@ -44,7 +45,8 @@ class SharedBuffer { ~SharedBuffer() { buffer_->detach(); } - SharedBuffer(const SharedBuffer& s) : buffer_(s.buffer_) { buffer_->attach(); } + SharedBuffer(const SharedBuffer& s) : + buffer_(s.buffer_) { buffer_->attach(); } SharedBuffer& operator=(const SharedBuffer& s) { buffer_->detach(); diff --git a/src/eckit/io/SharedHandle.h b/src/eckit/io/SharedHandle.h index 4543c9f74..45455044b 100644 --- a/src/eckit/io/SharedHandle.h +++ b/src/eckit/io/SharedHandle.h @@ -84,7 +84,7 @@ class SharedHandle : public DataHandle { virtual void toRemote(Stream& s) const override; virtual void cost(std::map&, bool) const override; virtual std::string title() const override; - virtual void collectMetrics( const std::string& what) const override; // Tag for metrics collection + virtual void collectMetrics(const std::string& what) const override; // Tag for metrics collection private: diff --git a/src/eckit/io/StatsHandle.h b/src/eckit/io/StatsHandle.h index 27f3e0ff3..030017455 100644 --- a/src/eckit/io/StatsHandle.h +++ b/src/eckit/io/StatsHandle.h @@ -86,7 +86,7 @@ class StatsHandle : public DataHandle, public HandleHolder { virtual void toRemote(Stream& s) const override; virtual void cost(std::map&, bool) const override; virtual std::string title() const override; - virtual void collectMetrics(const std::string& what) const override; // Tag for metrics collection + virtual void collectMetrics(const std::string& what) const override; // Tag for metrics collection private: diff --git a/src/eckit/io/StdFile.h b/src/eckit/io/StdFile.h index efa23356a..5617f0275 100644 --- a/src/eckit/io/StdFile.h +++ b/src/eckit/io/StdFile.h @@ -55,7 +55,8 @@ class AutoStdFile : public StdFile { void close() { StdFile::close(); } public: - AutoStdFile(const PathName& name, const std::string& mode = "r") : StdFile(name, mode) {} + AutoStdFile(const PathName& name, const std::string& mode = "r") : + StdFile(name, mode) {} ~AutoStdFile() noexcept(false) { close(); } }; diff --git a/src/eckit/io/StdPipe.h b/src/eckit/io/StdPipe.h index 46af6a591..afa3fd161 100644 --- a/src/eckit/io/StdPipe.h +++ b/src/eckit/io/StdPipe.h @@ -50,7 +50,8 @@ class StdPipe : private NonCopyable { class AutoStdPipe : public StdPipe { public: - AutoStdPipe(const std::string& name, const std::string& mode = "r") : StdPipe(name, mode) {} + AutoStdPipe(const std::string& name, const std::string& mode = "r") : + StdPipe(name, mode) {} ~AutoStdPipe() noexcept(false) { close(); } }; diff --git a/src/eckit/io/TeeHandle.cc b/src/eckit/io/TeeHandle.cc index b5b3bc702..967d280a0 100644 --- a/src/eckit/io/TeeHandle.cc +++ b/src/eckit/io/TeeHandle.cc @@ -160,7 +160,8 @@ void TeeHandle::cost(std::map& c, bool read) const { bool TeeHandle::moveable() const { for (const auto& dh : datahandles_) { - if (!dh->moveable()) return false; + if (!dh->moveable()) + return false; } return true; } diff --git a/src/eckit/io/URLHandle.h b/src/eckit/io/URLHandle.h index ff269f28d..626e71e80 100644 --- a/src/eckit/io/URLHandle.h +++ b/src/eckit/io/URLHandle.h @@ -27,7 +27,8 @@ class URLException : public Exception { int code_; public: - URLException(const std::string& what, int code) : Exception(what), code_(code) {} + URLException(const std::string& what, int code) : + Exception(what), code_(code) {} int code() const { return code_; } }; @@ -35,7 +36,6 @@ class URLException : public Exception { class URLHandle : public DataHandle { public: - URLHandle(const std::string& uri, bool useSSL = true); URLHandle(Stream&); @@ -68,7 +68,6 @@ class URLHandle : public DataHandle { static const ClassSpec& classSpec() { return classSpec_; } private: - std::string uri_; std::unique_ptr handle_; diff --git a/src/eckit/io/cluster/ClusterNode.cc b/src/eckit/io/cluster/ClusterNode.cc index c12d73fb6..1c6ec6c2a 100644 --- a/src/eckit/io/cluster/ClusterNode.cc +++ b/src/eckit/io/cluster/ClusterNode.cc @@ -33,7 +33,7 @@ class ClusterHeartBeat : public Thread { virtual void run(); public: - ClusterHeartBeat(ClusterNode& owner, int hostOffset=0) : + ClusterHeartBeat(ClusterNode& owner, int hostOffset = 0) : hostOffset_(hostOffset), owner_(owner) {} }; @@ -41,7 +41,7 @@ class ClusterHeartBeat : public Thread { void ClusterHeartBeat::run() { Monitor::instance().name("heartbeat"); std::vector hosts = Resource>("clusterHost", {"localhost"}); - int port = net::Port("cluster", 9555); + int port = net::Port("cluster", 9555); std::string reply; NodeInfo remote; diff --git a/src/eckit/io/cluster/ClusterNodes.cc b/src/eckit/io/cluster/ClusterNodes.cc index 920fbb657..4d925963d 100644 --- a/src/eckit/io/cluster/ClusterNodes.cc +++ b/src/eckit/io/cluster/ClusterNodes.cc @@ -13,6 +13,7 @@ #include +#include "eckit/config/EtcTable.h" #include "eckit/config/Resource.h" #include "eckit/container/MappedArray.h" #include "eckit/io/cluster/ClusterNodes.h" @@ -21,7 +22,6 @@ #include "eckit/memory/Zero.h" #include "eckit/thread/AutoLock.h" #include "eckit/utils/Clock.h" -#include "eckit/config/EtcTable.h" namespace eckit { @@ -52,12 +52,11 @@ class ClusterNodeEntry { zero(attributes_); nattrs_ = 0; for (const auto& a : attributes) { - strncpy(attributes_[nattrs_++], a.c_str(), sizeof(attributes_[0])-1); + strncpy(attributes_[nattrs_++], a.c_str(), sizeof(attributes_[0]) - 1); } } public: - ClusterNodeEntry(const NodeInfo& info) : ClusterNodeEntry(info.node(), info.name(), info.host(), info.port(), info.attributes()) {} @@ -173,7 +172,7 @@ class ClusterNodeEntry { zero(attributes_); nattrs_ = 0; for (const auto& a : attrs) { - strncpy(attributes_[nattrs_++], a.c_str(), sizeof(attributes_[0])-1); + strncpy(attributes_[nattrs_++], a.c_str(), sizeof(attributes_[0]) - 1); } } @@ -196,7 +195,8 @@ class ClusterNodeEntry { break; } } - if (!found) return false; + if (!found) + return false; } return true; } @@ -245,7 +245,6 @@ static void init() { Log::info() << "Offsite nodes [" << line[0] << "]" << std::endl; } } - } void ClusterNodes::reset() { @@ -314,7 +313,7 @@ NodeInfo ClusterNodes::lookUp(const std::string& type, const std::string& node) } } - if(offsite(type, node)) { + if (offsite(type, node)) { throw UnexpectedState(type + "@" + node + " is offsite."); } diff --git a/src/eckit/io/cluster/ClusterNodes.h b/src/eckit/io/cluster/ClusterNodes.h index f8840a1b4..317b9d3ea 100644 --- a/src/eckit/io/cluster/ClusterNodes.h +++ b/src/eckit/io/cluster/ClusterNodes.h @@ -46,7 +46,7 @@ class ClusterNodes { static NodeInfo lookUp(const std::string& type, const std::string& node); // Attributes argument is optional. Determines a labelled subset of a given type of node - static NodeInfo any(const std::string& type, const std::set& attributes={}); + static NodeInfo any(const std::string& type, const std::set& attributes = {}); static bool available(const std::string&, const std::string&); static bool offsite(const std::string&, const std::string&); diff --git a/src/eckit/io/cluster/NodeInfo.cc b/src/eckit/io/cluster/NodeInfo.cc index 20eba3e80..952fbaf26 100644 --- a/src/eckit/io/cluster/NodeInfo.cc +++ b/src/eckit/io/cluster/NodeInfo.cc @@ -161,7 +161,8 @@ NodeInfo NodeInfo::sendLogin(Stream& s) { bool NodeInfo::supportsAttributes(const std::set& attrs) const { for (const auto& a : attrs) { - if (attributes_.find(a) == attributes_.end()) return false; + if (attributes_.find(a) == attributes_.end()) + return false; } return true; } diff --git a/src/eckit/io/cluster/NodeInfo.h b/src/eckit/io/cluster/NodeInfo.h index d0e47e3ec..d6761f0c1 100644 --- a/src/eckit/io/cluster/NodeInfo.h +++ b/src/eckit/io/cluster/NodeInfo.h @@ -45,7 +45,7 @@ class NodeInfo { void node(const std::string& h) { node_ = h; } const std::string& node() const { return node_; } - void attribute(const std::string& a) { attributes_.insert(a); } + void attribute(const std::string& a) { attributes_.insert(a); } void attributes(const std::set& a) { attributes_ = a; } const std::set& attributes() const { return attributes_; } bool supportsAttributes(const std::set& attrs) const; diff --git a/src/eckit/linalg/LinearAlgebra.h b/src/eckit/linalg/LinearAlgebra.h index 778fe0a52..19a66ba21 100644 --- a/src/eckit/linalg/LinearAlgebra.h +++ b/src/eckit/linalg/LinearAlgebra.h @@ -110,7 +110,7 @@ class LinearAlgebra { LinearAlgebra() = default; private: - LinearAlgebra(const LinearAlgebra&) = delete; + LinearAlgebra(const LinearAlgebra&) = delete; LinearAlgebra& operator=(const LinearAlgebra&) = delete; friend std::ostream& operator<<(std::ostream& s, const LinearAlgebra&) { diff --git a/src/eckit/linalg/Tensor.h b/src/eckit/linalg/Tensor.h index 976bf49bb..d57b9db04 100644 --- a/src/eckit/linalg/Tensor.h +++ b/src/eckit/linalg/Tensor.h @@ -45,8 +45,8 @@ template class Tensor { public: // class methods - - enum class Layout : int { // specify underlying type to be "int" for interoperability + enum class Layout : int + { // specify underlying type to be "int" for interoperability Right = 0, Left = 1, RowMajor = Right, @@ -59,7 +59,7 @@ class Tensor { static std::vector strides(Layout layout, const std::vector& shape) { std::vector s(shape.size()); - if (layout==Layout::ColMajor) { + if (layout == Layout::ColMajor) { Size prod = 1; s[0] = prod; for (int i = 1; i < s.size(); ++i) { @@ -80,7 +80,7 @@ class Tensor { public: // methods /// Default constructor (empty tensor) - Tensor(Layout layout=Layout::ColMajor) : + Tensor(Layout layout = Layout::ColMajor) : array_(0), size_(0), shape_(0), strides_(0), layout_(layout), own_(false) {} /// Construct tensor with given rows and columns (allocates memory, not initialised) @@ -114,7 +114,7 @@ class Tensor { Tensor(Stream& s) : array_(0), size_(0), shape_(0), own_(true) { Size shape_size; - + // layout int layoutAsInt; s >> layoutAsInt; @@ -146,18 +146,18 @@ class Tensor { /// Move constructor Tensor(Tensor&& other) noexcept { - shape_ = std::move(other.shape_); + shape_ = std::move(other.shape_); strides_ = std::move(other.strides_); - size_ = other.size_; + size_ = other.size_; layout_ = other.layout_; - own_ = other.own_; + own_ = other.own_; array_ = other.array_; // nullify moved-from tensor other.array_ = nullptr; - other.own_ = false; + other.own_ = false; other.shape_.clear(); other.strides_.clear(); other.size_ = 0; @@ -185,24 +185,24 @@ class Tensor { /// Move assignment operator Tensor& operator=(Tensor&& other) noexcept { - if (&other != this){ + if (&other != this) { if (own_ && array_) { delete[] array_; } - shape_ = std::move(other.shape_); + shape_ = std::move(other.shape_); strides_ = std::move(other.strides_); - size_ = other.size_; + size_ = other.size_; layout_ = other.layout_; - own_ = other.own_; + own_ = other.own_; array_ = other.array_; // nullify moved-from tensor other.array_ = nullptr; - other.own_ = false; + other.own_ = false; other.shape_.clear(); other.strides_.clear(); other.size_ = 0; @@ -352,7 +352,7 @@ class Tensor { } /// Transform a rowMajor-layout tensor to colMajor-layout - Tensor transformRowMajorToColMajor() const { + Tensor transformRowMajorToColMajor() const { Tensor r(shape_); // ROW-MAJOR to COL-MAJOR @@ -408,16 +408,16 @@ class Tensor { return index_part<0>(idx...); } -protected: // member variables - S* array_; ///< data +protected: // member variables + S* array_; ///< data - Size size_; ///< flattened size + Size size_; ///< flattened size std::vector shape_; ///< tensor shape is a vector of sizes per dimension std::vector strides_; ///< tensor strides precomputed at construction - Layout layout_; ///< memory layout? (column-major equivalent to Fortran layout) - bool own_; ///< ownership + Layout layout_; ///< memory layout? (column-major equivalent to Fortran layout) + bool own_; ///< ownership }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/eckit/linalg/dense/LinearAlgebraGeneric.cc b/src/eckit/linalg/dense/LinearAlgebraGeneric.cc index bd44277ab..6aa8f6d7a 100644 --- a/src/eckit/linalg/dense/LinearAlgebraGeneric.cc +++ b/src/eckit/linalg/dense/LinearAlgebraGeneric.cc @@ -43,8 +43,7 @@ Scalar LinearAlgebraGeneric::dot(const Vector& x, const Vector& y) const { Scalar sum = 0.; #if eckit_HAVE_OMP -#pragma omp parallel for reduction(+ \ - : sum) +#pragma omp parallel for reduction(+ : sum) #endif for (Size i = 0; i < Ni; ++i) { const auto p = x[i] * y[i]; diff --git a/src/eckit/log/BigNum.h b/src/eckit/log/BigNum.h index 705c8ee74..30204f6e2 100644 --- a/src/eckit/log/BigNum.h +++ b/src/eckit/log/BigNum.h @@ -27,7 +27,8 @@ namespace eckit { class BigNum : private eckit::NonCopyable { public: - BigNum(long long v) : value_(v) {} + BigNum(long long v) : + value_(v) {} private: void print(std::ostream&) const; diff --git a/src/eckit/log/Bytes.cc b/src/eckit/log/Bytes.cc index fac130dea..59527c836 100644 --- a/src/eckit/log/Bytes.cc +++ b/src/eckit/log/Bytes.cc @@ -60,7 +60,7 @@ std::pair Bytes::reduceTo1024() const { double x = std::abs(bytes_); size_t n = 0; - while (x >= 1024. && n < NUMBER(magnitudes)-1) { + while (x >= 1024. && n < NUMBER(magnitudes) - 1) { x /= 1024.; n++; } diff --git a/src/eckit/log/Channel.h b/src/eckit/log/Channel.h index b8d358a36..bfd7360dc 100644 --- a/src/eckit/log/Channel.h +++ b/src/eckit/log/Channel.h @@ -78,7 +78,8 @@ class AutoIndent { Channel& channel_; public: - AutoIndent(Channel& channel, const char* prefix = "") : channel_(channel) { channel_.indent(prefix); } + AutoIndent(Channel& channel, const char* prefix = "") : + channel_(channel) { channel_.indent(prefix); } ~AutoIndent() { channel_.unindent(); } }; diff --git a/src/eckit/log/CodeLocation.h b/src/eckit/log/CodeLocation.h index 8e2ff579b..39ec50690 100644 --- a/src/eckit/log/CodeLocation.h +++ b/src/eckit/log/CodeLocation.h @@ -29,10 +29,12 @@ class CodeLocation { } /// Empty contructor - CodeLocation() : line_(0), file_(nullptr), func_(nullptr) {} + CodeLocation() : + line_(0), file_(nullptr), func_(nullptr) {} /// Full Contructor - CodeLocation(const char* file, int line, const char* func) : line_(line), file_(file), func_(func) {} + CodeLocation(const char* file, int line, const char* func) : + line_(line), file_(file), func_(func) {} /// @return as std::string std::string asString() const; diff --git a/src/eckit/log/Colour.cc b/src/eckit/log/Colour.cc index 93f5049c2..084b6f56d 100644 --- a/src/eckit/log/Colour.cc +++ b/src/eckit/log/Colour.cc @@ -44,8 +44,8 @@ enum WHITE = 7 }; -//#define X(a) putchar(a) -//#define X(a) out << (a) +// #define X(a) putchar(a) +// #define X(a) out << (a) #define X(a) out << char(a) static bool connected_to_console() { diff --git a/src/eckit/log/FileTarget.h b/src/eckit/log/FileTarget.h index 46a44c6f3..969b026b1 100644 --- a/src/eckit/log/FileTarget.h +++ b/src/eckit/log/FileTarget.h @@ -16,8 +16,8 @@ #include #include "eckit/filesystem/PathName.h" -#include "eckit/log/LogTarget.h" #include "eckit/io/Buffer.h" +#include "eckit/log/LogTarget.h" namespace eckit { diff --git a/src/eckit/log/JSON.h b/src/eckit/log/JSON.h index 42a339290..99033ff4e 100644 --- a/src/eckit/log/JSON.h +++ b/src/eckit/log/JSON.h @@ -36,19 +36,17 @@ class DateTime; class JSON : private NonCopyable { public: - class Formatting { - public: // types - - enum BitFlags { + public: // types + enum BitFlags + { COMPACT = 0, INDENT_DICT = (1 << 1), INDENT_LIST = (1 << 2), INDENT_ALL = (INDENT_DICT | INDENT_LIST) }; - public: // constructors - + public: // constructors /// Create compact formatting static Formatting compact(); @@ -63,22 +61,21 @@ class JSON : private NonCopyable { /// @param indentation Number of spaces used for indentation Formatting(int flags, int indentation = 2); - public: // methods - + public: // methods /// @return Number of spaces used for indentation int indentation() const; /// @return BitFlags that describe formatting int flags() const; - private: // data + private: // data int flags_{COMPACT}; int indentation_{2}; }; public: // methods JSON(std::ostream&, bool null = true); - JSON(std::ostream&, Formatting ); + JSON(std::ostream&, Formatting); ~JSON(); diff --git a/src/eckit/log/Log.h b/src/eckit/log/Log.h index 74ee2062d..0a4a28bbf 100644 --- a/src/eckit/log/Log.h +++ b/src/eckit/log/Log.h @@ -120,7 +120,8 @@ class LogFormatSetter { int format_; public: - explicit LogFormatSetter(int f) : format_(f) {} + explicit LogFormatSetter(int f) : + format_(f) {} friend std::ostream& operator<<(std::ostream& s, const LogFormatSetter& f) { format(s, f.format_); @@ -128,7 +129,8 @@ class LogFormatSetter { } }; -DEPRECATED("Use eckit::format() instead") std::ostream& setformat(std::ostream& s, int f); +DEPRECATED("Use eckit::format() instead") +std::ostream& setformat(std::ostream& s, int f); inline LogFormatSetter setformat(int format) { return LogFormatSetter(format); diff --git a/src/eckit/log/Plural.h b/src/eckit/log/Plural.h index 2837250fb..32412a5bb 100644 --- a/src/eckit/log/Plural.h +++ b/src/eckit/log/Plural.h @@ -23,7 +23,8 @@ namespace eckit { class Plural : private eckit::NonCopyable { public: // methods - Plural(int count, const std::string& s) : s_(s), count_(count) {} + Plural(int count, const std::string& s) : + s_(s), count_(count) {} ~Plural() {} diff --git a/src/eckit/log/ResourceUsage.h b/src/eckit/log/ResourceUsage.h index 0a3a39ad2..aa01cc474 100644 --- a/src/eckit/log/ResourceUsage.h +++ b/src/eckit/log/ResourceUsage.h @@ -59,9 +59,11 @@ class ResourceUsage : private NonCopyable { template class TraceResourceUsage : public ResourceUsage { public: - explicit TraceResourceUsage(const char* name) : ResourceUsage(name, eckit::Log::debug()) {} + explicit TraceResourceUsage(const char* name) : + ResourceUsage(name, eckit::Log::debug()) {} - explicit TraceResourceUsage(const std::string& name) : ResourceUsage(name, eckit::Log::debug()) {} + explicit TraceResourceUsage(const std::string& name) : + ResourceUsage(name, eckit::Log::debug()) {} }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/eckit/log/Seconds.h b/src/eckit/log/Seconds.h index c3dc59d37..4ebf13ef8 100644 --- a/src/eckit/log/Seconds.h +++ b/src/eckit/log/Seconds.h @@ -33,7 +33,7 @@ class Seconds { Seconds(double, bool compact = false); Seconds(const struct ::timeval&, bool compact = false); - //#include "eckit/types/Seconds.b" + // #include "eckit/types/Seconds.b" // -- Operators diff --git a/src/eckit/log/TraceTimer.h b/src/eckit/log/TraceTimer.h index a76d2b805..cc5e15fb3 100644 --- a/src/eckit/log/TraceTimer.h +++ b/src/eckit/log/TraceTimer.h @@ -26,9 +26,11 @@ namespace eckit { template class TraceTimer : public Timer { public: - explicit TraceTimer(const char* name) : Timer(name, eckit::Log::debug()) {} + explicit TraceTimer(const char* name) : + Timer(name, eckit::Log::debug()) {} - explicit TraceTimer(const std::string& name) : Timer(name, eckit::Log::debug()) {} + explicit TraceTimer(const std::string& name) : + Timer(name, eckit::Log::debug()) {} }; //----------------------------------------------------------------------------- diff --git a/src/eckit/memory/Builder.h b/src/eckit/memory/Builder.h index 986cd1547..c59473389 100644 --- a/src/eckit/memory/Builder.h +++ b/src/eckit/memory/Builder.h @@ -132,12 +132,14 @@ class ConcreteBuilderT0 : public BuilderT0 { typedef typename base_t::builder_ptr builder_ptr; public: // methods - ConcreteBuilderT0() : k_(name()) { + ConcreteBuilderT0() : + k_(name()) { DEBUG_BUILDER("ConcreteBuilderT0() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } - ConcreteBuilderT0(const key_t& k) : k_(k) { + ConcreteBuilderT0(const key_t& k) : + k_(k) { DEBUG_BUILDER("ConcreteBuilderT0() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } @@ -177,12 +179,14 @@ class ConcreteBuilderT1 : public BuilderT1 { typedef typename base_t::ARG1 ARG1; public: // methods - ConcreteBuilderT1() : k_(name()) { + ConcreteBuilderT1() : + k_(name()) { DEBUG_BUILDER("ConcreteBuilderT1() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } - ConcreteBuilderT1(const key_t& k) : k_(k) { + ConcreteBuilderT1(const key_t& k) : + k_(k) { DEBUG_BUILDER("ConcreteBuilderT1() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } @@ -224,12 +228,14 @@ class ConcreteBuilderT2 : public BuilderT2 { typedef typename base_t::ARG2 ARG2; public: // methods - ConcreteBuilderT2() : k_(name()) { + ConcreteBuilderT2() : + k_(name()) { DEBUG_BUILDER("ConcreteBuilderT2() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } - ConcreteBuilderT2(const key_t& k) : k_(k) { + ConcreteBuilderT2(const key_t& k) : + k_(k) { DEBUG_BUILDER("ConcreteBuilderT2() -- " << T::className()); Factory::instance().regist(k_, builder_ptr(this)); } diff --git a/src/eckit/memory/Counted.h b/src/eckit/memory/Counted.h index 40e6820b6..0cf59c3f7 100644 --- a/src/eckit/memory/Counted.h +++ b/src/eckit/memory/Counted.h @@ -76,7 +76,8 @@ class Counted : private NonCopyable, private memory::detail::ThreadedLock { void unlock() const { memory::detail::ThreadedLock::unlock(); } public: - Counted() : count_(0) {} + Counted() : + count_(0) {} virtual ~Counted(); diff --git a/src/eckit/memory/NonCopyable.h b/src/eckit/memory/NonCopyable.h index 26fd55473..839f414ec 100644 --- a/src/eckit/memory/NonCopyable.h +++ b/src/eckit/memory/NonCopyable.h @@ -22,7 +22,7 @@ class NonCopyable { ~NonCopyable(); private: // No copy allowed - NonCopyable(const NonCopyable&) = delete; + NonCopyable(const NonCopyable&) = delete; NonCopyable& operator=(const NonCopyable&) = delete; }; diff --git a/src/eckit/memory/OnlyMovable.h b/src/eckit/memory/OnlyMovable.h index b9c9fd0a5..7d7d539cc 100644 --- a/src/eckit/memory/OnlyMovable.h +++ b/src/eckit/memory/OnlyMovable.h @@ -23,12 +23,12 @@ class OnlyMovable { // Copying not allowed - OnlyMovable(const OnlyMovable&) = delete; + OnlyMovable(const OnlyMovable&) = delete; OnlyMovable& operator=(const OnlyMovable&) = delete; // Moving is allowed - OnlyMovable(OnlyMovable&&) = default; + OnlyMovable(OnlyMovable&&) = default; OnlyMovable& operator=(OnlyMovable&&) = default; }; diff --git a/src/eckit/memory/Owned.h b/src/eckit/memory/Owned.h index 3c5a0bf07..3ea17ea4f 100644 --- a/src/eckit/memory/Owned.h +++ b/src/eckit/memory/Owned.h @@ -29,7 +29,8 @@ template class OwnedT : private NonCopyable, public LOCK { public: // methods - OwnedT() : count_(0) {} + OwnedT() : + count_(0) {} virtual ~OwnedT() {} diff --git a/src/eckit/memory/ScopedPtr.h b/src/eckit/memory/ScopedPtr.h index 57022353a..23bade8d1 100644 --- a/src/eckit/memory/ScopedPtr.h +++ b/src/eckit/memory/ScopedPtr.h @@ -36,7 +36,8 @@ class DEPRECATED("Use C++11 std::unique_ptr instead") ScopedPtr : private NonCop public: // methods /// Constructor /// @throws nothing - explicit ScopedPtr(pointer_type ptr = 0) : ptr_(ptr) {} + explicit ScopedPtr(pointer_type ptr = 0) : + ptr_(ptr) {} /// Destructor /// @throws nothing diff --git a/src/eckit/memory/SharedPtr.h b/src/eckit/memory/SharedPtr.h index 82c94c940..88faa722d 100644 --- a/src/eckit/memory/SharedPtr.h +++ b/src/eckit/memory/SharedPtr.h @@ -75,17 +75,20 @@ class DEPRECATED("Use C++11 std::shared_ptr instead") SharedPtr { public: // methods /// Constructor - SharedPtr() : ptr_(0) {} + SharedPtr() : + ptr_(0) {} /// Constructor. /// @param ptr naked pointer - explicit SharedPtr(T* ptr) : ptr_(ptr) { + explicit SharedPtr(T* ptr) : + ptr_(ptr) { if (!null()) ptr_->attach(); } /// Copy constructor - SharedPtr(const SharedPtr& other) : ptr_(other.ptr_) { + SharedPtr(const SharedPtr& other) : + ptr_(other.ptr_) { if (!null()) ptr_->attach(); } diff --git a/src/eckit/message/Decoder.cc b/src/eckit/message/Decoder.cc index 32fa97239..d917baaf7 100644 --- a/src/eckit/message/Decoder.cc +++ b/src/eckit/message/Decoder.cc @@ -24,9 +24,9 @@ namespace message { //---------------------------------------------------------------------------------------------------------------------- namespace { -eckit::Mutex* local_mutex = 0; +eckit::Mutex* local_mutex = 0; std::vector* decoders = 0; -pthread_once_t once = PTHREAD_ONCE_INIT; +pthread_once_t once = PTHREAD_ONCE_INIT; void init() { local_mutex = new eckit::Mutex(); decoders = new std::vector(); diff --git a/src/eckit/message/Decoder.h b/src/eckit/message/Decoder.h index 31f8b0159..3f1953785 100644 --- a/src/eckit/message/Decoder.h +++ b/src/eckit/message/Decoder.h @@ -54,7 +54,8 @@ class MessageDecoder { virtual ~MessageDecoder(); virtual void getMetadata(const Message& msg, MetadataGatherer& gatherer, - const GetMetadataOptions& options=GetMetadataOptions{}) const = 0; + const GetMetadataOptions& options = GetMetadataOptions{}) const + = 0; virtual eckit::Buffer decode(const Message& msg) const = 0; diff --git a/src/eckit/message/Message.h b/src/eckit/message/Message.h index 7f2e029c9..277e539f5 100644 --- a/src/eckit/message/Message.h +++ b/src/eckit/message/Message.h @@ -77,10 +77,10 @@ class Message { double getDouble(const std::string& key) const; void getDoubleArray(const std::string& key, std::vector&) const; size_t getSize(const std::string& key) const; - - // Write double array at key to pre allocated array + + // Write double array at key to pre allocated array void getDoubleArray(const std::string& key, double* data, size_t len) const; - + void getMetadata(MetadataGatherer&, GetMetadataOptions options = GetMetadataOptions{}) const; eckit::Buffer decode() const; @@ -93,7 +93,7 @@ class Message { private: MessageContent* content_; - mutable MessageDecoder* decoder_ = nullptr; // non-owning + mutable MessageDecoder* decoder_ = nullptr; // non-owning MessageDecoder& lookupDecoder() const; diff --git a/src/eckit/message/MessageContent.h b/src/eckit/message/MessageContent.h index ef29ec365..89c6ffdec 100644 --- a/src/eckit/message/MessageContent.h +++ b/src/eckit/message/MessageContent.h @@ -18,8 +18,8 @@ #include #include -#include "eckit/types/Types.h" #include "eckit/memory/Counted.h" +#include "eckit/types/Types.h" namespace eckit { @@ -63,7 +63,7 @@ class MessageContent : public eckit::Counted { virtual size_t getSize(const std::string& key) const; - // Write double array at key to pre allocated array. + // Write double array at key to pre allocated array. virtual void getDoubleArray(const std::string& key, double* data, size_t len) const; virtual eckit::DataHandle* readHandle() const; diff --git a/src/eckit/message/Reader.cc b/src/eckit/message/Reader.cc index 305d49c58..b57ace428 100644 --- a/src/eckit/message/Reader.cc +++ b/src/eckit/message/Reader.cc @@ -28,13 +28,13 @@ namespace eckit { namespace message { Reader::Reader(eckit::DataHandle* h, bool opened) : -// handle_(h), opened_(opened) { + // handle_(h), opened_(opened) { handle_(new BufferedHandle(h, readerBufferSize(), opened)) { init(); } Reader::Reader(eckit::DataHandle& h, bool opened) : -// handle_(h), opened_(opened) { + // handle_(h), opened_(opened) { handle_(new BufferedHandle(h, readerBufferSize(), opened)) { init(); } diff --git a/src/eckit/message/Reader.h b/src/eckit/message/Reader.h index d79e6f44b..0e1b70c62 100644 --- a/src/eckit/message/Reader.h +++ b/src/eckit/message/Reader.h @@ -48,7 +48,6 @@ class Reader : public eckit::NonCopyable { eckit::Offset position(); private: - std::unique_ptr splitter_; eckit::PeekHandle handle_; diff --git a/src/eckit/message/Splitter.cc b/src/eckit/message/Splitter.cc index a666639ad..ccdcfa170 100644 --- a/src/eckit/message/Splitter.cc +++ b/src/eckit/message/Splitter.cc @@ -63,7 +63,7 @@ Splitter* SplitterFactory::lookup(eckit::PeekHandle& handle) { for (size_t i = 0; i < n; ++i) { SplitterBuilderBase* builder = decoders_[(i + index_) % n]; if (builder->match(handle)) { - index_ = i; // Start with this index for next message + index_ = i; // Start with this index for next message return builder->make(handle); } } diff --git a/src/eckit/message/Splitter.h b/src/eckit/message/Splitter.h index 877d62c55..8cd997eb3 100644 --- a/src/eckit/message/Splitter.h +++ b/src/eckit/message/Splitter.h @@ -58,14 +58,13 @@ class SplitterBuilderBase { virtual ~SplitterBuilderBase(); virtual Splitter* make(eckit::PeekHandle&) const = 0; - virtual bool match(eckit::PeekHandle&) const = 0; + virtual bool match(eckit::PeekHandle&) const = 0; }; //---------------------------------------------------------------------------------------------------------------------- class SplitterFactory { public: - static SplitterFactory& instance(); Splitter* lookup(eckit::PeekHandle&); @@ -74,12 +73,11 @@ class SplitterFactory { void deregister(const SplitterBuilderBase*); private: - - SplitterFactory() = default; + SplitterFactory() = default; ~SplitterFactory() = default; size_t index_ = 0; - std::vector decoders_; // non-owning pointers + std::vector decoders_; // non-owning pointers std::mutex mutex_; }; diff --git a/src/eckit/mpi/Comm.cc b/src/eckit/mpi/Comm.cc index 3f782d6d5..2421f27ab 100644 --- a/src/eckit/mpi/Comm.cc +++ b/src/eckit/mpi/Comm.cc @@ -45,15 +45,15 @@ class Environment { } if (have_parallel()) { const std::string defaultMPIDetectionVars = - "OMPI_COMM_WORLD_SIZE" // OpenMPI - ",ALPS_APP_PE" // Cray aprun - ",PMI_SIZE" // Intel MPI - ",SLURM_STEP_NUM_TASKS"; // slurm srun - std::string eckitMPIDetectionVars = eckit::LibResource("$ECKIT_MPI_DETECTION_VARS;eckitMPIDetectionVars",defaultMPIDetectionVars); + "OMPI_COMM_WORLD_SIZE" // OpenMPI + ",ALPS_APP_PE" // Cray aprun + ",PMI_SIZE" // Intel MPI + ",SLURM_STEP_NUM_TASKS"; // slurm srun + std::string eckitMPIDetectionVars = eckit::LibResource("$ECKIT_MPI_DETECTION_VARS;eckitMPIDetectionVars", defaultMPIDetectionVars); std::vector envVars; - Tokenizer{','}(eckitMPIDetectionVars,envVars); - for( const auto& env : envVars ) { - if( ::getenv(env.c_str()) ) { + Tokenizer{','}(eckitMPIDetectionVars, envVars); + for (const auto& env : envVars) { + if (::getenv(env.c_str())) { return "parallel"; } } diff --git a/src/eckit/mpi/Comm.h b/src/eckit/mpi/Comm.h index c898206fb..9c09b3551 100644 --- a/src/eckit/mpi/Comm.h +++ b/src/eckit/mpi/Comm.h @@ -22,9 +22,9 @@ #include "eckit/mpi/Buffer.h" #include "eckit/mpi/DataType.h" +#include "eckit/mpi/Group.h" #include "eckit/mpi/Operation.h" #include "eckit/mpi/Request.h" -#include "eckit/mpi/Group.h" #include "eckit/mpi/Status.h" namespace eckit { @@ -92,7 +92,7 @@ class Comm : private eckit::NonCopyable { /// @brief MPI size of this communicator size_t size() const { return size_; } - + virtual size_t remoteSize() const = 0; /// @brief MPI barrier for this communicator @@ -125,7 +125,7 @@ class Comm : private eckit::NonCopyable { virtual Status iProbe(int source, int tag) const = 0; virtual int procNull() const = 0; - + virtual int undefined() const = 0; virtual int anySource() const = 0; @@ -135,15 +135,15 @@ class Comm : private eckit::NonCopyable { virtual Status status() const = 0; virtual Request request(int) const = 0; - + virtual Group group(int) const = 0; - + virtual Group group() const = 0; - + virtual Group remoteGroup() const = 0; - + virtual Comm& create(const Group&, const std::string& name) const = 0; - + virtual Comm& create(const Group&, int tag, const std::string& name) const = 0; template @@ -369,11 +369,11 @@ class Comm : private eckit::NonCopyable { template Status sendReceiveReplace(T* sendrecv, size_t count, - int dest, int sendtag, int source, int recvtag) const; + int dest, int sendtag, int source, int recvtag) const; template Status sendReceiveReplace(T& sendrecv, - int dest, int sendtag, int source, int recvtag) const; + int dest, int sendtag, int source, int recvtag) const; /// /// All to all of vector< vector<> > @@ -400,40 +400,52 @@ class Comm : private eckit::NonCopyable { virtual void broadcast(void* buffer, size_t count, Data::Code datatype, size_t root) const = 0; virtual void gather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype, - size_t root) const = 0; + size_t root) const + = 0; virtual void scatter(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype, - size_t root) const = 0; + size_t root) const + = 0; virtual void gatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], - const int displs[], Data::Code datatype, size_t root) const = 0; + const int displs[], Data::Code datatype, size_t root) const + = 0; virtual void scatterv(const void* sendbuf, const int sendcounts[], const int displs[], void* recvbuf, - size_t recvcount, Data::Code datatype, size_t root) const = 0; + size_t recvcount, Data::Code datatype, size_t root) const + = 0; virtual void reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code datatype, - Operation::Code op, size_t root) const = 0; + Operation::Code op, size_t root) const + = 0; virtual void reduceInPlace(void* sendrecvbuf, size_t count, Data::Code datatype, - Operation::Code op, size_t root) const = 0; + Operation::Code op, size_t root) const + = 0; virtual void allReduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code datatype, - Operation::Code op) const = 0; + Operation::Code op) const + = 0; virtual void allReduceInPlace(void* sendrecvbuf, size_t count, Data::Code datatype, - Operation::Code op) const = 0; + Operation::Code op) const + = 0; virtual void allGather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, - Data::Code datatype) const = 0; + Data::Code datatype) const + = 0; virtual void allGatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], - const int displs[], Data::Code datatype) const = 0; + const int displs[], Data::Code datatype) const + = 0; virtual void allToAll(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, - Data::Code datatype) const = 0; + Data::Code datatype) const + = 0; virtual void allToAllv(const void* sendbuf, const int sendcounts[], const int sdispls[], void* recvbuf, - const int recvcounts[], const int rdispls[], Data::Code datatype) const = 0; + const int recvcounts[], const int rdispls[], Data::Code datatype) const + = 0; virtual Status receive(void* recv, size_t count, Data::Code datatype, int source, int tag) const = 0; @@ -446,7 +458,8 @@ class Comm : private eckit::NonCopyable { virtual Request iSend(const void* send, size_t count, Data::Code datatype, int dest, int tag) const = 0; virtual Status sendReceiveReplace(void* sendrecv, size_t count, Data::Code datatype, - int dest, int sendtag, int source, int recvtag) const = 0; + int dest, int sendtag, int source, int recvtag) const + = 0; /// @brief Call free on this communicator /// After calling this method, the communicator should not be used again @@ -497,7 +510,8 @@ class CommBuilder : public CommFactory { virtual Comm* make(const std::string& name, int comm) override { return new T(name, comm); } public: - CommBuilder(const std::string& builder) : CommFactory(builder) {} + CommBuilder(const std::string& builder) : + CommFactory(builder) {} }; //---------------------------------------------------------------------------------------------------------------------- @@ -558,7 +572,7 @@ void eckit::mpi::Comm::broadcast(Iter first, Iter last, size_t root) const { ECKIT_MPI_ASSERT(root < commsize); typename std::iterator_traits::difference_type n = std::distance(first, last); - Data::Code type = Data::Type::value_type>::code(); + Data::Code type = Data::Type::value_type>::code(); broadcast(&(*first), n, type, root); } @@ -746,12 +760,12 @@ void eckit::mpi::Comm::scatterv(CIter first, CIter last, const std::vector& template void eckit::mpi::Comm::reduce(const T send, T& recv, Operation::Code op, size_t root) const { - reduce(&send, &recv, 1, Data::Type::code(), op, root); + reduce(&send, &recv, 1, Data::Type::code(), op, root); } template void eckit::mpi::Comm::reduce(const T* send, T* recv, size_t count, Operation::Code op, size_t root) const { - reduce(send, recv, count, Data::Type::code(), op, root); + reduce(send, recv, count, Data::Type::code(), op, root); } template @@ -766,18 +780,18 @@ void eckit::mpi::Comm::reduce(const std::vector& send, std::vector& recv, template void eckit::mpi::Comm::reduceInPlace(T* sendrecvbuf, size_t count, Operation::Code op, size_t root) const { - reduceInPlace(sendrecvbuf, count, Data::Type::code(), op, root); + reduceInPlace(sendrecvbuf, count, Data::Type::code(), op, root); } template void eckit::mpi::Comm::reduceInPlace(T& sendrecvbuf, Operation::Code op, size_t root) const { - reduceInPlace(&sendrecvbuf, 1, Data::Type::code(), op, root); + reduceInPlace(&sendrecvbuf, 1, Data::Type::code(), op, root); } template void eckit::mpi::Comm::reduceInPlace(Iter first, Iter last, Operation::Code op, size_t root) const { typename std::iterator_traits::difference_type count = std::distance(first, last); - Data::Code type = Data::Type::value_type>::code(); + Data::Code type = Data::Type::value_type>::code(); reduceInPlace(&(*first), count, type, op, root); } @@ -818,7 +832,7 @@ void eckit::mpi::Comm::allReduceInPlace(T& sendrecvbuf, Operation::Code op) cons template void eckit::mpi::Comm::allReduceInPlace(Iter first, Iter last, Operation::Code op) const { typename std::iterator_traits::difference_type count = std::distance(first, last); - Data::Code type = Data::Type::value_type>::code(); + Data::Code type = Data::Type::value_type>::code(); allReduceInPlace(&(*first), count, type, op); } @@ -947,16 +961,16 @@ void eckit::mpi::Comm::synchronisedSend(const T& sendbuf, int dest, int tag) con template eckit::mpi::Status eckit::mpi::Comm::sendReceiveReplace(T* sendrecv, size_t count, - int dest, int sendtag, int source, int recvtag) const { + int dest, int sendtag, int source, int recvtag) const { return sendReceiveReplace(sendrecv, count, Data::Type::code(), - dest, sendtag, source, recvtag); + dest, sendtag, source, recvtag); } template eckit::mpi::Status eckit::mpi::Comm::sendReceiveReplace(T& sendrecv, - int dest, int sendtag, int source, int recvtag) const { + int dest, int sendtag, int source, int recvtag) const { return sendReceiveReplace(&sendrecv, 1, Data::Type::code(), - dest, sendtag, source, recvtag); + dest, sendtag, source, recvtag); } /// diff --git a/src/eckit/mpi/Group.cc b/src/eckit/mpi/Group.cc index e712759ab..ce57a05fc 100644 --- a/src/eckit/mpi/Group.cc +++ b/src/eckit/mpi/Group.cc @@ -34,16 +34,16 @@ class NullGroupContent : public GroupContent { virtual NullGroupContent* union_group(const GroupContent&) const { return new NullGroupContent(); } virtual size_t size() const { return -1; } - + virtual int rank() const { return -1; } virtual NullGroupContent* excl(const std::vector& ranks) const { return new NullGroupContent(); }; virtual NullGroupContent* incl(const std::vector& ranks) const { return new NullGroupContent(); }; - virtual NullGroupContent* range_excl(const std::vector>& ranks) const { return new NullGroupContent(); }; + virtual NullGroupContent* range_excl(const std::vector>& ranks) const { return new NullGroupContent(); }; - virtual NullGroupContent* range_incl(const std::vector>& ranks) const { return new NullGroupContent(); }; + virtual NullGroupContent* range_incl(const std::vector>& ranks) const { return new NullGroupContent(); }; virtual std::unordered_map translate_ranks(const std::vector&, const GroupContent&) const { return std::unordered_map{}; }; }; @@ -119,15 +119,15 @@ Group Group::incl(const std::vector& ranks) const { return Group(content_->incl(ranks)); }; -Group Group::range_excl(const std::vector>& ranks) const { - return Group(content_->range_excl(ranks)); +Group Group::range_excl(const std::vector>& ranks) const { + return Group(content_->range_excl(ranks)); }; -Group Group::range_incl(const std::vector>& ranks) const { - return Group(content_->range_incl(ranks)); +Group Group::range_incl(const std::vector>& ranks) const { + return Group(content_->range_incl(ranks)); }; -std::unordered_map Group::translate_ranks(const std::vector& ranks, const Group& other) const { +std::unordered_map Group::translate_ranks(const std::vector& ranks, const Group& other) const { return content_->translate_ranks(ranks, *other.content_); }; diff --git a/src/eckit/mpi/Group.h b/src/eckit/mpi/Group.h index 9567ef3ca..cfa30566f 100644 --- a/src/eckit/mpi/Group.h +++ b/src/eckit/mpi/Group.h @@ -11,10 +11,10 @@ #ifndef eckit_mpi_Group_h #define eckit_mpi_Group_h -#include -#include #include +#include #include +#include #include "eckit/memory/Counted.h" @@ -32,30 +32,29 @@ class GroupContent : public Counted { virtual int group() const = 0; virtual int compare(const GroupContent&) const = 0; - + virtual GroupContent* difference(const GroupContent&) const = 0; - + virtual GroupContent* intersection(const GroupContent&) const = 0; - + virtual GroupContent* union_group(const GroupContent&) const = 0; virtual size_t size() const = 0; - + virtual int rank() const = 0; - + virtual GroupContent* excl(const std::vector& ranks) const = 0; - + virtual GroupContent* incl(const std::vector& ranks) const = 0; - + virtual GroupContent* range_excl(const std::vector>& ranks) const = 0; - + virtual GroupContent* range_incl(const std::vector>& ranks) const = 0; - + virtual std::unordered_map translate_ranks(const std::vector&, const GroupContent&) const = 0; private: friend class Group; - }; //---------------------------------------------------------------------------------------------------------------------- @@ -84,7 +83,7 @@ class Group { T& as() { return dynamic_cast(*content_); } - + template const T& as() const { return dynamic_cast(*content_); @@ -94,35 +93,35 @@ class Group { /// Use only for interfacing with Fortran int group() const; - // Compares a group. + // Compares a group. // - // Returns + // Returns // * an negative integer (< 0): if the groups are not equal (MPI_UNQUAL) // * zero (= 0): if the groups are identical (MPI_IDENT), i.e. members are in exactly the same order in both groups // * a positive integer (> 0): if the groups are similar (MPI_SIMILAR), i.e. both groups contain the same members but in different order int compare(const Group&) const; - + Group difference(const Group&) const; - + Group intersection(const Group&) const; - + // Can not name the function union because it is a reserved word Group union_group(const Group&) const; - + size_t size() const; - - // Returns the rank of the calling process in the given group. + + // Returns the rank of the calling process in the given group. int rank() const; - + Group excl(const std::vector& ranks) const; - + Group incl(const std::vector& ranks) const; - + Group range_excl(const std::vector>& ranks) const; - + Group range_incl(const std::vector>& ranks) const; - - std::unordered_map translate_ranks(const std::vector&, const Group&) const; + + std::unordered_map translate_ranks(const std::vector&, const Group&) const; private: // methods void print(std::ostream&) const; @@ -134,7 +133,7 @@ class Group { private: // members GroupContent* content_; - + friend class Parallel; }; diff --git a/src/eckit/mpi/Parallel.cc b/src/eckit/mpi/Parallel.cc index 6c0038685..3c66d3f06 100644 --- a/src/eckit/mpi/Parallel.cc +++ b/src/eckit/mpi/Parallel.cc @@ -254,15 +254,15 @@ void Parallel::initialize() { int required; if (MPIInitThread == "MPI_THREAD_SINGLE") - required = MPI_THREAD_SINGLE; //< only one thread executes + required = MPI_THREAD_SINGLE; //< only one thread executes else if (MPIInitThread == "MPI_THREAD_FUNNELED") - required = MPI_THREAD_FUNNELED; //< process may be multi-threaded, but only the main thread will make - // MPI calls + required = MPI_THREAD_FUNNELED; //< process may be multi-threaded, but only the main thread will make + // MPI calls else if (MPIInitThread == "MPI_THREAD_SERIALIZED") required = MPI_THREAD_SERIALIZED; //< the process may be multi-threaded, and multiple threads may make // MPI calls, but only one at a time else if (MPIInitThread == "MPI_THREAD_MULTIPLE") - required = MPI_THREAD_MULTIPLE; //< multiple threads may call MPI, with no restrictions + required = MPI_THREAD_MULTIPLE; //< multiple threads may call MPI, with no restrictions else { std::ostringstream msg; msg << "Value of mpiInitThread is unrecognised: " << MPIInitThread @@ -497,7 +497,7 @@ void Parallel::scatterv(const void* sendbuf, const int sendcounts[], const int d recvbuf, int(recvcount), mpitype, int(root), comm_)); } - void Parallel::reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op, size_t root) const { +void Parallel::reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op, size_t root) const { ASSERT(count < size_t(std::numeric_limits::max())); MPI_Datatype mpitype = toType(type); @@ -513,10 +513,11 @@ void Parallel::reduceInPlace(void* sendrecvbuf, size_t count, Data::Code type, O MPI_Datatype mpitype = toType(type); MPI_Op mpiop = toOp(op); - if ( rank() == root ) { - MPI_CALL(MPI_Reduce(MPI_IN_PLACE, sendrecvbuf, int(count), mpitype, mpiop, int(root), comm_)); - } else { - MPI_CALL(MPI_Reduce(sendrecvbuf, sendrecvbuf, int(count), mpitype, mpiop, int(root), comm_)); + if (rank() == root) { + MPI_CALL(MPI_Reduce(MPI_IN_PLACE, sendrecvbuf, int(count), mpitype, mpiop, int(root), comm_)); + } + else { + MPI_CALL(MPI_Reduce(sendrecvbuf, sendrecvbuf, int(count), mpitype, mpiop, int(root), comm_)); } } @@ -631,7 +632,7 @@ Request Parallel::iSend(const void* send, size_t count, Data::Code type, int des } Status Parallel::sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, - int dest, int sendtag, int source, int recvtag) const { + int dest, int sendtag, int source, int recvtag) const { ASSERT(count < size_t(std::numeric_limits::max())); MPI_Datatype mpitype = toType(type); @@ -639,7 +640,7 @@ Status Parallel::sendReceiveReplace(void* sendrecv, size_t count, Data::Code typ Status status = createStatus(); MPI_CALL(MPI_Sendrecv_replace(sendrecv, int(count), mpitype, - dest, sendtag, source, recvtag, comm_, toStatus(status))); + dest, sendtag, source, recvtag, comm_, toStatus(status))); return status; } diff --git a/src/eckit/mpi/Parallel.h b/src/eckit/mpi/Parallel.h index 1c32a551d..34b76f1a8 100644 --- a/src/eckit/mpi/Parallel.h +++ b/src/eckit/mpi/Parallel.h @@ -38,7 +38,7 @@ class Parallel : public eckit::mpi::Comm { virtual eckit::mpi::Comm* self() const override; virtual std::string processorName() const override; - + virtual size_t remoteSize() const override; virtual void barrier() const override; @@ -82,10 +82,10 @@ class Parallel : public eckit::mpi::Comm { size_t recvcount, Data::Code type, size_t root) const override; virtual void reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, - Operation::Code op, size_t root) const override; + Operation::Code op, size_t root) const override; virtual void reduceInPlace(void* sendrecvbuf, size_t count, Data::Code type, - Operation::Code op, size_t root) const override; + Operation::Code op, size_t root) const override; virtual void allReduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op) const override; @@ -115,7 +115,7 @@ class Parallel : public eckit::mpi::Comm { virtual Request iSend(const void* send, size_t count, Data::Code type, int dest, int tag) const override; virtual Status sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, - int dest, int sendtag, int source, int recvtag) const override; + int dest, int sendtag, int source, int recvtag) const override; virtual eckit::SharedBuffer broadcastFile(const eckit::PathName& filepath, size_t root) const override; @@ -128,11 +128,11 @@ class Parallel : public eckit::mpi::Comm { virtual Status status() const override { return createStatus(); } virtual Request request(int) const override; - + virtual Group group(int) const override; - + virtual Group group() const override; - + virtual Group remoteGroup() const override; virtual Comm& create(const Group&, const std::string& name) const override; @@ -141,8 +141,7 @@ class Parallel : public eckit::mpi::Comm { virtual int communicator() const override; -public: // static methods - +public: // static methods static Status createStatus(); static MPI_Status* toStatus(Status&); @@ -154,9 +153,9 @@ class Parallel : public eckit::mpi::Comm { /// Warning! Do not use the return value to free or modify the MPI communicator! MPI_Comm MPIComm() const; -private: // methods - friend class ParallelGroup; // Groups should not call free if mpi has been finalized. Hence PrallelGroup needs to query finalized() - +private: // methods + friend class ParallelGroup; // Groups should not call free if mpi has been finalized. Hence PrallelGroup needs to query finalized() + static void initialize(); static void finalize(); diff --git a/src/eckit/mpi/ParallelGroup.h b/src/eckit/mpi/ParallelGroup.h index 7a3af4831..102756cf9 100644 --- a/src/eckit/mpi/ParallelGroup.h +++ b/src/eckit/mpi/ParallelGroup.h @@ -39,37 +39,37 @@ class ParallelGroup : public GroupContent { virtual int group() const override; virtual int compare(const GroupContent&) const override; - + int compare(const ParallelGroup&) const; - + virtual GroupContent* difference(const GroupContent&) const override; - + ParallelGroup* difference(const ParallelGroup&) const; - + virtual GroupContent* intersection(const GroupContent&) const override; - + ParallelGroup* intersection(const ParallelGroup&) const; - + virtual GroupContent* union_group(const GroupContent&) const override; - + ParallelGroup* union_group(const ParallelGroup&) const; - + virtual size_t size() const override; - + virtual int rank() const override; - + virtual GroupContent* excl(const std::vector& ranks) const override; - + virtual GroupContent* incl(const std::vector& ranks) const override; - virtual GroupContent* range_excl(const std::vector>& ranks) const override; + virtual GroupContent* range_excl(const std::vector>& ranks) const override; + + virtual GroupContent* range_incl(const std::vector>& ranks) const override; - virtual GroupContent* range_incl(const std::vector>& ranks) const override; - std::vector translate_ranks_native(const std::vector& ranks, const ParallelGroup& other) const; - + std::vector translate_ranks_native(const std::vector& ranks, const GroupContent& other) const; - + virtual std::unordered_map translate_ranks(const std::vector& ranks, const GroupContent& other) const override; private: // members diff --git a/src/eckit/mpi/Serial.cc b/src/eckit/mpi/Serial.cc index 20b907dee..bd2f581c8 100644 --- a/src/eckit/mpi/Serial.cc +++ b/src/eckit/mpi/Serial.cc @@ -22,9 +22,9 @@ #include "eckit/filesystem/PathName.h" #include "eckit/io/DataHandle.h" #include "eckit/maths/Functions.h" +#include "eckit/mpi/Group.h" #include "eckit/mpi/SerialData.h" #include "eckit/mpi/SerialRequest.h" -#include "eckit/mpi/Group.h" #include "eckit/mpi/SerialStatus.h" #include "eckit/runtime/Main.h" #include "eckit/thread/AutoLock.h" @@ -336,7 +336,7 @@ void Serial::scatterv(const void* sendbuf, const int[], const int[], void* recvb } } - void Serial::reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code, size_t root) const { +void Serial::reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code, size_t root) const { if (recvbuf != sendbuf && count > 0) { memcpy(recvbuf, sendbuf, count * dataSize[type]); } @@ -402,7 +402,7 @@ Status Serial::receive(void* recv, size_t count, Data::Code type, int /*source*/ } Status Serial::sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, - int /*dest*/, int sendtag, int /*source*/, int recvtag) const { + int /*dest*/, int sendtag, int /*source*/, int recvtag) const { AutoLock lock(SerialRequestPool::instance()); SerialRequestPool::instance().createSendRequest(sendrecv, count, type, sendtag); ReceiveRequest recv_request(sendrecv, count, type, recvtag); @@ -414,7 +414,7 @@ Status Serial::sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, if (count > 0) { memcpy(sendrecv, send.buffer(), send.count() * dataSize[send.type()]); } - + SerialStatus* st = new SerialStatus(); (*st).count_ = send.count(); (*st).source_ = 0; @@ -476,7 +476,6 @@ Comm& Serial::create(const Group&, int tag, const std::string& name) const { }; - void Serial::print(std::ostream& os) const { os << "Serial()"; } diff --git a/src/eckit/mpi/Serial.h b/src/eckit/mpi/Serial.h index 9beeb81d8..ff84fd566 100644 --- a/src/eckit/mpi/Serial.h +++ b/src/eckit/mpi/Serial.h @@ -41,7 +41,7 @@ class Serial : public eckit::mpi::Comm { virtual std::string processorName() const override; virtual size_t remoteSize() const override; - + virtual void barrier() const override; virtual Request iBarrier() const override; @@ -83,10 +83,10 @@ class Serial : public eckit::mpi::Comm { size_t recvcount, Data::Code type, size_t root) const override; virtual void reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, - Operation::Code op, size_t root) const override; + Operation::Code op, size_t root) const override; virtual void reduceInPlace(void* sendrecvbuf, size_t count, Data::Code type, - Operation::Code op, size_t root) const override; + Operation::Code op, size_t root) const override; virtual void allReduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op) const override; @@ -116,7 +116,7 @@ class Serial : public eckit::mpi::Comm { virtual Request iSend(const void* send, size_t count, Data::Code type, int dest, int tag) const override; virtual Status sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, - int dest, int sendtag, int source, int recvtag) const override; + int dest, int sendtag, int source, int recvtag) const override; virtual Comm& split(int color, const std::string& name) const override; @@ -129,13 +129,13 @@ class Serial : public eckit::mpi::Comm { virtual Status status() const override { return createStatus(); } virtual Request request(int tag) const override; - + // Not implemented - returns NullGroup virtual Group group(int) const override; - + // Not implemented - returns NullGroup virtual Group group() const override; - + // Not implemented - returns NullGroup virtual Group remoteGroup() const override; diff --git a/src/eckit/mpi/SerialData.h b/src/eckit/mpi/SerialData.h index a0dbad379..830864aba 100644 --- a/src/eckit/mpi/SerialData.h +++ b/src/eckit/mpi/SerialData.h @@ -43,8 +43,8 @@ static size_t dataSize[Data::MAX_DATA_CODE] = { /*[Data::DOUBLE_INT] = */ sizeof(std::pair), /*[Data::LONG_DOUBLE_INT] = */ sizeof(std::pair), /*[Data::LONG_LONG] = */ sizeof(long long), - /*[Data::TWO_LONG] = */ 2*sizeof(long), - /*[Data::TWO_LONG_LONG] = */ 2*sizeof(long long), + /*[Data::TWO_LONG] = */ 2 * sizeof(long), + /*[Data::TWO_LONG_LONG] = */ 2 * sizeof(long long), }; } // namespace mpi diff --git a/src/eckit/net/Connector.h b/src/eckit/net/Connector.h index 8f8a6bf9a..66876b0f7 100644 --- a/src/eckit/net/Connector.h +++ b/src/eckit/net/Connector.h @@ -32,7 +32,8 @@ class ConnectorException : public Exception { virtual bool retryOnClient() const { return true; } public: - ConnectorException(const std::string& what) : Exception(what) {} + ConnectorException(const std::string& what) : + Exception(what) {} }; //---------------------------------------------------------------------------------------------------------------------- @@ -61,7 +62,7 @@ class Connector : public Stream { static Connector& service(const std::string& name, const std::string& node); static Connector& service(const std::string& name, const std::map& cost, - const std::set& attributes={}); + const std::set& attributes = {}); static NodeInfo nodeInfo(const std::string& name, const std::string& node); @@ -144,7 +145,8 @@ class AutoMemoize { unsigned long t_; public: - AutoMemoize(Connector& c, unsigned long t) : c_(c), t_(t) { c_.memoize(true, t_); } + AutoMemoize(Connector& c, unsigned long t) : + c_(c), t_(t) { c_.memoize(true, t_); } ~AutoMemoize() { c_.memoize(false, t_); } }; diff --git a/src/eckit/net/HttpHeader.h b/src/eckit/net/HttpHeader.h index beeffcb98..16e96c65f 100644 --- a/src/eckit/net/HttpHeader.h +++ b/src/eckit/net/HttpHeader.h @@ -48,7 +48,8 @@ class HttpError : public Exception { }; public: - HttpError(int status, const std::string& msg = "HttpError") : Exception(msg), status_(status) {} + HttpError(int status, const std::string& msg = "HttpError") : + Exception(msg), status_(status) {} int status() const { return status_; } }; diff --git a/src/eckit/net/IPAddress.h b/src/eckit/net/IPAddress.h index 68b6afc4e..c4449efdb 100644 --- a/src/eckit/net/IPAddress.h +++ b/src/eckit/net/IPAddress.h @@ -26,7 +26,8 @@ namespace net { class IPAddress { public: // Contructors - IPAddress(const in_addr& address) : address_(address) {} + IPAddress(const in_addr& address) : + address_(address) {} IPAddress(const std::string&); IPAddress(const char*); diff --git a/src/eckit/net/NetService.cc b/src/eckit/net/NetService.cc index 46a6e439a..de716583b 100644 --- a/src/eckit/net/NetService.cc +++ b/src/eckit/net/NetService.cc @@ -11,12 +11,12 @@ #include "eckit/net/NetService.h" #include "eckit/config/Resource.h" +#include "eckit/io/Select.h" #include "eckit/log/Log.h" #include "eckit/net/NetUser.h" #include "eckit/runtime/Monitor.h" #include "eckit/runtime/ProcessControler.h" #include "eckit/thread/ThreadControler.h" -#include "eckit/io/Select.h" namespace eckit { namespace net { @@ -66,9 +66,9 @@ void NetService::run() { Log::status() << oss.str() << std::endl; - if(timeout()) { + if (timeout()) { Select select(server_); - if(!select.ready(timeout())) { + if (!select.ready(timeout())) { // This will allow to check stopped() again continue; } diff --git a/src/eckit/net/SocketOptions.cc b/src/eckit/net/SocketOptions.cc index 52f0935cf..0d50f17c6 100644 --- a/src/eckit/net/SocketOptions.cc +++ b/src/eckit/net/SocketOptions.cc @@ -34,7 +34,7 @@ static void init(SocketOptions& opts) { static bool tcpNoDelay = eckit::Resource("socketOptionsTcpNoDelay", true); static int receiveBufferSize = eckit::Resource("socketOptionsReceiveBufferSize", 0); - static int sendBufferSize = eckit::Resource("socketOptionsSendBufferSize", 0); + static int sendBufferSize = eckit::Resource("socketOptionsSendBufferSize", 0); opts.reusePort(reusePort); opts.reuseAddr(reuseAddr); @@ -62,7 +62,7 @@ void SocketOptions::print(std::ostream& s) const { << "ipLowDelay=" << ipLowDelay_ << ", " << "tcpNoDelay=" << tcpNoDelay_ << ", " << "receiveBufferSize=" << receiveBufferSize_ << ", " - << "sendBufferSize=" << sendBufferSize_ + << "sendBufferSize=" << sendBufferSize_ << "]" << std::endl; } diff --git a/src/eckit/net/TCPServer.h b/src/eckit/net/TCPServer.h index 535683c3e..c98dd1cb3 100644 --- a/src/eckit/net/TCPServer.h +++ b/src/eckit/net/TCPServer.h @@ -48,7 +48,7 @@ class TCPServer : public TCPSocket, private NonCopyable { SocketOptions options_; //< options to build the socket -protected: // methods +protected: // methods virtual void bind() override; virtual void print(std::ostream& s) const override; diff --git a/src/eckit/net/TCPSocket.cc b/src/eckit/net/TCPSocket.cc index 5ab55f0dd..9adbb595f 100644 --- a/src/eckit/net/TCPSocket.cc +++ b/src/eckit/net/TCPSocket.cc @@ -481,16 +481,16 @@ TCPSocket& TCPClient::connect(const std::string& remote, int port, int retries, return *this; } -void set_socket_buffer_size(int& socket, const char* ssock, const int& stype, const int size ) { +void set_socket_buffer_size(int& socket, const char* ssock, const int& stype, const int size) { Log::debug() << "Setting " << ssock << " buffer size " << size << std::endl; int flg = 0; socklen_t flgsize = sizeof(flg); if (getsockopt(socket, SOL_SOCKET, stype, &flg, &flgsize) < 0) - Log::warning() << "getsockopt " << ssock << " " << Log::syserr << std::endl; + Log::warning() << "getsockopt " << ssock << " " << Log::syserr << std::endl; - if (flg != size) { + if (flg != size) { if (setsockopt(socket, SOL_SOCKET, stype, &size, sizeof(size)) < 0) Log::warning() << "setsockopt " << ssock << " " << Log::syserr << std::endl; @@ -501,12 +501,12 @@ void set_socket_buffer_size(int& socket, const char* ssock, const int& stype, co #if defined(__linux__) // For Linux we ignore if the effective size is 2x what is set // see Linux 'man 7 socket' - // when set using setsockopt() the Linux kernel doubles the socket buffer size + // when set using setsockopt() the Linux kernel doubles the socket buffer size // to allow space for bookkeeping overhead and this doubled value is // returned by getsockopt(). The minimum (doubled) value for this option is 2048. - warn &= !(flg == 2 * size); + warn &= !(flg == 2 * size); #endif - if(warn) + if (warn) Log::warning() << "Attempt to set " << stype << " buffer size to " << size << " but kernel set size to " << flg << std::endl; } } @@ -669,7 +669,7 @@ std::string TCPSocket::addrToHost(in_addr addr) { else h = &host; #else - h = gethostbyaddr(reinterpret_cast(&addr), sizeof(addr), AF_INET); + h = gethostbyaddr(reinterpret_cast(&addr), sizeof(addr), AF_INET); #endif std::string s = h ? std::string(h->h_name) : IPAddress(addr).asString(); @@ -705,7 +705,7 @@ void TCPSocket::register_ignore_sigpipe() { struct sigaction act; eckit::zero(act); act.sa_handler = SIG_IGN; - act.sa_flags = SA_RESTART; + act.sa_flags = SA_RESTART; SYSCALL(::sigaction(SIGPIPE, &act, nullptr)); //< shouldn't fail -- see ERROR conditions in man(2) sigaction #endif } diff --git a/src/eckit/net/TCPSocket.h b/src/eckit/net/TCPSocket.h index 5919ebb12..7380fd98c 100644 --- a/src/eckit/net/TCPSocket.h +++ b/src/eckit/net/TCPSocket.h @@ -119,7 +119,7 @@ class TCPSocket { in_addr localAddr_; // local ip adress int receiveBufferSize_ = 0; - int sendBufferSize_ = 0; + int sendBufferSize_ = 0; // Debug bool debug_; diff --git a/src/eckit/net/TCPStream.h b/src/eckit/net/TCPStream.h index f903cc9a4..5f9ab7cd5 100644 --- a/src/eckit/net/TCPStream.h +++ b/src/eckit/net/TCPStream.h @@ -70,7 +70,8 @@ class TCPStream : public TCPStreamBase { class InstantTCPStream : public TCPStreamBase { public: /// @note does not take ownership of TCPSocket - InstantTCPStream(net::TCPSocket& socket) : socket_(socket) {} + InstantTCPStream(net::TCPSocket& socket) : + socket_(socket) {} virtual TCPSocket& socket() override { return socket_; } diff --git a/src/eckit/option/EckitTool.h b/src/eckit/option/EckitTool.h index af3d79e6b..d40b8fb59 100644 --- a/src/eckit/option/EckitTool.h +++ b/src/eckit/option/EckitTool.h @@ -14,34 +14,31 @@ #pragma once -#include "eckit/runtime/Tool.h" #include "eckit/filesystem/PathName.h" #include "eckit/option/SimpleOption.h" +#include "eckit/runtime/Tool.h" namespace eckit { - namespace option { - class Option; - class CmdArgs; - } +namespace option { +class Option; +class CmdArgs; +} // namespace option //---------------------------------------------------------------------------------------------------------------------- class EckitTool : public eckit::Tool { -protected: // methods - - EckitTool(int argc, char **argv); +protected: // methods + EckitTool(int argc, char** argv); public: - virtual void usage(const std::string &tool) const = 0; - -protected: // members + virtual void usage(const std::string& tool) const = 0; - std::vector options_; - -private: // methods +protected: // members + std::vector options_; +private: // methods virtual void init(const eckit::option::CmdArgs& args); virtual void execute(const eckit::option::CmdArgs& args) = 0; virtual void finish(const eckit::option::CmdArgs& args); @@ -50,10 +47,8 @@ class EckitTool : public eckit::Tool { virtual int minimumPositionalArguments() const { return -1; } virtual void run(); - }; //---------------------------------------------------------------------------------------------------------------------- -} // namespace eckit - +} // namespace eckit diff --git a/src/eckit/os/AutoUmask.h b/src/eckit/os/AutoUmask.h index 214d195c3..e4bd42ad9 100644 --- a/src/eckit/os/AutoUmask.h +++ b/src/eckit/os/AutoUmask.h @@ -25,7 +25,8 @@ class AutoUmask { mode_t umask_; public: - explicit AutoUmask(mode_t u = 0) : umask_(::umask(u)) {} + explicit AutoUmask(mode_t u = 0) : + umask_(::umask(u)) {} ~AutoUmask() { ::umask(umask_); } }; diff --git a/src/eckit/os/SharedInt.h b/src/eckit/os/SharedInt.h index ff196641b..ca01d823f 100644 --- a/src/eckit/os/SharedInt.h +++ b/src/eckit/os/SharedInt.h @@ -38,7 +38,7 @@ class SharedInt : public Semaphore { void newLimit(short val, unsigned short n = 0); private: - SharedInt(const SharedInt&) = delete; + SharedInt(const SharedInt&) = delete; SharedInt& operator=(const SharedInt&) = delete; }; diff --git a/src/eckit/parser/YAMLParser.cc b/src/eckit/parser/YAMLParser.cc index a07179dc0..6266df680 100644 --- a/src/eckit/parser/YAMLParser.cc +++ b/src/eckit/parser/YAMLParser.cc @@ -614,7 +614,7 @@ Value YAMLParser::parseStringOrNumber(bool& isKey) { if (c == '"' || c == '\'') { Value result = ObjectParser::parseString(c); - isKey = (peek(true) == ':'); + isKey = (peek(true) == ':'); return result; } @@ -672,7 +672,8 @@ Value YAMLParser::parseStringOrNumber(bool& isKey) { isKey = true; break; - } else { + } + else { s += p; } @@ -759,7 +760,7 @@ void YAMLParser::loadItem() { case '\'': v = parseStringOrNumber(isKey); if (isKey) { - next(true); + next(true); } item = new YAMLItemValue(indent, v); break; @@ -783,7 +784,7 @@ void YAMLParser::loadItem() { } item = new YAMLItemValue(indent, parseStringOrNumber(isKey)); if (isKey) { - next(true); + next(true); } break; } @@ -806,7 +807,7 @@ void YAMLParser::loadItem() { } item = new YAMLItemValue(indent, parseStringOrNumber(isKey)); if (isKey) { - next(true); + next(true); } break; } @@ -826,7 +827,7 @@ void YAMLParser::loadItem() { default: item = new YAMLItemValue(indent, parseStringOrNumber(isKey)); if (isKey) { - next(true); + next(true); } break; } diff --git a/src/eckit/persist/Isa.h b/src/eckit/persist/Isa.h index e36e0e43d..77f4657a1 100644 --- a/src/eckit/persist/Isa.h +++ b/src/eckit/persist/Isa.h @@ -21,7 +21,8 @@ class Isa { public: Isa* next_; TypeInfo* type_; - Isa(TypeInfo* t, Isa* n) : next_(n), type_(t) {} + Isa(TypeInfo* t, Isa* n) : + next_(n), type_(t) {} static void add(TypeInfo* t, const std::string&); static Isa* get(const std::string&); }; diff --git a/src/eckit/runtime/Dispatcher.h b/src/eckit/runtime/Dispatcher.h index e6308ac00..e52714f37 100644 --- a/src/eckit/runtime/Dispatcher.h +++ b/src/eckit/runtime/Dispatcher.h @@ -225,7 +225,8 @@ class DispatchInfo : public Thread { virtual void run() override; public: - DispatchInfo(Dispatcher& owner) : owner_(owner) {} + DispatchInfo(Dispatcher& owner) : + owner_(owner) {} }; //================================================================= diff --git a/src/eckit/runtime/Metrics.h b/src/eckit/runtime/Metrics.h index 83d2c3f35..9b1f345ec 100644 --- a/src/eckit/runtime/Metrics.h +++ b/src/eckit/runtime/Metrics.h @@ -67,7 +67,7 @@ class Metrics { class CollectMetrics { - MetricsCollector *collector_; + MetricsCollector* collector_; void print(std::ostream& s) const; diff --git a/src/eckit/runtime/Monitor.h b/src/eckit/runtime/Monitor.h index 8f7f4292e..55b91847f 100644 --- a/src/eckit/runtime/Monitor.h +++ b/src/eckit/runtime/Monitor.h @@ -144,7 +144,8 @@ class AutoState { char old_; public: - AutoState(char c) : old_(Monitor::instance().state(c)) {} + AutoState(char c) : + old_(Monitor::instance().state(c)) {} ~AutoState() { Monitor::instance().state(old_); } @@ -159,8 +160,10 @@ class AutoLockTag { AutoLock lock_; public: - AutoLockTag(T& t) : state_(t.tag()), lock_(t) { state_.set(t.tag() - 'a' + 'A'); } - AutoLockTag(T* t) : state_(t->tag()), lock_(t) { state_.set(t->tag() - 'a' + 'A'); } + AutoLockTag(T& t) : + state_(t.tag()), lock_(t) { state_.set(t.tag() - 'a' + 'A'); } + AutoLockTag(T* t) : + state_(t->tag()), lock_(t) { state_.set(t->tag() - 'a' + 'A'); } }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/eckit/runtime/Pipe.h b/src/eckit/runtime/Pipe.h index 7336b5568..23549a7ec 100644 --- a/src/eckit/runtime/Pipe.h +++ b/src/eckit/runtime/Pipe.h @@ -93,7 +93,8 @@ struct OnePayload { bool ready_; bool done_; PAYLOAD payload_; - OnePayload() : ready_(false), done_(false), payload_() {} + OnePayload() : + ready_(false), done_(false), payload_() {} }; template diff --git a/src/eckit/runtime/ProducerConsumer.h b/src/eckit/runtime/ProducerConsumer.h index 9970fc00c..71b566d15 100644 --- a/src/eckit/runtime/ProducerConsumer.h +++ b/src/eckit/runtime/ProducerConsumer.h @@ -94,7 +94,8 @@ struct OnePayload { bool ready_; bool done_; PAYLOAD payload_; - OnePayload() : ready_(false), done_(false), payload_() {} + OnePayload() : + ready_(false), done_(false), payload_() {} }; template @@ -113,7 +114,8 @@ class ProducerConsumerTask : public Thread { template -ProducerConsumer::ProducerConsumer(long count) : count_(count), error_(false) {} +ProducerConsumer::ProducerConsumer(long count) : + count_(count), error_(false) {} template ProducerConsumer::~ProducerConsumer() {} diff --git a/src/eckit/runtime/TaskInfo.h b/src/eckit/runtime/TaskInfo.h index f84be8c22..b5b11d3ae 100644 --- a/src/eckit/runtime/TaskInfo.h +++ b/src/eckit/runtime/TaskInfo.h @@ -199,7 +199,7 @@ class TaskInfo : public Padded, public NonCopyable { void host(const std::string& h) { touch(); strncpy(host_, h.c_str(), sizeof(host_)); - host_[sizeof(host_)-1] = '\0'; + host_[sizeof(host_) - 1] = '\0'; } std::string host() const { return host_; } diff --git a/src/eckit/serialisation/FstreamStream.h b/src/eckit/serialisation/FstreamStream.h index 343a5f8eb..a82bcd9f0 100644 --- a/src/eckit/serialisation/FstreamStream.h +++ b/src/eckit/serialisation/FstreamStream.h @@ -33,7 +33,8 @@ class FstreamStream : public Stream { public: // -- Contructors - FstreamStream(std::fstream& f) : f_(f) {} + FstreamStream(std::fstream& f) : + f_(f) {} // -- Destructor diff --git a/src/eckit/serialisation/HandleStream.h b/src/eckit/serialisation/HandleStream.h index fff5904f1..c0e88a276 100644 --- a/src/eckit/serialisation/HandleStream.h +++ b/src/eckit/serialisation/HandleStream.h @@ -30,7 +30,8 @@ class HandleStream : public Stream { public: // -- Contructors - HandleStream(DataHandle& h) : handle_(h) {} + HandleStream(DataHandle& h) : + handle_(h) {} // -- Destructor diff --git a/src/eckit/serialisation/IfstreamStream.h b/src/eckit/serialisation/IfstreamStream.h index 61baaf52d..cc0f3db34 100644 --- a/src/eckit/serialisation/IfstreamStream.h +++ b/src/eckit/serialisation/IfstreamStream.h @@ -33,7 +33,8 @@ class IfstreamStream : public Stream { public: // -- Contructors - IfstreamStream(std::ifstream& f) : f_(f) {} + IfstreamStream(std::ifstream& f) : + f_(f) {} // -- Destructor diff --git a/src/eckit/sql/Environment.h b/src/eckit/sql/Environment.h index 87624a73b..0c969281d 100644 --- a/src/eckit/sql/Environment.h +++ b/src/eckit/sql/Environment.h @@ -25,7 +25,8 @@ class SQLTableIterator; struct Environment { - Environment(SortedTables::iterator it) : tableIterator(it) {} + Environment(SortedTables::iterator it) : + tableIterator(it) {} ~Environment() {} const SelectOneTable& table() const { return **tableIterator; } diff --git a/src/eckit/sql/SQLColumn.h b/src/eckit/sql/SQLColumn.h index 000967ab6..4f8fab77c 100644 --- a/src/eckit/sql/SQLColumn.h +++ b/src/eckit/sql/SQLColumn.h @@ -53,9 +53,9 @@ class SQLColumn : public SQLIterator { bool isBitfield() const { return isBitfield_; } bool isMissingValue(const double* val) const { // return hasMissingValue_ && (*val == missingValue_); - const char* punnable_val = reinterpret_cast(val); - const char* punnable_missing = reinterpret_cast(&missingValue_); - const uint64_t* punned_val = reinterpret_cast(punnable_val); + const char* punnable_val = reinterpret_cast(val); + const char* punnable_missing = reinterpret_cast(&missingValue_); + const uint64_t* punned_val = reinterpret_cast(punnable_val); const uint64_t* punned_missing = reinterpret_cast(punnable_missing); return hasMissingValue_ && (*punned_val == *punned_missing); } diff --git a/src/eckit/sql/SQLDatabase.h b/src/eckit/sql/SQLDatabase.h index 4b9bb285f..7bf61e854 100644 --- a/src/eckit/sql/SQLDatabase.h +++ b/src/eckit/sql/SQLDatabase.h @@ -47,10 +47,10 @@ class SQLDatabase { SQLDatabase(const std::string& name = "default"); virtual ~SQLDatabase(); - SQLDatabase(const SQLDatabase&) = delete; + SQLDatabase(const SQLDatabase&) = delete; SQLDatabase& operator=(const SQLDatabase&) = delete; - SQLDatabase(SQLDatabase&&) = default; + SQLDatabase(SQLDatabase&&) = default; SQLDatabase& operator=(SQLDatabase&&) = default; // -- Methods diff --git a/src/eckit/sql/SQLDistinctOutput.h b/src/eckit/sql/SQLDistinctOutput.h index e3878fb75..9ceec0bce 100644 --- a/src/eckit/sql/SQLDistinctOutput.h +++ b/src/eckit/sql/SQLDistinctOutput.h @@ -31,10 +31,11 @@ class SQLDistinctOutput : public SQLOutput { struct DoubleBitwiseLessComparator { bool operator()(const std::vector& lhs, const std::vector& rhs) const { - if (lhs.size() != rhs.size()) return lhs.size() < rhs.size(); + if (lhs.size() != rhs.size()) + return lhs.size() < rhs.size(); for (int i = 0; i < lhs.size(); ++i) { - const void* p1 = &lhs[i]; - const void* p2 = &rhs[i]; + const void* p1 = &lhs[i]; + const void* p2 = &rhs[i]; const uint64_t& punned1 = *reinterpret_cast(p1); const uint64_t& punned2 = *reinterpret_cast(p2); if (punned1 != punned2) { diff --git a/src/eckit/sql/SQLIterator.h b/src/eckit/sql/SQLIterator.h index d4d07e58a..230f3daa3 100644 --- a/src/eckit/sql/SQLIterator.h +++ b/src/eckit/sql/SQLIterator.h @@ -28,7 +28,8 @@ class SQLIterator { // void *operator new(size_t s,void *p) { return p; } // void operator delete(void* p) { eckit::MemoryPool::fastDeallocate(p); } - SQLIterator(const type::SQLType& type) : type_(type) {} + SQLIterator(const type::SQLType& type) : + type_(type) {} virtual ~SQLIterator() {} diff --git a/src/eckit/sql/SQLSelect.cc b/src/eckit/sql/SQLSelect.cc index bd1a11777..e7e16cb5e 100644 --- a/src/eckit/sql/SQLSelect.cc +++ b/src/eckit/sql/SQLSelect.cc @@ -124,12 +124,12 @@ const type::SQLType* SQLSelect::typeOf(const std::string& name, const SQLTable* } static bool compareTables(SelectOneTable* a, SelectOneTable* b) { - //#if 1 + // #if 1 // if(&(a->table_->owner()) != &(b->table_->owner())) return a->table_->owner().name() < b->table_->owner().name(); - //#else + // #else // return a->table_->index() < b->table_->index(); - //#endif + // #endif } inline bool SQLSelect::resultsOut() { diff --git a/src/eckit/sql/SQLSession.h b/src/eckit/sql/SQLSession.h index 99355b215..ef28242ab 100644 --- a/src/eckit/sql/SQLSession.h +++ b/src/eckit/sql/SQLSession.h @@ -26,7 +26,7 @@ class DataHandle; #include "eckit/memory/OnlyMovable.h" #include "eckit/sql/SQLSelectFactory.h" -//#include "eckit/sql/SQLInsertFactory.h" +// #include "eckit/sql/SQLInsertFactory.h" #include "eckit/sql/SQLDatabase.h" #include "eckit/sql/SQLOutputConfig.h" diff --git a/src/eckit/sql/SQLTable.h b/src/eckit/sql/SQLTable.h index 19d4853ab..5f5d8ddfb 100644 --- a/src/eckit/sql/SQLTable.h +++ b/src/eckit/sql/SQLTable.h @@ -40,7 +40,7 @@ class SQLTableIterator { virtual std::vector columnOffsets() const = 0; virtual const double* data() const = 0; virtual std::vector doublesDataSizes() const = 0; - virtual std::vector columnsHaveMissing() const = 0; // n.b. don't use std::vector ... + virtual std::vector columnsHaveMissing() const = 0; // n.b. don't use std::vector ... virtual std::vector missingValues() const = 0; }; @@ -85,7 +85,8 @@ class SQLTable : private eckit::NonCopyable { virtual void print(std::ostream& s) const; virtual SQLTableIterator* iterator(const std::vector>&, - std::function metadataUpdateCallback) const = 0; + std::function metadataUpdateCallback) const + = 0; protected: std::string path_; diff --git a/src/eckit/sql/expression/SQLExpression.h b/src/eckit/sql/expression/SQLExpression.h index a938e37c8..716d7776b 100644 --- a/src/eckit/sql/expression/SQLExpression.h +++ b/src/eckit/sql/expression/SQLExpression.h @@ -90,7 +90,7 @@ class SQLExpression : public std::enable_shared_from_this { virtual void print(std::ostream&) const = 0; protected: - SQLExpression(const SQLExpression&) = default; + SQLExpression(const SQLExpression&) = default; SQLExpression& operator=(const SQLExpression&) = default; bool isBitfield_; @@ -113,7 +113,7 @@ class SQLExpression : public std::enable_shared_from_this { } // namespace sql } // namespace eckit -//#include "eckit/sql/expression/SQLExpressions.h" +// #include "eckit/sql/expression/SQLExpressions.h" using namespace eckit::sql::expression; diff --git a/src/eckit/sql/expression/SQLExpressions.h b/src/eckit/sql/expression/SQLExpressions.h index 436bcca9d..a219c8ce2 100644 --- a/src/eckit/sql/expression/SQLExpressions.h +++ b/src/eckit/sql/expression/SQLExpressions.h @@ -33,13 +33,15 @@ typedef std::vector> ExpressionsVector; class Expressions : public SQLExpression, public ExpressionsVector { public: - Expressions() : ExpressionsVector() {} - Expressions(size_t i) : ExpressionsVector(i, 0) {} + Expressions() : + ExpressionsVector() {} + Expressions(size_t i) : + ExpressionsVector(i, 0) {} - Expressions(const Expressions&) = default; + Expressions(const Expressions&) = default; Expressions& operator=(const Expressions&) = default; - Expressions(Expressions&&) = default; + Expressions(Expressions&&) = default; Expressions& operator=(Expressions&&) = default; virtual void print(std::ostream& s) const override; diff --git a/src/eckit/sql/expression/function/FunctionFactory.h b/src/eckit/sql/expression/function/FunctionFactory.h index d4e62c492..bf4c06d3d 100644 --- a/src/eckit/sql/expression/function/FunctionFactory.h +++ b/src/eckit/sql/expression/function/FunctionFactory.h @@ -79,7 +79,8 @@ class FunctionBuilderBase { virtual ~FunctionBuilderBase(); virtual std::shared_ptr make(const std::string& name, - const expression::Expressions& args) const = 0; + const expression::Expressions& args) const + = 0; int arity() const; std::string help() const; }; diff --git a/src/eckit/sql/expression/function/FunctionTDIFF.h b/src/eckit/sql/expression/function/FunctionTDIFF.h index 64c785679..16d66689b 100644 --- a/src/eckit/sql/expression/function/FunctionTDIFF.h +++ b/src/eckit/sql/expression/function/FunctionTDIFF.h @@ -14,8 +14,8 @@ #ifndef FunctionTDIFF_H #define FunctionTDIFF_H -#include "eckit/sql/expression/function/FunctionIntegerExpression.h" #include "eckit/sql/expression/function/FunctionFactory.h" +#include "eckit/sql/expression/function/FunctionIntegerExpression.h" namespace eckit { namespace sql { diff --git a/src/eckit/sql/type/SQLBitfield.h b/src/eckit/sql/type/SQLBitfield.h index abad6bae3..0ba1c1b2a 100644 --- a/src/eckit/sql/type/SQLBitfield.h +++ b/src/eckit/sql/type/SQLBitfield.h @@ -33,7 +33,7 @@ class SQLBitfield : public SQLType { const FieldNames& fields() const { return bitfieldDef_.first; } const Sizes& sizes() const { return bitfieldDef_.second; } - static std::string make(const std::string&, const FieldNames&, const Sizes&, const char* aliasName=NULL); + static std::string make(const std::string&, const FieldNames&, const Sizes&, const char* aliasName = NULL); private: SQLBitfield(const SQLBitfield&); diff --git a/src/eckit/sql/type/SQLType.h b/src/eckit/sql/type/SQLType.h index 595fcfd5e..d919a0c5b 100644 --- a/src/eckit/sql/type/SQLType.h +++ b/src/eckit/sql/type/SQLType.h @@ -69,7 +69,6 @@ class SQLType : private eckit::NonCopyable { static bool exists(const std::string&); private: - std::string name_; friend std::ostream& operator<<(std::ostream& s, const SQLType& p) { diff --git a/src/eckit/system/Library.h b/src/eckit/system/Library.h index 5fe673b2b..fc8d6f46c 100644 --- a/src/eckit/system/Library.h +++ b/src/eckit/system/Library.h @@ -64,21 +64,19 @@ class Library : private eckit::NonCopyable { virtual const Configuration& configuration() const; public: // methods - /// @deprecated Use LibraryManager instead static std::vector list(); /// @deprecated Use LibraryManager instead - static void list(std::ostream& s); + static void list(std::ostream& s); /// @deprecated Use LibraryManager instead - static bool exists(const std::string& name); + static bool exists(const std::string& name); /// @deprecated Use LibraryManager instead - static const Library& lookup(const std::string& name); + static const Library& lookup(const std::string& name); void lock() { mutex_.lock(); } void unlock() { mutex_.unlock(); } protected: // methods - virtual std::string home() const; virtual const void* addr() const; diff --git a/src/eckit/system/LibraryManager.cc b/src/eckit/system/LibraryManager.cc index e8648af25..e002304c7 100644 --- a/src/eckit/system/LibraryManager.cc +++ b/src/eckit/system/LibraryManager.cc @@ -393,7 +393,7 @@ class LibraryRegistry { is_plugin_initialized_.erase(name); } -private: // members +private: // members LibraryMap libs_; std::map plugins_; //< map plugin name to library std::map is_plugin_initialized_; @@ -427,8 +427,8 @@ const Library& LibraryManager::lookup(const std::string& name) { } const Plugin& LibraryManager::lookupPlugin(const std::string& name) { - Plugin * plugin = LibraryRegistry::instance().lookupPlugin(name); - if(plugin) + Plugin* plugin = LibraryRegistry::instance().lookupPlugin(name); + if (plugin) return *plugin; throw eckit::BadValue("Plugin " + name + " not loaded"); } diff --git a/src/eckit/system/LibraryManager.h b/src/eckit/system/LibraryManager.h index aa8933672..f19bd323e 100644 --- a/src/eckit/system/LibraryManager.h +++ b/src/eckit/system/LibraryManager.h @@ -17,8 +17,8 @@ #include #include -#include "eckit/memory/NonCopyable.h" #include "eckit/filesystem/LocalPathName.h" +#include "eckit/memory/NonCopyable.h" namespace eckit { namespace system { @@ -30,7 +30,6 @@ class Plugin; class LibraryManager : private eckit::NonCopyable { public: // class methods - /// @brief Register a library static void enregister(const std::string& name, Library* obj); @@ -84,7 +83,6 @@ class LibraryManager : private eckit::NonCopyable { /// To be called from the Plugin destructor /// @param [in] name Name of the library plugin to deregister static void deregisterPlugin(const std::string& name); - }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/eckit/system/MemoryInfo.h b/src/eckit/system/MemoryInfo.h index b60b243d4..e2fcbd4e0 100644 --- a/src/eckit/system/MemoryInfo.h +++ b/src/eckit/system/MemoryInfo.h @@ -44,7 +44,7 @@ struct MemoryInfo { // /proc/pid/smap size_t mapped_shared_; size_t mapped_read_; - size_t mapped_write_; + size_t mapped_write_; size_t mapped_execute_; size_t mapped_private_; diff --git a/src/eckit/system/Plugin.h b/src/eckit/system/Plugin.h index e6f5d731f..4dd9f9711 100644 --- a/src/eckit/system/Plugin.h +++ b/src/eckit/system/Plugin.h @@ -23,7 +23,7 @@ class Plugin : public eckit::system::Library { public: /// @param [in] name Plugin name /// @param [in] libname Library name as will be used in file system - explicit Plugin( const std::string& name, const std::string& libname = "" ); + explicit Plugin(const std::string& name, const std::string& libname = ""); virtual ~Plugin() override; @@ -43,7 +43,7 @@ class Plugin : public eckit::system::Library { void* handle() const { return handle_; } protected: - void* handle_ = nullptr; //< handle returned by dlopen + void* handle_ = nullptr; //< handle returned by dlopen private: std::string name_; diff --git a/src/eckit/testing/Test.h b/src/eckit/testing/Test.h index b458bf27a..f55dfee95 100644 --- a/src/eckit/testing/Test.h +++ b/src/eckit/testing/Test.h @@ -15,13 +15,13 @@ #ifndef eckit_testing_Test_h #define eckit_testing_Test_h -#include // for setenv +#include // for setenv #include +#include #include #include #include -#include #include "eckit/exception/Exceptions.h" #include "eckit/log/Colour.h" @@ -38,7 +38,8 @@ namespace testing { class TestException : public Exception { public: - TestException(const std::string& w, const CodeLocation& l) : Exception(w, l) {} + TestException(const std::string& w, const CodeLocation& l) : + Exception(w, l) {} }; enum TestVerbosity @@ -57,7 +58,8 @@ enum InitEckitMain class SetEnv { public: - SetEnv(const char* key, const char* val) : key_(key), value_(val) { + SetEnv(const char* key, const char* val) : + key_(key), value_(val) { oldValue_ = ::getenv(key_); ::setenv(key_, value_, true); } @@ -193,9 +195,12 @@ template class ArrayView { public: // -- Constructors - ArrayView(const T* data, size_t size) : data_(data), size_(size) {} - ArrayView(const T* begin, const T* end) : data_(begin), size_(end - begin) {} - explicit ArrayView(const std::vector& vec) : data_(&vec[0]), size_(vec.size()) {} + ArrayView(const T* data, size_t size) : + data_(data), size_(size) {} + ArrayView(const T* begin, const T* end) : + data_(begin), size_(end - begin) {} + explicit ArrayView(const std::vector& vec) : + data_(&vec[0]), size_(vec.size()) {} // -- Accessors const T& operator[](int i) const { return data_[i]; } @@ -364,7 +369,8 @@ inline int run(std::vector& tests, TestVerbosity v = AllFailures) { eckit::Log::info() << "Running case " << i << ": " << test.description() << " ..." << std::endl; test.run(v, failures); eckit::Log::info() << "Completed case " << i << ": " << test.descriptionNoSection() << std::endl; - } else { + } + else { eckit::Log::info() << "Skipping case " << i << ": " << test.description() << "..." << std::endl; } } @@ -379,16 +385,16 @@ inline int run(std::vector& tests, TestVerbosity v = AllFailures) { } int run_tests_main(std::vector& tests, int argc, char* argv[], bool initEckitMain = true) { - + // deactivate loading of plugins not to influence some tests ::setenv("AUTO_LOAD_PLUGINS", "false", true); - + if (initEckitMain) eckit::Main::initialise(argc, argv); - + eckit::Log::info() << "Running " << tests.size() << " tests:" << std::endl; int failures = run(tests); - + eckit::Log::info() << failures << " tests failed out of " << tests.size() << "." << std::endl; return failures; } @@ -417,10 +423,10 @@ int run_tests(int argc, char* argv[], bool initEckitMain = true) { #if ECKIT_TESTING_SELF_REGISTER_CASES -#define CASE(description) \ - void UNIQUE_NAME2(test_, __LINE__)(std::string&, int&, int); \ +#define CASE(description) \ + void UNIQUE_NAME2(test_, __LINE__)(std::string&, int&, int); \ static const eckit::testing::TestRegister UNIQUE_NAME2(test_registration_, __LINE__)(description, \ - &UNIQUE_NAME2(test_, __LINE__)); \ + &UNIQUE_NAME2(test_, __LINE__)); \ void UNIQUE_NAME2(test_, __LINE__)(std::string & _test_subsection, int& _num_subsections, int _subsection) #else // ECKIT_TESTING_SELF_REGISTER_CASES diff --git a/src/eckit/thread/AutoLock.h b/src/eckit/thread/AutoLock.h index 472391686..a31efe509 100644 --- a/src/eckit/thread/AutoLock.h +++ b/src/eckit/thread/AutoLock.h @@ -30,9 +30,11 @@ class AutoLock : private NonCopyable { public: // -- Contructors - AutoLock(T& resource) : resource_(resource) { resource_.lock(); } + AutoLock(T& resource) : + resource_(resource) { resource_.lock(); } - AutoLock(T* resource) : resource_(*resource) { resource_.lock(); } + AutoLock(T* resource) : + resource_(*resource) { resource_.lock(); } // -- Destructor @@ -49,8 +51,10 @@ class AutoSharedLock : private NonCopyable { public: // -- Contructors - AutoSharedLock(T& resource) : resource_(resource) { resource_.lockShared(); } - AutoSharedLock(T* resource) : resource_(*resource) { resource_.lockShared(); } + AutoSharedLock(T& resource) : + resource_(resource) { resource_.lockShared(); } + AutoSharedLock(T* resource) : + resource_(*resource) { resource_.lockShared(); } // -- Destructor @@ -67,7 +71,8 @@ class TimedAutoLock : private NonCopyable { public: // -- Constructors - TimedAutoLock(T& resource, const std::string& message) : resource_(resource), timer_(message + " (release)") { + TimedAutoLock(T& resource, const std::string& message) : + resource_(resource), timer_(message + " (release)") { resource_.lock(); timer_.report(message + " (acquire)"); } @@ -88,7 +93,8 @@ class TraceAutoLock : private NonCopyable { public: // -- Constructors - TraceAutoLock(T& resource, const std::string& message) : resource_(resource), timer_(message + " (release)") { + TraceAutoLock(T& resource, const std::string& message) : + resource_(resource), timer_(message + " (release)") { resource_.lock(); timer_.report(message + " (acquire)"); } diff --git a/src/eckit/thread/Mutex.h b/src/eckit/thread/Mutex.h index f76d91f64..e6656bc86 100644 --- a/src/eckit/thread/Mutex.h +++ b/src/eckit/thread/Mutex.h @@ -29,7 +29,6 @@ namespace eckit { /// especially when dealing with construction before main() execution (eg self-registration classes) class Mutex : private NonCopyable { public: // methods - Mutex(char tag = ' '); ~Mutex(); diff --git a/src/eckit/thread/Once.h b/src/eckit/thread/Once.h index 2600a64a9..8deb26c46 100644 --- a/src/eckit/thread/Once.h +++ b/src/eckit/thread/Once.h @@ -58,7 +58,8 @@ template pthread_mutex_t Once::mutex_; template -Once::Once() : value_(0) {} +Once::Once() : + value_(0) {} template Once::~Once() {} diff --git a/src/eckit/thread/ThreadSingleton.h b/src/eckit/thread/ThreadSingleton.h index c941ef945..18ce0f0dd 100644 --- a/src/eckit/thread/ThreadSingleton.h +++ b/src/eckit/thread/ThreadSingleton.h @@ -31,7 +31,8 @@ struct NewAlloc0 { template struct NewAlloc1 { - NewAlloc1(const P1& p1) : p1_(p1) {} + NewAlloc1(const P1& p1) : + p1_(p1) {} TYPE* operator()() { return new TYPE(p1_); } P1 p1_; }; @@ -68,10 +69,12 @@ template pthread_key_t ThreadSingleton::key_; template -ThreadSingleton::ThreadSingleton() : alloc_(A()) {} +ThreadSingleton::ThreadSingleton() : + alloc_(A()) {} template -ThreadSingleton::ThreadSingleton(const A& alloc) : alloc_(alloc) {} +ThreadSingleton::ThreadSingleton(const A& alloc) : + alloc_(alloc) {} template ThreadSingleton::~ThreadSingleton() { diff --git a/src/eckit/types/Coord.h b/src/eckit/types/Coord.h index f7f0e64ac..f2c034465 100644 --- a/src/eckit/types/Coord.h +++ b/src/eckit/types/Coord.h @@ -36,8 +36,10 @@ class Coord { // -- Contructors - Coord(double l = 0) : value_(l) {} - Coord(const Coord& other) : value_(other.value_) {} + Coord(double l = 0) : + value_(l) {} + Coord(const Coord& other) : + value_(other.value_) {} // -- Operators diff --git a/src/eckit/types/Date.h b/src/eckit/types/Date.h index 1de9d648d..01511ce7c 100644 --- a/src/eckit/types/Date.h +++ b/src/eckit/types/Date.h @@ -41,7 +41,8 @@ class Date { // -- Contructors - Date() : julian_(0) {} + Date() : + julian_(0) {} Date(long); Date(long, long, long); Date(const std::string&); @@ -51,7 +52,8 @@ class Date { // -- Copy - Date(const Date& other) : julian_(other.julian_) {} + Date(const Date& other) : + julian_(other.julian_) {} Date& operator=(const Date& other) { julian_ = other.julian_; @@ -128,7 +130,8 @@ class Date { } protected: - Date(long julian, bool) : julian_(julian) {} + Date(long julian, bool) : + julian_(julian) {} private: // -- Members diff --git a/src/eckit/types/FloatCompare.cc b/src/eckit/types/FloatCompare.cc index 356761c62..849b495ba 100644 --- a/src/eckit/types/FloatCompare.cc +++ b/src/eckit/types/FloatCompare.cc @@ -1,4 +1,4 @@ -//#include +// #include // Some of the math.h/cmath functions are not clean when switching to C++11 #if __cplusplus <= 199711L diff --git a/src/eckit/types/Fraction.h b/src/eckit/types/Fraction.h index af12ae797..856118a86 100644 --- a/src/eckit/types/Fraction.h +++ b/src/eckit/types/Fraction.h @@ -35,7 +35,8 @@ class Fraction { public: // methods // -- Contructors - Fraction() : top_(0), bottom_(1) {} + Fraction() : + top_(0), bottom_(1) {} // template // explicit Fraction(T top): top_(top), bottom_(1) {} @@ -43,15 +44,23 @@ class Fraction { Fraction(value_type top, value_type bottom); explicit Fraction(double n); - explicit Fraction(int n) : top_(n), bottom_(1) {} - explicit Fraction(short n) : top_(n), bottom_(1) {} - explicit Fraction(long n) : top_(n), bottom_(1) {} - explicit Fraction(long long n) : top_(n), bottom_(1) {} - - explicit Fraction(unsigned int n) : top_(n), bottom_(1) {} - explicit Fraction(unsigned short n) : top_(n), bottom_(1) {} - explicit Fraction(unsigned long n) : top_(n), bottom_(1) {} - explicit Fraction(unsigned long long n) : top_(n), bottom_(1) {} + explicit Fraction(int n) : + top_(n), bottom_(1) {} + explicit Fraction(short n) : + top_(n), bottom_(1) {} + explicit Fraction(long n) : + top_(n), bottom_(1) {} + explicit Fraction(long long n) : + top_(n), bottom_(1) {} + + explicit Fraction(unsigned int n) : + top_(n), bottom_(1) {} + explicit Fraction(unsigned short n) : + top_(n), bottom_(1) {} + explicit Fraction(unsigned long n) : + top_(n), bottom_(1) {} + explicit Fraction(unsigned long long n) : + top_(n), bottom_(1) {} // Fraction(const Fraction& other): // top_(other.top_), bottom_(other.bottom_) {} diff --git a/src/eckit/types/Grid.h b/src/eckit/types/Grid.h index 1244235c6..52f3c0278 100644 --- a/src/eckit/types/Grid.h +++ b/src/eckit/types/Grid.h @@ -44,7 +44,8 @@ class Grid { Grid(const std::string&); - Grid(double ns = undef, double ew = undef) : northSouth_(ns), eastWest_(ew) {} + Grid(double ns = undef, double ew = undef) : + northSouth_(ns), eastWest_(ew) {} Grid(const std::vector&); diff --git a/src/eckit/types/SemanticVersion.h b/src/eckit/types/SemanticVersion.h index 77eb8074f..fd3248f3e 100644 --- a/src/eckit/types/SemanticVersion.h +++ b/src/eckit/types/SemanticVersion.h @@ -13,8 +13,8 @@ #pragma once -#include #include +#include namespace eckit { @@ -24,7 +24,6 @@ namespace eckit { /// class SemanticVersion { public: // methods - SemanticVersion(); SemanticVersion(unsigned long major, unsigned long minor, unsigned long patch); SemanticVersion(const std::string&); @@ -44,13 +43,13 @@ class SemanticVersion { friend std::ostream& operator<<(std::ostream& os, const SemanticVersion& u) { u.print(os); return os; - } + } - private: // members - unsigned long major_; - unsigned long minor_; - unsigned long patch_; - }; +private: // members + unsigned long major_; + unsigned long minor_; + unsigned long patch_; +}; //-------------------------------------------------------------------------------------------------- diff --git a/src/eckit/types/Types.h b/src/eckit/types/Types.h index 9b2c8bd1e..088bfbf2f 100644 --- a/src/eckit/types/Types.h +++ b/src/eckit/types/Types.h @@ -76,7 +76,8 @@ class output_list_iterator : public output_iterator { output_list* list_; public: - output_list_iterator(output_list* l) : list_(l) {} + output_list_iterator(output_list* l) : + list_(l) {} ~output_list_iterator() {} output_list_iterator& operator=(const T& v) { diff --git a/src/eckit/utils/ByteSwap.h b/src/eckit/utils/ByteSwap.h index e99ca5120..412048524 100644 --- a/src/eckit/utils/ByteSwap.h +++ b/src/eckit/utils/ByteSwap.h @@ -39,9 +39,7 @@ inline uint32_t bitswap32(uint32_t a) { } inline uint64_t bitswap64(uint64_t a) { - a = ((a & 0x00000000000000FFULL) << 56) | ((a & 0x000000000000FF00ULL) << 40) | - ((a & 0x0000000000FF0000ULL) << 24) | ((a & 0x00000000FF000000ULL) << 8) | ((a & 0x000000FF00000000ULL) >> 8) | - ((a & 0x0000FF0000000000ULL) >> 24) | ((a & 0x00FF000000000000ULL) >> 40) | ((a & 0xFF00000000000000ULL) >> 56); + a = ((a & 0x00000000000000FFULL) << 56) | ((a & 0x000000000000FF00ULL) << 40) | ((a & 0x0000000000FF0000ULL) << 24) | ((a & 0x00000000FF000000ULL) << 8) | ((a & 0x000000FF00000000ULL) >> 8) | ((a & 0x0000FF0000000000ULL) >> 24) | ((a & 0x00FF000000000000ULL) >> 40) | ((a & 0xFF00000000000000ULL) >> 56); return a; } diff --git a/src/eckit/utils/Compressor.h b/src/eckit/utils/Compressor.h index f62e096ff..68af5843c 100644 --- a/src/eckit/utils/Compressor.h +++ b/src/eckit/utils/Compressor.h @@ -33,7 +33,7 @@ class Compressor : private eckit::NonCopyable { /// Compresses the bytestream within the in buffer /// @param in input buffer that holds the uncompressed bytesteam. /// @param len input buffer size. - /// @param out output buffer to hold the compressed bytesteam. Buffer may be oversized, in which case + /// @param out output buffer to hold the compressed bytesteam. Buffer may be oversized, in which case /// resizing is implementation specific. Nevertheless, it is expected that implementations /// will take this as oppurtunity for optimising and avoid resizing. /// @note if needed, it will resize or replace the internal buffer of out to match the compressed bytestream size @@ -41,7 +41,7 @@ class Compressor : private eckit::NonCopyable { virtual size_t compress(const void* in, size_t len, eckit::Buffer& out) const = 0; /// Uncompresses the bytestream within the in buffer - /// Since some compression algorithms dont record uncompressed size in the bytestream, client code is + /// Since some compression algorithms dont record uncompressed size in the bytestream, client code is /// required to record and handle the uncompressed size separately and pass it in via parameter outlen. /// @param in input buffer that holds the compressed bytesteam. /// @param len input buffer size. @@ -51,7 +51,6 @@ class Compressor : private eckit::NonCopyable { /// buffer in a tight loop. /// @note may resize or replace the internal buffer of out virtual void uncompress(const void* in, size_t len, eckit::Buffer& out, size_t outlen) const = 0; - }; //---------------------------------------------------------------------------------------------------------------------- @@ -83,7 +82,8 @@ class CompressorBuilder : public CompressorBuilderBase { virtual Compressor* make() override { return new T(); } public: - CompressorBuilder(const std::string& name) : CompressorBuilderBase(name) {} + CompressorBuilder(const std::string& name) : + CompressorBuilderBase(name) {} virtual ~CompressorBuilder() override = default; }; diff --git a/src/eckit/utils/EnumBitmask.h b/src/eckit/utils/EnumBitmask.h index 47c8d4f2f..af1613f34 100644 --- a/src/eckit/utils/EnumBitmask.h +++ b/src/eckit/utils/EnumBitmask.h @@ -14,33 +14,33 @@ namespace eckit { #include -#define ENUM_FLAG_OPERATORS(T) \ - inline constexpr T operator&(T X, T Y) { \ - return static_cast( \ - static_cast::type>(X) & static_cast::type>(Y)); \ - } \ - inline constexpr T operator|(T X, T Y) { \ - return static_cast( \ - static_cast::type>(X) | static_cast::type>(Y)); \ - } \ - inline constexpr T operator^(T X, T Y) { \ - return static_cast( \ - static_cast::type>(X) ^ static_cast::type>(Y)); \ - } \ - inline constexpr T operator~(T X) { \ - return static_cast(~static_cast::type>(X)); \ - } \ - inline T& operator&=(T& X, T Y) { \ - X = X & Y; \ - return X; \ - } \ - inline T& operator|=(T& X, T Y) { \ - X = X | Y; \ - return X; \ - } \ - inline T& operator^=(T& X, T Y) { \ - X = X ^ Y; \ - return X; \ +#define ENUM_FLAG_OPERATORS(T) \ + inline constexpr T operator&(T X, T Y) { \ + return static_cast( \ + static_cast::type>(X) & static_cast::type>(Y)); \ + } \ + inline constexpr T operator|(T X, T Y) { \ + return static_cast( \ + static_cast::type>(X) | static_cast::type>(Y)); \ + } \ + inline constexpr T operator^(T X, T Y) { \ + return static_cast( \ + static_cast::type>(X) ^ static_cast::type>(Y)); \ + } \ + inline constexpr T operator~(T X) { \ + return static_cast(~static_cast::type>(X)); \ + } \ + inline T& operator&=(T& X, T Y) { \ + X = X & Y; \ + return X; \ + } \ + inline T& operator|=(T& X, T Y) { \ + X = X | Y; \ + return X; \ + } \ + inline T& operator^=(T& X, T Y) { \ + X = X ^ Y; \ + return X; \ } diff --git a/src/eckit/utils/Hash.h b/src/eckit/utils/Hash.h index 30dcf6094..161dd82d2 100644 --- a/src/eckit/utils/Hash.h +++ b/src/eckit/utils/Hash.h @@ -111,7 +111,8 @@ class HashBuilder : public HashBuilderBase { virtual Hash* make(const std::string& param) override { return new T(param); } public: - HashBuilder(const std::string& name) : HashBuilderBase(name) {} + HashBuilder(const std::string& name) : + HashBuilderBase(name) {} virtual ~HashBuilder() override = default; }; diff --git a/src/eckit/utils/HyperCube.h b/src/eckit/utils/HyperCube.h index a60f0145e..c882d4a7e 100644 --- a/src/eckit/utils/HyperCube.h +++ b/src/eckit/utils/HyperCube.h @@ -34,7 +34,8 @@ class HyperCube { typedef std::vector Remapping; public: // methods - explicit HyperCube(const Dimensions& d) : dimensions_(d) {} + explicit HyperCube(const Dimensions& d) : + dimensions_(d) {} /// Translate coordinates into an index to a 1 dimension array Ordinal index(const Coordinates&) const; diff --git a/src/eckit/utils/Optional.h b/src/eckit/utils/Optional.h index 871f74423..bee19df4a 100644 --- a/src/eckit/utils/Optional.h +++ b/src/eckit/utils/Optional.h @@ -110,7 +110,7 @@ class Optional : public OptionalBase { Optional(TagCopyConstructor{}, rhs) {} ~Optional() = default; - + void reset() noexcept { if (hasValue_) { val_.value.~T(); @@ -132,7 +132,7 @@ class Optional : public OptionalBase { if (this == &other) { return *this; } - + if (hasValue_ && other.hasValue_) { val_.value = other.value(); } @@ -153,19 +153,19 @@ class Optional : public OptionalBase { } if (hasValue_ && other.hasValue_) { - val_.value = std::move(other.value()); + val_.value = std::move(other.value()); } else if (!hasValue_ && other.hasValue_) { // Explicitly construct here, previous value has been deleted. new (&val_.value) T(std::move(other.value())); - hasValue_ = true; + hasValue_ = true; } else if (hasValue_ && !other.hasValue_) { reset(); } return *this; } - + Optional& operator=(const None&) { reset(); return *this; diff --git a/src/eckit/utils/Tokenizer.h b/src/eckit/utils/Tokenizer.h index b45d20766..409f190ed 100644 --- a/src/eckit/utils/Tokenizer.h +++ b/src/eckit/utils/Tokenizer.h @@ -28,7 +28,6 @@ namespace eckit { class Tokenizer : private NonCopyable { public: // methods - Tokenizer(char, bool keepEmpty = false); Tokenizer(const std::string&, bool keepEmpty = false); @@ -44,12 +43,10 @@ class Tokenizer : private NonCopyable { std::vector tokenize(std::istream&) const; private: - std::set > separator_; // To make searching faster bool keepEmpty_; private: - void print(std::ostream&) const; friend std::ostream& operator<<(std::ostream& s, const Tokenizer& p) { diff --git a/src/eckit/utils/xxHashing.h b/src/eckit/utils/xxHashing.h index 109be5b1e..207064702 100644 --- a/src/eckit/utils/xxHashing.h +++ b/src/eckit/utils/xxHashing.h @@ -47,7 +47,6 @@ class xxHash : public Hash { } private: // members - struct Context; std::unique_ptr ctx_; }; diff --git a/src/eckit/value/BoolContent.cc b/src/eckit/value/BoolContent.cc index 49544f893..6c51e4349 100644 --- a/src/eckit/value/BoolContent.cc +++ b/src/eckit/value/BoolContent.cc @@ -64,7 +64,7 @@ int BoolContent::compareBool(const BoolContent& other) const { if (!value_) return -1; // this is false, hence smaller than other - return 1; // this is true, hence larger than other + return 1; // this is true, hence larger than other } void BoolContent::value(bool& l) const { diff --git a/src/eckit/value/Expression.h b/src/eckit/value/Expression.h index a291659c5..a35640bec 100644 --- a/src/eckit/value/Expression.h +++ b/src/eckit/value/Expression.h @@ -71,7 +71,8 @@ inline const char* opname(const logical_or&) { class EvalError : public eckit::Exception { public: - EvalError(const std::string& s) : Exception(std::string("EvalError: ") + s) {} + EvalError(const std::string& s) : + Exception(std::string("EvalError: ") + s) {} }; template @@ -95,7 +96,8 @@ class CondUnary : public Expression { virtual void print(std::ostream& s) const override { s << opname(T()) << '(' << *cond_ << ')'; } public: - CondUnary(Expression* cond) : cond_(cond) {} + CondUnary(Expression* cond) : + cond_(cond) {} virtual ~CondUnary() override {} virtual eckit::Value eval(U& task) const { return T()(cond_->eval(task)); } }; @@ -109,7 +111,8 @@ class CondBinary : public Expression { virtual void print(std::ostream& s) const override { s << '(' << *left_ << ' ' << opname(T()) << ' ' << *right_ << ')'; } public: - CondBinary(Expression* left, Expression* right) : left_(left), right_(right) {} + CondBinary(Expression* left, Expression* right) : + left_(left), right_(right) {} virtual ~CondBinary() override {} eckit::Value eval(U& task) const; @@ -126,7 +129,8 @@ class StringExpression : public Expression { virtual void print(std::ostream& s) const override { s << str_; } public: - StringExpression(const std::string& s) : str_(s) {} + StringExpression(const std::string& s) : + str_(s) {} virtual ~StringExpression() override {} virtual eckit::Value eval(T&) const { return eckit::Value(str_); } }; @@ -140,7 +144,8 @@ class NumberExpression : public Expression { long long value() const { return value_; } public: - NumberExpression(long long n) : value_(n) {} + NumberExpression(long long n) : + value_(n) {} virtual ~NumberExpression() override {} virtual eckit::Value eval(T&) const { return eckit::Value(value_); } }; @@ -152,7 +157,8 @@ class ListExpression : public Expression { public: ListExpression(); - ListExpression(const std::vector*>& v) : v_(v) {} + ListExpression(const std::vector*>& v) : + v_(v) {} virtual ~ListExpression() override; virtual eckit::Value eval(T&) const; }; diff --git a/src/eckit/value/Params.h b/src/eckit/value/Params.h index 2db1fb0a1..540b952e1 100644 --- a/src/eckit/value/Params.h +++ b/src/eckit/value/Params.h @@ -83,9 +83,11 @@ class Params { public: // methods template - explicit Params(const T& x) : self_(new Model(x)) {} + explicit Params(const T& x) : + self_(new Model(x)) {} - Params(const Params& x) : self_(x.self_->copy_()) {} + Params(const Params& x) : + self_(x.self_->copy_()) {} static void registerFactory(const std::string& name, factory_t f) { factories()[name] = f; } @@ -122,7 +124,8 @@ class Params { typedef std::map factory_map; static factory_map& factories(); - Params(Concept* concept) : self_(concept) {} + Params(Concept* concept) : + self_(concept) {} struct Concept { virtual ~Concept() {} @@ -134,8 +137,10 @@ class Params { template struct Model : Concept { - Model(T x) : data_(x) {} - Model(Stream& s) : data_(s) {} + Model(T x) : + data_(x) {} + Model(Stream& s) : + data_(s) {} virtual Concept* copy_() const { return new Model(data_); } diff --git a/src/eckit/value/Properties.h b/src/eckit/value/Properties.h index 51dcdee4b..373f6750c 100644 --- a/src/eckit/value/Properties.h +++ b/src/eckit/value/Properties.h @@ -80,7 +80,7 @@ class Properties { private: // members PropertyMap props_; //< storage of values -protected: // methods +protected: // methods void json(JSON& s) const; void encode(Stream& s) const; diff --git a/src/eckit/value/Value.h b/src/eckit/value/Value.h index 1f471cb58..f32aa42d9 100644 --- a/src/eckit/value/Value.h +++ b/src/eckit/value/Value.h @@ -345,7 +345,7 @@ class Value { Value element(const Value&) const; Value remove(const Value&); - void append(const Value&); // List append + void append(const Value&); // List append // -- Methods diff --git a/src/eckit/web/Html.h b/src/eckit/web/Html.h index fbae6094d..de72e388e 100644 --- a/src/eckit/web/Html.h +++ b/src/eckit/web/Html.h @@ -45,12 +45,14 @@ class Html { virtual void print(std::ostream& s) const override { s << tag_; } protected: - RawTag(const std::string& s) : tag_(s) {} + RawTag(const std::string& s) : + tag_(s) {} }; class Line : public RawTag { public: - Line() : RawTag("
") {} + Line() : + RawTag("
") {} }; // To be used with 'include' @@ -103,7 +105,8 @@ class Html { public: Link(Url&); Link() {} - Link(const std::string& url) : url_(addHex(url)) {} + Link(const std::string& url) : + url_(addHex(url)) {} private: virtual void print(std::ostream& s) const override; @@ -112,7 +115,8 @@ class Html { class Class { public: - Class(const std::string& str) : str_(str) {} + Class(const std::string& str) : + str_(str) {} private: std::string str_; @@ -127,38 +131,45 @@ class Html { class BeginFormatted : public RawTag { public: - BeginFormatted() : RawTag("
") {}
+        BeginFormatted() :
+            RawTag("
") {}
     };
 
     class EndFormatted : public RawTag {
     public:
-        EndFormatted() : RawTag("
") {} + EndFormatted() : + RawTag("
") {} }; class BeginFixed : public RawTag { public: - BeginFixed() : RawTag("") {} + BeginFixed() : + RawTag("") {} }; class EndFixed : public RawTag { public: - EndFixed() : RawTag("") {} + EndFixed() : + RawTag("") {} }; class BeginBold : public RawTag { public: - BeginBold() : RawTag("") {} + BeginBold() : + RawTag("") {} }; class EndBold : public RawTag { public: - EndBold() : RawTag("") {} + EndBold() : + RawTag("") {} }; //---------------------------------------------------------------------------------------------------------------------- class BeginForm : public Tag { public: - BeginForm(const std::string& str = "") : str_(str) {} + BeginForm(const std::string& str = "") : + str_(str) {} private: std::string str_; @@ -171,7 +182,8 @@ class Html { class BeginTextArea { public: - BeginTextArea(const std::string& name, int row, int col) : name_(name), row_(row), col_(col) {} + BeginTextArea(const std::string& name, int row, int col) : + name_(name), row_(row), col_(col) {} private: std::string name_; @@ -213,7 +225,8 @@ class Html { virtual void print(std::ostream& s) const override; public: - HiddenField(const std::string& name, const std::string& value) : name_(name), value_(value) {} + HiddenField(const std::string& name, const std::string& value) : + name_(name), value_(value) {} }; @@ -223,7 +236,8 @@ class Html { virtual void print(std::ostream& s) const override; public: - Button(const std::string& type, const std::string& title) : type_(type), title_(title) {} + Button(const std::string& type, const std::string& title) : + type_(type), title_(title) {} }; class CheckBox : public Tag { @@ -233,17 +247,20 @@ class Html { virtual void print(std::ostream& s) const override; public: - CheckBox(const std::string& name, const std::string& value, bool on) : name_(name), value_(value), on_(on) {} + CheckBox(const std::string& name, const std::string& value, bool on) : + name_(name), value_(value), on_(on) {} }; class ResetButton : public Button { public: - ResetButton(const std::string& title = "Reset") : Button("reset", title) {} + ResetButton(const std::string& title = "Reset") : + Button("reset", title) {} }; class SubmitButton : public Button { public: - SubmitButton(const std::string& title = "Submit") : Button("submit", title) {} + SubmitButton(const std::string& title = "Submit") : + Button("submit", title) {} }; class Hidden : public Tag {}; @@ -269,7 +286,8 @@ class Html { class EndTable : public RawTag { public: - EndTable() : RawTag("") {} + EndTable() : + RawTag("") {} }; @@ -287,32 +305,38 @@ class Html { class BeginHeader : public TableTag { public: - BeginHeader(int align = None, int colspan = 0, int rowspan = 0) : TableTag("TH", align, colspan, rowspan) {} + BeginHeader(int align = None, int colspan = 0, int rowspan = 0) : + TableTag("TH", align, colspan, rowspan) {} }; class EndHeader : public RawTag { public: - EndHeader() : RawTag("") {} + EndHeader() : + RawTag("") {} }; class BeginRow : public TableTag { public: - BeginRow(int align = None, int colspan = 0, int rowspan = 0) : TableTag("TR", align, colspan, rowspan) {} + BeginRow(int align = None, int colspan = 0, int rowspan = 0) : + TableTag("TR", align, colspan, rowspan) {} }; class EndRow : public RawTag { public: - EndRow() : RawTag("") {} + EndRow() : + RawTag("") {} }; class BeginData : public TableTag { public: - BeginData(int align = None, int colspan = 0, int rowspan = 0) : TableTag("TD", align, colspan, rowspan) {} + BeginData(int align = None, int colspan = 0, int rowspan = 0) : + TableTag("TD", align, colspan, rowspan) {} }; class EndData : public RawTag { public: - EndData() : RawTag("") {} + EndData() : + RawTag("") {} }; }; // class Html diff --git a/src/eckit/web/Url.h b/src/eckit/web/Url.h index 72b33dfb8..756c83929 100644 --- a/src/eckit/web/Url.h +++ b/src/eckit/web/Url.h @@ -31,7 +31,8 @@ class UrlAccess { public: - UrlAccess(Url& url, const std::string& s) : url_(url), s_(s) {} + UrlAccess(Url& url, const std::string& s) : + url_(url), s_(s) {} operator std::string(); operator long(); diff --git a/src/sandbox/memsharedlimit.cc b/src/sandbox/memsharedlimit.cc index 433790d08..5aa277267 100644 --- a/src/sandbox/memsharedlimit.cc +++ b/src/sandbox/memsharedlimit.cc @@ -30,7 +30,7 @@ unsigned short nlimit() { static long system_semmax = SYSCALL(::sysconf(_SC_SEM_VALUE_MAX)); // guaranteed to be positive long semmax = std::min(std::numeric_limits::max(), - system_semmax); // guaranteed to cast to unsigned short without precision loss + system_semmax); // guaranteed to cast to unsigned short without precision loss return (static_cast(semmax) / 8) * 8; // max multiple of 8 less than semmax } @@ -185,7 +185,7 @@ class MemApp : public Tool { ~MemApp() {} private: - MemApp(const MemApp&) = delete; + MemApp(const MemApp&) = delete; MemApp& operator=(const MemApp&) = delete; virtual void run() { diff --git a/src/sandbox/mpiobjsend.cc b/src/sandbox/mpiobjsend.cc index 51509091a..b2550f5dd 100644 --- a/src/sandbox/mpiobjsend.cc +++ b/src/sandbox/mpiobjsend.cc @@ -160,7 +160,7 @@ class ObjSend : public eckit::Tool { private: eckit::Buffer sendBuffer_; - ObjSend(const ObjSend&) = delete; + ObjSend(const ObjSend&) = delete; ObjSend& operator=(const ObjSend&) = delete; void send(const Obj& o, size_t to) { diff --git a/src/sandbox/shint.cc b/src/sandbox/shint.cc index d919adf0c..51d08b412 100644 --- a/src/sandbox/shint.cc +++ b/src/sandbox/shint.cc @@ -81,7 +81,7 @@ class SemApp : public Tool { return std::numeric_limits::max(); } - SemApp(const SemApp&) = delete; + SemApp(const SemApp&) = delete; SemApp& operator=(const SemApp&) = delete; virtual void run() { diff --git a/src/sandbox/tcp_server_forked.cc b/src/sandbox/tcp_server_forked.cc index 299cbf686..337ae5c0d 100644 --- a/src/sandbox/tcp_server_forked.cc +++ b/src/sandbox/tcp_server_forked.cc @@ -112,7 +112,7 @@ class FDBSvrApp : public Application { private: int port_; - FDBSvrApp(const FDBSvrApp&) = delete; + FDBSvrApp(const FDBSvrApp&) = delete; FDBSvrApp& operator=(const FDBSvrApp&) = delete; virtual void run() { diff --git a/src/sandbox/tcp_server_threaded.cc b/src/sandbox/tcp_server_threaded.cc index 7407f4f42..c9090a875 100644 --- a/src/sandbox/tcp_server_threaded.cc +++ b/src/sandbox/tcp_server_threaded.cc @@ -122,7 +122,7 @@ class FDBSvrApp : public Application { ~FDBSvrApp() {} private: // methods - FDBSvrApp(const FDBSvrApp&) = delete; + FDBSvrApp(const FDBSvrApp&) = delete; FDBSvrApp& operator=(const FDBSvrApp&) = delete; virtual void run() { diff --git a/tests/container/test_cachemanager.cc b/tests/container/test_cachemanager.cc index 919bf1f48..400ef8f6e 100644 --- a/tests/container/test_cachemanager.cc +++ b/tests/container/test_cachemanager.cc @@ -56,8 +56,8 @@ struct Manager : eckit::CacheManager { struct CacheCreator : Manager::CacheContentCreator { - CacheCreator() = default; - CacheCreator(const CacheCreator&) = delete; + CacheCreator() = default; + CacheCreator(const CacheCreator&) = delete; CacheCreator& operator=(const CacheCreator&) = delete; private: @@ -80,8 +80,8 @@ struct ManagerCantMiss : eckit::CacheManager { struct CacheCreatorCantMiss : ManagerCantMiss::CacheContentCreator { - CacheCreatorCantMiss() = default; - CacheCreatorCantMiss(const CacheCreatorCantMiss&) = delete; + CacheCreatorCantMiss() = default; + CacheCreatorCantMiss(const CacheCreatorCantMiss&) = delete; CacheCreatorCantMiss& operator=(const CacheCreatorCantMiss&) = delete; private: diff --git a/tests/container/test_queue.cc b/tests/container/test_queue.cc index 27c7548bc..24f65a8ce 100644 --- a/tests/container/test_queue.cc +++ b/tests/container/test_queue.cc @@ -44,8 +44,8 @@ CASE("Multi Producer Multi Consumer Queue access size = 1") { eckit::Queue q(1); // queue depth 1 to create high-contention, bug found with nprod = 93 and ncons = 77 { - size_t nprod = 13; // = 93 - size_t ncons = 7; // = 77 + size_t nprod = 13; // = 93 + size_t ncons = 7; // = 77 std::vector producers; for (int id = 0; id < nprod; ++id) { diff --git a/tests/filesystem/test_localpathname.cc b/tests/filesystem/test_localpathname.cc index d69c7282c..49e43eecb 100644 --- a/tests/filesystem/test_localpathname.cc +++ b/tests/filesystem/test_localpathname.cc @@ -9,8 +9,8 @@ */ #include -#include #include +#include #include "eckit/types/Types.h" diff --git a/tests/io/test_base64.cc b/tests/io/test_base64.cc index 18e5bc181..445cb8a83 100644 --- a/tests/io/test_base64.cc +++ b/tests/io/test_base64.cc @@ -25,7 +25,7 @@ namespace test { //---------------------------------------------------------------------------------------------------------------------- static std::string test(const char* text, const char* expect) { - char base64ed[10240] = {}; + char base64ed[10240] = {}; char unbase64ed[10240] = {}; Base64 base64; diff --git a/tests/io/test_compress.cc b/tests/io/test_compress.cc index 3d9e42f3b..b7eeaa0d3 100644 --- a/tests/io/test_compress.cc +++ b/tests/io/test_compress.cc @@ -24,7 +24,7 @@ namespace test { //---------------------------------------------------------------------------------------------------------------------- static std::string test(const char* text) { - char compressed[10240] = {}; + char compressed[10240] = {}; char uncompressed[10240] = {}; Compress compress(16); diff --git a/tests/linalg/test_la_tensor.cc b/tests/linalg/test_la_tensor.cc index 00140a649..e6ee772b9 100644 --- a/tests/linalg/test_la_tensor.cc +++ b/tests/linalg/test_la_tensor.cc @@ -547,8 +547,8 @@ CASE("TensorFloat [6, 3, 2, 5] col-major->row-major->col-major layout") { CASE("TensorFloat move constructor") { - std::vector data{0,1,2,3,4,5,6,7,8,9,10,11}; - std::vector shape{3,4}; + std::vector data{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + std::vector shape{3, 4}; TensorFloat tensor_from(data.data(), shape, TensorFloat::Layout::Right); @@ -558,28 +558,28 @@ CASE("TensorFloat move constructor") { EXPECT(tensor_to.shape()[0] == 3); EXPECT(tensor_to.shape()[1] == 4); - EXPECT(tensor_to(0,0) == 0); - EXPECT(tensor_to(0,1) == 1); - EXPECT(tensor_to(0,2) == 2); - EXPECT(tensor_to(0,3) == 3); + EXPECT(tensor_to(0, 0) == 0); + EXPECT(tensor_to(0, 1) == 1); + EXPECT(tensor_to(0, 2) == 2); + EXPECT(tensor_to(0, 3) == 3); - EXPECT(tensor_to(0,4) == 4); - EXPECT(tensor_to(0,5) == 5); - EXPECT(tensor_to(0,6) == 6); - EXPECT(tensor_to(0,7) == 7); + EXPECT(tensor_to(0, 4) == 4); + EXPECT(tensor_to(0, 5) == 5); + EXPECT(tensor_to(0, 6) == 6); + EXPECT(tensor_to(0, 7) == 7); - EXPECT(tensor_to(0,8) == 8); - EXPECT(tensor_to(0,9) == 9); - EXPECT(tensor_to(0,10) == 10); - EXPECT(tensor_to(0,11) == 11); + EXPECT(tensor_to(0, 8) == 8); + EXPECT(tensor_to(0, 9) == 9); + EXPECT(tensor_to(0, 10) == 10); + EXPECT(tensor_to(0, 11) == 11); EXPECT(tensor_from.data() == nullptr); } CASE("TensorFloat move assignment operator") { - std::vector data{0,1,2,3,4,5,6,7,8,9,10,11}; - std::vector shape{3,4}; + std::vector data{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + std::vector shape{3, 4}; TensorFloat tensor_from(data.data(), shape, TensorFloat::Layout::Right); @@ -590,23 +590,22 @@ CASE("TensorFloat move assignment operator") { EXPECT(tensor_to.shape()[0] == 3); EXPECT(tensor_to.shape()[1] == 4); - EXPECT(tensor_to(0,0) == 0); - EXPECT(tensor_to(0,1) == 1); - EXPECT(tensor_to(0,2) == 2); - EXPECT(tensor_to(0,3) == 3); + EXPECT(tensor_to(0, 0) == 0); + EXPECT(tensor_to(0, 1) == 1); + EXPECT(tensor_to(0, 2) == 2); + EXPECT(tensor_to(0, 3) == 3); - EXPECT(tensor_to(0,4) == 4); - EXPECT(tensor_to(0,5) == 5); - EXPECT(tensor_to(0,6) == 6); - EXPECT(tensor_to(0,7) == 7); + EXPECT(tensor_to(0, 4) == 4); + EXPECT(tensor_to(0, 5) == 5); + EXPECT(tensor_to(0, 6) == 6); + EXPECT(tensor_to(0, 7) == 7); - EXPECT(tensor_to(0,8) == 8); - EXPECT(tensor_to(0,9) == 9); - EXPECT(tensor_to(0,10) == 10); - EXPECT(tensor_to(0,11) == 11); + EXPECT(tensor_to(0, 8) == 8); + EXPECT(tensor_to(0, 9) == 9); + EXPECT(tensor_to(0, 10) == 10); + EXPECT(tensor_to(0, 11) == 11); EXPECT(tensor_from.data() == nullptr); - } //---------------------------------------------------------------------------------------------------------------------- diff --git a/tests/log/test_log.cc b/tests/log/test_log.cc index 5e55817c9..e05e6db19 100644 --- a/tests/log/test_log.cc +++ b/tests/log/test_log.cc @@ -10,8 +10,8 @@ #include "eckit/config/LibEcKit.h" #include "eckit/filesystem/LocalPathName.h" -#include "eckit/log/Log.h" #include "eckit/log/Bytes.h" +#include "eckit/log/Log.h" #include "eckit/runtime/Tool.h" #include "eckit/testing/Test.h" @@ -69,31 +69,30 @@ CASE("test_bytes") { b = 1024.; EXPECT("1 Kbyte" == std::string(b)); EXPECT("1K" == b.shorten()); - b = 1024.*1024.; + b = 1024. * 1024.; EXPECT("1 Mbyte" == std::string(b)); EXPECT("1M" == b.shorten()); - b = 1024.*1024.*1024.; + b = 1024. * 1024. * 1024.; EXPECT("1 Gbyte" == std::string(b)); EXPECT("1G" == b.shorten()); - b = 1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024.; EXPECT("1 Tbyte" == std::string(b)); EXPECT("1T" == b.shorten()); - b = 1024.*1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024. * 1024.; EXPECT("1 Pbyte" == std::string(b)); EXPECT("1P" == b.shorten()); - b = 1024.*1024.*1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024. * 1024. * 1024.; EXPECT("1 Ebyte" == std::string(b)); EXPECT("1E" == b.shorten()); - b = 1024.*1024.*1024.*1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024.; EXPECT("1 Zbyte" == std::string(b)); EXPECT("1Z" == b.shorten()); - b = 1024.*1024.*1024.*1024.*1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024.; EXPECT("1 Ybyte" == std::string(b)); EXPECT("1Y" == b.shorten()); - b = 1024.*1024.*1024.*1024.*1024.*1024.*1024.*1024.*1024.; + b = 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024. * 1024.; EXPECT("1024 Ybytes" == std::string(b)); EXPECT("99Y" == b.shorten()); - } //---------------------------------------------------------------------------------------------------------------------- diff --git a/tests/memory/test_counted.cc b/tests/memory/test_counted.cc index 386b04299..83e5cbd85 100644 --- a/tests/memory/test_counted.cc +++ b/tests/memory/test_counted.cc @@ -215,23 +215,39 @@ void TestSwap() { //---------------------------------------------------------------------------------------------------------------------- CASE("test_default") { - SECTION("Type FooLock") { TestDefault(); } - SECTION("Type FooNoLock") { TestDefault(); } + SECTION("Type FooLock") { + TestDefault(); + } + SECTION("Type FooNoLock") { + TestDefault(); + } } CASE("test_copy") { - SECTION("Type FooLock") { TestCopy(); } - SECTION("Type FooNoLock") { TestCopy(); } + SECTION("Type FooLock") { + TestCopy(); + } + SECTION("Type FooNoLock") { + TestCopy(); + } } CASE("test_release") { - SECTION("Type FooLock") { TestRelease(); } - SECTION("Type FooNoLock") { TestRelease(); } + SECTION("Type FooLock") { + TestRelease(); + } + SECTION("Type FooNoLock") { + TestRelease(); + } } CASE("test_swap") { - SECTION("Type FooLock") { TestSwap(); } - SECTION("Type FooNoLock") { TestSwap(); } + SECTION("Type FooLock") { + TestSwap(); + } + SECTION("Type FooNoLock") { + TestSwap(); + } } //---------------------------------------------------------------------------------------------------------------------- diff --git a/tests/mpi/eckit_test_mpi.cc b/tests/mpi/eckit_test_mpi.cc index 96f2eb9a3..3772266af 100644 --- a/tests/mpi/eckit_test_mpi.cc +++ b/tests/mpi/eckit_test_mpi.cc @@ -80,12 +80,12 @@ CASE("test_broadcast") { Log::info() << "Test vector>" << std::endl; { - std::vector< std::pair > data(5); + std::vector > data(5); if (mpi::comm().rank() == root) { - size_t j=0; - for(size_t i=0; i<5; ++i) { - data[i].first=d[j++]; - data[i].second=d[j++]; + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { + data[i].first = d[j++]; + data[i].second = d[j++]; } } @@ -94,8 +94,8 @@ CASE("test_broadcast") { // check results std::vector unpacked(10); { - size_t j=0; - for(size_t i=0; i<5; ++i) { + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { unpacked[j++] = data[i].first; unpacked[j++] = data[i].second; } @@ -105,12 +105,12 @@ CASE("test_broadcast") { Log::info() << "Test vector>" << std::endl; { - std::vector< std::pair > data(5); + std::vector > data(5); if (mpi::comm().rank() == root) { - size_t j=0; - for(size_t i=0; i<5; ++i) { - data[i].first=d[j++]; - data[i].second=d[j++]; + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { + data[i].first = d[j++]; + data[i].second = d[j++]; } } @@ -119,8 +119,8 @@ CASE("test_broadcast") { // check results std::vector unpacked(10); { - size_t j=0; - for(size_t i=0; i<5; ++i) { + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { unpacked[j++] = data[i].first; unpacked[j++] = data[i].second; } @@ -130,12 +130,12 @@ CASE("test_broadcast") { Log::info() << "Test vector>" << std::endl; { - std::vector< std::pair > data(5); + std::vector > data(5); if (mpi::comm().rank() == root) { - size_t j=0; - for(size_t i=0; i<5; ++i) { - data[i].first=d[j++]; - data[i].second=d[j++]; + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { + data[i].first = d[j++]; + data[i].second = d[j++]; } } @@ -144,15 +144,14 @@ CASE("test_broadcast") { // check results std::vector unpacked(10); { - size_t j=0; - for(size_t i=0; i<5; ++i) { + size_t j = 0; + for (size_t i = 0; i < 5; ++i) { unpacked[j++] = data[i].first; unpacked[j++] = data[i].second; } } EXPECT(unpacked == expect); } - } CASE("test_gather_scalar") { @@ -355,23 +354,23 @@ CASE("test_scatterv") { CASE("sendReceiveReplace") { int mpi_rank = mpi::comm().rank(); int mpi_size = mpi::comm().size(); - int first = 0; - int last = mpi_size - 1; - int sendtag = 0; - int recvtag = 0; + int first = 0; + int last = mpi_size - 1; + int sendtag = 0; + int recvtag = 0; Log::info() << "Testing swap" << std::endl; { int d = mpi_rank + 1; if (mpi_rank == first) { - int dest = last; // send to last - int src = last; // receive from last + int dest = last; // send to last + int src = last; // receive from last EXPECT_EQUAL(d, 1); EXPECT_NO_THROW(mpi::comm().sendReceiveReplace(d, dest, sendtag, src, recvtag)); EXPECT_EQUAL(d, mpi_size); } if (mpi_rank == last) { - int dest = first; // send to first - int src = first; // receive to first + int dest = first; // send to first + int src = first; // receive to first EXPECT_EQUAL(d, mpi_size); EXPECT_NO_THROW(mpi::comm().sendReceiveReplace(d, dest, sendtag, src, recvtag)); EXPECT_EQUAL(d, 1); @@ -379,31 +378,31 @@ CASE("sendReceiveReplace") { } Log::info() << "Testing open end shift" << std::endl; { - int d = mpi_rank + 1; - int expected = d+1; + int d = mpi_rank + 1; + int expected = d + 1; if (mpi_rank == last) { expected = d; } - int dest = mpi_rank-1; // send to lower rank - int src = mpi_rank+1; // receive from higher rank + int dest = mpi_rank - 1; // send to lower rank + int src = mpi_rank + 1; // receive from higher rank if (mpi_rank == first) { - dest = mpi::comm().procNull(); // first receives nothing + dest = mpi::comm().procNull(); // first receives nothing } if (mpi_rank == last) { - src = mpi::comm().procNull(); // last sends nothing + src = mpi::comm().procNull(); // last sends nothing } EXPECT_NO_THROW(mpi::comm().sendReceiveReplace(d, dest, sendtag, src, recvtag)); EXPECT_EQUAL(d, expected); } Log::info() << "Testing circular shift" << std::endl; { - int d = mpi_rank + 1; - int expected = d+1; + int d = mpi_rank + 1; + int expected = d + 1; if (mpi_rank == last) { - expected = first+1; + expected = first + 1; } - int dest = mpi_rank-1; // send to lower rank - int src = mpi_rank+1; + int dest = mpi_rank - 1; // send to lower rank + int src = mpi_rank + 1; if (mpi_rank == first) { dest = last; } @@ -430,21 +429,21 @@ CASE("test_reduce") { // check results int root = 0; /* master */ - int s = 0; - int p = 1; - int mx = 0; - int mn = mpi_size; - std::pair mxloc{-double(mpi_size),mpi_size-1}; - std::pair mnloc{-double(1),0}; + int s = 0; + int p = 1; + int mx = 0; + int mn = mpi_size; + std::pair mxloc{-double(mpi_size), mpi_size - 1}; + std::pair mnloc{-double(1), 0}; if (mpi_rank == root) { for (size_t j = 0; j < mpi_size; ++j) { s += (j + 1); p *= (j + 1); } - mx = mpi_size; - mn = 1; - mxloc = std::pair{-double(1),0}; - mnloc = std::pair{-double(mpi_size),mpi_size-1}; + mx = mpi_size; + mn = 1; + mxloc = std::pair{-double(1), 0}; + mnloc = std::pair{-double(mpi_size), mpi_size - 1}; } Log::info() << "Testing reduce" << std::endl; @@ -465,16 +464,15 @@ CASE("test_reduce") { EXPECT_NO_THROW(mpi::comm().reduce(d, min, mpi::min(), root)); EXPECT_EQUAL(min, mn); - std::pair maxloc{-double(mpi_size),mpi_size-1}; + std::pair maxloc{-double(mpi_size), mpi_size - 1}; EXPECT_NO_THROW(mpi::comm().reduce(v, maxloc, mpi::maxloc(), root)); - EXPECT_EQUAL(maxloc.first, mxloc.first ); + EXPECT_EQUAL(maxloc.first, mxloc.first); EXPECT_EQUAL(maxloc.second, mxloc.second); - std::pair minloc{-double(1),0}; + std::pair minloc{-double(1), 0}; EXPECT_NO_THROW(mpi::comm().reduce(v, minloc, mpi::minloc(), root)); - EXPECT_EQUAL(minloc.first, mnloc.first ); + EXPECT_EQUAL(minloc.first, mnloc.first); EXPECT_EQUAL(minloc.second, mnloc.second); - } std::vector arr(5, mpi_rank + 1); @@ -493,8 +491,8 @@ CASE("test_reduce") { int min = d; if (mpi_rank != root) { - s = d; - p = d; + s = d; + p = d; mx = d; mn = d; } @@ -513,26 +511,25 @@ CASE("test_reduce") { std::vector expected; - expected = (mpi_rank == root) ? std::vector(5, mpi_size) : arr; + expected = (mpi_rank == root) ? std::vector(5, mpi_size) : arr; std::vector maxvec = arr; EXPECT_NO_THROW(mpi::comm().reduceInPlace(maxvec.begin(), maxvec.end(), mpi::max(), root)); EXPECT_EQUAL(maxvec, expected); - expected = (mpi_rank == root) ? std::vector(5, 1) : arr; + expected = (mpi_rank == root) ? std::vector(5, 1) : arr; std::vector minvec = arr; EXPECT_NO_THROW(mpi::comm().reduceInPlace(minvec.begin(), minvec.end(), mpi::min(), root)); EXPECT_EQUAL(minvec, expected); - expected = (mpi_rank == root) ? std::vector(5, s) : arr; + expected = (mpi_rank == root) ? std::vector(5, s) : arr; std::vector sumvec = arr; EXPECT_NO_THROW(mpi::comm().reduceInPlace(sumvec.begin(), sumvec.end(), mpi::sum(), root)); EXPECT_EQUAL(sumvec, expected); - expected = (mpi_rank == root) ? std::vector(5, p) : arr; + expected = (mpi_rank == root) ? std::vector(5, p) : arr; std::vector prodvec = arr; EXPECT_NO_THROW(mpi::comm().reduceInPlace(prodvec.begin(), prodvec.end(), mpi::prod(), root)); EXPECT_EQUAL(prodvec, expected); - } } diff --git a/tests/mpi/eckit_test_mpi_objserialisation.cc b/tests/mpi/eckit_test_mpi_objserialisation.cc index 09e902053..addeda802 100644 --- a/tests/mpi/eckit_test_mpi_objserialisation.cc +++ b/tests/mpi/eckit_test_mpi_objserialisation.cc @@ -183,7 +183,7 @@ struct Fixture { eckit::Buffer sendBuffer_; - Fixture(const Fixture&) = delete; + Fixture(const Fixture&) = delete; Fixture& operator=(const Fixture&) = delete; void send(const Obj& o, size_t to) { diff --git a/tests/sql/test_select.cc b/tests/sql/test_select.cc index cfd459374..be46ffcc7 100644 --- a/tests/sql/test_select.cc +++ b/tests/sql/test_select.cc @@ -287,7 +287,7 @@ CASE("Select from constructed table") { SECTION("Test SQL select where string is not empty") { for (const auto& sql : {"select rcol from table1 where scol != \"\"", - "select rcol from table1 where scol != ''"}) { + "select rcol from table1 where scol != ''"}) { eckit::sql::SQLParser::parseString(session, sql); diff --git a/tests/testing/test_testing.cc b/tests/testing/test_testing.cc index fdb459ffb..f537e0da2 100644 --- a/tests/testing/test_testing.cc +++ b/tests/testing/test_testing.cc @@ -191,7 +191,9 @@ Tests fail_3 = {{CASE("F1"){EXPECT(0 == 1); } } , { - CASE("F3") { EXPECT(0 == 1); } + CASE("F3") { + EXPECT(0 == 1); + } } } ; @@ -249,7 +251,9 @@ SECTION("S2") { for (int j = 0; j < 10; j++) { std::stringstream ss; ss << "test-" << j; - SECTION(ss.str()) { ++global_counters[4]; } + SECTION(ss.str()) { + ++global_counters[4]; + } } } } diff --git a/tests/types/test_cache.cc b/tests/types/test_cache.cc index 6282dc12d..ed68ba58f 100644 --- a/tests/types/test_cache.cc +++ b/tests/types/test_cache.cc @@ -150,7 +150,7 @@ CASE("test_fetch") { EXPECT(!cache.fetch("f", o)); // no obj f exists - EXPECT(cache.fetch("b", o)); // obj b exists + EXPECT(cache.fetch("b", o)); // obj b exists EXPECT(o.s_ == "bbb"); EXPECT(o.d_ == 22222); diff --git a/tests/utils/test_byteswap.cc b/tests/utils/test_byteswap.cc index 0ec738bf2..7bd23631a 100644 --- a/tests/utils/test_byteswap.cc +++ b/tests/utils/test_byteswap.cc @@ -192,9 +192,15 @@ void test_scalar_value(T v, std::string bitstr, std::string swapped) { } CASE("ByteSwap short") { - SECTION("short 1234") { test_scalar_value(1234, "0000010011010010", "1101001000000100"); } - SECTION("short 3145") { test_scalar_value(3145, "0000110001001001", "0100100100001100"); } - SECTION("short 32767") { test_scalar_value(32767, "0111111111111111", "1111111101111111"); } + SECTION("short 1234") { + test_scalar_value(1234, "0000010011010010", "1101001000000100"); + } + SECTION("short 3145") { + test_scalar_value(3145, "0000110001001001", "0100100100001100"); + } + SECTION("short 32767") { + test_scalar_value(32767, "0111111111111111", "1111111101111111"); + } } CASE("ByteSwap int") { @@ -298,16 +304,36 @@ void test_roundtrip_vector() { } CASE("test_roundtrip_vector") { - SECTION("short") { test_roundtrip_vector(); } - SECTION("unsigned short") { test_roundtrip_vector(); } - SECTION("int") { test_roundtrip_vector(); } - SECTION("unsigned int") { test_roundtrip_vector(); } - SECTION("long") { test_roundtrip_vector(); } - SECTION("unsigned long") { test_roundtrip_vector(); } - SECTION("long long") { test_roundtrip_vector(); } - SECTION("unsigned long long") { test_roundtrip_vector(); } - SECTION("float") { test_roundtrip_vector(); } - SECTION("double") { test_roundtrip_vector(); } + SECTION("short") { + test_roundtrip_vector(); + } + SECTION("unsigned short") { + test_roundtrip_vector(); + } + SECTION("int") { + test_roundtrip_vector(); + } + SECTION("unsigned int") { + test_roundtrip_vector(); + } + SECTION("long") { + test_roundtrip_vector(); + } + SECTION("unsigned long") { + test_roundtrip_vector(); + } + SECTION("long long") { + test_roundtrip_vector(); + } + SECTION("unsigned long long") { + test_roundtrip_vector(); + } + SECTION("float") { + test_roundtrip_vector(); + } + SECTION("double") { + test_roundtrip_vector(); + } } //---------------------------------------------------------------------------------------------------------------------- diff --git a/tests/utils/test_compressor.cc b/tests/utils/test_compressor.cc index 9ad8f3560..a100cf28a 100644 --- a/tests/utils/test_compressor.cc +++ b/tests/utils/test_compressor.cc @@ -96,7 +96,7 @@ CASE("Builders") { CASE("Compression") { - Buffer in(2 * msg.size()); // oversized on purpose + Buffer in(2 * msg.size()); // oversized on purpose in.copy(msg.c_str(), msg.size()); const size_t len = msg.size(); // valid size diff --git a/tests/utils/test_hashing.cc b/tests/utils/test_hashing.cc index 47d5c5026..9f56a99ca 100644 --- a/tests/utils/test_hashing.cc +++ b/tests/utils/test_hashing.cc @@ -111,7 +111,7 @@ std::map> results = { "2dcf47703493b6ca", //"The quick brown fox jumps over the lazy cog" "e32a7da747f1bd6e", //"The quick brown fox jumps over the lazy cog" x 2 }}, - {"xxhash", // Deprecated alias of xxh64 + {"xxhash", // Deprecated alias of xxh64 { "ef46db3751d8e999", //"" "d24ec4f1a98c6e5b", //"a" @@ -176,7 +176,9 @@ CASE("Hashing") { testHash(*hash, "MD5"); } - SECTION("Not Existing Hashing") { EXPECT_THROWS(HashFactory::instance().build("dummy name")); } + SECTION("Not Existing Hashing") { + EXPECT_THROWS(HashFactory::instance().build("dummy name")); + } for (auto const& element : results) { if (HashFactory::instance().has(element.first)) { diff --git a/tests/utils/test_optional.cc b/tests/utils/test_optional.cc index 78629feaf..8c5bae970 100644 --- a/tests/utils/test_optional.cc +++ b/tests/utils/test_optional.cc @@ -127,12 +127,12 @@ CASE("copy and move assign") { opt2 = std::move(opt2); EXPECT(opt2); EXPECT(opt2.value() == 2); - + // Self copy-assignement opt2 = opt2; EXPECT(opt2); EXPECT(opt2.value() == 2); - + // Assign none opt2 = nullopt; EXPECT(!opt2); @@ -302,7 +302,7 @@ CASE("test destructor on non-trivial object: copy assign value") { EXPECT_EQUAL(opt.value().str, std::string("testCopyAssignValue1")); int testCopyAssignValue1OptId = opt.value().id; int testCopyAssignValue1OptUId = opt.value().uid; - + // Test copy assign value Some <- Some StringWrap testCopyAssignValue2("testCopyAssignValue2"); int testCopyAssignValue2Id = testCopyAssignValue2.id; @@ -329,7 +329,7 @@ CASE("test destructor on non-trivial object: copy assign value") { } } - + CASE("test destructor on non-trivial object: move assign value") { { Optional opt; @@ -361,15 +361,15 @@ CASE("test destructor on non-trivial object: move assign value") { EXPECT(!StringWrap::idIsDeleted(testMoveAssignValue1OptId)); EXPECT(!StringWrap::uidIsDeleted(testMoveAssignValue1OptUId)); EXPECT(!StringWrap::uidIsDeleted(testMoveAssignValue2UId)); - - + + Optional testCopyAssignSomeNone; opt = testCopyAssignSomeNone; EXPECT(!opt); // Reset should delete previous object EXPECT(StringWrap::idIsDeleted(testMoveAssignValue2OptId)); EXPECT(StringWrap::uidIsDeleted(testMoveAssignValue2OptUId)); - } + } } CASE("test destructor on non-trivial object: copy & move assign optional") { @@ -408,7 +408,7 @@ CASE("test destructor on non-trivial object: copy & move assign optional") { EXPECT(!StringWrap::uidIsDeleted(testCopyAssignNoneSomeOptUId)); EXPECT(!StringWrap::idIsDeleted(testCopyAssignSomeSomeId)); EXPECT(!StringWrap::uidIsDeleted(testCopyAssignSomeSomeUId)); - + // Test move assign some <- some Optional testMoveAssignSomeSome("testMoveAssignSomeSome"); int testMoveAssignSomeSomeId = testMoveAssignSomeSome.value().id; diff --git a/tests/utils/test_translator.cc b/tests/utils/test_translator.cc index 1765f2269..c47926c49 100644 --- a/tests/utils/test_translator.cc +++ b/tests/utils/test_translator.cc @@ -110,19 +110,19 @@ CASE("Translate strings to double") { EXPECT_NO_THROW(t("infinity")); // infinity is acceptable, case insensitive EXPECT_NO_THROW(t("INFINITY")); // INFINITY is acceptable, case insensitive - EXPECT_NO_THROW(t("nan")); // nan is acceptable, case insensitive - EXPECT_NO_THROW(t("NAN")); // NAN is acceptable, case insensitive + EXPECT_NO_THROW(t("nan")); // nan is acceptable, case insensitive + EXPECT_NO_THROW(t("NAN")); // NAN is acceptable, case insensitive - EXPECT(zero == t("0x0")); // hexadecimal is acceptable - EXPECT(ten == t("0xA")); // hexadecimal is acceptable + EXPECT(zero == t("0x0")); // hexadecimal is acceptable + EXPECT(ten == t("0xA")); // hexadecimal is acceptable /// these should fail ... - EXPECT_THROWS_AS(t(""), BadParameter); // empty string + EXPECT_THROWS_AS(t(""), BadParameter); // empty string - EXPECT_THROWS_AS(t("0.5 "), BadParameter); // no spaces accepted -- we are being extra strict - EXPECT_THROWS_AS(t(" 0.5"), BadParameter); // no spaces accepted -- we are being extra strict - EXPECT_THROWS_AS(t(" 0.5 "), BadParameter); // no spaces accepted -- we are being extra strict + EXPECT_THROWS_AS(t("0.5 "), BadParameter); // no spaces accepted -- we are being extra strict + EXPECT_THROWS_AS(t(" 0.5"), BadParameter); // no spaces accepted -- we are being extra strict + EXPECT_THROWS_AS(t(" 0.5 "), BadParameter); // no spaces accepted -- we are being extra strict EXPECT_THROWS_AS(t("1e+10000"), BadParameter); // overflow, max ~ 1.79769e+308 EXPECT_THROWS_AS(t("1e-10000"), BadParameter); // underflow, min ~ 2.22507e-308