12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef USERIOMAN_H
- #define USERIOMAN_H
- #include "ioman.h"
- /**
- * @class UserIoMan
- *
- * Provides specific implementations of IoMan outputs and prompts
- * for interactive user sessions
- */
- class UserIoMan : public IoMan {
- private:
- /**
- * Map containing pointers to the appropriate member functions for printing
- * formatted json output
- */
- map<string, void (UserIoMan::*)(Json::Value)> printmap;
- /**
- * Class-wide json functionality
- */
- Json::CharReader *reader;
- Json::StreamWriterBuilder wbuilder;
- string jsonerror;
- /**
- * Format and pretty print json for terminal output
- */
- void printJson(Json::Value root);
- /**
- * Method prototypes for printing json output
- */
- /* printing commands go here */
- void printConnect(Json::Value root);
- void printHelp(Json::Value root);
- void printStatus(Json::Value root);
- void printDisconnect(Json::Value root);
- void printPut(Json::Value root);
- void printGet(Json::Value root);
- void printList(Json::Value root);
- void printVersion(Json::Value root);
- void printLogin(Json::Value root);
- void printPutdata(Json::Value root);
- void printGetdata(Json::Value root);
- void printListdata(Json::Value root);
- /**
- * Mutex for synchronized message output
- */
- std::recursive_mutex msgmutex;
- public:
- /**
- * Constructor and destructor
- */
- UserIoMan(char *ipcstring);
- ~UserIoMan();
- protected:
- /**
- * Specific implementations for printing messages
- */
- void printMessage(std::string msg, OutMsgType type);
- void printWelcomeMessage();
- /**
- * Return the specific prompt strings for IoMan prompts
- */
- std::string getCmdPrompt();
- std::string getUserPrompt();
- std::string getPassPrompt();
- };
- #endif
|