cuda-api-wrappers icon indicating copy to clipboard operation
cuda-api-wrappers copied to clipboard

Structure 'attributes' and 'properties' better, using container-like facades and proxies

Open eyalroz opened this issue 1 year ago • 0 comments

Many of our the objects we wrap in the library have all sorts of "attributes" or "properties", with API functions for getting and setting them.

At the moment, we reflect this almost as-is, with set_whatever() and get_whatever() (or just ::whatever() if it's a method) for attributes named "whatever", or set(attribute_enum_t attribute, attribute_value_t value) and get(attribute_enum_t attribute).

This is overly-verbose and non-idiomatic. We should:

  1. Utilize proxies fort such attributes and properties, such that assigning to them triggers a set_ function and using their value triggers a get_.
  2. For the many-attribute case, have a map of these proxies, with each value being the proxy mentioned above; and an ability to access them using an expression such as: my_wrapped_object.attributes[whatever].

eyalroz avatar Jan 23 '24 08:01 eyalroz