From 184cd67e15337b3f1d7eaa781ae928ff8e67c9ac Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Thu, 11 Jan 2018 23:57:04 +0800 Subject: [PATCH 1/3] Data interface update Signed-off-by: Franklin_Zhang --- include/INxData.h | 12 ++++++------ include/INxServiceAccess.h | 4 ++++ src/NxModelService.cpp | 1 + src/NxModelService.h | 1 + src/NxServiceAccess.cpp | 11 +++++++++-- src/NxServiceAccess.h | 3 +++ 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/include/INxData.h b/include/INxData.h index 47b5005..ca69f8b 100644 --- a/include/INxData.h +++ b/include/INxData.h @@ -21,17 +21,17 @@ namespace NJGIS public: virtual int isExist(); - virtual int getID(std::string& id) = 0; + virtual const char* getID() = 0; - virtual int getTag(std::string& tag) = 0; + virtual const char* getTag() = 0; - virtual int getGenarationDateTime(std::string& datetime) = 0; + virtual const char* getGenarationDateTime() = 0; - virtual int getType(NJGIS::SERVICE::NjDataType& type) = 0; + virtual NJGIS::SERVICE::NjDataType getType() = 0; - virtual int getSize(int& size) = 0; + virtual int getSize() = 0; - virtual int getValue(std::string& value) = 0; + virtual const char* getValue() = 0; virtual int save(const char* path) = 0; }; diff --git a/include/INxServiceAccess.h b/include/INxServiceAccess.h index b59c894..ca3c4da 100644 --- a/include/INxServiceAccess.h +++ b/include/INxServiceAccess.h @@ -2,6 +2,7 @@ #define __NJGIS_INJSERVICEACCESS_H__ #include "INxModelService.h" +#include "INxData.h" #include namespace NJGIS @@ -19,6 +20,9 @@ namespace NJGIS //! get model servcie by name virtual int getModelServicesByName(const char* name, std::vector &list) = 0; + + //! get a data service + virtual NJGIS::SERVICE::INjData* getDataServiceByID(const char* id) = 0; }; } diff --git a/src/NxModelService.cpp b/src/NxModelService.cpp index 943758a..a39a008 100644 --- a/src/NxModelService.cpp +++ b/src/NxModelService.cpp @@ -92,5 +92,6 @@ int NJGIS::SERVICE::NjModelService::invoke( const INjDataConfiguration* config, int NJGIS::SERVICE::NjModelService::refresh() { + //! TODO DX return NULL; } diff --git a/src/NxModelService.h b/src/NxModelService.h index 6d59776..bd657fd 100644 --- a/src/NxModelService.h +++ b/src/NxModelService.h @@ -90,6 +90,7 @@ namespace NJGIS virtual int invoke( const INjDataConfiguration* config, std::string& recordid ); + //! to refresh the information of this model service virtual int refresh(); private: diff --git a/src/NxServiceAccess.cpp b/src/NxServiceAccess.cpp index b3e387f..0260f57 100644 --- a/src/NxServiceAccess.cpp +++ b/src/NxServiceAccess.cpp @@ -48,5 +48,12 @@ NJGIS::SERVICE::INjModelService* NJGIS::SERVICE::NjServiceAccess::getModelServic int NJGIS::SERVICE::NjServiceAccess::getModelServicesByName( const char* name, std::vector &list ) { - throw std::exception("The method or operation is not implemented."); -} \ No newline at end of file + //! TODO DX + return NULL: +} + +NJGIS::SERVICE::INjData* NJGIS::SERVICE::NjServiceAccess::getDataServiceByID( const char* id ) +{ + // TODO YL + return NULL: +} diff --git a/src/NxServiceAccess.h b/src/NxServiceAccess.h index a79c9f5..d0451f1 100644 --- a/src/NxServiceAccess.h +++ b/src/NxServiceAccess.h @@ -19,6 +19,9 @@ namespace NJGIS virtual NJGIS::SERVICE::INjModelService* getModelServiceByOID( const char* oid ); virtual int getModelServicesByName( const char* name, std::vector &list ); + + virtual NJGIS::SERVICE::INjData* getDataServiceByID( const char* id ); + }; } } -- Gitee From 6a913c238ba66c2bd8d89218c00927e17a7f7b13 Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Fri, 12 Jan 2018 00:19:53 +0800 Subject: [PATCH 2/3] Data class update Signed-off-by: Franklin_Zhang --- src/NxData.cpp | 42 ++++++++++++++++++++++++++++++++ src/NxData.h | 47 ++++++++++++++++++++++++++++++++++++ src/NxDataFactory.cpp | 6 +++++ src/NxDataFactory.h | 19 +++++++++++++++ src/NxModelServiceRecord.cpp | 0 src/NxModelServiceRecord.h | 0 6 files changed, 114 insertions(+) create mode 100644 src/NxData.cpp create mode 100644 src/NxData.h create mode 100644 src/NxDataFactory.cpp create mode 100644 src/NxDataFactory.h create mode 100644 src/NxModelServiceRecord.cpp create mode 100644 src/NxModelServiceRecord.h diff --git a/src/NxData.cpp b/src/NxData.cpp new file mode 100644 index 0000000..a3dde88 --- /dev/null +++ b/src/NxData.cpp @@ -0,0 +1,42 @@ +#include "NxData.h" + +int NJGIS::SERVICE::NjData::isExist() +{ + return NULL; +} + +const char* NJGIS::SERVICE::NjData::getID() +{ + return NULL; +} + +const char* NJGIS::SERVICE::NjData::getTag() +{ + return NULL; +} + +const char* NJGIS::SERVICE::NjData::getGenarationDateTime() +{ + return NULL; +} + +NJGIS::SERVICE::NjDataType NJGIS::SERVICE::NjData::getType() +{ + return this->_type; +} + +int NJGIS::SERVICE::NjData::getSize() +{ + return NULL; +} + +const char* NJGIS::SERVICE::NjData::getValue() +{ + return NULL; +} + +int NJGIS::SERVICE::NjData::save( const char* path ) +{ + return NULL; +} + diff --git a/src/NxData.h b/src/NxData.h new file mode 100644 index 0000000..825a895 --- /dev/null +++ b/src/NxData.h @@ -0,0 +1,47 @@ +#ifndef __NJGIS_NJDATA_H__ +#define __NJGIS_NJDATA_H__ + +#include "../include/INxData.h" +#include "NxService.h" + +namespace NJGIS +{ + namespace SERVICE + { + class NjData : public virtual INjData, public virtual NjService + { + public: + virtual int isExist(); + + virtual const char* getID(); + + virtual const char* getTag(); + + virtual const char* getGenarationDateTime(); + + virtual NJGIS::SERVICE::NjDataType getType(); + + virtual int getSize(); + + virtual const char* getValue(); + + virtual int save( const char* path ); + + private: + std::string _id; + + std::string _tag; + + int _size; + + std::string _genarationDateTime; + + NJGIS::SERVICE::NjDataType _type; + + std::string _value; + + }; + } +} + +#endif \ No newline at end of file diff --git a/src/NxDataFactory.cpp b/src/NxDataFactory.cpp new file mode 100644 index 0000000..414625d --- /dev/null +++ b/src/NxDataFactory.cpp @@ -0,0 +1,6 @@ +#include "NxDataFactory.h" + +NJGIS::SERVICE::INjData* NJGIS::SERVICE::NjDataFactory::createDataByJSON( Json::Value jData, const char* ip, int port ) +{ + return NULL; +} \ No newline at end of file diff --git a/src/NxDataFactory.h b/src/NxDataFactory.h new file mode 100644 index 0000000..528aec4 --- /dev/null +++ b/src/NxDataFactory.h @@ -0,0 +1,19 @@ +#ifndef __NJGIS_NJDATAFACTORY_H__ +#define __NJGIS_NJDATAFACTORY_H__ + +#include "../include/INxData.h" +#include "json/json.h" + +namespace NJGIS +{ + namespace SERVICE + { + class NjDataFactory + { + public: + static NJGIS::SERVICE::INjData* createDataByJSON(Json::Value jData, const char* ip, int port); + }; + } +} + +#endif \ No newline at end of file diff --git a/src/NxModelServiceRecord.cpp b/src/NxModelServiceRecord.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/NxModelServiceRecord.h b/src/NxModelServiceRecord.h new file mode 100644 index 0000000..e69de29 -- Gitee From 5dd4a440f7e7a5084247e658aa95c5ba55bcddb9 Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Fri, 12 Jan 2018 01:20:06 +0800 Subject: [PATCH 3/3] update model service record interface Signed-off-by: Franklin_Zhang --- include/INxModelServiceRecord.h | 21 ++++++++++++--------- src/NxModelServiceRecord.cpp | 1 + src/NxModelServiceRecord.h | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/include/INxModelServiceRecord.h b/include/INxModelServiceRecord.h index bfe9ba5..f4a038e 100644 --- a/include/INxModelServiceRecord.h +++ b/include/INxModelServiceRecord.h @@ -4,8 +4,9 @@ #include #include -#include "INxUnknown.h" +#include "INxService.h" #include "INxDataConfiguration.h" +#include "INxModelService.h" namespace NJGIS @@ -20,22 +21,24 @@ namespace NJGIS } NjRecordStatus; - class INjModelServiceRecord : public virtual INxUnknown + class INjModelServiceRecord : public virtual INjService { public: - virtual int getID(std::string& id) = 0; + virtual const char* getID() = 0; - virtual int getServiceID(std::string& id) = 0; + virtual const char* getModelServiceID() = 0; - virtual int getStartDatetime(std::string& datetime) = 0; + virtual INjModelService* getModelService() = 0; - virtual int getTimeSpan(int& span) = 0; + virtual const char* getStartDatetime() = 0; - virtual int getInputData(INjDataConfiguration* &input) = 0; + virtual int getTimeSpan() = 0; - virtual int getOutputData(INjDataConfiguration* &output) = 0; + virtual INjDataConfiguration* getInputData() = 0; - virtual int getStatus(NjRecordStatus& status) = 0; + virtual INjDataConfiguration* getOutputData() = 0; + + virtual NjRecordStatus getStatus() = 0; virtual int getRunningInfo(std::string& stardout, std::string& standerr, std::string& invokeerr) = 0; diff --git a/src/NxModelServiceRecord.cpp b/src/NxModelServiceRecord.cpp index e69de29..baa9dce 100644 --- a/src/NxModelServiceRecord.cpp +++ b/src/NxModelServiceRecord.cpp @@ -0,0 +1 @@ +#include "INxModelServiceRecord.h" diff --git a/src/NxModelServiceRecord.h b/src/NxModelServiceRecord.h index e69de29..3ff240c 100644 --- a/src/NxModelServiceRecord.h +++ b/src/NxModelServiceRecord.h @@ -0,0 +1,19 @@ +#ifndef __NJGIS_NJMODELSERVICERECORD_H__ +#define __NJGIS_NJMODELSERVICERECORD_H__ + +#include "../include/INxModelServiceRecord.h" +#include "NxService.h" + +namespace NJGIS +{ + namespace SERVICE + { + class NxModelServiceRecord : public virtual INjModelServiceRecord, public virtual NjService + { + public: + + }; + } +} + +#endif \ No newline at end of file -- Gitee