diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3c380580f18f691769890a69eeb01189eb60cd65 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +NJModelServiceSDK diff --git a/swig/csharp/NJModelServiceImport.cs b/swig/csharp/NJModelServiceImport.cs new file mode 100644 index 0000000000000000000000000000000000000000..54c2ef9934125b36460752fa8c11f56a934242d9 --- /dev/null +++ b/swig/csharp/NJModelServiceImport.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + + +namespace NJModelService.dotnet +{ + public class NjServer + { + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_createServerHandle", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_CreateServerHandle(byte[] ip, int port); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_createServiceAccessHandle", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_CreateServiceAccessHandle(byte[] server); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_createModelServiceList", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_CreateModelServiceList(byte[] access); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_cleanModelServiceListHandle", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_CleanModelServiceListHandle(byte[] list); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_getModelServiceCount", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_GetModelServiceListCount(byte[] list); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_getModelServiceByIndex", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern int NJS_GetModelServiceByIndex(byte[] list, int index); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_getModelServiceOID", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern byte[] NJS_GetModelServiceOID(byte[] ms); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_getModelServiceName", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern byte[] NJS_GetModelServiceName(byte[] ms); + + [DllImport("NJModelServiceWrap.dll", EntryPoint = "njgis_service_getModelServiceType", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] + public static extern byte[] NJS_GetModelServiceType(byte[] ms); + + } +} diff --git a/swig/csharp/factory/NJServiceFactory.cs b/swig/csharp/factory/NJServiceFactory.cs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/swig/csharp/interface/INJModelService.cs b/swig/csharp/interface/INJModelService.cs new file mode 100644 index 0000000000000000000000000000000000000000..613a0d2ff62b2beea6f7697643c3152a36846a37 --- /dev/null +++ b/swig/csharp/interface/INJModelService.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections; + + +namespace NJModelService.dotnet +{ + public interface INJModelService + { + public string ServiceOID + { + get; + } + + public string ServiceName + { + get; + } + + public string getServcie + { + get; + } + } +} \ No newline at end of file diff --git a/swig/csharp/interface/INJServer.cs b/swig/csharp/interface/INJServer.cs new file mode 100644 index 0000000000000000000000000000000000000000..5b7da43a16d38eaa71bb06f2a3ddb22a7b46efab --- /dev/null +++ b/swig/csharp/interface/INJServer.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + + +namespace NJModelService.dotnet +{ + public interface INJServer + { + public INJServiceAccess CreateModelServiceAccess(); + } +} diff --git a/swig/csharp/interface/INJServiceAccess.cs b/swig/csharp/interface/INJServiceAccess.cs new file mode 100644 index 0000000000000000000000000000000000000000..b779ea470520e7847480680fdd78332f7e7caba5 --- /dev/null +++ b/swig/csharp/interface/INJServiceAccess.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections; + + +namespace NJModelService.dotnet +{ + public interface INJServiceAccess + { + + } +} diff --git a/swig/csharp/interfaces/INJModelService.cs b/swig/csharp/interfaces/INJModelService.cs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/swig/csharp/interfaces/INJServer.cs b/swig/csharp/interfaces/INJServer.cs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/swig/csharp/interfaces/INJServiceAccess.cs b/swig/csharp/interfaces/INJServiceAccess.cs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/swig/csharp/model/NJModelServerModel.cs b/swig/csharp/model/NJModelServerModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..da24091098c4695a5954c4c3bf4310782e243180 --- /dev/null +++ b/swig/csharp/model/NJModelServerModel.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections; + + +namespace NJModelService.dotnet +{ + public class NJModelServiceModel : INJModelService + { + private string _oid; + + private string _name; + + private string _type; + + public NJModelServiceModel( + string oid, + string name, + string type) + { + this._oid = oid; + this._name = name; + this._type = type; + } + + public string ServiceOID + { + get { return _oid; } + } + + public string ServiceName + { + get { return _name; } + } + + public string getServcie + { + get { return _type; } + } + } +} \ No newline at end of file diff --git a/swig/csharp/model/NJServerModel.cs b/swig/csharp/model/NJServerModel.cs new file mode 100644 index 0000000000000000000000000000000000000000..4298af59917c5b58bc17de57e890b82871560d36 --- /dev/null +++ b/swig/csharp/model/NJServerModel.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NJModelService.dotnet.model +{ + class NJServerModel + { + } +} diff --git a/wrap/include/NxServiceAPI_C.h b/wrap/include/NxServiceAPI_C.h index 60b50b726edd56c6a6a9b8014a4ec613e263a589..d9aed568c92f06f6807a0fb4da260f51bdff5f2f 100644 --- a/wrap/include/NxServiceAPI_C.h +++ b/wrap/include/NxServiceAPI_C.h @@ -3,28 +3,22 @@ #include "../../include/NxServiceAPI.h" -namespace NJGIS -{ - namespace SERVICE - { - extern "C" NJGIS_SERVICE void* createServerHandle(char* ip, int port); +extern "C" NJGIS_SERVICE void* njgis_service_createServerHandle(char* ip, int port); - extern "C" NJGIS_SERVICE void* createServiceAccessHandle(void* server); +extern "C" NJGIS_SERVICE void* njgis_service_createServiceAccessHandle(void* server); - extern "C" NJGIS_SERVICE void* createModelServiceList(void* access); +extern "C" NJGIS_SERVICE void* njgis_service_createModelServiceList(void* access); - extern "C" NJGIS_SERVICE int cleanModelServiceListHandle(void* list); +extern "C" NJGIS_SERVICE int njgis_service_cleanModelServiceListHandle(void* list); - extern "C" NJGIS_SERVICE int getModelServiceCount(void* list); +extern "C" NJGIS_SERVICE int njgis_service_getModelServiceCount(void* list); - extern "C" NJGIS_SERVICE void* getModelServiceByIndex(void* list, int index); +extern "C" NJGIS_SERVICE void* njgis_service_getModelServiceByIndex(void* list, int index); - extern "C" NJGIS_SERVICE const char* getModelServiceOID(void* ms); - - extern "C" NJGIS_SERVICE const char* getModelServiceName(void* ms); +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceOID(void* ms); - extern "C" NJGIS_SERVICE const char* getModelServiceType(void* ms); - } -} +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceName(void* ms); + +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceType(void* ms); #endif \ No newline at end of file diff --git a/wrap/src/NxServiceAPI_C.cpp b/wrap/src/NxServiceAPI_C.cpp index 8704120fe971ee0cd19a64468e72ca64eef57b1a..7749515d8646651ca292d28a71cff81116a1b262 100644 --- a/wrap/src/NxServiceAPI_C.cpp +++ b/wrap/src/NxServiceAPI_C.cpp @@ -1,52 +1,52 @@ #include "../include/NxServiceAPI_C.h" -extern "C" NJGIS_SERVICE void* NJGIS::SERVICE::createServerHandle( char* ip, int port ) +extern "C" NJGIS_SERVICE void* njgis_service_createServerHandle( char* ip, int port ) { NJGIS::SERVICE::INjServerFactory* pServerFactory = NJGIS::SERVICE::createServerFactory(); - INjServer* pServer = pServerFactory->createServer(ip, port); + NJGIS::SERVICE::INjServer* pServer = pServerFactory->createServer(ip, port); return pServer; } -extern "C" NJGIS_SERVICE void* NJGIS::SERVICE::createServiceAccessHandle( void* server ) +extern "C" NJGIS_SERVICE void* njgis_service_createServiceAccessHandle( void* server ) { - INjServiceAccess* pAccess = ((INjServer*)server)->getServiceAccess(); + NJGIS::SERVICE::INjServiceAccess* pAccess = ((NJGIS::SERVICE::INjServer*)server)->getServiceAccess(); return pAccess; } -extern "C" NJGIS_SERVICE void* NJGIS::SERVICE::createModelServiceList( void* access ) +extern "C" NJGIS_SERVICE void* njgis_service_createModelServiceList( void* access ) { std::vector* list = new std::vector; ((NJGIS::SERVICE::INjServiceAccess*)access)->getModelServicesList(*list); return list; } -extern "C" NJGIS_SERVICE int NJGIS::SERVICE::cleanModelServiceListHandle( void* list ) +extern "C" NJGIS_SERVICE int njgis_service_cleanModelServiceListHandle( void* list ) { delete (std::vector*)list; return 1; } -extern "C" NJGIS_SERVICE int NJGIS::SERVICE::getModelServiceCount( void* list ) +extern "C" NJGIS_SERVICE int njgis_service_getModelServiceCount( void* list ) { return ((std::vector*)list)->size(); } -extern "C" NJGIS_SERVICE void* NJGIS::SERVICE::getModelServiceByIndex( void* list, int index ) +extern "C" NJGIS_SERVICE void* njgis_service_getModelServiceByIndex( void* list, int index ) { return (*((std::vector*)list))[index]; } -extern "C" NJGIS_SERVICE const char* NJGIS::SERVICE::getModelServiceOID( void* ms ) +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceOID( void* ms ) { - return ((INjModelService*)ms)->getServiceOID(); + return ((NJGIS::SERVICE::INjModelService*)ms)->getServiceOID(); } -extern "C" NJGIS_SERVICE const char* NJGIS::SERVICE::getModelServiceName( void* ms ) +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceName( void* ms ) { - return ((INjModelService*)ms)->getServiceName(); + return ((NJGIS::SERVICE::INjModelService*)ms)->getServiceName(); } -extern "C" NJGIS_SERVICE const char* NJGIS::SERVICE::getModelServiceType( void* ms ) +extern "C" NJGIS_SERVICE const char* njgis_service_getModelServiceType( void* ms ) { - return ((INjModelService*)ms)->getServiceType(); + return ((NJGIS::SERVICE::INjModelService*)ms)->getServiceType(); }