anatomist
5.0.5
3D neuroimaging data viewer
Command.h
Go to the documentation of this file.
1
/* This software and supporting documentation are distributed by
2
* Institut Federatif de Recherche 49
3
* CEA/NeuroSpin, Batiment 145,
4
* 91191 Gif-sur-Yvette cedex
5
* France
6
*
7
* This software is governed by the CeCILL-B license under
8
* French law and abiding by the rules of distribution of free software.
9
* You can use, modify and/or redistribute the software under the
10
* terms of the CeCILL-B license as circulated by CEA, CNRS
11
* and INRIA at the following URL "http://www.cecill.info".
12
*
13
* As a counterpart to the access to the source code and rights to copy,
14
* modify and redistribute granted by the license, users are provided only
15
* with a limited warranty and the software's author, the holder of the
16
* economic rights, and the successive licensors have only limited
17
* liability.
18
*
19
* In this respect, the user's attention is drawn to the risks associated
20
* with loading, using, modifying and/or developing or reproducing the
21
* software by the user in light of its specific status of free software,
22
* that may mean that it is complicated to manipulate, and that also
23
* therefore means that it is reserved for developers and experienced
24
* professionals having in-depth computer knowledge. Users are therefore
25
* encouraged to load and test the software's suitability as regards their
26
* requirements in conditions enabling the security of their systems and/or
27
* data to be ensured and, more generally, to use and operate it in the
28
* same conditions as regards security.
29
*
30
* The fact that you are presently reading this means that you have had
31
* knowledge of the CeCILL-B license and that you accept its terms.
32
*/
33
34
35
#ifndef ANA_PROCESSOR_COMMAND_H
36
#define ANA_PROCESSOR_COMMAND_H
37
38
39
//--- header files ------------------------------------------------------------
40
41
#include <map>
42
#include <string>
43
44
class
Tree
;
45
46
47
//--- class declarations ------------------------------------------------------
48
49
50
namespace
anatomist
51
{
52
class
Serializer;
53
class
Unserializer;
54
class
CommandReader;
55
struct
CommandContext;
56
59
class
Command
60
{
61
public
:
63
virtual
~Command
();
64
66
virtual
void
execute
();
68
virtual
void
undo
();
70
virtual
void
redo
();
71
72
typedef
Command
* (*Reader)(
const
Tree
&,
CommandContext
* );
73
75
virtual
std::string
name
()
const
= 0;
76
78
virtual
void
write
( Tree & com,
Serializer
*ser )
const
;
79
80
protected
:
84
Command
();
85
87
virtual
void
doit
() = 0;
89
virtual
void
undoit
();
90
91
private
:
93
Command
(
const
Command
&);
95
Command
& operator=(
const
Command
&);
96
};
97
98
99
//--- class declarations ----------------------------------------------------
100
103
class
RegularCommand
:
public
Command
104
{
105
public
:
107
virtual
~
RegularCommand
();
108
109
protected
:
113
RegularCommand
();
114
};
115
116
117
//--- class declarations ----------------------------------------------------
118
127
class
SerializingCommand
128
{
129
public
:
130
virtual
~
SerializingCommand
();
131
CommandContext
*
context
() {
return
_context; }
132
const
CommandContext
*
context
()
const
{
return
_context; }
133
134
protected
:
135
SerializingCommand
(
CommandContext
* );
136
137
CommandContext
*
_context
;
138
};
139
140
141
//--- class declarations ----------------------------------------------------
142
145
class
WaitCommand
:
public
Command
146
{
147
public
:
149
virtual
~
WaitCommand
();
150
152
virtual
void
execute
();
154
virtual
void
undo
();
156
virtual
void
redo
();
157
158
protected
:
162
WaitCommand
();
163
};
164
165
}
166
167
168
#endif
anatomist::SerializingCommand::context
CommandContext * context()
Definition:
Command.h:131
anatomist::Command::undoit
virtual void undoit()
Undo a command.
anatomist::Command::write
virtual void write(Tree &com, Serializer *ser) const
Print the guts of a command into a Tree given as parent.
anatomist::Command::~Command
virtual ~Command()
Destructor does nothing.
anatomist
Definition:
anatomistinfo.h:39
anatomist::Command::Command
Command()
The programmer cannot call the constructor of an abstract base class.
anatomist::Serializer
Serializer is a helper class for pointer serialization.
Definition:
Serializer.h:54
anatomist::SerializingCommand::context
const CommandContext * context() const
Definition:
Command.h:132
anatomist::RegularCommand
The abstract base class for usual commands.
Definition:
Command.h:103
Tree
anatomist::Command::execute
virtual void execute()
Execute the command - may use { doit()}.
anatomist::Command::doit
virtual void doit()=0
Do a command.
anatomist::Command::undo
virtual void undo()
Undo the command - may use { undoit()}.
anatomist::Command::redo
virtual void redo()
Redo the command - may use { doit()}.
anatomist::CommandContext
Context for commands processor readers (APipeReader etc)
Definition:
context.h:47
anatomist::Command
The abstract base class for commands.
Definition:
Command.h:59
anatomist::Command::name
virtual std::string name() const =0
Return the unique name of a class of commands.
anatomist::WaitCommand
The abstract base class for commands that display a watch cursor.
Definition:
Command.h:145
anatomist::SerializingCommand::_context
CommandContext * _context
Definition:
Command.h:137
anatomist::SerializingCommand
The abstract base class used for commands that have to read/write pointers.
Definition:
Command.h:127
anatomist
processor
Command.h
Generated by
1.8.13