pg_async
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Enumerations | Functions
tip::db::pg::io Namespace Reference

Namespaces

 detail
 
 traits
 

Classes

struct  protocol_parser
 
struct  protocol_formatter
 
struct  protocol_io_traits
 I/O Traits structure. More...
 
struct  protocol_formatter< T, TEXT_DATA_FORMAT >
 Generic implementation of a formatter for text data format. More...
 
struct  protocol_parser< T, TEXT_DATA_FORMAT >
 
struct  protocol_formatter< T, BINARY_DATA_FORMAT >
 
struct  protocol_parser< T, BINARY_DATA_FORMAT >
 
struct  protocol_parser< std::string, TEXT_DATA_FORMAT >
 Protocol parser specialization for std::string, text data format. More...
 
struct  protocol_formatter< std::string, TEXT_DATA_FORMAT >
 
struct  protocol_parser< bool, TEXT_DATA_FORMAT >
 Protocol parser specialization for bool, text data format. More...
 
struct  protocol_parser< bool, BINARY_DATA_FORMAT >
 Protocol parser specialization for bool, binary data format. More...
 
struct  protocol_parser< boost::optional< T >, TEXT_DATA_FORMAT >
 Protocol parser specialization for boost::optional (used for nullable types), text data format. More...
 
struct  protocol_parser< boost::optional< T >, BINARY_DATA_FORMAT >
 Protocol parser specialization for boost::optional (used for nullable types), binary data format. More...
 
struct  protocol_parser< bytea, TEXT_DATA_FORMAT >
 Protocol parser specialization for bytea (binary string), text data format. More...
 
struct  protocol_parser< bytea, BINARY_DATA_FORMAT >
 Protocol parser specialization for bytea (binary string), binary data format. More...
 

Enumerations

enum  protocol_binary_type { OTHER, INTEGRAL, FLOATING_POINT }
 Enumeration for binary parser/formatter template selection. More...
 

Functions

template<protocol_data_format F, typename T >
protocol_io_traits< T, F >
::parser_type 
protocol_reader (T &value)
 Helper function to create a protocol parser. More...
 
template<protocol_data_format F, typename T , typename InputIterator >
InputIterator protocol_read (InputIterator begin, InputIterator end, T &value)
 Read value from input buffer. More...
 
template<protocol_data_format F, typename T >
protocol_io_traits< T, F >
::formatter_type 
protocol_writer (T const &value)
 Helper function to create a protocol formatter. More...
 
template<protocol_data_format F, typename T >
bool protocol_write (std::vector< byte > &buffer, T const &value)
 Write value to a buffer. More...
 
template<protocol_data_format F, typename T , typename OutputIterator >
bool protocol_write (OutputIterator out, T const &value)
 Write a value to a buffer using an output iterator. More...
 

Enumeration Type Documentation

Enumeration for binary parser/formatter template selection.

Enumerator
OTHER 

OTHER Other types, require specialization.

INTEGRAL 

INTEGRAL Integral types, requiring endianness conversion.

FLOATING_POINT 

FLOATING_POINT Floating point types, requiring endianness conversion.

Definition at line 32 of file protocol_io_traits.hpp.

Function Documentation

template<protocol_data_format F, typename T , typename InputIterator >
InputIterator tip::db::pg::io::protocol_read ( InputIterator  begin,
InputIterator  end,
T &  value 
)

Read value from input buffer.

Deduces a parser using protocol_io_traits for the type and protocol and uses it to read a value from the buffer specified by the pair of iterators

Parameters
beginIterator to start of buffer
endIterator beyond the end of buffer
valuevariable to read into
Returns
iterator after the value. If the iterator returned is equal to the begin iterator, nothing has been read and it means an error.
Template Parameters
FProtocol data format
TData type to read
InputIteratorBuffer iterator type

Definition at line 127 of file protocol_io_traits.hpp.

template<protocol_data_format F, typename T >
protocol_io_traits< T, F >::parser_type tip::db::pg::io::protocol_reader ( T &  value)

Helper function to create a protocol parser.

Deduces datatype by the function argument and returns a data parser using protocol_io_traits.

Parameters
value
Returns

Definition at line 105 of file protocol_io_traits.hpp.

template<protocol_data_format F, typename T >
bool tip::db::pg::io::protocol_write ( std::vector< byte > &  buffer,
T const &  value 
)

Write value to a buffer.

Deduces a formatter using protocol_io_traits for the type and protocol and uses it to write the value to the buffer

Parameters
buffertarget data buffer
value
Returns
true in case of success, false in case of failure
Template Parameters
Fdata format
Tdata type

Definition at line 162 of file protocol_io_traits.hpp.

template<protocol_data_format F, typename T , typename OutputIterator >
bool tip::db::pg::io::protocol_write ( OutputIterator  out,
T const &  value 
)

Write a value to a buffer using an output iterator.

Deduces a formatter using protocol_io_traits for the type and protocol and uses it to write the value to the output iterator.

Parameters
outoutput iterator
valuevalue to output
Returns
true in case of success, false in case of failure

Definition at line 179 of file protocol_io_traits.hpp.

template<protocol_data_format F, typename T >
protocol_io_traits< T, F >::formatter_type tip::db::pg::io::protocol_writer ( T const &  value)

Helper function to create a protocol formatter.

Deduces datatype by the function argument and returns a data formatter using protocol_io_traits.

Parameters
value
Returns

Definition at line 143 of file protocol_io_traits.hpp.