Last change
on this file since 451 was
395,
checked in by epyon, 10 years ago
|
- bulk update
copyright update
include guards cleanup
core/common.hh -> common.hh
minor cleanups
|
File size:
867 bytes
|
Rev | Line | |
---|
[319] | 1 | // Copyright (C) 2012-2014 ChaosForge Ltd
|
---|
[59] | 2 | // http://chaosforge.org/
|
---|
| 3 | //
|
---|
[395] | 4 | // This file is part of Nova libraries.
|
---|
| 5 | // For conditions of distribution and use, see copying.txt file in root folder.
|
---|
[59] | 6 |
|
---|
[319] | 7 | #include "nv/core/uid.hh"
|
---|
[59] | 8 |
|
---|
| 9 | using namespace nv;
|
---|
| 10 |
|
---|
[266] | 11 | uid_store_raw::uid_store_raw()
|
---|
[59] | 12 | : m_map(), m_current(0)
|
---|
| 13 | {
|
---|
| 14 |
|
---|
| 15 | }
|
---|
| 16 |
|
---|
[266] | 17 | void* uid_store_raw::get( uid auid ) const
|
---|
[59] | 18 | {
|
---|
| 19 | map::const_iterator i = m_map.find( auid );
|
---|
| 20 | if ( i != m_map.end() )
|
---|
| 21 | {
|
---|
| 22 | return i->second;
|
---|
| 23 | }
|
---|
| 24 | return nullptr;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
[266] | 27 | bool uid_store_raw::remove( uid auid )
|
---|
[59] | 28 | {
|
---|
| 29 | return m_map.erase( auid ) != 0;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[266] | 32 | void uid_store_raw::insert( void* o, uid auid )
|
---|
[59] | 33 | {
|
---|
| 34 | m_map[ auid ] = o;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[266] | 37 | uid uid_store_raw::insert( void* o )
|
---|
[59] | 38 | {
|
---|
| 39 | uid u = request_uid();
|
---|
| 40 | m_map[ u ] = o;
|
---|
| 41 | return u;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[266] | 44 | uid uid_store_raw::request_uid()
|
---|
[59] | 45 | {
|
---|
| 46 | return ++m_current;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
[266] | 49 | uid_store_raw::~uid_store_raw()
|
---|
[59] | 50 | {
|
---|
| 51 | // no-op
|
---|
| 52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.