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

Interface Hierarchy System. More...

#include <bayeux/datatools/ui/ihs.h>

Inheritance diagram for datatools::ui::ihs:
datatools::enriched_base datatools::i_serializable datatools::i_tree_dumpable

Classes

class  node
 A node in the IHS. More...
 

Public Types

enum  node_type { NODE_INVALID = -1, NODE_INTERFACE = 0, NODE_COMMAND = 1 }
 Node type. More...
 
typedef std::map< std::string, nodenode_dict_type
 
- Public Types inherited from datatools::enriched_base
enum  export_config_flags {
  EXPORT_CONFIG_CLEAR = bit_mask::bit00, EXPORT_CONFIG_NAME = bit_mask::bit01, EXPORT_CONFIG_DISPLAY_NAME = bit_mask::bit02, EXPORT_CONFIG_TERSE_DESCRIPTION = bit_mask::bit03,
  EXPORT_CONFIG_LOGGING_PRIORITY = bit_mask::bit04, EXPORT_CONFIG_AUXILIARIES = bit_mask::bit05, EXPORT_CONFIG_DEFAULT, EXPORT_CONFIG_LAST = EXPORT_CONFIG_AUXILIARIES
}
 Flags for export to a container of properties. 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

 ihs (const std::string &scheme_="")
 Default constructor. More...
 
virtual ~ihs ()
 Destructor. More...
 
bool has_scheme () const
 Check is scheme is set. More...
 
void set_scheme (const std::string &)
 Set the scheme. More...
 
const std::string & get_scheme () const
 Return the scheme. More...
 
void add_interface (const std::string &parent_path_, const std::string &interface_name_, const std::string &description_="")
 Add an interface given its parent's full path and its basename. More...
 
void add_interface (const std::string &parent_path_, base_command_interface *interface_)
 Add a command interface given its parent's full path. More...
 
void add_interface (const std::string &parent_path_, base_command_interface &interface_)
 Add a command interface given its parent's full path. More...
 
void remove_interface (const std::string &interface_path_, bool recursive_=false)
 Remove a command interface given its full path. More...
 
void add_command (const std::string &parent_path_, base_command &cmd_)
 Add a command given its parent's full path. More...
 
void add_command (const std::string &parent_path_, base_command *cmd_)
 Add a command given its parent's full path. More...
 
void remove_command (const std::string &command_path_)
 Remove a command given its full path. More...
 
void remove (const std::string &path_, bool recursive_=false)
 Remove path. More...
 
bool exists (const std::string &path_) const
 Check if node exists given its full path. More...
 
bool is_interface (const std::string &path_) const
 Check if a path is a command interface. More...
 
bool has_interface (const std::string &path_) const
 Check if a path has an associated command interface. More...
 
bool is_command (const std::string &path_) const
 Check if a path is associated to a command interface. More...
 
void set_trait (const std::string &path_, const std::string &trait_label_, const bool set_=true)
 Set trait flag. More...
 
void reset_trait (const std::string &path_, const std::string &trait_label_)
 Reset trait flag. More...
 
bool is_trait (const std::string &path_, const std::string &trait_label_) const
 Check if a trait id set. More...
 
bool has_command (const std::string &path_) const
 Check if a path has an associated command. More...
 
base_commandgrab_command (const std::string &path_)
 Return the mutable command at given full path. More...
 
const base_commandget_command (const std::string &path_) const
 Return the command at given full path. More...
 
base_command_interfacegrab_interface (const std::string &path_)
 Return the mutable command interface at given full path. More...
 
const base_command_interfaceget_interface (const std::string &path_) const
 Return the command interface at given full path. More...
 
bool has_children (const std::string &path_) const
 Check if path has children. More...
 
void build_children_paths (const std::string &path_, std::vector< std::string > &children_paths_) const
 Build the list of children paths of a path. More...
 
std::string get_parent_path (const std::string &path_) const
 Return the parent path of a path. More...
 
bool has_child (const std::string &path_, const std::string &name_) const
 Check if a given path has a child with given name. More...
 
void reset ()
 Reset. More...
 
std::string canonical_path (const std::string &path_) const
 
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 build_path (std::set< std::string > &paths_, const uint32_t flags_=0) const
 Build a set of paths. More...
 
- Public Member Functions inherited from datatools::enriched_base
virtual bool is_name_valid (const std::string &name_) const
 Check if a name is valid. More...
 
 enriched_base ()
 Default constructor. More...
 
 enriched_base (const std::string &name_, const std::string &display_name_="", const std::string &terse_description_="", logger::priority lp_=logger::PRIO_FATAL)
 Constructor. More...
 
virtual ~enriched_base ()
 Destructor. More...
 
bool has_name () const
 Check if the name is not empty. More...
 
