1 #ifndef BARRY_RULES_MEAT_HPP
2 #define BARRY_RULES_MEAT_HPP 1
4 template <
typename Array_Type,
typename Data_Type>
11 for (
auto i = 0u;
i != rules_.
size(); ++
i)
12 this->add_rule(rules_.data[
i]);
18 template <
typename Array_Type,
typename Data_Type>
23 if (
this != &rules_) {
27 for (
auto i = 0u;
i != rules_.
size(); ++
i)
28 this->add_rule(rules_.data[
i]);
36 template<
typename Array_Type,
typename Data_Type>
42 template<
typename Array_Type,
typename Data_Type>
44 return fun(a,
i,
j, dat);
47 template<
typename Array_Type,
typename Data_Type>
53 template<
typename Array_Type,
typename Data_Type>
59 template<
typename Array_Type,
typename Data_Type>
65 template<
typename Array_Type,
typename Data_Type>
71 template <
typename Array_Type,
typename Data_Type>
81 template <
typename Array_Type,
typename Data_Type>
86 std::string description_
100 template <
typename Array_Type,
typename Data_Type>
102 const Array_Type & a,
size_t i,
size_t j
109 if (!f.operator()(a,
i,
j))
116 template <
typename Array_Type,
typename Data_Type>
118 const Array_Type & a,
119 std::vector< size_t > * free,
120 std::vector< size_t > * locked
128 (void) free->empty();
129 (void) free->reserve(2u * N * K);
131 for (
size_t i = 0u;
i < N; ++
i)
134 for (
size_t j = 0u;
j < K; ++
j)
138 if (!this->
operator()(a,
i,
j))
141 if (locked !=
nullptr)
144 locked->push_back(
i);
145 locked->push_back(
j);
160 free->shrink_to_fit();
166 template<
typename Array_Type,
typename Data_Type>
170 std::vector< std::string > out;
171 out.reserve(this->size());
172 for (
size_t i = 0u;
i < this->size(); ++
i)
173 out.push_back(
this->data.at(
i).get_name());
179 template<
typename Array_Type,
typename Data_Type>
183 std::vector< std::string > out;
184 out.reserve(this->size());
185 for (
size_t i = 0u;
i < out.size(); ++
i)
186 out.push_back(
data.at(
i).get_description());
Rule for determining if a cell should be included in a sequence.
bool operator()(const Array_Type &a, size_t i, size_t j)
Data_Type & D()
Read/Write access to the data.
std::string & get_description()
Vector of objects of class Rule.
size_t size() const noexcept
bool operator()(const Array_Type &a, size_t i, size_t j)
Check whether a given cell is free or locked.
void add_rule(Rule< Array_Type, Data_Type > rule)
std::vector< std::string > get_descriptions() const
void get_seq(const Array_Type &a, std::vector< size_t > *free, std::vector< size_t > *locked=nullptr)
Computes the sequence of free and locked cells in an BArray.
std::vector< std::string > get_names() const
Rules< Array_Type, Data_Type > operator=(const Rules< Array_Type, Data_Type > &rules_)
Data_Type &&counter_ desc(std::move(counter_.desc))
Move constructor.
Data_Type &&counter_ name(std::move(counter_.name))
Data_Type &&counter_ data(std::move(counter_.data))
Data_Type Counter_fun_type< Array_Type, Data_Type > Hasher_fun_type< Array_Type, Data_Type > Data_Type std::string name_
Data_Type Counter_fun_type< Array_Type, Data_Type > Hasher_fun_type< Array_Type, Data_Type > Data_Type data_
std::function< bool(const Array_Type &, size_t, size_t, Data_Type &)> Rule_fun_type