3.2.1 : File PEmptyControlBackend.h
The file PEmptyControlBackend.h can be found in src :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
/*************************************** Auteur : Pierre Aubert Mail : pierre.aubert@lapp.in2p3.fr Licence : CeCILL-C ****************************************/ #ifndef __PEMPTYCONTROLBACKEND_H__ #define __PEMPTYCONTROLBACKEND_H__ #include <string> #include <vector> #include "PLog.h" #include "phoenix_composeType.h" ///@brief Set of parameters to be passed to create a connector with mock backend struct PEmptyControlParam{ ///Directory where to save log files std::string logDirectory; ///Verbosity of log PLog::Level logLevel; }; ///@brief Set of parameters to be passed to create a connector with mock backend struct PEmptyManagerParam{ ///Name of the manager std::string name; ///Directory where to save log files std::string logDirectory; ///Verbosity of log PLog::Level logLevel; }; PEmptyControlParam phoenix_emptyControlParam(const std::string & logDirectory, PLog::Level logLevel); PEmptyManagerParam phoenix_emptyManagerParam(const std::string & name, const std::string & logDirectory, PLog::Level logLevel); ///@brief Contains all the data related to the connector struct PEmptyConnectorData{ ///Name of the host of the connector std::string hostname; ///Logger of the Backend PLog * logger; }; ///@brief Contains all the data related to the connector struct PEmptyManagerData{ ///Name of the host of the connector std::string name; ///Logger of the Backend PLog logger; }; ///@brief Backend to use ZMQ library with PAbtractSocket class PEmptyControlBackend{ public: ///Define the connector of the backend used by the PAbstractControlManager typedef PEmptyConnectorData Connector; ///Define the data of the backend manager used by the PAbstractControlManager typedef PEmptyManagerData Manager; ///Define the type of message used by the PAbstractControlManager typedef std::vector<char> Message; ///Define the type of extra parameters which initialise PEmptyConnectorData typedef PEmptyControlParam Param; ///Define the type of extra parameters which initialise PEmptyManagerData typedef PEmptyManagerParam MgrParam; ///Default param value (arguments are allowed, but this method has to be callabled with no argument) static Param defaultParam(const std::string & logDirectory = "./empty_connector", PLog::Level logLevel = PLog::INFO); ///Default param value (arguments are allowed, but this method has to be callabled with no argument) static MgrParam defaultMgrParam(const std::string & name = "EmptyManager", const std::string & logDirectory = "./empty_connector", PLog::Level logLevel = PLog::INFO); PEmptyControlBackend(); static bool initialiseDataManager(Manager & manager, const MgrParam & param); static bool createClientConnector(Manager & manager, Connector & connector, const std::string & address, const Param & param); static bool createServerConnector(Manager & manager, Connector & connector, const std::string & address, const Param & param); static bool registerVar(Connector & connector, const PComposeVar & composeVar); static bool registerCall(Connector & connector, const PFunctionPrototype & prototype); static bool push(Connector & connector, const std::string & varName, const Message & value); static bool pull(Connector & connector, const std::string & varName, Message & value); static bool call(Connector & connector, PFunctionCall & methodCall); static void msgResize(Message& msg, size_t sizeMsg); static size_t msgSize(const Message& msg); static const char* msgData(const Message& msg); static char* msgData(Message& msg); static void close(Connector & connector); static void closeMgr(Manager & manager); static bool isConnected(Connector & connector); static bool registerLocalVar(Manager & manager, const PComposeVar & composeVar); static bool getLocalVar(Manager & manager, PComposeVar & localVar); static bool setLocalVar(Manager & manager, const PComposeVar & localVar); //Method only for this particular backend static bool createConnector(Manager & manager, Connector & connector, const std::string & connectorType, const std::string & address, const Param & param); }; #endif |