source: trunk/src/core/uid.cc @ 534

Last change on this file since 534 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
9using namespace nv;
10
11uid_store_raw::uid_store_raw()
12        : m_map(), m_current(0)
13{
14       
15}
16
17void* 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
27bool uid_store_raw::remove( uid auid )
28{
29        return m_map.erase( auid ) != 0;
30}
31
32void uid_store_raw::insert( void* o, uid auid )
33{
34        m_map[ auid ] = o;
35}
36
37uid uid_store_raw::insert( void* o )
38{
39        uid u = request_uid();
40        m_map[ u ] = o;
41        return u;
42}
43
44uid uid_store_raw::request_uid()
45{
46        return ++m_current;
47}
48
49uid_store_raw::~uid_store_raw()
50{
51        // no-op
52}
Note: See TracBrowser for help on using the repository browser.