Loading...
Searching...
No Matches
bsdf_import.h
Go to the documentation of this file.
1#ifndef _BBM_BSDF_IMPORT_H_
2#define _BBM_BSDF_IMPORT_H_
3
4#include "concepts/config.h"
5#include "bbm/bsdf_ptr.h"
6
7/************************************************************************/
8/*! \file bsdf_import.h
9
10 \brief Import a BSDF from a string using the BBM_DEFAULT_BSDF_IMPORTER
11 method specified in the configuration.
12************************************************************************/
13
14#ifdef BBM_STRING_BSDF_IMPORTER
15
16#include "core/stringconvert.h"
17
18namespace bbm {
19 /*********************************************************************/
20 /*! \brief Import a bsdf_ptr from a string using bbm::fromString
21 *********************************************************************/
22 template<typename CONF> requires concepts::config<CONF>
23 auto bsdf_import(const std::string& str)
24 {
25 return bbm::fromString<bsdf_ptr<CONF>>(str);
26 }
27} // end bbm namepsace
28#endif /* BBM_STRING_BSDF_IMPORTER */
29
30
31#if defined(BBM_PYTHON_BSDF_IMPORTER) and !defined(BBM_CONFIG)
32
34
35namespace bbm {
36 /**********************************************************************/
37 /*! \brief Import a bsdf_ptr using the python interpreter
38 **********************************************************************/
39 template<typename CONF> requires concepts::config<CONF>
40 auto bsdf_import(const std::string& str)
41 {
42 return python::capture<bsdf_ptr<CONF>>(str);
43 }
44} // end bbm namespace
45#endif /* BBM_PYTHON_BSDF_IMPORTER && BBM_CONFIG */
46
47
48#if defined(BBM_PYTHON_BSDF_IMPORTER) and defined(BBM_CONFIG)
49
51
52namespace bbm {
53 /**********************************************************************/
54 /*! \brief Import a bsdf_ptr using the EMBEDDED python interpreter
55
56 Note: CONF must match the embdded configuration (BBM_CONFIG)
57 **********************************************************************/
58 template<typename CONF> requires concepts::config<CONF> && concepts::matching_config<CONF, BBM_CONFIG>
59 auto bsdf_import(const std::string& str)
60 {
61 return embed::capture<bsdf_ptr<CONF>>(str);
62 }
63} // end bbm nanespace
64#endif /* BBM_PYTHON_BSDF_IMPORTER */
65
66
67#endif /* _BBM_BSDF_IMPORT_H */
A shared_ptr wrapper for bsdfs.
Embed a static python module in the executable.
Python interpreter for BBM modules.
config contract
Convert a string to an object and vice versa.
Definition: aggregatebsdf.h:29