void set_name (const std::string &name_)
 Set the name. More...
 
enriched_baseset_name_c (const std::string &name_)
 Set the name. More...
 
const std::string & get_name () const
 Return the name. More...
 
void reset_name ()
 Reset the name. More...
 
bool has_display_name () const
 Check if the display name is empty. More...
 
void set_display_name (const std::string &display_name_)
 Set the display name. More...
 
enriched_baseset_display_name_c (const std::string &display_name_)
 Set the display name. More...
 
const std::string & get_display_name () const
 Return the display name. More...
 
bool has_terse_description () const
 Check if the description is empty. More...
 
void set_terse_description (const std::string &terse_description_)
 Set the description. More...
 
enriched_baseset_terse_description_c (const std::string &terse_description_)
 Set the description. More...
 
const std::string & get_terse_description () const
 Return the description. More...
 
bool has_auxiliaries () const
 Check if the container of auxiliary properties is empty. More...
 
const datatools::propertiesget_auxiliaries () const
 Return a reference to the non mutable container of auxiliary properties. More...
 
datatools::propertiesgrab_auxiliaries ()
 Return a reference to the mutable container of auxiliary properties. More...
 
void reset_auxiliaries ()
 Remove all auxiliary properties. More...
 
bool is_debug () const
 Check the debug status. More...
 
void set_logging_priority (logger::priority lp_)
 Set the logging priority threshold. More...
 
enriched_baseset_logging_priority_c (logger::priority lp_)
 Set the logging priority threshold. More...
 
void set_logging (const std::string &label_)
 Set the logging priority threshold from a string. More...
 
logger::priority get_logging_priority () const
 Return the logging priority threshold. More...
 
void clear ()
 Clear. More...
 
void reset ()
 Clear. More...
 
void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const override
 Smart print. More...
 
void initialize (const datatools::properties &config_, bool clear_=false)
 Initialization from a container of properties. More...
 
void export_to_config (datatools::properties &config_, uint32_t flags_=EXPORT_CONFIG_DEFAULT, const std::string &prefix_="") const
 Export to a container of properties. 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...
 
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 std::string node_type_to_label (node_type)
 Convert node type to label. More...
 
static node_type label_to_node_type (const std::string &label_)
 Convert label to node type. More...
 
static void path_remove_scheme (const std::string &path_, std::string &out_)
 
static bool path_has_scheme (const std::string &path_, const std::string &scheme_="")
 
- Static Public Member Functions inherited from datatools::enriched_base
static bool validate_name (const std::string &candidate_name_)
 Validate a name. More...
 
static logger::priority default_logging_priority ()
 Return the default logging priority threshold. More...
 
static void init_ocd (datatools::object_configuration_description &)
 OCD support. 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_)
 

Protected Member Functions

node_grab_node (const std::string &path_)
 Return the mutable node at given full path. More...
 
const node_get_node (const std::string &path_) const
 Return the node at given full path. More...
 

Detailed Description

Interface Hierarchy System.

Member Typedef Documentation

◆ node_dict_type

typedef std::map<std::string, node> datatools::ui::ihs::node_dict_type

Member Enumeration Documentation

◆ node_type

Node type.

Enumerator
NODE_INVALID 

Invalid node type.

NODE_INTERFACE 

Interface node (directory populated)

NODE_COMMAND 

Command node (file/leaf)

Constructor & Destructor Documentation

◆ ihs()

datatools::ui::ihs::ihs ( const std::string &  scheme_ = "")

Default constructor.

◆ ~ihs()

virtual datatools::ui::ihs::~ihs ( )
virtual

Destructor.

Member Function Documentation

◆ _get_node()

const node& datatools::ui::ihs::_get_node ( const std::string &  path_) const
protected

Return the node at given full path.

◆ _grab_node()

node& datatools::ui::ihs::_grab_node ( const std::string &  path_)
protected

Return the mutable node at given full path.

◆ add_command() [1/2]

void datatools::ui::ihs::add_command ( const std::string &  parent_path_,
base_command cmd_ 
)

Add a command given its parent's full path.

◆ add_command() [2/2]

void datatools::ui::ihs::add_command ( const std::string &  parent_path_,
base_command cmd_ 
)

Add a command given its parent's full path.

◆ add_interface() [1/3]

void datatools::ui::ihs::add_interface ( const std::string &  parent_path_,
const std::string &  interface_name_,
const std::string &  description_ = "" 
)

Add an interface given its parent's full path and its basename.

◆ add_interface() [2/3]

void datatools::ui::ihs::add_interface ( const std::string &  parent_path_,
base_command_interface interface_ 
)

Add a command interface given its parent's full path.

◆ add_interface() [3/3]

