Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
stub.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_TEST_STUB_ASSETS_H
22 #define LIB_LIGHTMETRICA_TEST_STUB_ASSETS_H
23 
24 #include "common.h"
25 #include <lightmetrica/assets.h>
26 #include <lightmetrica/asset.h>
27 #include <string>
28 #include <memory>
29 #include <boost/unordered_map.hpp>
30 
31 LM_NAMESPACE_BEGIN
32 LM_TEST_NAMESPACE_BEGIN
33 
34 class StubAssets : public Assets
35 {
36 public:
37 
38  LM_COMPONENT_IMPL_DEF("stub");
39 
40 public:
41 
42  virtual bool Load( const ConfigNode& node ) { return true; }
43  virtual Asset* GetAssetByName(const std::string& name) const { return assetInstanceMap.at(name).get(); }
44  virtual boost::signals2::connection Connect_ReportProgress( const std::function<void (double, bool ) >& func) { return boost::signals2::connection(); }
45  virtual bool RegisterInterface( const std::string& interfaceName, const std::string& interfaceGroupName, const std::vector<std::string>& dependencies ) { return true; }
46 
47 public:
48 
49  void Add(const std::string& id, Asset* asset) { assetInstanceMap[id] = std::unique_ptr<Asset>(asset); }
50 
51 protected:
52 
53  boost::unordered_map<std::string, std::unique_ptr<Asset>> assetInstanceMap;
54 
55 };
56 
57 LM_TEST_NAMESPACE_END
58 LM_NAMESPACE_END
59 
60 #endif // LIB_LIGHTMETRICA_TEST_STUB_ASSETS_H
Definition: stub.assets.h:34
virtual Asset * GetAssetByName(const std::string &name) const
Definition: stub.assets.h:43
virtual bool Load(const ConfigNode &node)
Definition: stub.assets.h:42
Definition: assets.h:39
Definition: asset.h:35
virtual bool RegisterInterface(const std::string &interfaceName, const std::string &interfaceGroupName, const std::vector< std::string > &dependencies)
Definition: stub.assets.h:45
Definition: confignode.h:37