Last change
on this file since 395 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
|
Line | |
---|
1 | // Copyright (C) 2012-2014 ChaosForge Ltd
|
---|
2 | // http://chaosforge.org/
|
---|
3 | //
|
---|
4 | // This file is part of Nova libraries.
|
---|
5 | // For conditions of distribution and use, see copying.txt file in root folder.
|
---|
6 |
|
---|
7 | #include "nv/core/uid.hh"
|
---|
8 |
|
---|
9 | using namespace nv;
|
---|
10 |
|
---|
11 | uid_store_raw::uid_store_raw()
|
---|
12 | : m_map(), m_current(0)
|
---|
13 | {
|
---|
14 |
|
---|
15 | }
|
---|
16 |
|
---|
17 | void* uid_store_raw::get( uid auid ) const
|
---|
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 |
|
---|
27 | bool uid_store_raw::remove( uid auid )
|
---|
28 | {
|
---|
29 | return m_map.erase( auid ) != 0;
|
---|
30 | }
|
---|
31 |
|
---|
32 | void uid_store_raw::insert( void* o, uid auid )
|
---|
33 | {
|
---|
34 | m_map[ auid ] = o;
|
---|
35 | }
|
---|
36 |
|
---|
37 | uid uid_store_raw::insert( void* o )
|
---|
38 | {
|
---|
39 | uid u = request_uid();
|
---|
40 | m_map[ u ] = o;
|
---|
41 | return u;
|
---|
42 | }
|
---|
43 |
|
---|
44 | uid uid_store_raw::request_uid()
|
---|
45 | {
|
---|
46 | return ++m_current;
|
---|
47 | }
|
---|
48 |
|
---|
49 | uid_store_raw::~uid_store_raw()
|
---|
50 | {
|
---|
51 | // no-op
|
---|
52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.