CN116450234A - C++ model library service packaging framework system and method - Google Patents

C++ model library service packaging framework system and method Download PDF

Info

Publication number
CN116450234A
CN116450234A CN202310318146.XA CN202310318146A CN116450234A CN 116450234 A CN116450234 A CN 116450234A CN 202310318146 A CN202310318146 A CN 202310318146A CN 116450234 A CN116450234 A CN 116450234A
Authority
CN
China
Prior art keywords
service
model
framework
code
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310318146.XA
Other languages
Chinese (zh)
Inventor
李伟夫
刘影梅
朱双琳
徐筠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Simulation Center
Original Assignee
Beijing Simulation Center
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Simulation Center filed Critical Beijing Simulation Center
Priority to CN202310318146.XA priority Critical patent/CN116450234A/en
Publication of CN116450234A publication Critical patent/CN116450234A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a C++ model library service encapsulation framework system and a method, wherein the system comprises a model interface configuration module, a model service interaction module and a model service encapsulation module, wherein the model interface configuration module is used for configuring the data structure and the name of a model service interaction interface; the judging module is used for judging whether the dll dynamic library needs to be loaded after the encapsulation is finished: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated. The invention decouples the simulation model from the service package without considering the problem of inconsistent service package and interaction protocol; the configuration file is provided, so that the service interaction interface can be encapsulated, a unified interface interaction protocol of the model service is provided, and the flexibility of the system is improved; and the simulation model is packaged into service, so that the efficiency of simulation calculation is improved.

Description

