Tools for easy creation of a constructors. More...
#include "concepts/bsdf_attribute.h"#include "util/type_traits.h"#include "util/reflection.h"#include "core/args.h"Go to the source code of this file.
Namespaces | |
| namespace | bbm |
Macros | |
| #define | BBM_DEFAULT_CONSTRUCTOR(ClassName) |
| Helper macro to define a default constructor based on Attribute reflection. | |
| #define | BBM_CONSTRUCTOR(ClassName, Args, ...) |
| Helper macro for declaring a constructor based on a list of bbm::arg. | |
Typedefs | |
| template<typename TUP > | |
| using | attribute_tuple_to_args_t = typename bbm::detail::attribute_tuple_to_args_t< std::decay_t< TUP > >::type |
| Convert an attribute_tuple_t to a bbm::args. | |
Tools for easy creation of a constructors.
Case 1: a constructor that initializes all class attributes (requires bbm::refletion::attribute<T>)
where 'foo' is the class name, and body is a custom constructor body executed after Attributes have been declared. The constructor uses bbm::args to pass the arguments.
Case 2: declare a constructor that takes a list of bbm::arg
where 'foo' is again the class name, 'args' is the name given to the bbm::args passed as constructor arguments, followed by a list of bbm::arg (or a single bbm::args).
| #define BBM_CONSTRUCTOR | ( | ClassName, | |
| Args, | |||
| ... | |||
| ) |
Helper macro for declaring a constructor based on a list of bbm::arg.
| ClassName | = name of constructor/class |
| Args | = name to give to bbm::args to access the arguments. |
| ... | = lots of bbm::arg (or a defintion of a single bbm::args) used to define the arguments to the constructor |
Creates a constructor (with forwarding) that takes a single bbm::args as input. Use BBM_IMPORT_ARGS to create aliases in the body of the constructor of the passed arguments. A constructor_args_t is also created with the signature of the bbm::args.
Example:
This example creates a constructor which is equivalent to the regular C++ constructor foo(float a, float b).
| #define BBM_DEFAULT_CONSTRUCTOR | ( | ClassName | ) |
Helper macro to define a default constructor based on Attribute reflection.
| ClassName | = name of the constructor/class |
Creates a constructor that initializes the reflected attributes. The constructor uses bbm::args to pass the constructor arguments. The bbm::args signature is stored in an accessible constructor_args_t alias.
The constructor will copy the corresponding bbm::args to the reflected attributes in the constructor body.
Limitations:
Example: