Commit 616351de authored by Millian Poquet's avatar Millian Poquet
Browse files

[code] json_reader: unimplemented handlers+stuff

parent 874dd4cf
......@@ -352,9 +352,21 @@ bool test_json_writer()
JsonProtocolReader::~JsonProtocolReader()
JsonProtocolReader::JsonProtocolReader(BatsimContext *context) :
context(context)
{
_type_to_handler_map["QUERY_REQUEST"] = &JsonProtocolReader::handle_query_request;
_type_to_handler_map["REJECT_JOB"] = &JsonProtocolReader::handle_reject_job;
_type_to_handler_map["EXECUTE_JOB"] = &JsonProtocolReader::handle_execute_job;
_type_to_handler_map["CALL_ME_LATER"] = &JsonProtocolReader::handle_call_me_later;
_type_to_handler_map["KILL_JOB"] = &JsonProtocolReader::handle_kill_job;
_type_to_handler_map["SUBMIT_JOB"] = &JsonProtocolReader::handle_submit_job;
_type_to_handler_map["SET_RESOURCE_STATE"] = &JsonProtocolReader::handle_set_resource_state;
_type_to_handler_map["NOTIFY"] = &JsonProtocolReader::handle_notify;
}
JsonProtocolReader::~JsonProtocolReader()
{
}
void JsonProtocolReader::parse_and_apply_message(const string &message)
......@@ -653,6 +665,30 @@ void JsonProtocolReader::handle_set_resource_state(int event_number, double time
dsend_message(timestamp, "server", IPMessageType::PSTATE_MODIFICATION, (void*) message);
}
void JsonProtocolReader::handle_notify(int event_number, double timestamp, const Value &data_object)
{
xbt_assert(false, "Unimplemented");
(void) event_number;
(void) timestamp;
(void) data_object;
}
void JsonProtocolReader::handle_submit_job(int event_number, double timestamp, const Value &data_object)
{
xbt_assert(false, "Unimplemented");
(void) event_number;
(void) timestamp;
(void) data_object;
}
void JsonProtocolReader::handle_kill_job(int event_number, double timestamp, const Value &data_object)
{
xbt_assert(false, "Unimplemented");
(void) event_number;
(void) timestamp;
(void) data_object;
}
void JsonProtocolReader::dsend_message(double when,
const string &destination_mailbox,
IPMessageType type,
......
......@@ -439,6 +439,12 @@ public:
class JsonProtocolReader : public AbstractProtocolReader
{
public:
/**
* @brief Constructor
* @param[in] context The BatsimContext
*/
JsonProtocolReader(BatsimContext * context);
/**
* @brief Destructor
*/
......@@ -493,6 +499,27 @@ public:
*/
void handle_set_resource_state(int event_number, double timestamp, const rapidjson::Value & data_object);
/**
* @brief Handles a NOTIFY event
* @param[in] timestamp The event timestamp
* @param[in] data_object The data associated with the event (JSON object)
*/
void handle_notify(int event_number, double timestamp, const rapidjson::Value & data_object);
/**
* @brief Handles a SUBMIT_JOB event
* @param[in] timestamp The event timestamp
* @param[in] data_object The data associated with the event (JSON object)
*/
void handle_submit_job(int event_number, double timestamp, const rapidjson::Value & data_object);
/**
* @brief Handles a KILL_JOB event
* @param[in] timestamp The event timestamp
* @param[in] data_object The data associated with the event (JSON object)
*/
void handle_kill_job(int event_number, double timestamp, const rapidjson::Value & data_object);
private:
/**
* @brief Sends a message at a given time, sleeping to reach the given time if needed
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment