58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#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:
|
|
const std::string &get(const std::string &key) const;
|
|
|
|
void serialize(StreamBuffer *sb) const;
|
|
void deserialize(StreamBuffer *sb);
|
|
};
|
|
|
|
class Invocation {
|
|
public:
|
|
enum Kind {
|
|
KIND_INVALID,
|
|
KIND_PLAN,
|
|
KIND_LUA,
|
|
KIND_FLUSH_PRINTS,
|
|
KIND_TICK,
|
|
KIND_LUA_SOURCE,
|
|
};
|
|
|
|
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);
|
|
Invocation(Kind kind, int64_t actor, int64_t place, const std::string &action);
|
|
|
|
bool valid() const { return kind_ != KIND_INVALID; }
|
|
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);
|
|
|
|
std::string debug_string();
|
|
};
|
|
|
|
class InvocationQueue : public std::deque<Invocation> {
|
|
};
|
|
|
|
|
|
#endif // INVOCATION_HPP
|