void datatools::ui::ihs::add_interface ( const std::string &  parent_path_,
base_command_interface interface_ 
)

Add a command interface given its parent's full path.

◆ build_children_paths()

void datatools::ui::ihs::build_children_paths ( const std::string &  path_,
std::vector< std::string > &  children_paths_ 
) const

Build the list of children paths of a path.

◆ build_path()

void datatools::ui::ihs::build_path ( std::set< std::string > &  paths_,
const uint32_t  flags_ = 0 
) const

Build a set of paths.

◆ canonical_path()

std::string datatools::ui::ihs::canonical_path ( const std::string &  path_) const

Build a canonical path : remove leading scheme if any and '//' path leading decorator if any

◆ exists()

bool datatools::ui::ihs::exists ( const std::string &  path_) const

Check if node exists given its full path.

◆ get_command()

const base_command& datatools::ui::ihs::get_command ( const std::string &  path_) const

Return the command at given full path.

◆ get_interface()

const base_command_interface& datatools::ui::ihs::get_interface ( const std::string &  path_) const

Return the command interface at given full path.

◆ get_parent_path()

std::string datatools::ui::ihs::get_parent_path ( const std::string &  path_) const

Return the parent path of a path.

◆ get_scheme()

const std::string& datatools::ui::ihs::get_scheme ( ) const

Return the scheme.

◆ grab_command()

base_command& datatools::ui::ihs::grab_command ( const std::string &  path_)

Return the mutable command at given full path.

◆ grab_interface()

base_command_interface& datatools::ui::ihs::grab_interface ( const std::string &  path_)

Return the mutable command interface at given full path.

◆ has_child()

bool datatools::ui::ihs::has_child ( const std::string &  path_,
const std::string &  name_ 
) const

Check if a given path has a child with given name.

◆ has_children()

bool datatools::ui::ihs::has_children ( const std::string &  path_) const

Check if path has children.

◆ has_command()

bool datatools::ui::ihs::has_command ( const std::string &  path_) const

Check if a path has an associated command.

◆ has_interface()

bool datatools::ui::ihs::has_interface ( const std::string &  path_) const

Check if a path has an associated command interface.

◆ has_scheme()

bool datatools::ui::ihs::has_scheme ( ) const

Check is scheme is set.

◆ is_command()

bool datatools::ui::ihs::is_command ( const std::string &  path_) const

Check if a path is associated to a command interface.

◆ is_interface()

bool datatools::ui::ihs::is_interface ( const std::string &  path_) const

Check if a path is a command interface.

◆ is_trait()

bool datatools::ui::ihs::is_trait ( const std::string &  path_,
const std::string &  trait_label_ 
) const

Check if a trait id set.

◆ label_to_node_type()

static node_type datatools::ui::ihs::label_to_node_type ( const std::string &  label_)
static

Convert label to node type.

◆ node_type_to_label()

static std::string datatools::ui::ihs::node_type_to_label ( node_type  )
static

Convert node type to label.

◆ path_has_scheme()

static bool datatools::ui::ihs::path_has_scheme ( const std::string &  path_,
const std::string &  scheme_ = "" 
)
static

Check if a path has a leading scheme. If scheme is given, its specific value is checked.

Examples: "/path/to/resource" -> has no scheme "foo:/path/to/resource" -> has scheme "foo" "bar:/path/to/resource" -> has scheme "bar"

◆ path_remove_scheme()

static void datatools::ui::ihs::path_remove_scheme ( const std::string &  path_,
std::string &  out_ 
)
static

Remove the leading scheme from the path

Examples: "/path/to/resource" -> "/path/to/resource" (unchanged) "foo:/path/to/resource" -> "/path/to/resource"

◆ remove()

void datatools::ui::ihs::remove ( const std::string &  path_,
bool  recursive_ = false 
)

Remove path.

◆ remove_command()

void datatools::ui::ihs::remove_command ( const std::string &  command_path_)

Remove a command given its full path.

◆ remove_interface()

void datatools::ui::ihs::remove_interface ( const std::string &  interface_path_,
bool  recursive_ = false 
)

Remove a command interface given its full path.

◆ reset()

void datatools::ui::ihs::reset ( )

Reset.

◆ reset_trait()

void datatools::ui::ihs::reset_trait ( const std::string &  path_,
const std::string &  trait_label_ 
)

Reset trait flag.

◆ set_scheme()

void datatools::ui::ihs::set_scheme ( const std::string &  )

Set the scheme.

◆ set_trait()

void datatools::ui::ihs::set_trait ( const std::string &  path_,
const std::string &  trait_label_,
const bool  set_ = true 
)

Set trait flag.

◆ tree_dump()

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

Smart print.

Reimplemented from datatools::enriched_base.


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