Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Member Functions | Protected Member Functions | List of all members
datatools::ui::base_command_interface Class Referenceabstract

Command interface for arbitrary objects. More...

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

Inheritance diagram for datatools::ui::base_command_interface:
datatools::enriched_base datatools::i_serializable datatools::i_tree_dumpable datatools::ui::const_target_command_interface< Type > datatools::ui::target_command_interface< Type > datatools::ui::target_command_interface< basic_shell > datatools::ui::reflective_command_interface< Type > datatools::ui::shell_command_interface

Public Member Functions

 base_command_interface ()
 Default constructor. More...
 
 base_command_interface (const std::string &name_, const std::string &description_="", const version_id &vid_=version_id::invalid())
 Constructor. More...
 
virtual ~base_command_interface ()
 Destructor. More...
 
bool has_version () const
 Check if the version is set. More...
 
void set_version (const datatools::version_id &version_)
 Set the version. More...
 
const datatools::version_idget_version () const
 Return the version. More...
 
std::size_t size () const
 Return the number of commands. More...
 
bool has_command (const std::string &command_name_) const
 Check if a command with given name exists. More...
 
base_commandgrab_command (const std::string &command_name_)
 Return a reference to a mutable command. More...
 
const base_commandget_command (const std::string &command_name_) const
 Return a reference to a command. More...
 
base_command_interfaceadd_command (base_command &command_, const std::string &command_name_="")
 Add an external command object. More...
 
base_command_interfaceadd_command (base_command *command_, const std::string &command_name_="")
 
void remove_command (const std::string &command_name_)
 Remove a command. More...
 
void remove_all_commands ()
 Remove all commands. More...
 
void build_command_names (std::vector< std::string > &names_) const
 Build the list of command names. More...
 
void initialize_simple ()
 Initialize the parser. More...
 
void initialize_standalone (const datatools::properties &)
 Initialize the parser using only a list of properties. More...
 
virtual bool is_initialized () const =0
 Check if the parser is initialized. More...
 
virtual void initialize (const datatools::properties &config_, const datatools::service_manager &services_)=0
 Initialize the parser using a list of properties with access to a service manager. More...
 
virtual void reset ()=0
 Reset. More...
 
bool is_valid () const
 Check if the command interface is valid. More...
 
bool is_disabled () const
 Check if the command interface is disabled. More...
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Smart print. More...
 
int operator() (const std::vector< std::string > &argv_, datatools::command::returned_info &cri_, uint32_t flags_=0)
 Main command call operator. More...
 
datatools::command::returned_info operator() (const std::vector< std::string > &argv_, uint32_t flags_=0)
 Command call operator. More...
 
void call (const std::vector< std::string > &argv_, datatools::command::returned_info &cri_, uint32_t flags_=0)
 Call method. 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
 

Protected Member Functions

void _base_setup (const std::string &name_, const std::string &description_, const version_id &vid_)
 Basic setup. More...
 
void _set_version (const datatools::version_id &)
 Set the version. More...
 
void _base_initialize (const datatools::properties &config_)
 Base initialization. More...
 
void _base_reset ()
 Base reset. More...
 
virtual bool _is_valid () const
 Check the validity (this can be overloaded) More...
 
virtual bool _is_disabled () const
 Check the active status (default: true, this can be overloaded) More...
 

Additional Inherited Members

- 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...
 
- 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_)
 

Detailed Description

Command interface for arbitrary objects.

   This object contains a dictionary of commands
   associated to some arbitrary resource (object) 

Constructor & Destructor Documentation

◆ base_command_interface() [1/2]

datatools::ui::base_command_interface::base_command_interface ( )

Default constructor.

◆ base_command_interface() [2/2]

datatools::ui::base_command_interface::base_command_interface ( const std::string &  name_,
const std::string &  description_ = "",
const version_id vid_ = version_id::invalid() 
)

Constructor.

◆ ~base_command_interface()

virtual datatools::ui::base_command_interface::~base_command_interface ( )
virtual

Destructor.

Member Function Documentation

◆ _base_initialize()

void datatools::ui::base_command_interface::_base_initialize ( const datatools::properties config_)
protected

Base initialization.

◆ _base_reset()

