Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A class that builds an arbitrary list of filenames on user request. Supported modes are: More...
#include <bayeux/datatools/smart_filename.h>
Classes | |
struct | labels |
Public Types | |
enum | mode_t { MODE_INVALID = 0, MODE_SINGLE = 0x1, MODE_LIST = 0x2, MODE_INCREMENTAL = 0x4 } |
typedef std::vector< std::string > | list_type |
typedef list_type::const_iterator | const_iterator |
Public Member Functions | |
smart_filename () | |
Default constructor: More... | |
virtual | ~smart_filename () |
Destructor. More... | |
void | set_logging_priority (datatools::logger::priority p_) |
Set logging priority. More... | |
datatools::logger::priority | get_logging_priority () const |
Returns logging priority. More... | |
int | get_mode () const |
Return the mode. More... | |
bool | is_initialized () const |
Check the initialization flag. More... | |
bool | is_single () const |
Check the single mode. More... | |
bool | is_list () const |
Check the list mode. More... | |
bool | is_incremental () const |
Check the incremental mode. More... | |
bool | is_valid () const |
Check if the object is valid. More... | |
bool | is_ranged () const |
Check is the list of filenames is ranged. More... | |
bool | is_expand_path () const |
Check the expand path flag. More... | |
size_t | size () const |
Return the number of filenames. More... | |
size_t | current_size () const |
Return the current number of filenames. More... | |
const_iterator | begin () const |
Return the first const iterator from the embedded list of filenames. More... | |
const_iterator | end () const |
Return the fpast-the-end const iterator from the embedded list of filenames. More... | |
const std::string & | operator[] (int index_) const |
Access to a filename by index. More... | |
const std::string & | get_filename (int index_) const |
Access to a filename by index. More... | |
bool | has_filename (const std::string &name_, bool expand_=true) const |
Check if a given filename exists from the embedded list of filenames. More... | |
void | set (const std::string &filename_) |
Set the filename in single mode. More... | |
void | set_single (const std::string &filename_) |
Set the single mode and associated filename. More... | |
void | add (const std::string &filename_) |
Add a filename in list mode. More... | |
void | add_to_list (const std::string &filename_) |
Add a filename in list mode. More... | |
void | reset () |
Reset the object. More... | |
void | build_incremental_filename (int increment_index_, std::string &filename_) const |
Build the filename from the increment index in incremental mode. More... | |
void | dump (std::ostream &out_=std::clog) const |
Raw print. More... | |
void | initialize (const properties &config_) |
Initialize from a list of configuration parameters. More... | |
void | print_list_of_filenames (std::ostream &out_=std::clog) const |
Print the list of filenames. More... | |
void | store_list_of_filenames (const std::string &list_filename_, bool append_=true) const |
Store the list of filenames in a file. More... | |
Static Public Member Functions | |
static void | make_single (smart_filename &smart_filename_, const std::string &filename_, bool expand_path_=true) |
Make a smart_filename object in single mode. More... | |
static void | make_list (smart_filename &smart_filename_, bool allow_duplication_=false, bool expand_path_=true) |
Make a smart_filename object in list mode. More... | |
static void | make_list (smart_filename &smart_filename_, const std::string &list_file_, bool allow_duplication_=false, bool expand_path_=true) |
Make a smart_filename object in list mode. More... | |
static void | make_incremental (smart_filename &smart_filename_, const std::string &path_, const std::string &prefix_, const std::string &extension_, int stopping_index_, int starting_index_=0, int increment_index_=1, const std::string &suffix_="", int incremental_index_ndigit_=0, bool expand_path_=true) |
Make a smart_filename object in incremental mode. More... | |
static void | make_unranged_incremental (smart_filename &smart_filename_, const std::string &path_, const std::string &prefix_, const std::string &extension_, int starting_index_=0, int increment_index_=1, const std::string &suffix_="", int incremental_index_ndigit_=0, bool expand_path_=true) |
Make a smart_filename object in unranged incremental mode. More... | |
Static Public Attributes | |
static const int | MODE_INCREMENTAL_UNRANGED = -1 |
static const int | MODE_INCREMENTAL_DEFAULT_START = 0 |
static const int | MODE_INCREMENTAL_DEFAULT_INCREMENT = 1 |
Protected Member Functions | |
void | set_mode (int) |
Set the mode. More... | |
void | add_list (const std::string &filename_) |
Add a file name in the embedded list of filenames. More... | |
void | set_list_allow_duplication (bool) |
Set the flag to allow duplicated filenames. More... | |
void | set_current_index (int) |
Set the current in incremental/list mode. More... | |
A class that builds an arbitrary list of filenames on user request. Supported modes are:
typedef list_type::const_iterator datatools::smart_filename::const_iterator |
typedef std::vector<std::string> datatools::smart_filename::list_type |
datatools::smart_filename::smart_filename | ( | ) |
Default constructor:
|
virtual |
Destructor.
void datatools::smart_filename::add | ( | const std::string & | filename_ | ) |
Add a filename in list mode.
|
protected |
Add a file name in the embedded list of filenames.
void datatools::smart_filename::add_to_list | ( | const std::string & | filename_ | ) |
Add a filename in list mode.
const_iterator datatools::smart_filename::begin | ( | ) | const |
Return the first const iterator from the embedded list of filenames.
void datatools::smart_filename::build_incremental_filename | ( | int | increment_index_, |
std::string & | filename_ | ||
) | const |
Build the filename from the increment index in incremental mode.
size_t datatools::smart_filename::current_size | ( | ) | const |
Return the current number of filenames.
void datatools::smart_filename::dump | ( | std::ostream & | out_ = std::clog | ) | const |
Raw print.
const_iterator datatools::smart_filename::end | ( | ) | const |
Return the fpast-the-end const iterator from the embedded list of filenames.
const std::string& datatools::smart_filename::get_filename | ( | int | index_ | ) | const |
Access to a filename by index.
datatools::logger::priority datatools::smart_filename::get_logging_priority | ( | ) | const |
Returns logging priority.
int datatools::smart_filename::get_mode | ( | ) | const |
Return the mode.
bool datatools::smart_filename::has_filename | ( | const std::string & | name_, |
bool | expand_ = true |
||
) | const |
Check if a given filename exists from the embedded list of filenames.
void datatools::smart_filename::initialize | ( | const properties & | config_ | ) |
Initialize from a list of configuration parameters.
bool datatools::smart_filename::is_expand_path | ( | ) | const |
Check the expand path flag.
bool datatools::smart_filename::is_incremental | ( | ) | const |
Check the incremental mode.
bool datatools::smart_filename::is_initialized | ( | ) | const |
Check the initialization flag.
bool datatools::smart_filename::is_list | ( | ) | const |
Check the list mode.
bool datatools::smart_filename::is_ranged | ( | ) | const |
Check is the list of filenames is ranged.
bool datatools::smart_filename::is_single | ( | ) | const |
Check the single mode.
bool datatools::smart_filename::is_valid | ( | ) | const |
Check if the object is valid.
|
static |
Make a smart_filename object in incremental mode.
|
static |
Make a smart_filename object in list mode.
|
static |
Make a smart_filename object in list mode.
|
static |
Make a smart_filename object in single mode.
|
static |
Make a smart_filename object in unranged incremental mode.
const std::string& datatools::smart_filename::operator[] | ( | int | index_ | ) | const |
Access to a filename by index.
void datatools::smart_filename::print_list_of_filenames | ( | std::ostream & | out_ = std::clog | ) | const |
Print the list of filenames.
void datatools::smart_filename::reset | ( | ) |
Reset the object.
void datatools::smart_filename::set | ( | const std::string & | filename_ | ) |
Set the filename in single mode.
|
protected |
Set the current in incremental/list mode.
|
protected |
Set the flag to allow duplicated filenames.
void datatools::smart_filename::set_logging_priority | ( | datatools::logger::priority | p_ | ) |
Set logging priority.
|
protected |
Set the mode.
void datatools::smart_filename::set_single | ( | const std::string & | filename_ | ) |
Set the single mode and associated filename.
size_t datatools::smart_filename::size | ( | ) | const |
Return the number of filenames.
void datatools::smart_filename::store_list_of_filenames | ( | const std::string & | list_filename_, |
bool | append_ = true |
||
) | const |
Store the list of filenames in a file.
|
static |
|
static |
|
static |