Class RegisterMsgParser

Class Documentation

class RegisterMsgParser

RegisterMsgParser de-serialises json-formatted commands (json string to struct) and serialises replies (struct to json string)

Public Functions

std::vector<ReqData> parse_commands(const char *msg, size_t len)

parses a char array containing a command in json format

Parameters:
  • msg -- pointer to message C-string

  • len -- length of C-string message

Returns:

a ReqData struct containing the command.

std::vector<ReqData> parse_commands(const std::string &cmd)

parses a string containing a command in json format

Parameters:

cmd -- the command string

Returns:

a ReqData struct containing the command.

std::string encode_replies(uint64_t fid, const std::vector<ReqData> &cmds)

encodes a reply in json

Parameters:
  • fid -- the reply fid

  • cmds -- vector of ReqData structures containing the command execution data

Returns:

an std::string containin the reply in serialised json.

std::vector<FelixClientThread::Reply> decode_replies(const std::string &r)

decode felix-register replies

Parameters:

r -- the string containing the reply array in json format

Returns:

a vector of FelixClientThread::Reply containing the decoded replies.

std::string encode_commands(const std::vector<Command> &cmds)

encodes a vector of commands into a json array

Parameters:
  • fid -- the reply fid

  • cmds -- vector of Command structures cdescribing commands

Returns:

an std::string containin the command json array