17#include "utility/utility.h"
22const category_info category_info::null = {};
35 for (
const auto &c : cols)
38 if (c.domain == d_void)
39 id = undefined_category;
40 else if (t == typing::strong || c.domain == d_string)
44 const auto it(std::find_if(begin(), end(),
45 [target = c.domain](
const auto &x)
47 return x.domain == target;
50 if (it == columns_.end())
56 columns_.push_back({id, c.domain, c.name});
66 const auto it(std::find_if(begin(), end(),
71 return it == columns_.end() ? category_info::null : *it;
80 Expects(i < columns_.size());
90 const auto it(std::find_if(begin(), end(),
93 return e.name == name;
95 return it == columns_.end() ? category_info::null : *it;
103 std::set<category_t> ret;
105 std::transform(begin(), end(), std::inserter(ret, ret.end()),
106 [](
const auto &c) { return c.category; });
117 for (std::size_t i(0); i < columns_.size(); ++i)
118 if (!columns_[i].name.empty())
119 for (std::size_t j(i + 1); j < columns_.size(); ++j)
120 if (columns_[j].name == columns_[i].name)
124 for (std::size_t i(0); i < columns_.size(); ++i)
125 if (columns_[i].
category == undefined_category
126 && columns_[i].domain != d_void)
130 for (std::size_t i(0); i < columns_.size(); ++i)
133 const domain_t domain(columns_[i].domain);
135 for (std::size_t j(i + 1); j < columns_.size(); ++j)
152 return s << c.name <<
" (category " << c.category <<
", domain " << c.domain;
164 return lhs.category == rhs.category && lhs.domain == rhs.domain
165 && lhs.name == rhs.name;
const category_info & category(category_t) const
const category_info & column(std::size_t) const
std::set< category_t > used_categories() const
category_set(const dataframe::columns_info &, typing=typing::weak)
Builds a category_set extracting data from a columns_info object.
Information about the collection of columns (type, name, output index).
The main namespace for the project.
typing
Category/type management of the dataframe columns.
domain_t
In an environment where a symbol such as '+' may have many different meanings, it's useful to specify...
std::size_t category_t
A category provide operations which supplement or supersede those of the domain but which are restric...
std::ostream & operator<<(std::ostream &o, hash_t h)
Mainly useful for debugging / testing.