Skip to content

Commit 47e2704

Browse files
committed
ECKIT-635: param case
1 parent 05f1ea7 commit 47e2704

21 files changed

+259
-247
lines changed

src/eckit/io/fam/FamHashTable.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ namespace eckit {
2828

2929
//----------------------------------------------------------------------------------------------------------------------
3030

31-
FamHashTable::FamHashTable(const FamRegionName& regionName, const std::string& tableName) :
32-
region_{regionName.lookup()},
33-
begin_{initSentinel(tableName + "-hash-begin", sizeof(FamDescriptor))},
34-
count_{initSentinel(tableName + "-hash-count", sizeof(size_type))} {}
31+
FamHashTable::FamHashTable(const FamRegionName& region_name, const std::string& table_name) :
32+
region_{region_name.lookup()},
33+
begin_{initSentinel(table_name + "-hash-begin", sizeof(FamDescriptor))},
34+
count_{initSentinel(table_name + "-hash-count", sizeof(size_type))} {}
3535

3636
auto FamHashTable::initSentinel(const std::string& name, const fam::size_t size) const -> FamObject {
3737
try {

src/eckit/io/fam/FamHashTable.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class FamRegionName;
4141
// FAM HASHER
4242

4343
/// @brief Hash functor. Override this to make a specialized hasher
44-
template <typename key_type>
44+
template <typename KeyType>
4545
struct FamHash {
46-
auto operator()(const key_type& key) const noexcept -> std::size_t {
46+
auto operator()(const KeyType& key) const noexcept -> std::size_t {
4747
return std::hash<std::string>{}(key.asString());
4848
/// @note example for a 3-level key
4949
// const auto l1 = std::hash<std::string> {}(key.firstLevel);
@@ -61,13 +61,13 @@ struct FamHash {
6161
// unsigned int index = key % table->size;
6262

6363
class FamHashTable {
64-
static constexpr auto keySize = 32; // template?
64+
static constexpr auto key_size = 32; // template?
6565

6666
static constexpr auto capacity = 1024;
6767

6868
public: // types
6969

70-
using key_type = FixedString<keySize>;
70+
using key_type = FixedString<key_size>;
7171
using hash_type = FamHash<key_type>;
7272
/// @todo char array ?
7373
using value_type = char;
@@ -93,7 +93,7 @@ class FamHashTable {
9393

9494
public: // methods
9595

96-
FamHashTable(const FamRegionName& regionName, const std::string& tableName);
96+
FamHashTable(const FamRegionName& region_name, const std::string& table_name);
9797

9898
private: // methods
9999

src/eckit/io/fam/FamList.cc

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ namespace eckit {
3434

3535
namespace {
3636

37-
auto initSentinel(const FamRegion& region, const std::string& objectName, const fam::size_t objectSize) -> FamObject {
37+
auto initSentinel(const FamRegion& region, const std::string& object_name, const fam::size_t object_size) -> FamObject {
3838
try {
39-
return region.allocateObject(objectSize, objectName);
39+
return region.allocateObject(object_size, object_name);
4040
}
4141
catch (const AlreadyExists&) {
42-
auto object = region.lookupObject(objectName);
43-
ASSERT(object.size() == objectSize);
42+
auto object = region.lookupObject(object_name);
43+
ASSERT(object.size() == object_size);
4444
return object;
4545
}
4646
}
@@ -57,11 +57,11 @@ FamList::FamList(const FamRegion& region, const Descriptor& desc) :
5757
ASSERT(region.index() == desc.region);
5858
}
5959

60-
FamList::FamList(const FamRegion& region, const std::string& listName) :
60+
FamList::FamList(const FamRegion& region, const std::string& list_name) :
6161
region_{region},
62-
head_{initSentinel(region_, listName + "-list-head", sizeof(FamListNode))},
63-
tail_{initSentinel(region_, listName + "-list-tail", sizeof(FamListNode))},
64-
size_{initSentinel(region_, listName + "-list-size", sizeof(size_type))} {
62+
head_{initSentinel(region_, list_name + "-list-head", sizeof(FamListNode))},
63+
tail_{initSentinel(region_, list_name + "-list-tail", sizeof(FamListNode))},
64+
size_{initSentinel(region_, list_name + "-list-size", sizeof(size_type))} {
6565
// set head's next to tail's prev
6666
if (FamListNode::getNextOffset(head_) == 0) {
6767
head_.put(tail_.descriptor(), offsetof(FamListNode, next));
@@ -111,59 +111,59 @@ auto FamList::back() const -> Buffer {
111111
//----------------------------------------------------------------------------------------------------------------------
112112
// modifiers
113113

114-
void FamList::push_front(const void* data, const size_type length) {
114+
void FamList::pushFront(const void* data, const size_type length) {
115115
// allocate an object
116-
auto newObject = region_.allocateObject(sizeof(FamListNode) + length);
116+
auto new_object = region_.allocateObject(sizeof(FamListNode) + length);
117117

118118
// set new object's previous to head
119-
newObject.put(head_.descriptor(), offsetof(FamListNode, prev));
119+
new_object.put(head_.descriptor(), offsetof(FamListNode, prev));
120120

121121
// set head's next to new object
122-
const auto prevOffset = head_.swap(offsetof(FamListNode, next.offset), newObject.offset());
123-
const auto oldObject = region_.proxyObject(prevOffset);
122+
const auto prev_offset = head_.swap(offsetof(FamListNode, next.offset), new_object.offset());
123+
const auto old_object = region_.proxyObject(prev_offset);
124124

125125
// set old object's prev to new object
126-
oldObject.put(newObject.descriptor(), offsetof(FamListNode, prev));
126+
old_object.put(new_object.descriptor(), offsetof(FamListNode, prev));
127127
// set new object's next to old object
128-
newObject.put(oldObject.descriptor(), offsetof(FamListNode, next));
128+
new_object.put(old_object.descriptor(), offsetof(FamListNode, next));
129129

130130
// finally put the data
131-
newObject.put(length, offsetof(FamListNode, length));
132-
newObject.put(data, sizeof(FamListNode), length);
131+
new_object.put(length, offsetof(FamListNode, length));
132+
new_object.put(data, sizeof(FamListNode), length);
133133

134134
// increment size
135135
size_.add(0, 1UL);
136136
}
137137

138-
void FamList::push_back(const void* data, const size_type length) {
138+
void FamList::pushBack(const void* data, const size_type length) {
139139
// allocate an object
140-
auto newObject = region_.allocateObject(sizeof(FamListNode) + length);
140+
auto new_object = region_.allocateObject(sizeof(FamListNode) + length);
141141

142142
// set new object's next to tail
143-
newObject.put(tail_.descriptor(), offsetof(FamListNode, next));
143+
new_object.put(tail_.descriptor(), offsetof(FamListNode, next));
144144

145145
// set tail's prev to new object
146-
const auto prevOffset = tail_.swap(offsetof(FamListNode, prev.offset), newObject.offset());
147-
const auto oldObject = region_.proxyObject(prevOffset);
146+
const auto prev_offset = tail_.swap(offsetof(FamListNode, prev.offset), new_object.offset());
147+
const auto old_object = region_.proxyObject(prev_offset);
148148

149149
// set old object's next to new object
150-
oldObject.put(newObject.descriptor(), offsetof(FamListNode, next));
150+
old_object.put(new_object.descriptor(), offsetof(FamListNode, next));
151151
// set new object's prev to old object
152-
newObject.put(oldObject.descriptor(), offsetof(FamListNode, prev));
152+
new_object.put(old_object.descriptor(), offsetof(FamListNode, prev));
153153

154154
// finally put the data
155-
newObject.put(length, offsetof(FamListNode, length));
156-
newObject.put(data, sizeof(FamListNode), length);
155+
new_object.put(length, offsetof(FamListNode, length));
156+
new_object.put(data, sizeof(FamListNode), length);
157157

158158
// increment size
159159
size_.add(0, 1UL);
160160
}
161161

162-
void FamList::pop_front() {
162+
void FamList::popFront() {
163163
NOTIMP;
164164
}
165165

166-
void FamList::pop_back() {
166+
void FamList::popBack() {
167167
NOTIMP;
168168
}
169169

src/eckit/io/fam/FamList.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ class FamList {
4343
using const_iterator = FamListConstIterator;
4444

4545
struct Descriptor {
46-
fam::index_t region; // region ID
47-
fam::index_t head; // offset of head sentinel
48-
fam::index_t tail; // offset of tail sentinel
49-
fam::index_t size; // offset of size sentinel
46+
fam::index_t region{0}; // region ID
47+
fam::index_t head{0}; // offset of head sentinel
48+
fam::index_t tail{0}; // offset of tail sentinel
49+
fam::index_t size{0}; // offset of size sentinel
5050
};
5151

5252
public: // methods
5353

5454
FamList(const FamRegion& region, const Descriptor& desc);
5555

56-
FamList(const FamRegion& region, const std::string& listName);
56+
FamList(const FamRegion& region, const std::string& list_name);
5757

5858
FamList(const FamRegionName& name);
5959

@@ -87,13 +87,13 @@ class FamList {
8787

8888
// void clear() noexcept;
8989

90-
void push_back(const void* data, size_type length);
90+
void pushBack(const void* data, size_type length);
9191

92-
void push_front(const void* data, size_type length);
92+
void pushFront(const void* data, size_type length);
9393

94-
void pop_front();
94+
void popFront();
9595

96-
void pop_back();
96+
void popBack();
9797

9898
private: // methods
9999

src/eckit/io/fam/FamMap.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ namespace eckit {
2929

3030
//----------------------------------------------------------------------------------------------------------------------
3131

32-
FamMap::FamMap(const FamRegion& region, const std::string& tableName) :
32+
FamMap::FamMap(const FamRegion& region, const std::string& table_name) :
3333
region_{region},
34-
root_{initSentinel(tableName + "-map-root", sizeof(FamMapNode))},
35-
table_{initSentinel(tableName + "-map-table", capacity * sizeof(FamMapNode))},
36-
count_{initSentinel(tableName + "-map-count", sizeof(size_type))} {}
34+
root_{initSentinel(table_name + "-map-root", sizeof(FamMapNode))},
35+
table_{initSentinel(table_name + "-map-table", capacity * sizeof(FamMapNode))},
36+
count_{initSentinel(table_name + "-map-count", sizeof(size_type))} {}
3737

38-
auto FamMap::initSentinel(const std::string& objectName, const size_type objectSize) const -> FamObject {
38+
auto FamMap::initSentinel(const std::string& object_name, const size_type object_size) const -> FamObject {
3939
try {
40-
return region_.allocateObject(objectSize, objectName);
40+
return region_.allocateObject(object_size, object_name);
4141
}
4242
catch (const AlreadyExists&) {
43-
auto object = region_.lookupObject(objectName);
44-
ASSERT(object.size() == objectSize);
43+
auto object = region_.lookupObject(object_name);
44+
ASSERT(object.size() == object_size);
4545
return object;
4646
}
4747
}
@@ -68,23 +68,23 @@ auto FamMap::cend() const -> const_iterator {
6868
//----------------------------------------------------------------------------------------------------------------------
6969
// lookup
7070

71-
auto FamMap::at(const key_type& key) -> reference {
71+
auto FamMap::at(const key_type& /* key */) -> reference {
7272
NOTIMP;
7373
}
7474

75-
auto FamMap::at(const key_type& key) const -> const_reference {
75+
auto FamMap::at(const key_type& /* key */) const -> const_reference {
7676
NOTIMP;
7777
}
7878

79-
auto FamMap::find(const key_type& key) -> iterator {
79+
auto FamMap::find(const key_type& /* key */) -> iterator {
8080
NOTIMP;
8181
}
8282

83-
auto FamMap::find(const key_type& key) const -> const_iterator {
83+
auto FamMap::find(const key_type& /* key */) const -> const_iterator {
8484
NOTIMP;
8585
}
8686

87-
auto FamMap::contains(const key_type& key) const -> bool {
87+
auto FamMap::contains(const key_type& /* key */) const -> bool {
8888
NOTIMP;
8989
}
9090

@@ -99,11 +99,11 @@ auto FamMap::contains(const key_type& key) const -> bool {
9999
//----------------------------------------------------------------------------------------------------------------------
100100
// modifiers
101101

102-
auto FamMap::insert(const value_type& value) -> iterator {
102+
auto FamMap::insert(const value_type& /* value */) -> iterator {
103103
NOTIMP;
104104
}
105105

106-
auto FamMap::insert(value_type&& value) -> iterator {
106+
auto FamMap::insert(value_type&& /* value */) -> iterator {
107107
NOTIMP;
108108
}
109109

src/eckit/io/fam/FamMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class FamMap {
8787

8888
auto empty() const -> bool;
8989

90-
auto max_size() const noexcept -> size_type { return capacity; }
90+
auto maxSize() const noexcept -> size_type { return capacity; }
9191

9292
// iterators
9393

src/eckit/io/fam/FamObject.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ auto FamObject::swap(const fam::size_t offset, const T value) const -> T { // N
138138
}
139139

140140
template <typename T>
141-
auto FamObject::compareSwap(const fam::size_t offset, const T oldValue, const T newValue) const -> T {
142-
return session_->compareSwap<T>(*object_, offset, oldValue, newValue);
141+
auto FamObject::compareSwap(const fam::size_t offset, const T old_value, const T new_value) const -> T {
142+
return session_->compareSwap<T>(*object_, offset, old_value, new_value);
143143
}
144144

145145
//----------------------------------------------------------------------------------------------------------------------

src/eckit/io/fam/FamObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class FamObject {
107107
auto swap(fam::size_t offset, T value) const -> T;
108108

109109
template <typename T>
110-
auto compareSwap(fam::size_t offset, T oldValue, T newValue) const -> T;
110+
auto compareSwap(fam::size_t offset, T old_value, T new_value) const -> T;
111111

112112
private: // methods
113113

src/eckit/io/fam/FamPath.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ auto parsePath(const std::string& path) -> std::tuple<std::string, std::string>
4949
}
5050

5151
/* ISO Object Identifier Namespace */
52-
const uuid_t nsOID = {0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8};
52+
const uuid_t ns_oid = {0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8};
5353

5454
} // namespace
5555

@@ -59,7 +59,7 @@ auto FamPath::generateUUID(const std::string& name) -> std::string {
5959
std::string result = "00000000-0000-0000-0000-000000000000";
6060

6161
uuid_t oid;
62-
uuid_generate_sha1(&oid[0], &nsOID[0], name.c_str(), name.length());
62+
uuid_generate_sha1(&oid[0], &ns_oid[0], name.c_str(), name.length());
6363
uuid_unparse(&oid[0], result.data());
6464

6565
return result;

src/eckit/io/fam/FamRegion.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@ auto FamRegion::proxyObject(const fam::index_t offset) const -> FamObject {
8484
return session_->proxyObject(index(), offset);
8585
}
8686

87-
auto FamRegion::lookupObject(const std::string& objectName) const -> FamObject {
88-
return session_->lookupObject(name(), objectName);
87+
auto FamRegion::lookupObject(const std::string& object_name) const -> FamObject {
88+
return session_->lookupObject(name(), object_name);
8989
}
9090

91-
auto FamRegion::allocateObject(const fam::size_t objectSize, const fam::perm_t objectPerm,
92-
const std::string& objectName, const bool overwrite) const -> FamObject {
91+
auto FamRegion::allocateObject(const fam::size_t object_size, const fam::perm_t object_perm,
92+
const std::string& object_name, const bool overwrite) const -> FamObject {
9393
if (overwrite) {
94-
return session_->ensureAllocateObject(*region_, objectSize, objectPerm, objectName);
94+
return session_->ensureAllocateObject(*region_, object_size, object_perm, object_name);
9595
}
96-
return session_->allocateObject(*region_, objectSize, objectPerm, objectName);
96+
return session_->allocateObject(*region_, object_size, object_perm, object_name);
9797
}
9898

99-
void FamRegion::deallocateObject(const std::string& objectName) const {
100-
session_->deallocateObject(region_->get_name(), objectName);
99+
void FamRegion::deallocateObject(const std::string& object_name) const {
100+
session_->deallocateObject(region_->get_name(), object_name);
101101
}
102102

103103
//----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)