Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
assets.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_ASSETS_H
22 #define LIB_LIGHTMETRICA_ASSETS_H
23 
24 #include "component.h"
25 #include "asset.h"
26 #include <functional>
27 #include <vector>
28 #include <boost/signals2.hpp>
29 
30 LM_NAMESPACE_BEGIN
31 
32 class Asset;
33 class ConfigNode;
34 
39 class Assets : public Component
40 {
41 public:
42 
43  LM_COMPONENT_INTERFACE_DEF("assets");
44 
45 public:
46 
47  Assets() {}
48  virtual ~Assets() {}
49 
50 private:
51 
52  LM_DISABLE_COPY_AND_MOVE(Assets);
53 
54 public:
55 
63  virtual bool Load(const ConfigNode& node) = 0;
64 
71  virtual Asset* GetAssetByName(const std::string& name) const = 0;
72 
78  virtual boost::signals2::connection Connect_ReportProgress(const std::function<void (double, bool)>& func) = 0;
79 
93  virtual bool RegisterInterface(const std::string& interfaceName, const std::string& interfaceGroupName, const std::vector<std::string>& dependencies) = 0;
94 
104  template <typename AssetInterfaceType>
105  bool RegisterInterface();
106 
107 public:
108 
117  LM_PUBLIC_API Asset* ResolveReferenceToAsset(const ConfigNode& node, const std::string& type) const;
118 
126  template <typename AssetInterfaceType>
127  AssetInterfaceType* ResolveReferenceToAsset(const ConfigNode& node) const;
128 
129 };
130 
131 LM_NAMESPACE_END
132 
133 #include "assets.inl"
134 
135 #endif // LIB_LIGHTMETRICA_ASSETS_H
Definition: component.h:45
bool RegisterInterface()
Definition: assets.h:39
LM_PUBLIC_API Asset * ResolveReferenceToAsset(const ConfigNode &node, const std::string &type) const
Definition: assets.cpp:279
virtual bool Load(const ConfigNode &node)=0
Definition: asset.h:35
virtual Asset * GetAssetByName(const std::string &name) const =0
virtual boost::signals2::connection Connect_ReportProgress(const std::function< void(double, bool)> &func)=0
Definition: confignode.h:37