C++ model library service packaging framework system and method
Technical Field
The invention relates to a C++ service encapsulation framework technology. And more particularly to a c++ model library servitization package framework system and method.
Background
With the development of internet technology, the drawbacks of the conventional single-body architecture become more apparent. In the simulation field, most models or simulators are still in a monolithic architecture, and how to quickly transform the monolithic architecture into a service architecture is a serious task.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art: most techniques now solve the problem of model service encapsulation, but there are several problems with this technique. Firstly, the code change amount is large, secondly, after the service encapsulation is finished, the externally provided simulation interface protocol needs to be defined in advance, and for different models, the interactive protocol is inconsistent and the protocol needs to be adapted. The model developer needs to pay attention not only to the problem of the model itself, but also to the protocol of the model interaction interface. In project joint debugging, each model needs to be unified in protocol, each model can carry out multi-branch maintenance according to different protocols, a large amount of time is needed to be spent on the aspect of protocol unification, reusability of the model is low, and model developers are not friendly.
Accordingly, there is a need to provide a c++ model library servitization package framework system and method.
Disclosure of Invention
The invention aims to provide a C++ model library service encapsulation framework system and a method for solving at least one of the problems existing in the prior art.
In order to achieve the above purpose, the invention adopts the following technical scheme:
the first aspect of the present invention provides a c++ model library server package framework system, which includes a model interface configuration module and a judgment module, wherein,
the model interface configuration module is used for configuring the data structure and the name of the model service interaction interface and packaging the interface provided by the model service;
the judging module is used for judging whether the dll dynamic library needs to be loaded after the encapsulation is finished: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
Optionally, the service code framework loaded with the dll dynamic library is used for packaging the existing model into a model service framework; the general service code framework is used for developing a new service model and encapsulating the new service model into a service model framework.
Optionally, the system comprises a configuration module and a parsing module, wherein,
the configuration module is used for configuring the complex data structure and the name of the model service interaction interface;
the analysis module is used for analyzing the configuration file and generating a code file with a complex data structure.
Optionally, the service code framework for loading dll dynamic libraries includes a parse dynamic library and a first model service code framework, wherein,
the analysis dynamic library is used for filling out analysis codes according to the loaded dll dynamic library access interface;
and the first model service code framework is used for packaging the existing model into a model service framework according to the analysis result of the dynamic analysis library.
Optionally, the generic service code framework includes a second model service code framework for encapsulating the model into a model service architecture according to the complex data structure code file generated by the parsing module.
Optionally, the first model service code framework includes a service request function, where the service request function is used to add interface information for calling dll dynamic library and make a call.
A second aspect of the present invention provides a method for c++ model library servicing package framework, the method comprising,
configuring a data structure and a name of a model service interaction interface, and packaging the interface provided by the model service;
judging whether a dll dynamic library needs to be loaded after packaging is completed: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
Optionally, the service code framework loaded with the dll dynamic library encapsulates an existing model into a model service framework;
the generic service code framework develops a new service model and encapsulates it into a service model framework.
Optionally, the step of loading the service code framework of the dll dynamic library includes,
configuring complex data structures and names of model service interaction interfaces in configuration files;
analyzing the configuration file and generating a complex data structure code file according to the interaction information configured in the configuration file;
analyzing the information of the dll dynamic library and filling in an analysis code according to the access interface of the loaded dll dynamic library by the analysis dynamic library;
and the first model service code frame file encapsulates the existing model into a model service architecture according to the analysis result of the dynamic analysis library.
Optionally, the step of generic service code framework comprises,
configuring complex data structures and names of model service interaction interfaces in configuration files;
analyzing a configuration file, and generating a complex data structure code, an http request and a response function code file according to interaction information configured in the configuration file;
and the second model service code frame file encapsulates the model into a model service architecture according to the complex data structure code file generated by the analysis module.
The beneficial effects of the invention are as follows:
the invention provides a C++ model library service encapsulation framework system and a method, which have the advantages that firstly, a simulation model is decoupled from service encapsulation, a model developer only needs to pay attention to service logic, the problem of inconsistent encapsulation and interaction protocol of the service is not needed to be considered, and the method is particularly obvious in reuse of the simulation model; secondly, the mode of the model simulator is influenced by computer configuration, the simulation model is packaged into service, and the efficiency of simulation calculation can be improved by adding a service memory, the configuration of a CPU (Central processing Unit) or adding a plurality of service copies, and especially under the conditions of complex simulation scenes and more model entities, the speed of simulation operation is obviously improved.
Drawings
The following describes the embodiments of the present invention in further detail with reference to the drawings.
FIG. 1 illustrates a frame diagram of a model library servicing package frame system of the present invention;
FIG. 2 shows a flow diagram of a service code framework for loading dll dynamic libraries;
fig. 3 shows a flow chart of a generic service code framework.
Detailed Description
In order to more clearly illustrate the present invention, the present invention will be further described with reference to preferred embodiments and the accompanying drawings. Like parts in the drawings are denoted by the same reference numerals. It is to be understood by persons skilled in the art that the following detailed description is illustrative and not restrictive, and that this invention is not limited to the details given herein.
The invention provides a C++ model library service packaging framework system and a method, wherein most of the existing simulation models exist in a mode based on a single-edition model simulator, each model simulator has different interface protocols, and great workload is caused to the reuse of the models or joint debugging of multiple models. The invention provides a model library service packaging framework which can package the existing models and provide a unified protocol interface, so that model developers and model interface protocols are decoupled, the problems of the models are more concerned, and the reuse of the models is improved.
The first aspect of the invention provides a C++ model library service package framework system, which comprises a model interface configuration module and a judgment module.
The main function of the model interface configuration module is to package the interfaces of the model service, the system mainly adopts an http service mode to access, the interfaces of the model service are packaged into a JSON file format, the access type format of the model service is unified, and the interface protocol and the network access type are not needed to be considered in the process of joint debugging of the model service.
The judging module is used for judging whether the dll dynamic library needs to be loaded after the encapsulation is finished: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
The service model code frame generating module mainly generates two code frames, namely a service code frame for loading dll dynamic libraries and a common service code frame. The service code framework for loading the dll dynamic library has the advantages that the development logic is simple, the model service source code is not required to be exposed, the existing model can be rapidly subjected to service encapsulation, and the time for developing the model service is reduced. The general service code framework is to write the model service logic into the framework, and is suitable for newly developed model services.
In one particular embodiment, the service code framework for loading dll dynamic libraries includes a configuration module and a parsing module, further includes parsing the dynamic libraries and a first model service code framework,
the configuration module is used for configuring the complex data structure and name of the model service interaction interface in the configuration file;
the analysis module analyzes the configuration file and generates a complex data structure code (DataStruct.h), an http request and a response function code file according to the interaction information in the configuration file;
the dynamic analysis library generates a model interface according to the loaded dll dynamic library mode, an analysis function for the dll dynamic library is added in a model service code frame file, case information for analyzing the dll dynamic library is provided, the interface name provided for the dynamic library is only required to be modified, if the interface name is required to be returned to a service pointer, and the service frame can maintain a pointer queue;
in the model service code frame file, model service frame codes are automatically generated, and the model service frame codes comprise a service encapsulation function, a service connection function, a service uninstallation function, a service request function, a service closing function and an interactive information data conversion function. And the first model service code framework encapsulates the existing model into a model service framework according to the analysis result of the dynamic analysis library. The model service developer only needs to add the running logic of the model in the function, does not need to care about the encapsulation and analysis of the service, the service encapsulation can be automatically invoked in the frame logic, and only needs to care about the logic of the model service, so that the model logic and the service interaction are decoupled, and the service development or the model reuse is more convenient and quick.
In one particular embodiment, the generic service code framework includes a configuration module, a parsing module and a second model service code framework,
the configuration module is used for configuring the complex data structure and name of the model service interaction interface in the configuration file;
the analysis module analyzes the configuration file and generates a complex data structure code (DataStruct.h), an http request and a response function code file according to the interaction information in the configuration file;
in the model service code frame file, model service frame codes are automatically generated, and the model service frame codes comprise a service encapsulation function, a service connection function, a service uninstallation function, a service request function, a service closing function and an interactive information data conversion function. The general service code framework needs to write service codes in the service request function to complete code writing of model service. And the second model service code framework encapsulates the model into a model service framework according to the complex data structure code file generated by the analysis module. The model service developer only needs to add the running logic of the model in the function, does not need to care about the encapsulation and analysis of the service, the service encapsulation can be automatically invoked in the frame logic, and only needs to care about the logic of the model service, so that the model logic and the service interaction are decoupled, and the model service developer only needs to care about the service development of the model.
A second aspect of the present invention provides a method for servicing a package framework by a c++ model library, the method comprising,
configuring a data structure and a name of a model service interaction interface, and packaging the interface provided by the model service;
judging whether a dll dynamic library needs to be loaded after packaging is completed: if the dll dynamic library needs to be loaded, a service model code frame generating module is called to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
Loading a service code framework of a dll dynamic library to encapsulate an existing model into a model service framework; the generic service code framework develops a new service model and encapsulates it into a service model architecture.
In a specific embodiment, the service code framework loaded with the dll dynamic library encapsulates an existing model into a model service architecture, and the flowchart of the service code framework loaded with the dll dynamic library shown in fig. 2 specifically includes the following steps:
configuring a complex data structure of a model service interaction interface in a configuration file, configuring the name of the interaction interface, and automatically generating a complex data structure code (DataStruct.h) file, an http request and response function code file according to interaction information configured in the configuration file when the configuration file is analyzed;
selecting a mode needing to load the dll dynamic library, and automatically filling an analysis code according to a dll dynamic library access interface when a generated model service code frame file is provided with a case for analyzing the dll dynamic library;
automatically generating a code frame packaged into service in a model service code frame file, wherein the code frame comprises a service packaging function, a service connecting function, a service unloading function, a service request function, a service closing function and an interactive information data conversion function, and further comprises an analysis dll dynamic library function;
and adding interface information for calling dll in the service request function to perform interface calling. If initialization information exists, initialization configuration function codes can be added in the service initialization function, and after completion of filling, framework codes are compiled to encapsulate the model into a model service architecture.
After the encapsulation is finished, registering the service in a registration center, providing the service to the outside, enabling a service user to connect the service in the code, calling the service, receiving response parameters, and calling an interactive information data conversion function to analyze the service response parameters.
In one embodiment, FIG. 3 is a flow chart of a generic service code framework, which writes model service logic to the code framework in the following specific steps:
configuring a complex data structure of a model service interaction interface in a configuration file, configuring the name of the interaction interface, and automatically generating a complex data structure code (DataStruct.h) and an http request response function code file according to interaction information configured in the configuration file when the configuration file is analyzed;
automatically generating a code frame packaged into service in a model service code frame file, wherein the code frame comprises a service packaging function, a service connecting function, a service unloading function, a service request function, a service closing function and an interactive information data conversion function;
and adding service logic for calling the service request function in the service request function, if the service is initialized, adding initialization configuration function codes in the service initialization function, compiling frame codes after filling, and packaging the model into a model service architecture.
After the encapsulation is finished, registering the service in a registration center, providing the service to the outside, enabling a service user to connect the service in the code, calling the service, receiving response parameters, and calling an interactive information data conversion function to analyze the service response parameters.
In the description of the present invention, it should be noted that the azimuth or positional relationship indicated by the terms "upper", "lower", etc. are based on the azimuth or positional relationship shown in the drawings, and are merely for convenience of describing the present invention and simplifying the description, and are not indicative or implying that the apparatus or element in question must have a specific azimuth, be constructed and operated in a specific azimuth, and thus should not be construed as limiting the present invention. Unless specifically stated or limited otherwise, the terms "mounted," "connected," and "coupled" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
It is further noted that in the description of the present invention, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
It should be understood that the foregoing examples of the present invention are provided merely for clearly illustrating the present invention and are not intended to limit the embodiments of the present invention, and that various other changes and modifications may be made therein by one skilled in the art without departing from the spirit and scope of the present invention as defined by the appended claims.

