2021-07-19 15:32:34 -04:00
|
|
|
#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:
|
2021-10-15 14:47:12 -04:00
|
|
|
const std::string &get(const std::string &key) const;
|
|
|
|
|
|
2021-07-19 15:32:34 -04:00
|
|
|
void serialize(StreamBuffer *sb) const;
|
|
|
|
|
void deserialize(StreamBuffer *sb);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Invocation {
|
|
|
|
|
public:
|
|
|
|
|
enum Kind {
|
|
|
|
|
KIND_INVALID,
|
|
|
|
|
KIND_PLAN,
|
2021-10-15 14:47:12 -04:00
|
|
|
KIND_LUA,
|
2021-07-19 15:32:34 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|