Plan invocations are now serializable objects
This commit is contained in:
47
luprex/core/cpp/invocation.hpp
Normal file
47
luprex/core/cpp/invocation.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef INVOCATION_HPP
|
||||
#define INVOCATION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
|
||||
class InvocationData : public std::map<std::string, std::string> {
|
||||
public:
|
||||
void serialize(StreamBuffer *sb) const;
|
||||
void deserialize(StreamBuffer *sb);
|
||||
};
|
||||
|
||||
class Invocation {
|
||||
public:
|
||||
enum Kind {
|
||||
KIND_INVALID,
|
||||
KIND_PLAN,
|
||||
};
|
||||
|
||||
private:
|
||||
Kind kind_;
|
||||
int64_t actor_;
|
||||
int64_t place_;
|
||||
std::string action_;
|
||||
InvocationData data_;
|
||||
public:
|
||||
Invocation();
|
||||
Invocation(Kind kind, int64_t actor, int64_t place, const std::string &action, const InvocationData &data);
|
||||
|
||||
Kind kind() const { return kind_; }
|
||||
int64_t actor() const { return actor_; }
|
||||
int64_t place() const { return place_; }
|
||||
const std::string &action() const { return action_; }
|
||||
const InvocationData &data() const { return data_; }
|
||||
|
||||
void serialize(StreamBuffer *sb) const;
|
||||
void deserialize(StreamBuffer *sb);
|
||||
};
|
||||
|
||||
class InvocationQueue : public std::deque<Invocation> {
|
||||
};
|
||||
|
||||
|
||||
#endif // INVOCATION_HPP
|
||||
Reference in New Issue
Block a user