Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Communication method for achieving real-time two-way assistance between C++ module and Python module

A communication method and inter-module technology, applied in inter-program communication, instruments, multi-program devices, etc., can solve problems such as inability to unilaterally and directly call C++ function modules, increase workload, and unfavorable application development, etc., to achieve Improve development efficiency, program stability, and avoid extra work

Inactive Publication Date: 2017-06-13
SOUTH CHINA NORMAL UNIVERSITY
View PDF7 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] As far as the current technology is concerned, C++ can unilaterally call Python function modules, but Python cannot unilaterally and directly call C++ function modules. Python can call C++ modules indirectly, but this indirect call needs to use SWIG Or boost encapsulates the C++ function module as a function module that can be called by Python, which adds extra workload and is not conducive to the development of the application

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Communication method for achieving real-time two-way assistance between C++ module and Python module

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0040] In a kind of communication method that realizes real-time two-way assistance between C++ and Python modules in this embodiment, the C++ module is set as the server, and the Python module is set as the client, and the socket instance is all created inside the two, and the communication between them It is realized through socket, and the status monitoring between the two is realized through a daemon process. The workflow of the server, client and daemon process will be described in detail below.

[0041] Server:

[0042] That is, the C++ module only creates one socket, and the receiving and sending of commands are located in the main thread, and the processing of commands is also located in the main thread. The socket creation and related processing steps of the server are as follows:

[0043] 1. Create a socket instance, bind the port number, bind the processing function function1, and set the processing flag as the access flag, that is, when the Python module requests acc...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a communication method for achieving real-time two-way assistance between a C++ module and a Python module. According to the method, real-time communication is achieved by the usage of a socket, the C++ module serves as a service side, the Python module serves as a client side, and therefore two-way communication is achieved, a plurality of sockets can be constructed at the client side, so that the interaction between the Python module and the C++ module is more flexible; meanwhile, assistance of the communication is achieved by using a multi-thread technology, the main thread of the Python module is used for receiving command requests of the C++ module, the sub-thread of the Python module is used for handling corresponding command requests, and after the C++ module receives the command requests, corresponding processing is carried out according to a predefined command processing list. According to the communication method for achieving real-time two-way assistance between the C++ module and the Python module, mutual flexible calling between the C++ module and the Python module is achieved, extra work caused by C++ module calling by the Python module by the usage of the a SWIG is avoided, the program development efficiency can be significantly improved, and the communication method is suitable for the fields such as program development and test.

Description

technical field [0001] The invention belongs to the field of computer application conversion research, in particular to a communication method for realizing real-time two-way assistance between C++ and Python modules. Background technique [0002] At present, because C++ supports object-oriented mechanism, generic programming mechanism, exception handling, operator overloading, has a mature, reliable and efficient standard template library (STL), and develops programs with high execution efficiency, C++ is widely used in computer applications. development. In addition, Python is an object-oriented, interpreted computer programming language, which has the characteristics of simple syntax, cross-platform, and many public libraries, so Python has also been widely used. However, both C++ and Python have certain shortcomings. For example, the C++ language itself is complex, the learning cycle is relatively long, and the public libraries are not as many as Python's. Python is an ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/54
CPCG06F9/544
Inventor 陈棋江郭旸蔡夫鸿何赛灵
Owner SOUTH CHINA NORMAL UNIVERSITY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products