blob: c6708b715ae91003ad980d97f7a788b5a53adc2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// file : odb/session.ixx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#include <odb/exceptions.hxx>
namespace odb
{
template <typename T>
inline void session::
erase (const object_position<T>& p)
{
// @@ Empty maps are not cleaned up by this version of erase.
//
p.map_->erase (p.pos_);
}
//
// object_pointers
//
template <typename T>
inline session::object_pointers<T>::
object_pointers () : p_ (), cp_ () {}
template <typename T>
inline void session::object_pointers<T>::
set (const pointer_type& p)
{
p_ = p;
cp_ = const_pointer_type ();
}
template <typename T>
inline void session::object_pointers<T>::
set (const const_pointer_type& cp)
{
p_ = pointer_type ();
cp_ = cp;
}
template <typename T>
inline void session::object_pointers<T>::
get (pointer_type& p) const
{
if (!pointer_traits<pointer_type>::null_ptr (p_))
p = p_;
else if (!pointer_traits<const_pointer_type>::null_ptr (cp_))
throw const_object ();
else
p = pointer_type ();
}
template <typename T>
inline void session::object_pointers<T>::
get (const_pointer_type& cp) const
{
if (!pointer_traits<pointer_type>::null_ptr (p_))
cp = const_pointer_type (p_);
else if (!pointer_traits<const_pointer_type>::null_ptr (cp_))
cp = cp_;
else
cp = const_pointer_type ();
}
}
|