Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A class documenting an object addressed by its unique URN and linked to other objects (also addressed by URNs).. More...
#include <bayeux/datatools/urn_info.h>
Public Types | |
typedef std::map< std::string, std::vector< std::string > > | component_topic_dict_type |
Dictionary of list of components addressed by topic. More... | |
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 | |
urn_info () | |
Default constructor. More... | |
urn_info (const std::string &urn_, const std::string &category_, const std::string &description_="") | |
Constructor with explicit path segments. More... | |
virtual | ~urn_info () |
Destructor. More... | |
bool | is_valid () const |
Check validity. More... | |
void | initialize (const properties &) |
Initialize. More... | |
void | reset () |
Clear the URN info. More... | |
void | set_urn (const std::string &urn_) |
Set the URN. More... | |
const std::string & | get_urn () const |
Return the URN. More... | |
bool | has_category () const |
Check if category is set. More... | |
void | set_category (const std::string &category_) |
Set the category. More... | |
const std::string & | get_category () const |
Return the category. More... | |
void | set_description (const std::string &description_) |
Set the description. More... | |
bool | has_description () const |
Check if the description is set. More... | |
const std::string & | get_description () const |
Return the description. More... | |
void | lock () |
Lock the record. More... | |
void | unlock () |
Unlock the record. More... | |
bool | is_locked () const |
Check lock flag. More... | |
void | remove_all_components () |
Remove all components. More... | |
bool | has_component (const std::string &comp_urn_) const |
Check if a component exists. More... | |
bool | has_component_in_topic (const std::string &comp_urn_, const std::string &comp_topic_) const |
Check if a component exists in a given topic. More... | |
void | add_component (const std::string &comp_urn_, const std::string &comp_topic_="") |
Add an URN component given its topic. More... | |
void | remove_component (const std::string &comp_urn_) |
Remove an URN component. More... | |
bool | has_components () const |
Check if URN components are set. More... | |
std::size_t | get_number_of_components () const |
Return the total number of URN components. More... | |
std::size_t | get_number_of_components_by_topic (const std::string &comp_topic_) const |
Return the number of URN components with given topic. More... | |
std::string | get_component (const std::string &comp_topic_, int rank_=0) const |
Return the URN component with given topic at given rank. More... | |
bool | has_topic (const std::string &comp_topic_) const |
Check if a given component topic is defined. More... | |
const std::vector< std::string > & | get_components_by_topic (const std::string &comp_topic_) const |
Return the components associated to a given topic. More... | |
void | build_topics (std::vector< std::string > &) const |
Build the current list of component topics. More... | |
std::vector< std::string > | get_topics () const |
Return the current list of component topics. More... | |
virtual void | tree_dump (std::ostream &out=std::clog, const std::string &title="", const std::string &indent="", bool inherit=false) const |
Main interface method for smart dump. More... | |
bool | operator< (const urn_info &other_) const |
Basic comparison with respect to the URN name. More... | |
Public Member Functions inherited from datatools::i_serializable | |
i_serializable () | |
Default constructor. More... | |
virtual | ~i_serializable () |
Destructor. More... | |
virtual const std::string & | get_serial_tag () const =0 |
Return the serialization string identifier of the class. More... | |
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 bool | validate_urn (const std::string &) |
static bool | validate_category (const std::string &) |
Validate a category name. More... | |
static bool | validate_topic (const std::string &) |
Validate a topic name. More... | |
static const std::string & | anonymous_topic () |
Return the anonymous topic. More... | |
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_) |
A class documenting an object addressed by its unique URN and linked to other objects (also addressed by URNs)..
An object A can be connected to other objects (B, C and D), known as components:
The nature of the relationship between the object and its "components" depends on the context. It is represented by a specific "topic" which represents a category of relationship. Example:
typedef std::map<std::string, std::vector<std::string> > datatools::urn_info::component_topic_dict_type |
Dictionary of list of components addressed by topic.
datatools::urn_info::urn_info | ( | ) |
Default constructor.
datatools::urn_info::urn_info | ( | const std::string & | urn_, |
const std::string & | category_, | ||
const std::string & | description_ = "" |
||
) |
Constructor with explicit path segments.
|
virtual |
Destructor.
void datatools::urn_info::add_component | ( | const std::string & | comp_urn_, |
const std::string & | comp_topic_ = "" |
||
) |
Add an URN component given its topic.
|
static |
Return the anonymous topic.
void datatools::urn_info::build_topics | ( | std::vector< std::string > & | ) | const |
Build the current list of component topics.
const std::string& datatools::urn_info::get_category | ( | ) | const |
Return the category.
std::string datatools::urn_info::get_component | ( | const std::string & | comp_topic_, |
int | rank_ = 0 |
||
) | const |
Return the URN component with given topic at given rank.
const std::vector<std::string>& datatools::urn_info::get_components_by_topic | ( | const std::string & | comp_topic_ | ) | const |
Return the components associated to a given topic.
const std::string& datatools::urn_info::get_description | ( | ) | const |
Return the description.
std::size_t datatools::urn_info::get_number_of_components | ( | ) | const |
Return the total number of URN components.
std::size_t datatools::urn_info::get_number_of_components_by_topic | ( | const std::string & | comp_topic_ | ) | const |
Return the number of URN components with given topic.
std::vector<std::string> datatools::urn_info::get_topics | ( | ) | const |
Return the current list of component topics.
const std::string& datatools::urn_info::get_urn | ( | ) | const |
Return the URN.
bool datatools::urn_info::has_category | ( | ) | const |
Check if category is set.
bool datatools::urn_info::has_component | ( | const std::string & | comp_urn_ | ) | const |
Check if a component exists.
bool datatools::urn_info::has_component_in_topic | ( | const std::string & | comp_urn_, |
const std::string & | comp_topic_ | ||
) | const |
Check if a component exists in a given topic.
bool datatools::urn_info::has_components | ( | ) | const |
Check if URN components are set.
bool datatools::urn_info::has_description | ( | ) | const |
Check if the description is set.
bool datatools::urn_info::has_topic | ( | const std::string & | comp_topic_ | ) | const |
Check if a given component topic is defined.
void datatools::urn_info::initialize | ( | const properties & | ) |
Initialize.
Example:
bool datatools::urn_info::is_locked | ( | ) | const |
Check lock flag.
bool datatools::urn_info::is_valid | ( | ) | const |
Check validity.
void datatools::urn_info::lock | ( | ) |
Lock the record.
Basic comparison with respect to the URN name.
void datatools::urn_info::remove_all_components | ( | ) |
Remove all components.
void datatools::urn_info::remove_component | ( | const std::string & | comp_urn_ | ) |
Remove an URN component.
void datatools::urn_info::reset | ( | ) |
Clear the URN info.
void datatools::urn_info::set_category | ( | const std::string & | category_ | ) |
Set the category.
void datatools::urn_info::set_description | ( | const std::string & | description_ | ) |
Set the description.
void datatools::urn_info::set_urn | ( | const std::string & | urn_ | ) |
Set the URN.
|
virtual |
Main interface method for smart dump.
Reimplemented from datatools::i_tree_dumpable.
void datatools::urn_info::unlock | ( | ) |
Unlock the record.
|
static |
Validate a category name.
|
static |
Validate a topic name.
|
static |
Validate an URN representation
Format:
Examples: