RuntimeId.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class Me >
5 runtime_id::Dictionary * RuntimeId< Me >::dict()
6 {
7  return Me::Dictionary.dict();
8 }
9 
10 template< class Me >
12  _runtime_value( runtime_id::Dictionary::InvalidRuntimeId )
13 {
14 }
15 
16 template< class Me >
18  _runtime_value( dict()->runtime_validate( runtime ) )
19 {
20 }
21 
22 template< class Me >
23 RuntimeId< Me >::RuntimeId( const char * persistent ) :
24  _runtime_value( dict()->persistent_to_runtime( persistent ) )
25 {
26 }
27 
28 template< class Me >
29 RuntimeId< Me >::RuntimeId( const char * persistent, Context * context ) :
30  _runtime_value( dict()->persistent_to_runtime( persistent ) )
31 {
32  if( !this->valid() )
33  RuntimeId_WarningIdDoesNotExist( context, Me::TypeName, persistent );
34 }
35 
36 template< class Me >
37 Me RuntimeId< Me >::create( const char * persistent_name )
38 {
39  return Me( dict()->create( persistent_name, Me::TypeName ) );
40 }
41 
42 template< class Me >
44 {
45  dict()->lock();
46 }
47 
48 template< class Me >
50 {
51  return dict()->ids_count();
52 }
53 
54 template< class Me >
56 {
57  return this->_runtime_value;
58 }
59 
60 template< class Me >
62 {
63  return dict()->runtime_to_persistent( this->_runtime_value );
64 }
65 
66 template< class Me >
68 {
69  return this->_runtime_value != runtime_id::Dictionary::InvalidRuntimeId;
70 }
71 
72 template< class Me >
73 bool RuntimeId< Me >::operator==( Me const & other ) const
74 {
75  return this->_runtime_value == other._runtime_value;
76 }
77 
78 template< class Me >
79 bool RuntimeId< Me >::operator!=( Me const & other ) const
80 {
81  return this->_runtime_value != other._runtime_value;
82 }
83 
84 template< class Me >
85 bool RuntimeId< Me >::operator<( Me const & other ) const
86 {
87  return this->_runtime_value < other._runtime_value;
88 }
89 
90 //------ io --------------------
91 template< class Me >
92 std::ostream & operator<<( std::ostream & out, RuntimeId< Me > const & id )
93 {
94  return ( out << id.persistent_value() );
95 }
96 
97 }