/usr/include/odb/container-traits.hxx is in libodb-dev 2.4.0-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | // file : odb/container-traits.hxx
// copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_CONTAINER_TRAITS_HXX
#define ODB_CONTAINER_TRAITS_HXX
#include <odb/pre.hxx>
#include <odb/forward.hxx>
#include <odb/details/config.hxx> // ODB_CXX11
namespace odb
{
// Keep this enum synchronized with the one in odb/odb/context.hxx.
//
enum container_kind
{
ck_ordered,
ck_set,
ck_multiset,
ck_map,
ck_multimap
};
//
// Container API provided by the generated code.
//
// Ordered containers.
//
template <typename I, typename V>
struct ordered_functions
{
typedef I index_type;
typedef V value_type;
// Return true if the order is preserved in the database. If the
// order is not preserved, then the index argument in the functions
// below is not used.
//
bool
ordered () const
{
return ordered_;
}
void
insert (I index, const V& value) const
{
insert_ (index, value, data_);
}
bool
select (I& next_index, V& next_value) const
{
return select_ (next_index, next_value, data_);
}
void
delete_ () const
{
delete__ (data_);
}
// Implementation details.
//
public:
ordered_functions (void* data): data_ (data) {}
public:
void* data_;
bool ordered_;
void (*insert_) (I, const V&, void*);
bool (*select_) (I&, V&, void*);
void (*delete__) (void*);
};
template <typename I, typename V>
struct smart_ordered_functions
{
typedef I index_type;
typedef V value_type;
void
insert (I index, const V& value) const
{
insert_ (index, value, data_);
}
bool
select (I& next_index, V& next_value) const
{
return select_ (next_index, next_value, data_);
}
void
update (I index, const V& value) const
{
update_ (index, value, data_);
}
// Delete all the elements starting with the specified index. To
// delete everything, pass 0.
//
void
delete_ (I start_index) const
{
delete__ (start_index, data_);
}
// Implementation details.
//
public:
smart_ordered_functions (void* data) : data_ (data) {}
public:
void* data_;
void (*insert_) (I, const V&, void*);
bool (*select_) (I&, V&, void*);
void (*update_) (I, const V&, void*);
void (*delete__) (I, void*);
};
// Set/multiset containers.
//
template <typename V>
struct set_functions
{
typedef V value_type;
void
insert (const V& value) const
{
insert_ (value, data_);
}
bool
select (V& next_value) const
{
return select_ (next_value, data_);
}
void
delete_ () const
{
delete__ (data_);
}
// Implementation details.
//
public:
set_functions (void* data): data_ (data) {}
public:
void* data_;
void (*insert_) (const V&, void*);
bool (*select_) (V&, void*);
void (*delete__) (void*);
};
// Map/multimap containers.
//
template <typename K, typename V>
struct map_functions
{
typedef K key_type;
typedef V value_type;
void
insert (const K& key, const V& value) const
{
insert_ (key, value, data_);
}
bool
select (K& next_key, V& next_value) const
{
return select_ (next_key, next_value, data_);
}
void
delete_ () const
{
delete__ (data_);
}
// Implementation details.
//
public:
map_functions (void* data): data_ (data) {}
public:
void* data_;
void (*insert_) (const K&, const V&, void*);
bool (*select_) (K&, V&, void*);
void (*delete__) (void*);
};
}
#include <odb/post.hxx>
#include <odb/std-map-traits.hxx>
#include <odb/std-set-traits.hxx>
#include <odb/std-list-traits.hxx>
#include <odb/std-vector-traits.hxx>
#include <odb/std-deque-traits.hxx>
#ifdef ODB_CXX11
# include <odb/std-array-traits.hxx>
# include <odb/std-forward-list-traits.hxx>
# include <odb/std-unordered-map-traits.hxx>
# include <odb/std-unordered-set-traits.hxx>
#endif
#endif // ODB_CONTAINER_TRAITS_HXX
|