I have to provide an API to users who need to send some command to the server.
the commands will be of the form
I need to construct an object with the following which is the command to be send to a server. The command is of this form(i.e, three separate lines with the following format)
msg is one of write, read, delete, update, etc.
id is not relevant for now.
The dataValue may be a string, int or a json encoded string. I will be setting this data field according the command.
I have another class that actually send this string to the server.
What I am trying to do is to create the commandMsgs and
do something like
So, I need to create a Command class and constuct it as per the request. What is the better way to do it.
So, I need to create the Command objects by simply passing
Command *cmd = new Command(write, 123, dataValueString);
then call sendCommand(cmd->getString()) or something like this.