visitor draft - #4786
Conversation
|
|
||
| Any::register_visitor<InterfaceType, InterfaceVisitor>([] (auto value, auto visitor) { | ||
| visitor->value = value; | ||
| }); |
There was a problem hiding this comment.
i think the idea is to put this in watch_param? @vigsterkr
vigsterkr
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.