Claims (10)

1. A c++ model library servitized package framework system comprising: the model interface configuration module and the judging module are used for judging the model interface of the mobile terminal, wherein,
the model interface configuration module is used for configuring the data structure and the name of the model service interaction interface and packaging the interface provided by the model service;
the judging module is used for judging whether the dll dynamic library needs to be loaded after the encapsulation is finished: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
2. The system of claim 1, wherein the service code framework loaded dll dynamic library is configured to encapsulate an existing model into a model service architecture;
the general service code framework is used for developing a new service model and encapsulating the new service model into a service model framework.
3. The system of claim 1, wherein the system comprises a configuration module and a parsing module, wherein,
the configuration module is used for configuring the complex data structure and the name of the model service interaction interface;
the analysis module is used for analyzing the configuration file and generating a code file with a complex data structure.
4. The system of claim 2, wherein the service code framework loading dll dynamic libraries includes a parse dynamic library and a first model service code framework, wherein,
the analysis dynamic library is used for filling out analysis codes according to the loaded dll dynamic library access interface;
and the first model service code framework is used for packaging the existing model into a model service framework according to the analysis result of the dynamic analysis library.
5. The system of claim 2, wherein the generic service code framework comprises a second model service code framework for encapsulating models into model service frameworks based on complex data structure code files generated by the parsing module.
6. The system of claim 4, wherein the first model service code framework includes a service request function for adding interface information to call dll dynamic libraries and making calls.
7. A method for a C++ model library to server a packaging framework is characterized in that the method comprises the following steps,
configuring a data structure and a name of a model service interaction interface, and packaging the interface provided by the model service;
judging whether a dll dynamic library needs to be loaded after packaging is completed: if so, calling a service model code frame generating module to generate a service code frame for loading the dll dynamic library; if not, a generic service code framework is generated.
8. The method of claim 7, wherein the service code framework loading dll dynamic libraries encapsulates an existing model into a model service framework;
the generic service code framework develops a new service model and encapsulates it into a service model framework.
9. The method of claim 8, wherein the step of loading the service code framework of the dll dynamic library includes,
configuring complex data structures and names of model service interaction interfaces in configuration files;
analyzing the configuration file and generating a complex data structure code file according to the interaction information configured in the configuration file;
analyzing the information of the dll dynamic library and filling in an analysis code according to the access interface of the loaded dll dynamic library by the analysis dynamic library;
and the first model service code frame file encapsulates the existing model into a model service architecture according to the analysis result of the dynamic analysis library.
10. The method of claim 8, wherein the step of generic service code framework comprises,
configuring complex data structures and names of model service interaction interfaces in configuration files;
analyzing a configuration file, and generating a complex data structure code, an http request and a response function code file according to interaction information configured in the configuration file;
and the second model service code frame file encapsulates the model into a model service architecture according to the complex data structure code file generated by the analysis module.
CN202310318146.XA 2023-03-28 2023-03-28 C++ model library service packaging framework system and method Pending CN116450234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310318146.XA CN116450234A (en) 2023-03-28 2023-03-28 C++ model library service packaging framework system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310318146.XA CN116450234A (en) 2023-03-28 2023-03-28 C++ model library service packaging framework system and method

