[go: up one dir, main page]

CN118981487A - A universal serialization method, device, equipment and readable storage medium - Google Patents

A universal serialization method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN118981487A
CN118981487A CN202410969774.9A CN202410969774A CN118981487A CN 118981487 A CN118981487 A CN 118981487A CN 202410969774 A CN202410969774 A CN 202410969774A CN 118981487 A CN118981487 A CN 118981487A
Authority
CN
China
Prior art keywords
serialization
file
code
original file
structured data
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
CN202410969774.9A
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.)
Neusoft Reach Automotive Technology Shenyang Co Ltd
Original Assignee
Neusoft Reach Automotive Technology Shenyang Co Ltd
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 Neusoft Reach Automotive Technology Shenyang Co Ltd filed Critical Neusoft Reach Automotive Technology Shenyang Co Ltd
Priority to CN202410969774.9A priority Critical patent/CN118981487A/en
Publication of CN118981487A publication Critical patent/CN118981487A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • 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)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供了一种通用的序列化方法、装置、设备及可读存储介质,可应用于序列化技术领域,该方法包括:获取待生成序列化代码的原始文件;解析所述原始文件,并确定与所述原始文件对应的各个结构化数据;将所述结构化数据载入内存,并基于序列化代码模型为所述原始文件对应的每一个结构化数据生成通用序列化接口代码;所述通用序列化接口代码可用于跨核通信。如此,将数据直接映射到内存,序列化代码模型直接操作内存地址读取数据,避免数据拷贝,通过零拷贝的方式为原始文件的结构化数据进行序列化,且生成的序列化代码支持SOC和MCU跨核通信使用,无需调用其它接口,提高了执行效率。

The present application provides a general serialization method, device, equipment and readable storage medium, which can be applied to the field of serialization technology. The method includes: obtaining the original file for generating serialization code; parsing the original file and determining each structured data corresponding to the original file; loading the structured data into the memory, and generating a general serialization interface code for each structured data corresponding to the original file based on the serialization code model; the general serialization interface code can be used for cross-core communication. In this way, the data is directly mapped to the memory, and the serialization code model directly operates the memory address to read the data, avoiding data copying, and serializing the structured data of the original file in a zero-copy manner. The generated serialization code supports SOC and MCU cross-core communication, without calling other interfaces, which improves execution efficiency.

Description

