-
-
Notifications
You must be signed in to change notification settings - Fork 1k
visitor draft #4786
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
visitor draft #4786
Conversation
src/shogun/base/SGObject.h
Outdated
|
|
||
| Any::register_visitor<InterfaceType, InterfaceVisitor>([] (auto value, auto visitor) { | ||
| visitor->value = value; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the idea is to put this in watch_param? @vigsterkr
vigsterkr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to think about how to deal with arrays
| { | ||
| auto* result = sgo_details::get_by_tag(this, name, sgo_details::GetByNameIndex(index)); | ||
| //auto* result = sgo_details::get_by_tag(this, name, sgo_details::GetByNameIndex(index)); | ||
| auto* result = sgo_details::get_by_tag(this, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem here that imo this ignores the index parameter. so the visitor that you've written only works in the expected manner for CSGObject::get(std::string_view name, std::nothrow_t). i need to see how we support get CSGObject* CSGObject::get(std::string_view name, index_t index) const. that's basically when the registered parameter is an array
| { | ||
| return get_dispatch_all_base_types(obj, name, how); | ||
| } | ||
| CSGObject* get_by_tag(const CSGObject* obj, std::string_view name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this whole thing could be deleted and go into a private function that is implemented in .cpp
| BaseTag tag(name); | ||
| create_parameter(tag, AnyParameter(make_any_ref(value), properties)); | ||
|
|
||
| if constexpr (is_sg_base<T>::value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo if you wrap this whole block into a constexpr function then you could just call that instead of copy pasting things 4 times.
| #endif // DOXYGEN_SHOULD_SKIP_THIS | ||
| #endif // SWIG | ||
|
|
||
| struct InterfaceVisitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be better to place into a separate .h file and include it here. place it under src/shogun/util/visitors
No description provided.