Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
The brio generic writer class. More...
#include <bayeux/brio/writer.h>
Public Member Functions | |
writer () | |
Default constructor. More... | |
writer (const std::string &filename_, datatools::logger::priority p_=datatools::logger::PRIO_FATAL) | |
Constructor. More... | |
writer (const std::string &filename_, const std::string &format_str_, datatools::logger::priority p_=datatools::logger::PRIO_FATAL) | |
Constructor. More... | |
virtual | ~writer () |
Destructor. More... | |
void | lock () |
Lock the writer. More... | |
void | unlock () |
Unlock the writer. More... | |
bool | is_locked () const |
Check if the writer is locked. More... | |
bool | is_allow_mixed_types_in_stores () const |
Check if mixed types are allowed in any given store. More... | |
bool | is_allow_automatic_store () const |
Check if automatic store is allowed. More... | |
bool | is_existing_file_protected () const |
Check if protection against file overwriting exists. More... | |
void | set_allow_mixed_types_in_stores (bool new_value_=true) |
void | set_allow_automatic_store (bool new_value_=true) |
void | set_existing_file_protected (bool new_value_=true) |
Set the protection against file overwriting. More... | |
int | add_store (const std::string &label_, const std::string &serial_tag_, size_t buffer_size_=256000) |
int | add_store (const std::string &label_, size_t buffer_size_=256000) |
int | add_mixed_store (const std::string &label_, size_t buffer_size_=0) |
template<typename T > | |
int | store (const T &data_, const std::string &label_="") |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Smart print. More... | |
void | print_info (std::ostream &out_=std::clog) const |
Print. More... | |
Public Member Functions inherited from brio::detail::base_io | |
base_io (int rw_) | |
base_io (int rw_, datatools::logger::priority p_) | |
base_io (int rw_, int format_, datatools::logger::priority p_) | |
virtual | ~base_io () |
virtual void | open (const std::string &filename_) |
File open. More... | |
virtual void | close () |
File close. More... | |
virtual bool | is_opened () const |
bool | is_reading () const |
bool | is_writing () const |
bool | is_format_pba () const |
bool | is_format_text () const |
int | get_format () const |
void | set_format (int format_) |
void | set_format (const std::string &format_str_) |
bool | is_debug () const |
void | set_debug (bool) |
bool | is_verbose () const |
void | set_verbose (bool) |
int64_t | get_number_of_entries (const std::string &label_="") const |
int64_t | get_current_entry (const std::string &label_="") const |
const std::string & | get_serialization_tag (const std::string &label_="") const |
bool | has_store (const std::string &label_) const |
bool | has_store_with_serial_tag (const std::string &label_, const std::string &serial_tag_) const |
template<class T > | |
bool | has_store_with_matching_serial_tag (const std::string &label_) const |
bool | has_mixed_store (const std::string &label_) const |
void | select_store (const std::string &label_) |
bool | has_automatic_store () const |
void | select_automatic_store () |
void | unselect_store () |
void | get_list_of_stores (std::list< std::string > &list_) const |
void | reset () |
void | set_logging_priority (datatools::logger::priority) |
datatools::logger::priority | get_logging_priority () 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 |
Protected Member Functions | |
void | _set_default () |
store_info * | _add_store (const std::string &label_, const std::string &serial_tag_, size_t buffer_size_) |
template<typename T > | |
int | _at_store (const T &dat, store_info *store_info_) |
virtual void | _at_open (const std::string &filename_) |
Protected Member Functions inherited from brio::detail::base_io | |
void | _set_default () |
void | _reset () |
store_info * | _get_store_info (const std::string &label_="") |
const store_info * | _get_store_info (const std::string &label_="") const |
Additional Inherited Members | |
Public Types inherited from brio::detail::base_io | |
enum | format_type { FORMAT_UNDEFINED = 0, FORMAT_PBA = 1, FORMAT_TEXT = 2 } |
Label for Boost portable text archive. More... | |
enum | rw_type { RW_UNDEFINED = 0, RW_READ = 1, RW_WRITE = 2 } |
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... | |
Static Public Member Functions inherited from brio::detail::base_io | |
static const std::string & | pba_label () |
static const std::string & | text_label () |
Label for Boost portable binary archive. More... | |
static int | get_format (const std::string &format_str_) |
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_) |
Protected Attributes inherited from brio::detail::base_io | |
std::string | _filename |
Name of the current I/O file (extensions are .brio or .trio) More... | |
TFile * | _file |
Handle to the current embedded ROOT file. More... | |
store_info_dict_type | _store_infos |
Dictionnary of stores. More... | |
store_info * | _current_store |
Handle to the current active store (if any) More... | |
int | _rw |
Read/write mode tag. More... | |
std::locale * | _default_locale |
Default I/O locale (for portable streams) More... | |
std::locale * | _locale |
I/O locale (for portable streams) More... | |
The brio generic writer class.
brio::writer::writer | ( | ) |
Default constructor.
brio::writer::writer | ( | const std::string & | filename_, |
datatools::logger::priority | p_ = datatools::logger::PRIO_FATAL |
||
) |
Constructor.
brio::writer::writer | ( | const std::string & | filename_, |
const std::string & | format_str_, | ||
datatools::logger::priority | p_ = datatools::logger::PRIO_FATAL |
||
) |
Constructor.
|
virtual |
Destructor.
|
protected |
|
protectedvirtual |
Implements brio::detail::base_io.
|
protected |
|
protected |
int brio::writer::add_mixed_store | ( | const std::string & | label_, |
size_t | buffer_size_ = 0 |
||
) |
Add a new store with label 'label_' to store objects with arbitrary serialization tags
int brio::writer::add_store | ( | const std::string & | label_, |
const std::string & | serial_tag_, | ||
size_t | buffer_size_ = 256000 |
||
) |
Add a new store with label 'label_' to store objects with a dedicated serialization tag 'serial_tag_'
int brio::writer::add_store | ( | const std::string & | label_, |
size_t | buffer_size_ = 256000 |
||
) |
Add a new store with label 'label_' to store objects with a dedicated serialization tag 'serial_tag_'
bool brio::writer::is_allow_automatic_store | ( | ) | const |
Check if automatic store is allowed.
bool brio::writer::is_allow_mixed_types_in_stores | ( | ) | const |
Check if mixed types are allowed in any given store.
bool brio::writer::is_existing_file_protected | ( | ) | const |
Check if protection against file overwriting exists.
bool brio::writer::is_locked | ( | ) | const |
Check if the writer is locked.
void brio::writer::lock | ( | ) |
Lock the writer.
void brio::writer::print_info | ( | std::ostream & | out_ = std::clog | ) | const |
Print.
void brio::writer::set_allow_automatic_store | ( | bool | new_value_ = true | ) |
Enables the use of some automatic store (with standard label == store_info::AUTOMATIC_STORE_LABEL) within the writer. Default at construction is true.
void brio::writer::set_allow_mixed_types_in_stores | ( | bool | new_value_ = true | ) |
Allow to serialize different types of objects within stores. Usually, each store is setup in order to accept only one kind of serializable object (potato) , in such a way one cannot mix several object's types (ex: potato and carot) within the same branch Default at construction is false.
void brio::writer::set_existing_file_protected | ( | bool | new_value_ = true | ) |
Set the protection against file overwriting.
int brio::writer::store | ( | const T & | data_, |
const std::string & | label_ = "" |
||
) |
|
virtual |
Smart print.
Reimplemented from brio::detail::base_io.
void brio::writer::unlock | ( | ) |
Unlock the writer.