Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1144: add names for basic types #229

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/search/plugins/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,16 @@ EmptyListType TypeRegistry::EMPTY_LIST_TYPE;
BasicType TypeRegistry::NO_TYPE = BasicType(typeid(void), "<no type>");

TypeRegistry::TypeRegistry() {
insert_basic_type<bool>();
insert_basic_type<string>();
insert_basic_type<int>();
insert_basic_type<double>();
insert_basic_type<bool>("bool");
insert_basic_type<string>("string");
insert_basic_type<int>("int");
insert_basic_type<double>("double");
}

template<typename T>
void TypeRegistry::insert_basic_type() {
void TypeRegistry::insert_basic_type(const string &name) {
type_index type = typeid(T);
registered_types[type] = utils::make_unique_ptr<BasicType>(type, utils::get_type_name<T>());
registered_types[type] = utils::make_unique_ptr<BasicType>(type, name);
}

const FeatureType &TypeRegistry::create_feature_type(const CategoryPlugin &plugin) {
Expand Down
2 changes: 1 addition & 1 deletion src/search/plugins/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class TypeRegistry {
std::unordered_map<const Type *, std::unique_ptr<ListType>,
SemanticHash, SemanticEqual> registered_list_types;
template<typename T>
void insert_basic_type();
void insert_basic_type(const std::string &name);
const Type &get_nonlist_type(std::type_index type) const;
public:
static BasicType NO_TYPE;
Expand Down
Loading