Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
experiments.h
1 /*
2  Lightmetrica : A research-oriented renderer
3 
4  Copyright (c) 2014 Hisanari Otsu
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 #ifndef LIB_LIGHTMETRICA_EXPERIMENTS_H
22 #define LIB_LIGHTMETRICA_EXPERIMENTS_H
23 
24 #include "common.h"
25 #include <string>
26 
27 LM_NAMESPACE_BEGIN
28 
29 class ConfigNode;
30 class Assets;
31 
37 class LM_PUBLIC_API Experiments
38 {
39 public:
40 
41  Experiments() {}
42  virtual ~Experiments() {}
43 
44 private:
45 
46  LM_DISABLE_COPY_AND_MOVE(Experiments);
47 
48 public:
49 
56  virtual bool Configure(const ConfigNode& node, const Assets& assets) = 0;
57 
62  virtual void Notify(const std::string& type) = 0;
63 
69  virtual void UpdateParam(const std::string& name, const void* param) = 0;
70 
76  virtual bool CheckConfigured() = 0;
77 
78 };
79 
80 LM_NAMESPACE_END
81 
82 #if LM_EXPERIMENTAL_MODE
83 
84  #define LM_EXPT_NOTIFY(expts, type) \
85  do { \
86  if (expts.CheckConfigured()) \
87  expts.Notify(type); \
88  } while (0)
89 
90  #define LM_EXPT_UPDATE_PARAM(expts, name, param) \
91  do { \
92  if (expts.CheckConfigured()) \
93  expts.UpdateParam(name, param); \
94  } while (0)
95 
96 #else
97 
98  #define LM_EXPT_NOTIFY(expts, type)
99  #define LM_EXPT_UPDATE_PARAM(expts, name, param)
100 
101 #endif
102 
103 #endif // LIB_LIGHTMETRICA_EXPERIMENTS_H
Definition: assets.h:39
Definition: experiments.h:37
Definition: confignode.h:37