12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef IVSERVICE_H
- #define IVSERVICE_H
- #include <memory>
- #include <QtCore/qglobal.h>
- #if defined(IVSERVICE_LIBRARY)
- # define IVSERVICE_EXPORT Q_DECL_EXPORT
- #else
- # define IVSERVICE_EXPORT Q_DECL_IMPORT
- #endif
- typedef void (*ServiceProc)(std::shared_ptr<char> pstr_request,const int nreqsize, std::shared_ptr<char> & pstr_response,int & nsize);
- namespace iv {
- namespace service {
- class IVSERVICE_EXPORT Server
- {
- public:
- Server(const char * strservicename,ServiceProc xProc);
- ~Server();
- private:
- void * mpimpl;
- };
- class IVSERVICE_EXPORT Client
- {
- public:
- Client(const char * strservicename);
- ~Client();
- enum ServiceResRes
- {
- NO_RES = 1,
- HAVE_RES = 2
- };
- public:
- /**
- * @brief SendRequest 获得服务结果
- * @param pstr_request 请求的数据
- * @param pstr_response 返回的结果
- * @param timeout 超时时间
- * @return 如果成功,返回 HAVE_RES,如果超时,返回NO_RES
- */
- ServiceResRes SendRequest(std::shared_ptr<char> pstr_request,const int nreqsize,std::shared_ptr<char> & pstr_response,
- int & nressize,const int timeout = 100);
- private:
- void * mpimpl;
- };
- }
- }
- #endif // IVSERVICE_H
|