cgv
find_reflection_handler.h
1 #pragma once
2 
3 #include "reflection_handler.h"
4 #include <cgv/utils/token.h>
5 
6 #include "lib_begin.h"
7 
8 namespace cgv {
9  namespace reflect {
10 
19 {
20 private:
21  std::vector<cgv::utils::token> tokens;
22  unsigned token_idx;
23  bool at_end() const;
24  bool step_if_matches(const std::string& name);
25 
26 protected:
27  const std::string* target;
28  const void* target_ptr;
29  struct group_info {
30  std::string group_name;
31  void* group_ptr;
33  GroupKind group_kind;
34  unsigned group_size;
35  };
36  bool traverse_matched_groups;
37  std::vector<group_info> traversed_groups;
38  void push_group(const std::string& _group_name, void* _group_ptr, abst_reflection_traits* _rt, GroupKind _group_kind, unsigned _group_size = -1);
39  void check_for_index_increment();
40  std::vector<std::string> target_tokens;
41  bool found;
42  bool valid;
43  std::string member_name;
45  void* member_ptr;
46  GroupKind group_kind;
47  unsigned grp_size;
48 
49 public:
51  find_reflection_handler(const std::string& _target);
53  find_reflection_handler(const void* _target_ptr, bool _traverse_matched_groups);
57  bool found_target() const;
59  bool found_valid_target() const;
61  void* get_member_ptr() const;
63  const std::string& get_member_name() const;
65  abst_reflection_traits* get_reflection_traits() const;
67  virtual void process_member_void(const std::string& member_name, void* member_ptr,
68  abst_reflection_traits* rt, GroupKind group_kind = GK_NO_GROUP, unsigned grp_size = -1);
70  int reflect_group_begin(GroupKind group_kind, const std::string& group_name, void* group_ptr,
71  abst_reflection_traits* rt, unsigned grp_size);
72 
74  void reflect_group_end(GroupKind group_kind);
76  bool reflect_member_void(const std::string& member_name, void* member_ptr, abst_reflection_traits* rt);
78  bool reflect_method_void(const std::string& method_name, method_interface* mi_ptr,
79  abst_reflection_traits* return_traits, const std::vector<abst_reflection_traits*>& param_value_traits);
80 };
81  }
82 }
83 
84 #include <cgv/config/lib_end.h>
cgv::reflect::find_reflection_handler
Definition: find_reflection_handler.h:19
cgv::reflect::abst_reflection_traits
abstract interface for type reflection with basic type management and optional string conversion
Definition: reflection_traits.h:24
cgv::reflect::method_interface
Definition: reflection_handler.h:24
cgv::reflect::reflection_handler
Definition: reflection_handler.h:63
cgv::math::reflect
vec< T > reflect(const vec< T > &v, const vec< T > &n)
calculates the reflected direction of v; n is the normal of the reflecting surface
Definition: vec.h:822
cgv
the cgv namespace
Definition: vr_calib.cxx:9