Skip to content

Commit

Permalink
Format source files
Browse files Browse the repository at this point in the history
  • Loading branch information
figi44 committed Apr 14, 2023
1 parent df3fcde commit 446ac25
Show file tree
Hide file tree
Showing 201 changed files with 993 additions and 790 deletions.
7 changes: 3 additions & 4 deletions src/eckit/cmd/StartCmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/eckit/cmd/StopCmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
6 changes: 4 additions & 2 deletions src/eckit/compat/Inited.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace eckit {
template <class T>
class Inited {
public:
Inited() : value_(0) {}
Inited(const T& v) : value_(v) {}
Inited() :
value_(0) {}
Inited(const T& v) :
value_(v) {}

~Inited() {}

Expand Down
5 changes: 2 additions & 3 deletions src/eckit/config/LibEcKit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion src/eckit/config/LibEcKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ class LibEcKit : public eckit::system::Library {
//----------------------------------------------------------------------------------------------------------------------

} // namespace eckit

9 changes: 6 additions & 3 deletions src/eckit/config/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, T>()(value)) {}
Expand Down Expand Up @@ -68,7 +70,8 @@ std::ostream& operator<<(std::ostream& os, const Resource<T>& r) {
template <class T, class LIB>
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<LibResource<T, LIB>*>(this)->init();
Expand Down
6 changes: 4 additions & 2 deletions src/eckit/container/BSPTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class BSPTreeX : public SPTree<Traits, BSPNode<Traits, Partition> > {
Partition partition_;

public:
BSPTreeX(Alloc& alloc) : SPTree<Traits, BSPNode<Traits, Partition> >(alloc) {}
BSPTreeX(Alloc& alloc) :
SPTree<Traits, BSPNode<Traits, Partition> >(alloc) {}


/// Container must be a random access
Expand All @@ -45,7 +46,8 @@ class BSPTreeMemory : public BSPTreeX<TT<Traits, KDMemory>, Partition> {
KDMemory alloc_;

public:
BSPTreeMemory() : BSPTreeX<TT<Traits, KDMemory>, Partition>(alloc_) {}
BSPTreeMemory() :
BSPTreeX<TT<Traits, KDMemory>, Partition>(alloc_) {}
};

template <class Traits, class Partition>
Expand Down
70 changes: 34 additions & 36 deletions src/eckit/container/BTree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* does it submit to any jurisdiction.
*/

#include <ostream>
#include <sys/file.h>
#ifdef __linux__
#include <ostream>
#ifdef __linux__
#include <linux/errno.h>
#ifndef ENOTSUPP
#define ENOTSUPP 524
Expand Down Expand Up @@ -662,24 +662,23 @@ void BTree<K, V, S, L>::unlock() {
template <class K, class V, int S, class L>
void BTree<K, V, S, L>::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_;
Expand All @@ -691,24 +690,23 @@ void BTree<K, V, S, L>::flock() {
template <class K, class V, int S, class L>
void BTree<K, V, S, L>::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_;
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/BTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned long, _PageInfo> Cache;
Expand Down
6 changes: 4 additions & 2 deletions src/eckit/container/Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}
Expand Down Expand Up @@ -134,7 +135,8 @@ class Cache : private NonCopyable {
//-----------------------------------------------------------------------------

template <typename K, typename V>
Cache<K, V>::Cache() : storage_() {}
Cache<K, V>::Cache() :
storage_() {}

template <typename K, typename V>
Cache<K, V>::~Cache() {
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/CacheLRU.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
2 changes: 1 addition & 1 deletion src/eckit/container/CacheManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/ClassExtent.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ void ClassExtent<T>::callAll(void (T::*proc)(P1&, P2&), P1& arg1, P2& arg2) {
}

template <class T>
ClassExtent<T>::Extent::Extent() : inited_(true) {}
ClassExtent<T>::Extent::Extent() :
inited_(true) {}

template <class T>
ClassExtent<T>::Extent::~Extent() {
Expand Down
11 changes: 6 additions & 5 deletions src/eckit/container/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ namespace eckit {

template <typename K, typename V>
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<K, V> item_type; ///< (key, value) item type

private: // types
private: // types
typedef std::deque<item_type> 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() {}

Expand Down
5 changes: 3 additions & 2 deletions src/eckit/container/DenseSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DenseSet {
public: // types
typedef V value_type; ///< value type

private: // types
private: // types
typedef std::vector<value_type> store_t;

public: // methods
Expand All @@ -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);
}
Expand Down
6 changes: 4 additions & 2 deletions src/eckit/container/KDTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class KDTreeX : public SPTree<Traits, KDNode<Traits> > {
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)
Expand Down Expand Up @@ -76,7 +77,8 @@ class KDTreeMemory : public KDTreeX<TT<Traits, KDMemory> > {
typedef typename KDTree::Payload Payload;

public:
KDTreeMemory() : KDTree(alloc_) {}
KDTreeMemory() :
KDTree(alloc_) {}
};

template <class Traits>
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/MappedArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
7 changes: 4 additions & 3 deletions src/eckit/container/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ template <typename ELEM>
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_; }
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/Recycler.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class Recycler {
//-----------------------------------------------------------------------------

template <class T>
Recycler<T>::Recycler(const PathName& path) : path_(path), fd_(-1) {
Recycler<T>::Recycler(const PathName& path) :
path_(path), fd_(-1) {
path_.dirName().mkdir();
fd_ = ::open(path_.localPath(), O_RDWR | O_CREAT, 0777);
if (fd_ < 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/SharedMemArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion src/eckit/container/bsptree/BSPHyperPlane.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {}
Expand Down
Loading

0 comments on commit 446ac25

Please sign in to comment.