2021-07-19 15:32:34 -04:00
|
|
|
#ifndef INVOCATION_HPP
|
|
|
|
|
#define INVOCATION_HPP
|
|
|
|
|
|
2022-02-23 23:08:28 -05:00
|
|
|
#include "wrap-string.hpp"
|
|
|
|
|
#include "wrap-map.hpp"
|
|
|
|
|
#include "wrap-deque.hpp"
|
|
|
|
|
|
2021-07-19 15:32:34 -04:00
|
|
|
#include "streambuffer.hpp"
|
|
|
|
|
|
|
|
|
|
|
2022-02-24 02:17:41 -05:00
|
|
|
class InvocationData : public eng::map<eng::string, eng::string> {
|
2021-07-19 15:32:34 -04:00
|
|
|
public:
|
2022-02-24 02:17:41 -05:00
|
|
|
const eng::string &get(const eng::string &key) const;
|
2021-10-15 14:47:12 -04:00
|
|
|
|
2021-07-19 15:32:34 -04:00
|
|
|
void serialize(StreamBuffer *sb) const;
|
|
|
|
|
void deserialize(StreamBuffer *sb);
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-02 14:52:51 -05:00
|
|
|
class Invocation : public eng::nevernew {
|
2021-07-19 15:32:34 -04:00
|
|
|
public:
|
|
|
|
|
enum Kind {
|
|
|
|
|
KIND_INVALID,
|
|
|
|
|
KIND_PLAN,
|
2021-10-15 14:47:12 -04:00
|
|
|
KIND_LUA,
|
2021-10-25 14:47:37 -04:00
|
|
|
KIND_FLUSH_PRINTS,
|
2021-11-26 15:45:36 -05:00
|
|
|
KIND_TICK,
|
2021-12-15 14:18:19 -05:00
|
|
|
KIND_LUA_SOURCE,
|
2021-07-19 15:32:34 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Kind kind_;
|
|
|
|
|
int64_t actor_;
|
|
|
|
|
int64_t place_;
|
2022-02-24 02:17:41 -05:00
|
|
|
eng::string action_;
|
2021-07-19 15:32:34 -04:00
|
|
|
InvocationData data_;
|
|
|
|
|
public:
|
|
|
|
|
Invocation();
|
2022-02-24 02:17:41 -05:00
|
|
|
Invocation(Kind kind, int64_t actor, int64_t place, const eng::string &action, const InvocationData &data);
|
|
|
|
|
Invocation(Kind kind, int64_t actor, int64_t place, const eng::string &action);
|
2021-11-16 12:20:11 -05:00
|
|
|
|
|
|
|
|
bool valid() const { return kind_ != KIND_INVALID; }
|
2021-07-19 15:32:34 -04:00
|
|
|
Kind kind() const { return kind_; }
|
|
|
|
|
int64_t actor() const { return actor_; }
|
|
|
|
|
int64_t place() const { return place_; }
|
2022-02-24 02:17:41 -05:00
|
|
|
const eng::string &action() const { return action_; }
|
2021-07-19 15:32:34 -04:00
|
|
|
const InvocationData &data() const { return data_; }
|
|
|
|
|
|
|
|
|
|
void serialize(StreamBuffer *sb) const;
|
|
|
|
|
void deserialize(StreamBuffer *sb);
|
2021-11-11 16:23:11 -05:00
|
|
|
|
2023-04-10 16:00:47 -04:00
|
|
|
eng::string debug_string() const;
|
2021-07-19 15:32:34 -04:00
|
|
|
};
|
|
|
|
|
|
2022-02-24 02:17:41 -05:00
|
|
|
class InvocationQueue : public eng::deque<Invocation> {
|
2021-07-19 15:32:34 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // INVOCATION_HPP
|