Skip to content

Commit c58b95b

Browse files
committed
revert some changes
1 parent 0e60c82 commit c58b95b

File tree

11 files changed

+125
-112
lines changed

11 files changed

+125
-112
lines changed

keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <vector>
3232

3333
#include "keyvi/dictionary/fsa/automata.h"
34-
#include "keyvi/dictionary/fsa/traversal/traversal_base.h"
3534
#include "keyvi/dictionary/fsa/traverser_types.h"
3635

3736
// #define ENABLE_TRACING
@@ -66,7 +65,7 @@ class ComparableStateTraverser final {
6665
using label_t = typename innerTraverserType::label_t;
6766
using transition_t = typename innerTraverserType::transition_t;
6867

69-
explicit ComparableStateTraverser(const innerTraverserType&& traverser, const bool advance = true,
68+
explicit ComparableStateTraverser(const innerTraverserType &&traverser, const bool advance = true,
7069
const size_t order = 0)
7170
: state_traverser_(std::move(traverser)), order_(order) {
7271
if (advance) {
@@ -86,7 +85,7 @@ class ComparableStateTraverser final {
8685
: ComparableStateTraverser(f, f->GetStartState(), advance, order) {}
8786

8887
explicit ComparableStateTraverser(const automata_t f, const uint64_t start_state,
89-
traversal::TraversalPayload<transition_t>&& payload, const bool advance = true,
88+
traversal::TraversalPayload<transition_t> &&payload, const bool advance = true,
9089
const size_t order = 0)
9190
: state_traverser_(f, start_state, std::move(payload), false), order_(order) {
9291
if (advance) {
@@ -95,13 +94,13 @@ class ComparableStateTraverser final {
9594
}
9695

9796
ComparableStateTraverser() = delete;
98-
ComparableStateTraverser& operator=(ComparableStateTraverser const&) = delete;
99-
ComparableStateTraverser(const ComparableStateTraverser& that) = delete;
97+
ComparableStateTraverser &operator=(ComparableStateTraverser const &) = delete;
98+
ComparableStateTraverser(const ComparableStateTraverser &that) = delete;
10099

101100
/**
102101
* Comparison of the state traverser for the purpose of ordering them
103102
*/
104-
bool operator<(const ComparableStateTraverser& rhs) const {
103+
bool operator<(const ComparableStateTraverser &rhs) const {
105104
int compare = std::memcmp(label_stack_.data(), rhs.label_stack_.data(),
106105
std::min(label_stack_.size(), rhs.label_stack_.size()) * sizeof(label_t));
107106
if (compare != 0) {
@@ -115,24 +114,24 @@ class ComparableStateTraverser final {
115114
return order_ > rhs.order_;
116115
}
117116

118-
bool operator>(const ComparableStateTraverser& rhs) const { return rhs.operator<(*this); }
117+
bool operator>(const ComparableStateTraverser &rhs) const { return rhs.operator<(*this); }
119118

120-
bool operator<=(const ComparableStateTraverser& rhs) const { return !operator>(rhs); }
119+
bool operator<=(const ComparableStateTraverser &rhs) const { return !operator>(rhs); }
121120

122-
bool operator>=(const ComparableStateTraverser& rhs) const { return !operator<(rhs); }
121+
bool operator>=(const ComparableStateTraverser &rhs) const { return !operator<(rhs); }
123122

124123
/**
125124
* Compare traverser with another one, _ignoring_ the order value
126125
*/
127-
bool operator==(const ComparableStateTraverser& rhs) const {
126+
bool operator==(const ComparableStateTraverser &rhs) const {
128127
if (label_stack_.size() != rhs.label_stack_.size()) {
129128
return false;
130129
}
131130

132131
return std::memcmp(label_stack_.data(), rhs.label_stack_.data(), label_stack_.size() * sizeof(label_t)) == 0;
133132
}
134133

135-
bool operator!=(const ComparableStateTraverser& rhs) const { return !operator==(rhs); }
134+
bool operator!=(const ComparableStateTraverser &rhs) const { return !operator==(rhs); }
136135

137136
operator bool() const { return state_traverser_; }
138137

@@ -163,7 +162,7 @@ class ComparableStateTraverser final {
163162

164163
label_t GetStateLabel() const { return state_traverser_.GetStateLabel(); }
165164

166-
[[nodiscard]] const std::vector<label_t>& GetStateLabels() const { return label_stack_; }
165+
const std::vector<label_t> &GetStateLabels() const { return label_stack_; }
167166

168167
size_t GetOrder() const { return order_; }
169168

@@ -187,22 +186,22 @@ class ComparableStateTraverser final {
187186
template <class nearInnerTraverserType>
188187
friend class matching::NearMatching;
189188

190-
traversal::TraversalState<transition_t>& GetStates() { return state_traverser_.GetStates(); }
189+
traversal::TraversalState<transition_t> &GetStates() { return state_traverser_.GetStates(); }
191190

192-
traversal::TraversalPayload<transition_t>& GetTraversalPayload() { return state_traverser_.GetTraversalPayload(); }
191+
traversal::TraversalPayload<transition_t> &GetTraversalPayload() { return state_traverser_.GetTraversalPayload(); }
193192

194-
[[nodiscard]] const traversal::TraversalPayload<transition_t>& GetTraversalPayload() const {
193+
const traversal::TraversalPayload<transition_t> &GetTraversalPayload() const {
195194
return state_traverser_.GetTraversalPayload();
196195
}
197196
};
198197

199-
inline bool CompareWeights(const traversal::TraversalState<traversal::WeightedTransition>& i,
200-
const traversal::TraversalState<traversal::WeightedTransition>& j) {
198+
inline bool CompareWeights(const traversal::TraversalState<traversal::WeightedTransition> &i,
199+
const traversal::TraversalState<traversal::WeightedTransition> &j) {
201200
return i.GetNextInnerWeight() == j.GetNextInnerWeight();
202201
}
203202

204203
template <>
205-
inline bool ComparableStateTraverser<WeightedStateTraverser>::operator<(const ComparableStateTraverser& rhs) const {
204+
inline bool ComparableStateTraverser<WeightedStateTraverser>::operator<(const ComparableStateTraverser &rhs) const {
206205
TRACE("operator< (weighted state specialization)");
207206

208207
TRACE("depth %ld %ld", state_traverser_.GetDepth(), rhs.state_traverser_.GetDepth());
@@ -232,7 +231,7 @@ inline bool ComparableStateTraverser<WeightedStateTraverser>::operator<(const Co
232231
}
233232

234233
template <>
235-
inline bool ComparableStateTraverser<NearStateTraverser>::operator==(const ComparableStateTraverser& rhs) const {
234+
inline bool ComparableStateTraverser<NearStateTraverser>::operator==(const ComparableStateTraverser &rhs) const {
236235
if (label_stack_.size() != rhs.label_stack_.size()) {
237236
return false;
238237
}
@@ -245,7 +244,7 @@ inline bool ComparableStateTraverser<NearStateTraverser>::operator==(const Compa
245244
}
246245

247246
template <>
248-
inline bool ComparableStateTraverser<NearStateTraverser>::operator<(const ComparableStateTraverser& rhs) const {
247+
inline bool ComparableStateTraverser<NearStateTraverser>::operator<(const ComparableStateTraverser &rhs) const {
249248
TRACE("operator< (near state specialization)");
250249

251250
if (GetTraversalPayload().exact != rhs.GetTraversalPayload().exact) {

keyvi/include/keyvi/dictionary/fsa/internal/lru_generation_cache.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ class LeastRecentlyUsedGenerationsCache final {
6666

6767
~LeastRecentlyUsedGenerationsCache() {
6868
delete current_generation_;
69-
for (MinimizationHash<EntryT>* generation : generations_) {
69+
for (MinimizationHash<EntryT> *generation : generations_) {
7070
delete generation;
7171
}
7272
}
7373

7474
LeastRecentlyUsedGenerationsCache() = delete;
75-
LeastRecentlyUsedGenerationsCache& operator=(LeastRecentlyUsedGenerationsCache const&) = delete;
76-
LeastRecentlyUsedGenerationsCache(const LeastRecentlyUsedGenerationsCache& that) = delete;
75+
LeastRecentlyUsedGenerationsCache &operator=(LeastRecentlyUsedGenerationsCache const &) = delete;
76+
LeastRecentlyUsedGenerationsCache(const LeastRecentlyUsedGenerationsCache &that) = delete;
7777

7878
/** Add this object.
7979
* @param key The key to add
8080
*/
8181
void Add(EntryT key) {
8282
if (current_generation_->Size() >= size_per_generation_) {
83-
MinimizationHash<EntryT>* newGeneration = nullptr;
83+
MinimizationHash<EntryT> *newGeneration = nullptr;
8484
if (generations_.size() + 1 == max_number_of_generations_) {
8585
// remove(free) the first generation
8686
newGeneration = generations_[0];
@@ -101,7 +101,7 @@ class LeastRecentlyUsedGenerationsCache final {
101101
}
102102

103103
template <typename EqualityType>
104-
const EntryT Get(EqualityType& key) { // NOLINT
104+
const EntryT Get(EqualityType &key) { // NOLINT
105105
EntryT state = current_generation_->Get(key);
106106

107107
if (!state.IsEmpty()) {
@@ -126,7 +126,7 @@ class LeastRecentlyUsedGenerationsCache final {
126126
*/
127127
void Clear() {
128128
current_generation_->Clear();
129-
for (MinimizationHash<EntryT>* generation : generations_) {
129+
for (MinimizationHash<EntryT> *generation : generations_) {
130130
delete generation;
131131
}
132132
generations_.clear();
@@ -148,8 +148,8 @@ class LeastRecentlyUsedGenerationsCache final {
148148
private:
149149
size_t size_per_generation_;
150150
size_t max_number_of_generations_;
151-
MinimizationHash<EntryT>* current_generation_;
152-
std::vector<MinimizationHash<EntryT>*> generations_;
151+
MinimizationHash<EntryT> *current_generation_;
152+
std::vector<MinimizationHash<EntryT> *> generations_;
153153
};
154154

155155
} /* namespace internal */

keyvi/include/keyvi/dictionary/fsa/internal/minimization_hash.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class MinimizationHash final {
180180
* @return the equal state or an empty value
181181
*/
182182
template <typename EqualityType>
183-
inline const T Get(EqualityType& key) const { // NOLINT
183+
inline const T Get(EqualityType &key) const { // NOLINT
184184
size_t hash = key.GetHashcode() & 0x7fffffff;
185185
size_t bucket = hash % hash_size_;
186186

@@ -209,7 +209,7 @@ class MinimizationHash final {
209209
* @return the equal state or an empty value
210210
*/
211211
template <typename EqualityType>
212-
inline const T GetAndMove(EqualityType& key, MinimizationHash<T>* other) { // NOLINT
212+
inline const T GetAndMove(EqualityType &key, MinimizationHash<T> *other) { // NOLINT
213213
size_t hash = key.GetHashcode() & 0x7fffffff;
214214
size_t bucket = hash % hash_size_;
215215
T entry = entries_[bucket];
@@ -325,10 +325,10 @@ class MinimizationHash final {
325325
size_t rehash_limit_ = 0;
326326

327327
/// the actual data storage
328-
T* entries_ = 0;
328+
T *entries_ = 0;
329329

330330
/// overflow data storage for colliding entries
331-
T* overflow_entries_ = 0;
331+
T *overflow_entries_ = 0;
332332

333333
/// number of items in the data
334334
size_t count_ = 0;
@@ -399,10 +399,10 @@ class MinimizationHash final {
399399
hash_size_ = hash_size_step_table_[hash_size_step_];
400400
rehash_limit_ = static_cast<int>(hash_size_ * load_factor_);
401401

402-
T* old_entries = entries_;
402+
T *old_entries = entries_;
403403
entries_ = new T[hash_size_];
404404

405-
T* old_overflow_entries = overflow_entries_;
405+
T *old_overflow_entries = overflow_entries_;
406406
overflow_entries_size_ = std::min(hash_size_ >> 2, max_cookie_size_);
407407
overflow_entries_ = new T[overflow_entries_size_];
408408

keyvi/include/keyvi/dictionary/fsa/state_traverser.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class StateTraverser final {
5555
this->operator++(0);
5656
}
5757

58-
StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT>&& payload,
58+
StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT> &&payload,
5959
const bool advance = true)
6060
: fsa_(f), current_weight_(0), current_label_(0), stack_(std::move(payload)) {
6161
current_state_ = start_state;
@@ -81,10 +81,10 @@ class StateTraverser final {
8181
}
8282

8383
StateTraverser() = delete;
84-
StateTraverser& operator=(StateTraverser const&) = delete;
85-
StateTraverser(const StateTraverser& that) = delete;
84+
StateTraverser &operator=(StateTraverser const &) = delete;
85+
StateTraverser(const StateTraverser &that) = delete;
8686

87-
StateTraverser(StateTraverser&& other)
87+
StateTraverser(StateTraverser &&other)
8888
: fsa_(other.fsa_),
8989
current_state_(other.current_state_),
9090
current_weight_(other.current_weight_),
@@ -182,13 +182,13 @@ class StateTraverser final {
182182

183183
template <class innerTraverserType>
184184
friend class ComparableStateTraverser;
185-
const traversal::TraversalStack<TransitionT>& GetStack() const { return stack_; }
185+
const traversal::TraversalStack<TransitionT> &GetStack() const { return stack_; }
186186

187-
traversal::TraversalState<transition_t>& GetStates() { return stack_.GetStates(); }
187+
traversal::TraversalState<transition_t> &GetStates() { return stack_.GetStates(); }
188188

189-
traversal::TraversalPayload<TransitionT>& GetTraversalPayload() { return stack_.traversal_stack_payload; }
189+
traversal::TraversalPayload<TransitionT> &GetTraversalPayload() { return stack_.traversal_stack_payload; }
190190

191-
const traversal::TraversalPayload<TransitionT>& GetTraversalPayload() const { return stack_.traversal_stack_payload; }
191+
const traversal::TraversalPayload<TransitionT> &GetTraversalPayload() const { return stack_.traversal_stack_payload; }
192192
};
193193

194194
/**

0 commit comments

Comments
 (0)