|
Project
|
Set of Category datastructure. More...
#include <Categories.h>
Public Member Functions | |
| Categories (int number_of_categories=2, std::string prefix="cat") | |
| Categories (std::vector< std::string > vect_category_ids) | |
| Categories (const Categories &categories) | |
| std::vector< int > | getRankCategories () |
| void | setRankCategories (std::vector< int > &set_ranks) |
| void | setRankCategories () |
| std::vector< std::string > | getIdCategories () |
| void | setIdCategories (std::string prefix) |
| void | setIdCategories (std::vector< std::string > &set_category_ids) |
| Category | getCategoryOfRank (int rank) |
| int | getNumberCategories () |
| Category | operator[] (int index) |
| Category | operator[] (int index) const |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Categories &categories) |
Set of Category datastructure.
The Categories datastructure represents a full set of category, well formatted to be used in the problem. It is implemented with a c++ Vector.
It is used to represents all the category defined in a dataset. Each category must be different for all the others, and more specifically, the rank must be correctly defined such that we can decide which category is better when comparing two single categories. Futhermore, the categories must be ranked such that when itterating over the categories, we go from the best one (higest rank) to the lowest one. Therefore, categories[0] always represents the best category of the set.
| Categories::Categories | ( | int | number_of_categories = 2, |
| std::string | prefix = "cat" |
||
| ) |
Categories standard constructor 1
| number_of_categories | number of categories wanted |
| prefix | prefix given to each category ids. |
| Categories::Categories | ( | std::vector< std::string > | vect_category_ids | ) |
Categories standard constructor 2
| vect_category_ids | vector of category ids |
| Categories::Categories | ( | const Categories & | categories | ) |
Categories constructor by copy
| number_of_categories | number of categories wanted |
| Category Categories::getCategoryOfRank | ( | int | rank | ) |
getCategoryOfRank get the category corresponding to the requested rank in the vector.
| rank | rank of the category to return |
| std::vector<std::string> Categories::getIdCategories | ( | ) |
Getter all the ids from Categories object
| int Categories::getNumberCategories | ( | ) |
Set a new values of Category ids from Categories object
| set_category_ids | vector of new Category id for Categories object |
| std::vector<int> Categories::getRankCategories | ( | ) |
Getter all the ranks from Categories object
| Category Categories::operator[] | ( | int | index | ) |
Overloading [] operator for Categories
| index | index of the object we want |
| void Categories::setIdCategories | ( | std::string | prefix | ) |
Set a new values of Category ids from Categories object
| prefix | prefix given to Category ids. |
| void Categories::setIdCategories | ( | std::vector< std::string > & | set_category_ids | ) |
Set a new values of Category ids from Categories object
| set_category_ids | vector of new Category id for Categories object |
| void Categories::setRankCategories | ( | ) |
Setter all the ranks from Categories object Ranks start at 0 and end until length of Categories vector.
| void Categories::setRankCategories | ( | std::vector< int > & | set_ranks | ) |
Setter all the ranks from Categories object
| set_ranks | vector of new category ranks |
|
friend |
Overloading << operator for Categories class
| out | ostream |
| categories | Categories object |