Last change
on this file since 7 was
7,
checked in by epyon, 12 years ago
|
- resource base class
- resource_manager auto_singleton (universal)
|
File size:
813 bytes
|
Rev | Line | |
---|
[7] | 1 | // Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
|
---|
| 2 | // http://chaosforge.org/
|
---|
| 3 | //
|
---|
| 4 | // This file is part of NV Libraries.
|
---|
| 5 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
| 6 |
|
---|
| 7 | #include <nv/resource_manager.hh>
|
---|
| 8 |
|
---|
| 9 | using namespace nv;
|
---|
| 10 |
|
---|
| 11 | resource_manager::resource_manager()
|
---|
| 12 | {
|
---|
| 13 |
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | resource::ptr resource_manager::get_raw_resource(uint32 id) const
|
---|
| 17 | {
|
---|
| 18 | return m_data[ id ];
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | resource::ptr resource_manager::get_raw_resource(const std::string& id) const
|
---|
| 22 | {
|
---|
| 23 | auto i = m_id_map.find( id );
|
---|
| 24 | if ( i != m_id_map.end() )
|
---|
| 25 | {
|
---|
| 26 | return m_data[ i->second ];
|
---|
| 27 | }
|
---|
| 28 | return resource::ptr();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | void resource_manager::register_resource_type( const std::string& name, resource_constructor_func c )
|
---|
| 32 | {
|
---|
| 33 | m_constructors[ name ] = c;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | resource_manager::~resource_manager()
|
---|
| 37 | {
|
---|
| 38 |
|
---|
| 39 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.