Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
datatools::data_reader Class Reference

A generic data reader based on Boost/Serialization. More...

#include <bayeux/datatools/io_factory.h>

Public Types

enum  status_type { STATUS_OK = 0, STATUS_ERROR = 1, STATUS_EOF = 2 }
 

Public Member Functions

 data_reader ()
 Constructor. More...
 
 data_reader (const std::string &filename_, bool use_multiple_archives_=using_single_archive)
 Constructor. More...
 
 data_reader (const std::string &filename_, int mode_)
 Constructor. More...
 
virtual ~data_reader ()
 Destructor. More...
 
bool is_error () const
 
bool is_eof () const
 
const std::string & get_record_tag () const
 
bool has_record_tag () const
 
bool record_tag_is (const std::string &tag_) const
 
void reset ()
 
bool is_initialized () const
 
bool is_multi_archives () const
 
bool is_single_archive () const
 
bool is_compressed () const
 
bool is_uncompressed () const
 
bool is_gzip () const
 
bool is_bzip2 () const
 
bool is_text () const
 
bool is_binary () const
 
bool is_portable_binary () const
 
bool is_xml () const
 
void init (const std::string &filename_, bool use_multiple_archives_=using_single_archive)
 
void init_multi (const std::string &filename_)
 
void init_single (const std::string &filename_)
 
void init (const std::string &filename_, int mode_)
 
void dump (std::ostream &out_=std::clog) const
 
template<typename Data >
void load (const std::string &tag_, Data &data_)
 
template<typename Data >
void load_alt (const std::string &tag_, const std::string &alt_tag_, Data &data_)
 
template<typename Data >
void load_serializable (Data &data_, typename boost::disable_if< has_bsts< Data > >::type *dummy_=0)
 
template<typename Data >
void load_serializable (Data &data_, typename boost::enable_if< has_bsts< Data > >::type *dummy_=0)
 
template<typename Data >
void load (Data &data_)
 

Static Public Member Functions

static const std::string & empty_record_tag ()
 

Protected Member Functions

template<typename Data >
void basic_load (Data &data_)
 

Detailed Description

A generic data reader based on Boost/Serialization.

The data_reader class supports :

Example :

int main()
{
datatools::data_reader reader ("test.xml", datatools::using_multi_archives);
if (reader.has_record_tag () &&
reader.record_tag_is (datatools::properties::SERIAL_TAG))
{
reader.load (setup);
}
return 0;
}

Member Enumeration Documentation

◆ status_type

Enumerator
STATUS_OK 
STATUS_ERROR 
STATUS_EOF 

Constructor & Destructor Documentation

◆ data_reader() [1/3]

datatools::data_reader::data_reader ( )

Constructor.

◆ data_reader() [2/3]

datatools::data_reader::data_reader ( const std::string &  filename_,
bool  use_multiple_archives_ = using_single_archive 
)

Constructor.

◆ data_reader() [3/3]

datatools::data_reader::data_reader ( const std::string &  filename_,
int  mode_ 
)

Constructor.

◆ ~data_reader()

virtual datatools::data_reader::~data_reader ( )
virtual

Destructor.

Member Function Documentation

◆ basic_load()

template<typename Data >
void datatools::data_reader::basic_load ( Data &  data_)
inlineprotected

◆ dump()

void datatools::data_reader::dump ( std::ostream &  out_ = std::clog) const

◆ empty_record_tag()

static const std::string& datatools::data_reader::empty_record_tag ( )
static

◆ get_record_tag()

const std::string& datatools::data_reader::get_record_tag ( ) const

◆ has_record_tag()

bool datatools::data_reader::has_record_tag ( ) const

◆ init() [1/2]

void datatools::data_reader::init ( const std::string &  filename_,
bool  use_multiple_archives_ = using_single_archive 
)

◆ init() [2/2]

void datatools::data_reader::init ( const std::string &  filename_,
int  mode_ 
)

◆ init_multi()

void datatools::data_reader::init_multi ( const std::string &  filename_)
inline

◆ init_single()

void datatools::data_reader::init_single ( const std::string &  filename_)
inline

◆ is_binary()

bool datatools::data_reader::is_binary ( ) const

◆ is_bzip2()

bool datatools::data_reader::is_bzip2 ( ) const

◆ is_compressed()

bool datatools::data_reader::is_compressed ( ) const

◆ is_eof()

bool datatools::data_reader::is_eof ( ) const

◆ is_error()

bool datatools::data_reader::is_error ( ) const

◆ is_gzip()

bool datatools::data_reader::is_gzip ( ) const

◆ is_initialized()

bool datatools::data_reader::is_initialized ( ) const

◆ is_multi_archives()

bool datatools::data_reader::is_multi_archives ( ) const

◆ is_portable_binary()

bool datatools::data_reader::is_portable_binary ( ) const

◆ is_single_archive()

bool datatools::data_reader::is_single_archive ( ) const

◆ is_text()

bool datatools::data_reader::is_text ( ) const

◆ is_uncompressed()

bool datatools::data_reader::is_uncompressed ( ) const

◆ is_xml()

bool datatools::data_reader::is_xml ( ) const

◆ load() [1/2]

template<typename Data >
void datatools::data_reader::load ( const std::string &  tag_,
Data &  data_ 
)
inline

◆ load() [2/2]

template<typename Data >
void datatools::data_reader::load ( Data &  data_)
inline

◆ load_alt()

template<typename Data >
void datatools::data_reader::load_alt ( const std::string &  tag_,
const std::string &  alt_tag_,
Data &  data_ 
)
inline

◆ load_serializable() [1/2]

template<typename Data >
void datatools::data_reader::load_serializable ( Data &  data_,
typename boost::disable_if< has_bsts< Data > >::type *  dummy_ = 0 
)
inline

◆ load_serializable() [2/2]

template<typename Data >
void datatools::data_reader::load_serializable ( Data &  data_,
typename boost::enable_if< has_bsts< Data > >::type *  dummy_ = 0 
)
inline

◆ record_tag_is()

bool datatools::data_reader::record_tag_is ( const std::string &  tag_) const

◆ reset()

void datatools::data_reader::reset ( )

The documentation for this class was generated from the following file: