summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/action.cpp10
-rw-r--r--common/action.h13
2 files changed, 22 insertions, 1 deletions
diff --git a/common/action.cpp b/common/action.cpp
new file mode 100644
index 0000000..467df4e
--- /dev/null
+++ b/common/action.cpp
@@ -0,0 +1,10 @@
+#include "action.h"
+#include <algorithm>
+
+bool Action::operator==(Action other) {
+ return type == other.type && target == other.target;
+}
+
+bool Actions::contains(Action action) {
+ return std::find(begin(), end(), action) != end();
+}
diff --git a/common/action.h b/common/action.h
index 5099e03..bae22cf 100644
--- a/common/action.h
+++ b/common/action.h
@@ -2,6 +2,7 @@
#define ACTION_H
#include <vector>
+#include <boost/serialization/base_object.hpp>
class Action {
public:
@@ -35,6 +36,16 @@ class Action {
}
};
-typedef std::vector<Action> Actions;
+//! List of actions.
+class Actions : public std::vector<Action> {
+ public:
+ //! Check if specified action is present in list.
+ bool contains(Action action);
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version) {
+ ar & boost::serialization::base_object<std::vector<Action> >(*this);
+ }
+};
#endif