Universal serialization method, device, equipment and readable storage medium
Technical Field
The present application relates to the field of serialization technologies, and in particular, to a general serialization method, device, apparatus, and readable storage medium.
Background
Serialization is a process of converting state information of an object into a form that can be stored or transmitted, and thus is critical in communication development.
Each programming language has its corresponding serialization tool, and the Protobuf approach is typically used for serialization for systems with large memory and processing capabilities. Protobuf, while having an important role in the C++ project, does not support the C language and cannot meet the requirements in cross-protocol, cross-core and cross-platform communication architectures. And other interfaces need to be called by using other tools, so that the problem of low serialization execution efficiency is caused.
Therefore, how to improve the execution efficiency of serialization is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
Based on the above problems, the application provides a general serialization method, device, equipment and readable storage medium, which are used for directly mapping data to a memory, directly operating a memory address to read the data by a serialization code model, avoiding data copy, serializing the structured data of an original file in a zero copy mode, and enabling the generated serialization code to support the use of cross-core communication of an SOC and an MCU without calling other interfaces, thereby improving the execution efficiency.
In a first aspect, an embodiment of the present application provides a general serialization method, including:
acquiring an original file of a serialization code to be generated;
Analyzing the original file, and determining each structured data corresponding to the original file;
Loading the structured data into a memory, and generating a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
Optionally, the obtaining the original file of the serialization code to be generated includes:
acquiring file parameters input by a user; the file parameters comprise original file addresses;
And acquiring an original file corresponding to the original file address based on the original file address.
Optionally, the file parameters further include: a serialization type;
the general serialization method further comprises the following steps:
If the serialization type specifies a Protobuf mode, executing Protoc commands to generate Protobuf serialization codes for the original file.
Optionally, the file parameters further include: generating a storage position of a file;
the general serialization method further comprises the following steps:
Creating a storage folder at the save location;
and storing the generated universal serial interface code in the storage folder.
Optionally, the generating, based on the serialization code model, a universal serialization interface code for each structured data corresponding to the original file includes:
Acquiring description information of each structured data;
Based on the description information, a generic serialized interface code is generated for each structured data by a serialized code model.
Optionally, before generating the universal serial interface code for each structured data corresponding to the original file based on the serial code model, the method further includes:
And adjusting the arrangement sequence of each structured data based on the nesting relation to queue the dependent structured data preferentially.
Optionally, the method further comprises:
traversing the file list; the file list comprises all original files of the serialization codes to be generated;
and if all the original files in the file list are generated by the serialization codes, identifying the file list.
In a second aspect, an embodiment of the present application provides a universal serialization apparatus, including:
the acquisition module is used for acquiring an original file of the serialization code to be generated;
the analysis module is used for analyzing the original file and determining each structured data corresponding to the original file;
the serialization module is used for loading the structured data into a memory and generating a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
In a third aspect, an embodiment of the present application provides a general serialization apparatus, including:
A memory for storing a computer program;
a processor for implementing the steps of the general serialization method as described above when executing the computer program.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a serialization method generally as described above.
Compared with the prior art, the application has the following advantages that:
the application firstly obtains an original file of a serialization code to be generated. The original file is then parsed and respective structured data corresponding to the original file is determined. And finally, loading the structured data into a memory, and generating a universal serial interface code for each structured data corresponding to the original file based on the serial code model, wherein the generated universal serial interface code can be used for cross-core communication. Therefore, the data is directly mapped to the memory, the memory address is directly operated by the serialization code model to read the data, the data copy is avoided, the serialization is carried out on the structured data of the original file in a zero copy mode, the generated serialization code supports the use of the cross-core communication of the SOC and the MCU, other interfaces are not required to be called, and the execution efficiency is improved.
Drawings
FIG. 1 is a flow chart of a general serialization method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an association relationship between dependent components according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating an implementation of a serialization code generating tool according to an embodiment of the present application;
Fig. 4 is a schematic structural diagram of a general serialization apparatus according to an embodiment of the present application.
Detailed Description
As described above, the conventional serialization method has a problem of low execution efficiency. Specifically, each programming language has its corresponding serialization tool, and Protobuf is designed for a system with large memory and processing capacity, and has important use for the c++ project as an excellent and universal serialization mode. However, protobuf does not support the C language, and cannot meet the requirements in the cross-protocol, cross-core and cross-platform communication architecture, other interfaces need to be called, and other tools matched with the interfaces are used for serialization, so that the problem of low serialization execution efficiency is caused.
In order to solve the above problems, an embodiment of the present application provides a general serialization method, including: firstly, an original file of a serialization code to be generated is obtained. The original file is then parsed and respective structured data corresponding to the original file is determined. And finally, loading the structured data into a memory, and generating a universal serial interface code for each structured data corresponding to the original file based on the serial code model, wherein the generated universal serial interface code can be used for cross-core communication.
Therefore, the data is directly mapped to the memory, the memory address is directly operated by the serialization code model to read the data, the data copy is avoided, the serialization is carried out on the structured data of the original file in a zero copy mode, the generated serialization code supports the use of the cross-core communication of the SOC and the MCU, other interfaces are not required to be called, and the execution efficiency is improved.
It should be noted that the general serialization method, device, equipment and readable storage medium provided by the embodiment of the application can be applied to the technical field of serialization. The foregoing is merely exemplary, and is not intended to limit the application fields of the general serialization method, apparatus, device and readable storage medium provided by the present application.
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Fig. 1 is a flowchart of a general serialization method according to an embodiment of the present application. Referring to fig. 1, a general serialization method provided in an embodiment of the present application may include:
S101: and obtaining an original file of the serialization code to be generated.
In practical applications, serialization is the process of converting state information of an object into a form that can be stored or transmitted. The original file for which the serialization code is to be generated refers to the Proto file that needs to be serialized. The Protocol file generally refers to a file format of Protocol Buffer for serializing structured data.
In addition, since the ways of obtaining the original files are different, the embodiment of the present application can be described with respect to a possible obtaining way.
In one case, the obtaining the original file of the serialization code to be generated includes:
acquiring file parameters input by a user; the file parameters comprise original file addresses;
And acquiring an original file corresponding to the original file address based on the original file address.
In practical application, the application provides a serialization code generating tool which interacts with a user through a universal interface to support command line to enter Proto file parameters. The user may input the Proto file parameters to the serialization code generating tool in the form of a command line, which is received by the serialization code generating tool, and thus perform the serialization process. The Proto file parameters may include a variety of, for example, proto file address, save location of the generated file, and serialization type, etc. When the Proto file parameter input by the user comprises the Proto file address, the serialization code generating tool can extract the Proto file address by analyzing the file parameter input by the user, and acquire the corresponding Proto file from the file address, so as to execute the serialization process.
S102: analyzing the original file, and determining each structured data corresponding to the original file.
In practice, the Proto file may define a variety of data structure types, including basic data types (e.g., integer types, fixed-size integer types, floating point number type boolean types, string types, etc.), compound data types, and user-defined data types. The serialization code generating tool provided by the embodiment of the application needs to analyze the Proto file to be serialized and determine all structured data (message data) in the Proto file to be serialized, so as to generate a unified serialization interface code for each message data. message data is a custom data structure that may include multiple fields, each having its own type and identifier (e.g., a basic data type field, an enumeration type field, a nested message type field, a repetition field, a mapping type field, an Any type field, and a Bytes type field, etc.).
S103: loading the structured data into a memory, and generating a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
In practical application, the serialization code model adopts a copy-free technology to realize that unnecessary data copying is avoided in the data processing and transmitting process, so that the efficiency and the performance are improved. By way of reference or pointer, rather than creating a copy of the data, it is shared among different functions or modules. Specifically, in the embodiment of the application, message data is directly mapped to a memory, and then a unified serialization interface code (namely, a binary serialization mode) such as an msg.hpp file is generated for each message data through a serialization code model. One possible execution command line for serializing the serialization code model is as follows:
sf-msg-tool.exe
-o./out
-p'binary,protobuf'./msg.proto
Wherein the-t parameter is the type of serialization to be supported; -o parameter is the position of the save generated serialized code file; finally, the Proto file name parameter may be plural. In this manner, the generated generic serialized interface code may be used for cross-core communications.
In addition, since the serialization is not the same, embodiments of the present application can be described in terms of one possible serialization.
In one case, the generating, based on the serialization code model, a generic serialization interface code for each structured data corresponding to the original file includes:
Acquiring description information of each structured data;
Based on the description information, a generic serialized interface code is generated for each structured data by a serialized code model.
In practice, message data generally refers to units of information that are communicated between network communications, applications, or systems. The description information can include data type, structure, size, format, purpose, security, transmission mode, etc. Among these are various formats including text, digital, media files, and binary data. The description information of the message data corresponding to different Proto files is different, and the universal serialization interface codes obtained through the serialization code model are also different. Therefore, the description information of the message data corresponding to a Proto file needs to be transferred to the serialization code model, and the serialization code model generates the binary serialization code of the Proto file message, namely the universal serialization interface code.
In addition, since the order in which the structured data is serialized is not the same, embodiments of the present application may be described in terms of one possible ordering.
In one case, before the generating, based on the serialization code model, a universal serialization interface code for each structured data corresponding to the original file, the method further includes:
And adjusting the arrangement sequence of each structured data based on the nesting relation to queue the dependent structured data preferentially.
In practical applications, one Proto file may include a plurality of message data, and one type of message data may include fields of other types of message data, so that a nested relationship is formed. The Proto file allows complex structural definitions so that this nesting can be done in multiple layers. When the Proto files are serialized, all message data are required to be sequenced, and the embodiment of the application provides a message data sequencing method, which is based on a nested relation, the dependent message data are sequenced in front, and then description information of the message data is sequentially transmitted to a serialization code model according to the sequencing order, and a corresponding binary serialization code is generated.
In addition, since the ways in which the tag serialization is completed are not the same, embodiments of the present application can be described in terms of one possible tag.
In one case, the method further comprises:
traversing the file list; the file list comprises all original files of the serialization codes to be generated;
and if all the original files in the file list are generated by the serialization codes, identifying the file list.
In practical applications, a user may input the Proto file parameters to the serialization code generating tool through a generic interface. The Proto file parameter input by the user at one time may indicate a plurality of Proto files to be serialized, so that a plurality of Proto file addresses exist, and the serialization code generating tool may acquire all the Proto files according to the Proto file addresses, where the files are recorded in the form of a file list and are serialized as the same batch. When all the Proto files indicated in the file list are serialized, the task is considered to be completed, so that the serialization code generating tool provided by the embodiment of the application needs to traverse the file list, and if the traversing result is that the Proto files in the file list are not serialized, the serialization process is continuously executed until all the Proto files in the file list are serialized; if the traversing result is that all Proto files in the file list are serialized, ending the serialization code generating process and marking the file list with a mark of completed.
In summary, an original file of a serialization code to be generated is first obtained. The original file is then parsed and respective structured data corresponding to the original file is determined. And finally, loading the structured data into a memory, generating a universal serialization interface code for each structured data corresponding to the original file based on the serialization code model, wherein the generated serialization interface code can be used for cross-core communication. Therefore, the data is directly mapped to the memory, the memory address is directly operated by the serialization code model to read the data, the data copy is avoided, the original file is serialized in a zero copy mode, and the generated serialization code supports the use of cross-core communication of the SOC and the MCU without calling other interfaces, so that the execution efficiency is improved.
In addition, since the serialization manners corresponding to different file parameters are different, the embodiment of the present application can be described with respect to one possible serialization manner.
In one case, the file parameters further include: a serialization type;
the general serialization method further comprises the following steps:
If the serialization type specifies a Protobuf mode, executing Protoc commands to generate Protobuf serialization codes for the original file.
In practice, a user may desire to use other serialization tools to serialize, such as Protoc tools, etc. In order to not introduce redundant interfaces (each tool generally has an interactive interface with a user), the serialization code generating tool provided by the embodiment of the application can directly call other serialization modes by analyzing the Proto file parameters input by the user. Specifically, the serialization code generating tool provided by the embodiment of the application only provides a universal interface for a user, and the user can input the Proto file parameter to the serialization code generating tool through the universal interface, wherein the file parameter can comprise serialization type. For example, if the serialization type designates the Protobuf mode, the serialization code generating tool may directly execute Protoc commands to invoke Protoc tools to perform Protobuf mode serialization, and generate Protobuf serialization codes corresponding to Proto files, without introducing new interfaces. It should be noted that whether or not the serialization type is specified, the universal serialization interface code needs to be generated in a binary serialization manner.
The Proto file parameters entered by the user may also include serialization type.
In addition, since the serialization manners corresponding to different file parameters are different, the embodiment of the present application can be described with respect to one possible serialization manner.
In one case, the file parameters further include: generating a storage position of a file;
the general serialization method further comprises the following steps:
Creating a storage folder at the save location;
and storing the generated universal serial interface code in the storage folder.
In practical applications, the save location of the generated file may be specified by the user. Specifically, the user can write the storage location of the generated file in the input Proto file parameter, then input the file parameter including the storage location of the generated file into the serialization code generating tool, the serialization code generating tool analyzes the file parameter, creates a storage folder in the storage location written by the user, and then stores the universal serialization interface code generated by the serialization code generating tool in the storage folder.
To sum up, fig. 2 is a schematic diagram of an association relationship of a dependency component according to an embodiment of the present application. In connection with FIG. 2, a user inputs Proto file parameters and a serialization code generating tool (sf-msg-tool) obtains and parses a corresponding Proto file (msg-pro file). If the file parameters indicate that the Protobuf mode is used, then Protoc commands are executed, and the call Protoc tool generates Protobuf own serialization code (Protobuf serialization code), such as Protobuf_msg h or Protobuf_msg cc. Binary serialization code, such as an msg.hpp file, is generated simultaneously. MessageBus services may enable storage or transmission of structured data by invoking a generic serialization interface.
Fig. 3 is a flowchart of an implementation of a serialization code generating tool according to an embodiment of the present application. Referring to fig. 3, a user inputs Proto file parameters to a serialization code generating tool, the serialization code generating tool analyzes the parameter list, and creates an output folder according to the saved location of the analyzed generated file. And determining whether a Protobuf type serialization code needs to be generated according to the parsed serialization type. If so, using Protoc tools to generate Protobuf serialization codes corresponding to all Proto files in the list. Whether other serialization is needed or not, the message information in all the Proto files in the list needs to be loaded into the memory, and the integrity of the serialization execution process is ensured by traversing the form of the Proto file list. And acquiring message description information in the Proto file by a serialization code generation tool, and simultaneously readjusting the arrangement sequence of the messages according to the nesting relationship so as to ensure that the dependent messages are arranged in the front. And finally, transmitting the message description information of the current Proto file to a serialization code model, and generating a binary serialization code of the message of the current Proto file through the model. The serialization code generating tool traverses the file list and considers the serialization process to be ended when there is no Proto file for which serialization is not performed.
In summary, an original file of a serialization code to be generated is first obtained. The original file is then parsed and respective structured data corresponding to the original file is determined. And finally, loading the structured data into a memory, and generating a universal serial interface code for each structured data corresponding to the original file based on the serial code model, wherein the generated universal serial interface code can be used for cross-core communication. Therefore, the data is directly mapped to the memory, the memory address is directly operated by the serialization code model to read the data, the data copy is avoided, the original file is serialized in a zero copy mode, and the generated serialization code supports the use of cross-core communication of the SOC and the MCU without calling other interfaces, so that the execution efficiency is improved.
Based on the general serialization method provided by the embodiment, the embodiment of the application also provides a general serialization device. The general serialization apparatus is described below with reference to the embodiments and the drawings, respectively.
Fig. 4 is a schematic structural diagram of a general serialization apparatus according to an embodiment of the present application. Referring to fig. 4, a general serialization apparatus 400 according to an embodiment of the present application includes:
an obtaining module 401, configured to obtain an original file of a serialization code to be generated;
the parsing module 402 is configured to parse the original file and determine each structured data corresponding to the original file;
a serialization module 403, configured to load the structured data into a memory, and generate a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
As an embodiment, it is directed to how to acquire the original file. Accordingly, the obtaining module 401 may specifically be configured to:
acquiring file parameters input by a user; the file parameters comprise original file addresses;
And acquiring an original file corresponding to the original file address based on the original file address.
As an embodiment, the file parameters further include, for different configurations of the file parameters: a serialization type;
the serialization apparatus 400 further includes: a first serialization submodule;
and the first serialization submodule is used for executing Protoc commands to generate Protobuf serialization codes for the original file if the serialization type designates a Protobuf mode.
As an embodiment, the file parameters further include, for different configurations of the file parameters: generating a storage position of a file;
The serialization apparatus 400 further includes: a storage module;
The storage module is used for creating a storage folder at the storage position;
and storing the generated universal serial interface code in the storage folder.
As an embodiment, the serialization module 403 is specifically configured to:
Acquiring description information of each structured data;
Based on the description information, a generic serialized interface code is generated for each structured data by a serialized code model.
As an embodiment, it is directed to how to program the serialization order. Correspondingly, the serialization apparatus 400 further includes: an adjustment module;
And the adjustment module is used for adjusting the arrangement sequence of each structured data based on the nested relation so as to queue the dependent structured data preferentially.
As one implementation, it is directed to how to determine whether to generate the serialized code completion. Correspondingly, the serialization apparatus 400 further includes: an identification module;
the identification module is used for traversing the file list; the file list comprises all original files of the serialization codes to be generated;
and if all the original files in the file list are generated by the serialization codes, identifying the file list.
In summary, an original file of a serialization code to be generated is first obtained. The original file is then parsed and respective structured data corresponding to the original file is determined. And finally, loading the structured data into a memory, and generating a universal serial interface code for each structured data corresponding to the original file based on the serial code model, wherein the generated universal serial interface code can be used for cross-core communication. Therefore, the data is directly mapped to the memory, the memory address is directly operated by the serialization code model to read the data, the data copy is avoided, the original file is serialized in a zero copy mode, and the generated serialization code supports the use of cross-core communication of the SOC and the MCU without calling other interfaces, so that the execution efficiency is improved.
In addition, the application also provides general serialization equipment, which comprises:
A memory for storing a computer program;
A processor for implementing the steps of the general serialization method according to any one of the preceding claims when executing the computer program.
In addition, the application also provides a readable storage medium, wherein the readable storage medium stores a computer program, and the computer program realizes the steps of the general serialization method according to any one of the above steps when being executed by a processor.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for universal serialization, the method comprising:
acquiring an original file of a serialization code to be generated;
Analyzing the original file, and determining each structured data corresponding to the original file;
Loading the structured data into a memory, and generating a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
2. The method of claim 1, wherein the obtaining the original file of the serialization code to be generated comprises:
acquiring file parameters input by a user; the file parameters comprise original file addresses;
And acquiring an original file corresponding to the original file address based on the original file address.
3. The method of claim 2, wherein the file parameters further comprise: a serialization type;
the general serialization method further comprises the following steps:
If the serialization type specifies a Protobuf mode, executing Protoc commands to generate Protobuf serialization codes for the original file.
4. The method of claim 2, wherein the file parameters further comprise: generating a storage position of a file;
the general serialization method further comprises the following steps:
Creating a storage folder at the save location;
and storing the generated universal serial interface code in the storage folder.
5. The method of claim 1, wherein generating a generic serialized interface code for each structured data corresponding to the original file based on the serialized code model comprises:
Acquiring description information of each structured data;
Based on the description information, a generic serialized interface code is generated for each structured data by a serialized code model.
6. The method of claim 1, wherein before generating a generic serialized interface code for each structured data corresponding to the original file based on the serialized code model, further comprises:
And adjusting the arrangement sequence of each structured data based on the nesting relation to queue the dependent structured data preferentially.
7. The method according to claim 1, wherein the method further comprises:
traversing the file list; the file list comprises all original files of the serialization codes to be generated;
and if all the original files in the file list are generated by the serialization codes, identifying the file list.
8. A universal serialization apparatus, comprising:
the acquisition module is used for acquiring an original file of the serialization code to be generated;
the analysis module is used for analyzing the original file and determining each structured data corresponding to the original file;
the serialization module is used for loading the structured data into a memory and generating a universal serialization interface code for each structured data corresponding to the original file based on a serialization code model; the universal serialized interface code may be used for cross-core communication.
9. A universal serialization apparatus, comprising:
A memory for storing a computer program;
a processor for implementing the steps of the general serialization method according to any one of claims 1 to 7 when said computer program is executed.
10. A readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the general serialization method according to any one of claims 1 to 7.
CN202410969774.9A 2024-07-18 2024-07-18 A universal serialization method, device, equipment and readable storage medium Pending CN118981487A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410969774.9A CN118981487A (en) 2024-07-18 2024-07-18 A universal serialization method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410969774.9A CN118981487A (en) 2024-07-18 2024-07-18 A universal serialization method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN118981487A true CN118981487A (en) 2024-11-19

