Link.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 //=================== Link ==============================
5 template< class Target >
7  _target( nullptr )
8 {
9 }
10 
11 template< class Target >
12 Link< Target >::Link( Target * target ) :
13  _target( target )
14 {
15 }
16 
17 template< class Target >
18 void Link< Target >::set( Target * tgt )
19 {
20  this->_target = tgt;
21 }
22 
23 template< class Target >
25 {
26  return this->_target;
27 }
28 
29 template< class Target >
31 {
32  return this->_target;
33 }
34 
35 template< class Target >
37 {
38  return this->_target;
39 }
40 
41 //=================== VLink ==============================
42 template< class Target >
43 VLink::VLink( Target * target ) :
44  _type( typeid( std::decay_t< Target >() ) ),
45  _target( reinterpret_cast< void * >( target ) )
46 {
47 }
48 
49 template< class Target >
50 Target * VLink::get()
51 {
52  if( this->_type != std::decay_t< Target >() )
53  return nullptr;
54  return reinterpret_cast< Target * >( this->_target );
55 }
56 
57 template< class Target >
58 void VLink::set( Target * target )
59 {
60  this->_type = typeid( std::decay_t< Target >() );
61  this->_target = reinterpret_cast< void * >( target );
62 }
63 
64 }