From f9fd238a1838c7ca90be08b8b5b07f36a49e7925 Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Wed, 3 Jan 2018 10:58:21 +0800 Subject: [PATCH] update some functions add server interface Signed-off-by: Franklin_Zhang --- include/INxServer.h | 35 +++++++++++++++++++++++++++++++++++ include/INxServiceAPI.h | 26 +++++++++++++++----------- include/INxServiceAccess.h | 7 +++++++ 3 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 include/INxServer.h diff --git a/include/INxServer.h b/include/INxServer.h new file mode 100644 index 0000000..890fdaa --- /dev/null +++ b/include/INxServer.h @@ -0,0 +1,35 @@ +#ifndef __NJGIS_INXSERVER_H__ +#define __NJGIS_INXSERVER_H__ + +#include +#include "INxUnknown.h" +#include "INxServiceAccess.h" + +namespace NJGIS +{ + namespace SERVICE + { + class INjServer : public virtual INxUnknown + { + //! get IP "xxxx.xxxx.xxxx.xxxx" + virtual int getIP(std::string &ip) = 0; + + //! get Port + virtual int getPort(int &port) = 0; + + //! set IP and Port + virtual int setIPAndPort(const char* ip, const int port = 8060) = 0; + + //! connect + virtual int connect() = 0; + + //! check is the server online + virtual bool isOnline() = 0; + + //! get service access + virtual INjServiceAccess* getServiceAccess() = 0; + } + } +} + +#endif \ No newline at end of file diff --git a/include/INxServiceAPI.h b/include/INxServiceAPI.h index 8e9bfe6..0db7d7b 100644 --- a/include/INxServiceAPI.h +++ b/include/INxServiceAPI.h @@ -1,32 +1,36 @@ #ifndef __NJGIS_INXSERVICEAPI_H__ #define __NJGIS_INXSERVICEAPI_H__ +#include "INxServer.h" + +//! Windows #ifdef _WINDOWS -#ifndef _NSGIS_STATIC_LIB_ -#ifdef _NSGIS_XPOIRTS -#define NSGIS_SERVICE __declspec(dllexport) +//! Static Lib +#ifndef _NJGIS_STATIC_LIB_ +#ifdef _NJGIS_EXPORTS +#define NJGIS_SERVICE __declspec(dllexport) #else -#define NSGIS_SERVICE __declspec(dllimport) +#define NJGIS_SERVICE __declspec(dllimport) #endif #endif +//! Linux OSX(UNIX) #else -#ifndef _NSGIS_STATIC_LIB_ -#ifdef _NSGIS_XPOIRTS -#define NSGIS_SERVICE __declspec(dllexport) +#ifndef _NJGIS_STATIC_LIB_ +#ifdef _NJGIS_EXPORTS +#define NJGIS_SERVICE __declspec(dllexport) #else -#define NSGIS_SERVICE __attribute ((visibility("default"))) +#define NJGIS_SERVICE __attribute ((visibility("default"))) #endif #endif - #endif namespace NSGIS { namespace SERVICE { - extern "C" NSGIS_SERVICE const char* getVersion(); + extern "C" NJGIS_SERVICE const char* getVersion(); - extern "C" NSGIS_SERVICE IUdxDataset* createUdxDataset(const char* pName); + extern "C" NJGIS_SERVICE INjServer* createServer(const char* ip = "127.0.0.1", const int port = 8060); } } diff --git a/include/INxServiceAccess.h b/include/INxServiceAccess.h index 59d41c7..870bf05 100644 --- a/include/INxServiceAccess.h +++ b/include/INxServiceAccess.h @@ -12,7 +12,14 @@ namespace NJGIS class INjServiceAccess : public virtual INxUnknown { public: + //! get model service list virtual int getServicesList(std::vector &list) = 0; + + //! get model service by OID + virtual int getServiceByOID(const char* oid) = 0; + + //! get model servcie by name + virtual int getServicesByName(const char* name, std::vector &list) = 0; } } } -- Gitee