Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
once-temp-type.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#ifndef SOCI_ONCE_TEMP_TYPE_H_INCLUDED
9
#define SOCI_ONCE_TEMP_TYPE_H_INCLUDED
10
11
#include "
ref-counted-statement.h
"
12
#include "
prepare-temp-type.h
"
13
14
#if __cplusplus >= 201103L
15
#define SOCI_ONCE_TEMP_TYPE_NOEXCEPT noexcept(false)
16
#else
17
#define SOCI_ONCE_TEMP_TYPE_NOEXCEPT
18
#endif
19
20
namespace
soci
21
{
22
23
class
session;
24
25
namespace
details
26
{
27
28
class
ref_counted_statement;
29
30
// this needs to be lightweight and copyable
31
class
SOCI_DECL
once_temp_type
32
{
33
public
:
34
35
once_temp_type
(
session
& s);
36
once_temp_type
(
once_temp_type
const
& o);
37
once_temp_type
& operator=(
once_temp_type
const
& o);
38
39
~
once_temp_type
()
SOCI_ONCE_TEMP_TYPE_NOEXCEPT
;
40
41
template
<
typename
T>
42
once_temp_type
&
operator<<
(T
const
& t)
43
{
44
rcst_->accumulate(t);
45
return
*
this
;
46
}
47
48
once_temp_type
& operator,(
into_type_ptr
const
&);
49
template
<
typename
T,
typename
Indicator>
50
once_temp_type
&
operator,
(
into_container<T, Indicator>
const
&ic)
51
{
52
rcst_->exchange(ic);
53
return
*
this
;
54
}
55
template
<
typename
T,
typename
Indicator>
56
once_temp_type
&
operator,
(
use_container<T, Indicator>
const
&uc)
57
{
58
rcst_->exchange(uc);
59
return
*
this
;
60
}
61
62
private
:
63
ref_counted_statement
*
rcst_
;
64
};
65
66
// this needs to be lightweight and copyable
67
class
once_type
68
{
69
public
:
70
once_type
() : session_(NULL) {}
71
once_type
(
session
* s) : session_(s) {}
72
73
void
set_session
(
session
* s)
74
{
75
session_ = s;
76
}
77
78
template
<
typename
T>
79
once_temp_type
operator<<
(T
const
& t)
80
{
81
once_temp_type
o(*session_);
82
o << t;
83
return
o;
84
}
85
86
private
:
87
session
*
session_
;
88
};
89
90
91
// this needs to be lightweight and copyable
92
class
prepare_type
93
{
94
public
:
95
prepare_type
() : session_(NULL) {}
96
prepare_type
(
session
* s) : session_(s) {}
97
98
void
set_session
(
session
* s)
99
{
100
session_ = s;
101
}
102
103
template
<
typename
T>
104
prepare_temp_type
operator<<
(T
const
& t)
105
{
106
prepare_temp_type
p(*session_);
107
p << t;
108
return
p;
109
}
110
111
private
:
112
session
*
session_
;
113
};
114
115
}
// namespace details
116
117
}
// namespace soci
118
119
#endif
soci::details::once_type::operator<<
once_temp_type operator<<(T const &t)
Definition:
once-temp-type.h:79
soci::details::prepare_type::operator<<
prepare_temp_type operator<<(T const &t)
Definition:
once-temp-type.h:104
soci::details::prepare_temp_type
Definition:
prepare-temp-type.h:23
SOCI_DECL
#define SOCI_DECL
Definition:
soci-config.h:31
soci::details::prepare_type::set_session
void set_session(session *s)
Definition:
once-temp-type.h:98
soci::details::once_temp_type
Definition:
once-temp-type.h:31
soci::details::prepare_type::prepare_type
prepare_type()
Definition:
once-temp-type.h:95
soci::details::prepare_type
Definition:
once-temp-type.h:92
soci::details::ref_counted_statement
Definition:
ref-counted-statement.h:72
soci::details::once_type::once_type
once_type(session *s)
Definition:
once-temp-type.h:71
soci::details::use_container
Definition:
use.h:19
soci::details::once_temp_type::rcst_
ref_counted_statement * rcst_
Definition:
once-temp-type.h:63
soci::details::once_temp_type::operator<<
once_temp_type & operator<<(T const &t)
Definition:
once-temp-type.h:42
soci::session
Definition:
session.h:40
soci::details::once_temp_type::operator,
once_temp_type & operator,(into_container< T, Indicator > const &ic)
Definition:
once-temp-type.h:50
prepare-temp-type.h
soci::details::once_type
Definition:
once-temp-type.h:67
SOCI_ONCE_TEMP_TYPE_NOEXCEPT
#define SOCI_ONCE_TEMP_TYPE_NOEXCEPT
Definition:
once-temp-type.h:17
soci::details::into_container
Definition:
into.h:28
soci::details::once_type::once_type
once_type()
Definition:
once-temp-type.h:70
soci::details::once_type::set_session
void set_session(session *s)
Definition:
once-temp-type.h:73
soci::details::prepare_type::prepare_type
prepare_type(session *s)
Definition:
once-temp-type.h:96
soci::details::once_temp_type::operator,
once_temp_type & operator,(use_container< T, Indicator > const &uc)
Definition:
once-temp-type.h:56
soci::details::once_type::session_
session * session_
Definition:
once-temp-type.h:87
soci::details::type_ptr
Definition:
type-ptr.h:14
soci
Definition:
db2/common.h:15
soci::details::prepare_type::session_
session * session_
Definition:
once-temp-type.h:112
ref-counted-statement.h
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40