void datatools::ui::base_command_interface::_base_reset ( )
protected

Base reset.

◆ _base_setup()

void datatools::ui::base_command_interface::_base_setup ( const std::string &  name_,
const std::string &  description_,
const version_id vid_ 
)
protected

Basic setup.

◆ _is_disabled()

virtual bool datatools::ui::base_command_interface::_is_disabled ( ) const
protectedvirtual

Check the active status (default: true, this can be overloaded)

◆ _is_valid()

virtual bool datatools::ui::base_command_interface::_is_valid ( ) const
protectedvirtual

Check the validity (this can be overloaded)

◆ _set_version()

void datatools::ui::base_command_interface::_set_version ( const datatools::version_id )
protected

Set the version.

◆ add_command() [1/2]

base_command_interface& datatools::ui::base_command_interface::add_command ( base_command command_,
const std::string &  command_name_ = "" 
)

Add an external command object.

◆ add_command() [2/2]

base_command_interface& datatools::ui::base_command_interface::add_command ( base_command command_,
const std::string &  command_name_ = "" 
)

Add a local command object The interface is responsible of the memory management

◆ build_command_names()

void datatools::ui::base_command_interface::build_command_names ( std::vector< std::string > &  names_) const

Build the list of command names.

◆ call()

void datatools::ui::base_command_interface::call ( const std::vector< std::string > &  argv_,
datatools::command::returned_info cri_,
uint32_t  flags_ = 0 
)

Call method.

◆ get_command()

const base_command& datatools::ui::base_command_interface::get_command ( const std::string &  command_name_) const

Return a reference to a command.

◆ get_version()

const datatools::version_id& datatools::ui::base_command_interface::get_version ( ) const

Return the version.

◆ grab_command()

base_command& datatools::ui::base_command_interface::grab_command ( const std::string &  command_name_)

Return a reference to a mutable command.

◆ has_command()

bool datatools::ui::base_command_interface::has_command ( const std::string &  command_name_) const

Check if a command with given name exists.

◆ has_version()

bool datatools::ui::base_command_interface::has_version ( ) const

Check if the version is set.

◆ initialize()

virtual void datatools::ui::base_command_interface::initialize ( const datatools::properties config_,
const datatools::service_manager services_ 
)
pure virtual

Initialize the parser using a list of properties with access to a service manager.

Implemented in datatools::ui::reflective_command_interface< Type >, and datatools::ui::shell_command_interface.

◆ initialize_simple()

void datatools::ui::base_command_interface::initialize_simple ( )

Initialize the parser.

◆ initialize_standalone()

void datatools::ui::base_command_interface::initialize_standalone ( const datatools::properties )

Initialize the parser using only a list of properties.

◆ is_disabled()

bool datatools::ui::base_command_interface::is_disabled ( ) const

Check if the command interface is disabled.

◆ is_initialized()

virtual bool datatools::ui::base_command_interface::is_initialized ( ) const
pure virtual

Check if the parser is initialized.

Implemented in datatools::ui::reflective_command_interface< Type >, and datatools::ui::shell_command_interface.

◆ is_valid()

bool datatools::ui::base_command_interface::is_valid ( ) const

Check if the command interface is valid.

◆ operator()() [1/2]

int datatools::ui::base_command_interface::operator() ( const std::vector< std::string > &  argv_,
datatools::command::returned_info cri_,
uint32_t  flags_ = 0 
)

Main command call operator.

◆ operator()() [2/2]

datatools::command::returned_info datatools::ui::base_command_interface::operator() ( const std::vector< std::string > &  argv_,
uint32_t  flags_ = 0 
)

Command call operator.

◆ remove_all_commands()

void datatools::ui::base_command_interface::remove_all_commands ( )

Remove all commands.

◆ remove_command()

void datatools::ui::base_command_interface::remove_command ( const std::string &  command_name_)

Remove a command.

◆ reset()

virtual void datatools::ui::base_command_interface::reset ( )
pure virtual

◆ set_version()

void datatools::ui::base_command_interface::set_version ( const datatools::version_id version_)

Set the version.

◆ size()

std::size_t datatools::ui::base_command_interface::size ( ) const

Return the number of commands.

◆ tree_dump()

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

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