1#ifndef _BBM_BSDF_STRING_CONVERT_H_
2#define _BBM_BSDF_STRING_CONVERT_H_
25 template<
typename BSDF_PTR>
requires concepts::bsdf_ptr<BSDF_PTR>
33 static inline std::string
toString(
const BSDF_PTR& obj) {
return obj.toString(); }
52 static inline BSDF_PTR
fromString(
const std::string& str)
58 #include
"bbm_bsdfmodels.h"
68 return binary_search_named(key, dict, []<
size_t IDX,
typename NAMED>(
const std::string& key, NAMED&&
named,
const std::string& str) -> BSDF_PTR
71 if constexpr (IDX == std::decay_t<NAMED>::size)
throw std::invalid_argument(std::string(
"BBM: unrecognized bsdf_ptr type ") + key +
" in: " + str);
75 if(key != std::string(std::decay_t<NAMED>::template name<IDX>))
throw std::invalid_argument(std::string(
"BBM: unrecognized bsdf_ptr type ") + key +
" in: " + str);
A run-time aggregation of BSDFs.
Connects a BSDF model and a BSDF.
A shared_ptr wrapper for bsdfs.
fromString support for BBM
A BSDF that is the aggregate of different BSDFs.
Definition: aggregatebsdf.h:39
Clears and defines the export macros.
Convert a string to an object and vice versa.
std::pair< std::string, std::string > get_keyword(const std::string &str)
Return the keyword substring appearing an open bracket, and the arguments appearing in the brackets: ...
Definition: string_util.h:65
Definition: aggregatebsdf.h:29
constexpr auto named_cat(T &&... t)
cat named types
Definition: named_util.h:40
constexpr named< anonymize_t< T >, NAMES... > make_named(T &&t)
Make a named of a gettable type (with size == #NAMES); renames if the type is a named container.
Definition: named.h:293
constexpr auto sort_named(NAMED &&named, PARTIAL &&partial=PARTIAL{})
sort a named tuple by name using insert-sort.
Definition: named_util.h:251
auto binary_search_named(const std::string &str, NAMED &&named, PROCESS &&process, Ts &&... context)
Run-time binary search for a matching name in a named tuple based on a string. The (index of the) fou...
Definition: named_util.h:359
T fromString(const std::string &)
fromString alias
Definition: stringconvert.h:584
decltype(auto) value(T &&t)
return the value of an attribute, or if not an attribute the object
Definition: attribute_value.h:20
bsdf_ptr< get_config< BSDFTYPE > > make_bsdf_ptr(ARGS... args)
Helper method for making a bsdf_ptr from a BSDF (new construction)
Definition: bsdf_ptr.h:180
named container
Definition: named.h:131
static BSDF_PTR fromString(const std::string &str)
fromString converts a string to a bsdf_ptr to a bsfmodel.
Definition: bsdf_string_convert.h:52
BBM_IMPORT_CONFIG(BSDF_PTR)
static std::string toString(const BSDF_PTR &obj)
toString: forward to toStrig method of bsdf_ptr
Definition: bsdf_string_convert.h:33
forward decalaration
Definition: stringconvert.h:47