Bayeux  3.4.1
Core Foundation library for SuperNEMO
shell_command_interface.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2015 by François Mauger <mauger@lpccaen.in2p3.fr>
5 //
6 // This file is part of datatools.
7 //
8 // datatools is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // datatools is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with datatools. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef DATATOOLS_UI_SHELL_COMMAND_INTERFACE_H
22 #define DATATOOLS_UI_SHELL_COMMAND_INTERFACE_H
23 
24 // This project:
27 #include <datatools/properties.h>
28 #include <datatools/version_id.h>
31 
32 namespace datatools {
33 
34  namespace ui {
35 
36  class basic_shell;
37 
40  : public target_command_interface<basic_shell>
41  {
42  public:
43 
46 
48  shell_command_interface(const std::string & name_ ,
49  const std::string & description_ = "",
51 
54  const std::string & name_,
55  const std::string & description_ = "",
57 
59  virtual ~shell_command_interface();
60 
62  virtual bool is_initialized() const;
63 
65  virtual void initialize(const datatools::properties & config_,
66  const datatools::service_manager & services_);
67 
69  virtual void reset();
70 
72  bool is_inhibit_load() const;
73 
75  void set_inhibit_load(bool);
76 
78  bool is_inhibit_cd() const;
79 
81  void set_inhibit_cd(bool);
82 
84  bool has_shell() const;
85 
88 
90  const basic_shell & get_shell() const;
91 
92  protected:
93 
95  virtual void _add_shell_commands();
96 
98  virtual void _remove_shell_commands();
99 
100  private:
101 
102  // Management:
103  bool _initialized_ = false;
104 
105  // Configuration:
106  bool _inhibit_cd_ = false;
107  bool _inhibit_load_ = false;
108 
109  // Factory registration:
112 
113  };
114 
115  } // namespace ui
116 
117 } // namespace datatools
118 
119 #endif // DATATOOLS_UI_SHELL_COMMAND_INTERFACE_H
120 
121 // Local Variables: --
122 // mode: c++ --
123 // c-file-style: "gnu" --
124 // tab-width: 2 --
125 // End: --
bool has_shell() const
Check if the shell is set.
const basic_shell & get_shell() const
Return a non mutable reference to the shell.
virtual ~shell_command_interface()
Destructor.
Base class for command line interface command objects.
basic_shell & grab_shell()
Return a mutable reference to the shell.
Target command interface.
void set_inhibit_load(bool)
Set the load command inhibition flag.
static const version_id & invalid()
Return an invalid version identifier.
#define DATATOOLS_FACTORY_SYSTEM_AUTO_REGISTRATION_INTERFACE(BaseType, DerivedType)
Interface macro of the automated registration for derived classes.
Definition: factory_macros.h:87
void set_inhibit_cd(bool)
Set the cd command inhibition flag.
Base command interface for a target object.
Definition: target_command_interface.h:37
bool is_inhibit_load() const
Check if the load command is inhibited.
virtual void initialize(const datatools::properties &config_, const datatools::service_manager &services_)
Initialization.
virtual void _remove_shell_commands()
Remove base shell commands.
Base command interface for a shell.
Definition: shell_command_interface.h:39
shell_command_interface()
Default constructor.
virtual bool is_initialized() const
Check initialization status.
Command interface for arbitrary objects.
Definition: base_command_interface.h:54
virtual void _add_shell_commands()
Add base shell commands.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
bool is_inhibit_cd() const
Check if the cd command is inhibited.
A class representing a version ID :
Definition: version_id.h:67
Service management class.
Definition: service_manager.h:57
Command line shell interface.
Definition: basic_shell.h:58
A dictionary of arbitrary properties.
Definition: properties.h:125