Skip to content

Commit 48bfce2

Browse files
committed
update functions in command execution, update objects, update annotations, fixes #10, fixes #11
1 parent 4c3b4fe commit 48bfce2

25 files changed

+290
-64
lines changed

source/annotatorlib/include/AnnotatorLib/Commands/AdjustNeighbors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class ANNOTATORLIB_API AdjustNeighbors : public Command {
2323

2424
~AdjustNeighbors() {}
2525

26-
bool execute();
26+
virtual bool execute(Session *informSession = 0) override;
2727

28-
bool undo();
28+
virtual bool undo(Session *informSession = 0) override;
2929

3030
protected:
3131
std::shared_ptr<Object> object;

source/annotatorlib/include/AnnotatorLib/Commands/CleanSession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class ANNOTATORLIB_API CleanSession : public Command {
1818

1919
~CleanSession() {}
2020

21-
bool execute();
21+
virtual bool execute(Session *informSession = 0) override;
2222

23-
bool undo();
23+
virtual bool undo(Session *informSession = 0) override;
2424

2525
protected:
2626
std::shared_ptr<Session> session;

source/annotatorlib/include/AnnotatorLib/Commands/Command.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
#define ANNOTATOR_ANNOTATORLIB_COMMANDS_COMMAND_H
44

55
/************************************************************
6-
Annotation class header
6+
Annotation command header
77
************************************************************/
88
#include <AnnotatorLib/annotatorlib_api.h>
99
#include <vector>
1010

1111
namespace AnnotatorLib {
1212

13+
class Session;
14+
1315
namespace Commands {
1416

1517
/************************************************************/
@@ -20,10 +22,24 @@ class ANNOTATORLIB_API Command {
2022
public:
2123
virtual ~Command() {}
2224

23-
virtual bool execute() = 0;
25+
/**
26+
* @brief execute
27+
* Let the command make its execution.
28+
* @param session
29+
* The session that can be informed about changes.
30+
* @return
31+
*/
32+
virtual bool execute(Session *informSession = 0) = 0;
2433

25-
virtual bool undo() = 0;
34+
/**
35+
* @brief undo
36+
* Let the command undo its execution.
37+
* @param session
38+
* The session that can be informed about changes.
39+
* @return
40+
*/
41+
virtual bool undo(Session *informSession = 0) = 0;
2642
};
27-
}
28-
}
43+
} // of namespace Commands
44+
} // of namespace AnnotatorLib
2945
#endif

source/annotatorlib/include/AnnotatorLib/Commands/CompressObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class ANNOTATORLIB_API CompressObject : public Command {
2424

2525
~CompressObject() { removed_annotations.clear(); }
2626

27-
bool execute();
27+
virtual bool execute(Session *informSession = 0) override;
2828

29-
bool undo();
29+
virtual bool undo(Session *informSession = 0) override;
3030

3131
shared_ptr<Object> getObject() { return obj; }
3232

source/annotatorlib/include/AnnotatorLib/Commands/CompressSession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class ANNOTATORLIB_API CompressSession : public Command {
2424

2525
~CompressSession() { removed_annotations.clear(); }
2626

27-
bool execute();
27+
virtual bool execute(Session *informSession = 0) override;
2828

29-
bool undo();
29+
virtual bool undo(Session *informSession = 0) override;
3030

3131
protected:
3232
std::shared_ptr<Session> session;

source/annotatorlib/include/AnnotatorLib/Commands/NewAnnotation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class ANNOTATORLIB_API NewAnnotation : public Command {
3636

3737
~NewAnnotation() {}
3838

39-
bool execute();
39+
virtual bool execute(Session *informSession = 0) override;
4040

41-
bool undo();
41+
virtual bool undo(Session *informSession = 0) override;
4242

4343
shared_ptr<Annotation> getAnnotation();
4444
bool newObjectCreated() { return createdNewObject; }

source/annotatorlib/include/AnnotatorLib/Commands/RemoveAnnotation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class ANNOTATORLIB_API RemoveAnnotation : public Command {
2121
shared_ptr<Annotation> a);
2222
~RemoveAnnotation() {}
2323

24-
bool execute();
24+
virtual bool execute(Session *informSession = 0) override;
2525

26-
bool undo();
26+
virtual bool undo(Session *informSession = 0) override;
2727

2828
shared_ptr<AnnotatorLib::Annotation> getAnnotation();
2929

source/annotatorlib/include/AnnotatorLib/Commands/RemoveAnnotationRange.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class ANNOTATORLIB_API RemoveAnnotationRange : public Command {
3838
shared_ptr<AnnotatorLib::Frame> f2);
3939
~RemoveAnnotationRange() {}
4040

41-
bool execute();
41+
virtual bool execute(Session *informSession = 0) override;
4242

43-
bool undo();
43+
virtual bool undo(Session *informSession = 0) override;
4444

4545
shared_ptr<AnnotatorLib::Object> getObject();
4646
unsigned long getFrame1();

source/annotatorlib/include/AnnotatorLib/Commands/RemoveObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class ANNOTATORLIB_API RemoveObject : public Command {
2222
RemoveObject(const RemoveObject &other) = delete;
2323
~RemoveObject() {}
2424

25-
bool execute();
25+
virtual bool execute(Session *informSession = 0) override;
2626

27-
bool undo();
27+
virtual bool undo(Session *informSession = 0) override;
2828

2929
shared_ptr<Object> getObject() { return object; }
3030

source/annotatorlib/include/AnnotatorLib/Commands/UpdateAnnotation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class ANNOTATORLIB_API UpdateAnnotation : public Command {
1818

1919
~UpdateAnnotation() {}
2020

21-
bool execute();
21+
virtual bool execute(Session *informSession = 0) override;
2222

23-
bool undo();
23+
virtual bool undo(Session *informSession = 0) override;
2424

2525
shared_ptr<Annotation> getAnnotation();
2626

0 commit comments

Comments
 (0)