Family

ID=93448231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410969774.9A Pending CN118981487A (en) 2024-07-18 2024-07-18 A universal serialization method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN118981487A (en)

Similar Documents

Publication Publication Date Title
US7761586B2 (en) Accessing and manipulating data in a data flow graph
CN111428462B (en) Communication protocol template construction method and terminal equipment
US9892144B2 (en) Methods for in-place access of serialized data
US10509854B2 (en) Annotation processing of computer files
CN110457260A (en) File processing method, device, device, and computer-readable storage medium
CN111475150B (en) Cross-language binding method, device, equipment and storage medium
CN110941655A (en) A data format conversion method and device
CN114047970A (en) Configuration method and system of AUTOSAR (automotive open system architecture) architecture software
CN110647316A (en) Method and device for generating universal business object, computer equipment and storage medium
CN116225578A (en) Data serialization method, anti-serialization method and inter-process instruction parameter transmission method
JP2024173607A (en) Method and system for converting text and graphic codes for automobile development
CN113238739A (en) Plug-in development and data acquisition method, device, electronic equipment and medium
CN111338614A (en) Application program interface development method, device, device and storage medium
CN118981487A (en) A universal serialization method, device, equipment and readable storage medium
CN109726213B (en) Program code conversion method, device, medium and computing equipment
US8108828B2 (en) System for generating optimized computer data field conversion routines
CN115866086A (en) Message conversion method and message conversion device
CN114528041A (en) A configurable automatic analysis method and device
US20250110755A1 (en) Method, device, and computer program product for providing interface
CN113467860B (en) Service logic execution method and device of program source code
CN111752602B (en) Method for generating protobuf file running in GO language
CN117827217A (en) Method and device for interconversion of c-language structure and json
CN117493610A (en) GraphQL parameter generation method and system based on java implementation
CN118590563A (en) A method, device, equipment and medium for parsing a DBC file into a JSON file
CN118051262A (en) Instruction conversion method, apparatus, computer device and storage medium

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