Bayeux  3.4.1
Core Foundation library for SuperNEMO
reflective_command_interface.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2016 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_REFLECTIVE_COMMAND_INTERFACE_H
22 #define DATATOOLS_UI_REFLECTIVE_COMMAND_INTERFACE_H
23 
24 // Standard library:
25 #include <string>
26 #include <set>
27 
28 // This project:
31 #include <datatools/properties.h>
32 #include <datatools/version_id.h>
35 
36 namespace datatools {
37 
38  namespace ui {
39 
41  template <typename Type>
43  : public target_command_interface<Type>
44  {
45  public:
46 
49 
50 
52  reflective_command_interface(const std::string & name_ ,
53  const std::string & description_ = "",
55 
57  reflective_command_interface(Type & target_,
58  const std::string & name_,
59  const std::string & description_ = "",
61 
64 
66  virtual bool is_initialized() const;
67 
69  virtual void initialize(const datatools::properties & config_,
70  const datatools::service_manager & services_);
71 
73  virtual void reset();
74 
76  void add_disabled_command(const std::string & name_);
77 
78  protected:
79 
81  virtual void _add_commands();
82 
84  virtual void _remove_commands();
85 
86  private:
87 
88  // Management:
89  bool _initialized_ = false;
90  std::set<std::string> _disabled_commands_;
91 
92  };
93 
94  } // namespace ui
95 
96 } // namespace datatools
97 
99 
100 #endif // DATATOOLS_UI_REFLECTIVE_COMMAND_INTERFACE_H
101 
102 // Local Variables: --
103 // mode: c++ --
104 // c-file-style: "gnu" --
105 // tab-width: 2 --
106 // End: --
reflective_command_interface()
Default constructor.
Definition: reflective_command_interface-inl.h:21
Target command interface.
virtual bool is_initialized() const
Check initialization status.
Definition: reflective_command_interface-inl.h:58
static const version_id & invalid()
Return an invalid version identifier.
void add_disabled_command(const std::string &name_)
Add the name of a command to be disabled.
Definition: reflective_command_interface-inl.h:99
Base command interface for a target object.
Definition: target_command_interface.h:37
Base command for target objects.
virtual void reset()
Reset.
Definition: reflective_command_interface-inl.h:88
virtual void _remove_commands()
Remove commands.
Definition: reflective_command_interface-inl.h:130
virtual ~reflective_command_interface()
Destructor.
Definition: reflective_command_interface-inl.h:49
virtual void _add_commands()
Add commands.
Definition: reflective_command_interface-inl.h:106
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void initialize(const datatools::properties &config_, const datatools::service_manager &services_)
Initialization.
Definition: reflective_command_interface-inl.h:64
Reflective command interface for a target object.
Definition: reflective_command_interface.h:42
A class representing a version ID :
Definition: version_id.h:67
Service management class.
Definition: service_manager.h:57
A dictionary of arbitrary properties.
Definition: properties.h:125