Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
datatools::io_factory Class Reference

A generic base reader/writer class based on Boost/Serialization. More...

#include <bayeux/datatools/io_factory.h>

Inheritance diagram for datatools::io_factory:
datatools::i_tree_dumpable datatools::io_reader datatools::io_writer

Classes

struct  format
 

Public Types

enum  mode_flag_type {
  MODE_READ = 0x0, MODE_WRITE = 0x1, read = MODE_READ, write = MODE_WRITE,
  MODE_TEXT = 0x0, MODE_BINARY = 0x2, MODE_XML = 0x4, text = MODE_TEXT,
  binary = MODE_BINARY, xml = MODE_XML, MODE_NO_COMPRESS = 0x0, MODE_GZIP = 0x10,
  MODE_BZIP2 = 0x20, no_compress = MODE_NO_COMPRESS, gzip = MODE_GZIP, bzip2 = MODE_BZIP2,
  MODE_UNIQUE_ARCHIVE = 0x0, MODE_MULTI_ARCHIVES = 0x80, unique_archive = MODE_UNIQUE_ARCHIVE, multi_archives = MODE_MULTI_ARCHIVES,
  MODE_NO_APPEND = 0x0, MODE_APPEND = 0x100, no_append = MODE_NO_APPEND, append = MODE_APPEND,
  MODE_DEFAULT
}
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 

Public Member Functions

void set_logging_priority (datatools::logger::priority)
 
datatools::logger::priority get_logging_priority () const
 
 io_factory (int mode_=io_factory::MODE_DEFAULT)
 Constructor. More...
 
 io_factory (const std::string &stream_name_, int mode_=io_factory::MODE_DEFAULT)
 Constructor. More...
 
virtual ~io_factory ()
 Destructor. More...
 
bool eof () const
 
bool is_read () const
 
bool is_write () 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
 
bool is_append () const
 
bool is_no_append () const
 
bool is_single_archive () const
 
bool is_multi_archives () const
 
void start_archive ()
 
void stop_archive ()
 
template<typename Data >
void store (const Data &data_)
 
template<typename Data >
void load (Data &data_)
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Main old interface method for printing. More...
 
void dump (std::ostream &out_) const
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 Main new interface method for printing. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 

Static Public Member Functions

static int guess_mode_from_filename (const std::string &filename_, int &mode_)
 
- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 

Static Public Attributes

static const int SUCCESS = 0
 
static const int ERROR = 1
 
static const unsigned int MASK_RW = 0x1
 
static const unsigned int MASK_FORMAT = 0xE
 
static const unsigned int MASK_COMPRESSION = 0x30
 
static const unsigned int MASK_MULTIARCHIVE = 0x80
 
static const unsigned int MASK_APPEND = 0x100
 

Friends

template<typename Data >
io_factoryoperator<< (io_factory &iof_, const Data &data_)
 
template<typename Data >
io_factoryoperator>> (io_factory &iof_, Data &data_)
 

Detailed Description

A generic base reader/writer class based on Boost/Serialization.

Member Enumeration Documentation

◆ mode_flag_type

Enumerator
MODE_READ 
MODE_WRITE 
read 
write 
MODE_TEXT 
MODE_BINARY 
MODE_XML 
text 
binary 
xml 
MODE_NO_COMPRESS 
MODE_GZIP 
MODE_BZIP2 
no_compress 
gzip 
bzip2 
MODE_UNIQUE_ARCHIVE 
MODE_MULTI_ARCHIVES 
unique_archive 
multi_archives 
MODE_NO_APPEND 
MODE_APPEND 
no_append 
append 
MODE_DEFAULT 

Constructor & Destructor Documentation

◆ io_factory() [1/2]

datatools::io_factory::io_factory ( int  mode_ = io_factory::MODE_DEFAULT)

Constructor.

◆ io_factory() [2/2]

datatools::io_factory::io_factory ( const std::string &  stream_name_,
int  mode_ = io_factory::MODE_DEFAULT 
)

Constructor.

◆ ~io_factory()

virtual datatools::io_factory::~io_factory ( )
virtual

Destructor.

Member Function Documentation

◆ dump()

void datatools::io_factory::dump ( std::ostream &  out_) const

◆ eof()

bool datatools::io_factory::eof ( ) const

◆ get_logging_priority()

datatools::logger::priority datatools::io_factory::get_logging_priority ( ) const

◆ guess_mode_from_filename()

static int datatools::io_factory::guess_mode_from_filename ( const std::string &  filename_,
int &  mode_ 
)
static

◆ is_append()

bool datatools::io_factory::is_append ( ) const

◆ is_binary()

bool datatools::io_factory::is_binary ( ) const

◆ is_bzip2()

bool datatools::io_factory::is_bzip2 ( ) const

◆ is_compressed()

bool datatools::io_factory::is_compressed ( ) const

◆ is_gzip()

bool datatools::io_factory::is_gzip ( ) const

◆ is_multi_archives()

bool datatools::io_factory::is_multi_archives ( ) const

◆ is_no_append()

bool datatools::io_factory::is_no_append ( ) const

◆ is_portable_binary()

bool datatools::io_factory::is_portable_binary ( ) const

◆ is_read()

bool datatools::io_factory::is_read ( ) const

◆ is_single_archive()

bool datatools::io_factory::is_single_archive ( ) const

◆ is_text()

bool datatools::io_factory::is_text ( ) const

◆ is_uncompressed()

bool datatools::io_factory::is_uncompressed ( ) const

◆ is_write()

bool datatools::io_factory::is_write ( ) const

◆ is_xml()

bool datatools::io_factory::is_xml ( ) const

◆ load()

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

◆ set_logging_priority()

void datatools::io_factory::set_logging_priority ( datatools::logger::priority  )

◆ start_archive()

void datatools::io_factory::start_archive ( )

◆ stop_archive()

void datatools::io_factory::stop_archive ( )

◆ store()

template<typename Data >
void datatools::io_factory::store ( const Data &  data_)
inline

◆ tree_dump()

virtual void datatools::io_factory::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Main old interface method for printing.

Reimplemented from datatools::i_tree_dumpable.

Friends And Related Function Documentation

◆ operator<<

template<typename Data >
io_factory& operator<< ( io_factory iof_,
const Data &  data_ 
)
friend

◆ operator>>

template<typename Data >
io_factory& operator>> ( io_factory iof_,
Data &  data_ 
)
friend

Member Data Documentation

◆ ERROR

const int datatools::io_factory::ERROR = 1
static

◆ MASK_APPEND

const unsigned int datatools::io_factory::MASK_APPEND = 0x100
static

◆ MASK_COMPRESSION

const unsigned int datatools::io_factory::MASK_COMPRESSION = 0x30
static

◆ MASK_FORMAT

const unsigned int datatools::io_factory::MASK_FORMAT = 0xE
static

◆ MASK_MULTIARCHIVE

const unsigned int datatools::io_factory::MASK_MULTIARCHIVE = 0x80
static

◆ MASK_RW

const unsigned int datatools::io_factory::MASK_RW = 0x1
static

◆ SUCCESS

const int datatools::io_factory::SUCCESS = 0
static

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