Publications (1)

Publication Number Publication Date
CN116450234A true CN116450234A (en) 2023-07-18

Family

ID=87123090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310318146.XA Pending CN116450234A (en) 2023-03-28 2023-03-28 C++ model library service packaging framework system and method

Country Status (1)

Country Link
CN (1) CN116450234A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555528A (en) * 2024-01-12 2024-02-13 成都索贝视频云计算有限公司 Method, device, equipment and medium for generating service code frame

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555528A (en) * 2024-01-12 2024-02-13 成都索贝视频云计算有限公司 Method, device, equipment and medium for generating service code frame
CN117555528B (en) * 2024-01-12 2024-03-26 成都索贝视频云计算有限公司 Method, device, equipment and medium for generating service code frame

Similar Documents

Publication Publication Date Title
US11422778B2 (en) Development environment for real-time dataflow programming language
CN109933522B (en) Test method, test system and storage medium for automatic case
CN111176626B (en) Cross-programming-language code calling method and device, medium and equipment
CN111158690B (en) Desktop application framework, construction method, desktop application running method and storage medium
US20060136880A1 (en) System, apparatus and methods for automatic program translation
CN116450234A (en) C++ model library service packaging framework system and method
CN112328313A (en) Universal architecture applied to embedded system
CN114579091B (en) Cross-operating system robot flow automation system and method
CN116974620A (en) Application program generation method, operation method and corresponding device
US7143400B2 (en) Configuration description language value management method and system
CN114217789A (en) Function component expansion method, device, equipment, storage medium and program product
CN111488144A (en) Data processing method and equipment
CN111683005A (en) Internet of things intelligent gateway equipment and construction method thereof
CN114675821B (en) Service standardization system and method based on low codes
CN113778451B (en) File loading method, file loading device, computer system and computer readable storage medium
CN114816357A (en) Service arrangement system for serving process bank
CN115185599A (en) Project deployment method, system and storage medium based on Golang
CN103257911A (en) SOA (service-oriented architecture) based model testing tool integrating method
CN113885841A (en) Script generation method and device, electronic equipment and readable medium
CN115237457A (en) AI application operation method and related product
CN114816385B (en) Integration method, device and equipment of heterogeneous system and storage medium
CN112698813B (en) System development method, device, computer readable storage medium and processor
CN114615521B (en) Video processing method and device, computer readable storage medium and electronic equipment
CN114115828A (en) Embedded component entity generation method and device
CN116820782A (en) Hardware calling system, method and system building method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination