Configuration file parsing method and device, equipment and storage medium

By directly manipulating the memory area of ​​the target type object to parse the configuration file, the problem of poor generality in parsing configuration files for different custom type objects is solved, achieving efficient and unified configuration file parsing and improving the performance of autonomous driving communication.

CN116257298BActive Publication Date: 2025-12-16APOLLO INTELLIGENT CONNECTIVITY (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310129494.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-07
Publication Date
2025-12-16
Estimated Expiration
2043-02-07

AI Technical Summary

Technical Problem

Existing middleware in the autonomous driving field requires defining a separate parsing interface for each type of configuration file when parsing custom type objects. This results in poor versatility of configuration file parsing and consumes additional memory and CPU resources.

Method used

A configuration file parsing method is provided, which directly determines the configuration values ​​of members and writes them into the memory area by obtaining the configuration file and description information of the target type object, avoiding the creation of additional objects, and using a unified parsing interface to handle different custom type objects.

Benefits of technology

It improves the universality and efficiency of configuration file parsing, reduces memory and CPU consumption, and increases the speed of autonomous driving communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257298B_ABST
    Figure CN116257298B_ABST
Patent Text Reader

Abstract

The present disclosure provides a configuration file parsing method and device, equipment and a storage medium. The present disclosure relates to the technical field of automatic driving, and specifically relates to the technical field of configuration file parsing. The specific implementation scheme is: in response to detecting a parsing instruction of a target type object, obtaining a configuration file and description information of the target type object; based on the configuration file, determining configuration values corresponding to N members included in the target type object respectively, N being an integer not less than 1; based on the description information, determining memory areas corresponding to the N members respectively; and writing the configuration values corresponding to the N members respectively into the memory areas corresponding to the N members respectively. According to the scheme of the present disclosure, the generality of configuration file parsing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of automatic driving, in particular to the technical field of configuration file parsing. BACKGROUND

[0002] In the field of automatic driving, a plurality of middlewares need to be used. The functions of the middlewares involve communication, module upgrade, task scheduling, execution management, etc. Some middlewares need to parse configuration files of custom type objects. For the parsing of the configuration files of the custom type objects, an interface is usually defined for each custom type object, and then each member of the custom type object is traversed, and the configuration value of the corresponding member is obtained from the configuration file of the custom type object. In the related art, a parsing configuration interface needs to be defined for each custom type object, and a plurality of parsing configuration interfaces need to be defined for a plurality of custom type objects. Therefore, the generality of the configuration file parsing among different custom type objects is poor. SUMMARY

[0003] The present disclosure provides a configuration file parsing method, apparatus, device, and storage medium.

[0004] According to a first aspect of the present disclosure, a configuration file parsing method is provided, comprising:

[0005] In response to detecting a parsing instruction of a target type object, obtaining a configuration file and description information of the target type object;

[0006] Based on the configuration file, determining configuration values corresponding to N members included in the target type object respectively, N being an integer not less than 1;

[0007] Based on the description information, determining memory areas corresponding to the N members respectively;

[0008] Writing the configuration values corresponding to the N members respectively into the memory areas corresponding to the N members respectively.

[0009] According to a second aspect of the present disclosure, a configuration file parsing apparatus is provided, comprising:

[0010] An obtaining module, configured to, in response to detecting a parsing instruction of a target type object, obtain a configuration file and description information of the target type object;

[0011] A first determining module, configured to, based on the configuration file, determine configuration values corresponding to N members included in the target type object respectively, N being an integer not less than 1;

[0012] A second determining module, configured to, based on the description information, determine memory areas corresponding to the N members respectively;

[0013] The writing module is configured to write the configuration values corresponding to the N members respectively into memory regions corresponding to the N members respectively.

[0014] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0015] at least one processor;

[0016] a memory in communication with the at least one processor;

[0017] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any of the embodiments of the present disclosure.

[0018] According to a fourth aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to perform the method according to any of the embodiments of the present disclosure.

[0019] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to any of the embodiments of the present disclosure.

[0020] According to the scheme of the present disclosure, the generality of configuration file parsing can be improved.

[0021] The above summary is merely intended to illustrate the present disclosure and is not intended to limit in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features will be readily apparent to those skilled in the art by reference to the drawings and the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0022] In the drawings, like reference numerals refer to same or similar components throughout the several views. These drawings are not necessarily to scale. It should be understood that these drawings are merely schematic representations, which are intended to provide a general understanding of the application. In addition, the drawings are provided to illustrate implementation of some embodiments of the present disclosure and should not be interpreted to limit the scope of the application.

[0023] Figure 1 is a flowchart of a configuration file parsing method according to an embodiment of the present disclosure;

[0024] Figure 2 is a schematic diagram of description information of a target type object demo according to an embodiment of the present disclosure;

[0025] Figure 3 is a schematic diagram of memory layout of each member of the target type object demo according to an embodiment of the present disclosure;

[0026] Figure 4This is a schematic diagram of the configuration values ​​of each member of the target type object demo according to an embodiment of this disclosure;

[0027] Figure 5 This is a schematic diagram of the configuration file parsing process according to an embodiment of this disclosure. Figure 1 ;

[0028] Figure 6 This is a schematic diagram of the configuration file parsing process according to an embodiment of this disclosure. Figure 2 ;

[0029] Figure 7 This is a schematic diagram of the configuration file parsing device according to an embodiment of the present disclosure;

[0030] Figure 8 This is a schematic diagram illustrating a scenario of configuration file parsing according to an embodiment of this disclosure;

[0031] Figure 9 This is a schematic diagram of the structure of an electronic device used to implement the configuration file parsing method of the embodiments of this disclosure. Detailed Implementation

[0032] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0033] The terms "first," "second," and "third," etc., used in the embodiments, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as including a series of steps or units. A method, system, product, or apparatus is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses.

[0034] In the related art, a communication middleware in the field of automatic driving can be responsible for communication between vehicles and between modules in a vehicle. The communication middleware can be applied in an Apollo operating system (OS) framework. A configuration file parsing version in the communication middleware includes an Apollo interactive data language (IDL) 0.x version, an Apollo IDL 1.x version, and a structured data storage format (Protocol Buffers, Protobuf). The Apollo IDL 0.x version and the Apollo IDL 1.x version are non-open source versions, and the Protobuf is an open source version.

[0035] In the related art, the Apollo IDL 0.x version needs to create a Reflector object, read the configuration file into the Reflector object, serialize it into a string, and finally deserialize it into a specific object through a self-deserialization interface. However, this version needs to additionally create a Reflector object and also needs to perform serialization / deserialization operations, thus consuming additional memory and central processing units (CPUs).

[0036] In the related art, the Apollo IDL 1.x version needs to create a Dynamic Interactive Data Language Struct (DynamicIDLStruct for short) object, read the configuration file into the DynamicIDLStruct object, serialize it into a string, and finally deserialize it into a specific object. This version has improved efficiency compared to the Apollo IDL 0.x version, but still needs to additionally create a DynamicIDLStruct object, so there is still a problem of consuming additional memory and CPUs.

[0037] In the related art, the Protobuf needs to create a FileInputStream object, read the configuration file into the FileInputStream object, and parse the configuration file through a TextFormat type. This version supports fewer types, does not support complex types, and only supports the configuration file format defined by the Protobuf itself, thus having a low universality.

[0038] The disclosure proposes a universal configuration file parsing method of custom type objects to at least partially solve one or more of the above problems and other potential problems. The method supports different custom type objects using the same configuration parsing interface, eliminating the need for specific parsing methods for specific type objects, improving the universality of configuration file parsing, and further improving the efficiency of configuration file parsing, which helps to improve the communication speed in the field of autonomous driving.

[0039] The disclosure provides a configuration file parsing method, Figure 1 is a flowchart of the configuration file parsing method according to an embodiment of the disclosure. The configuration file parsing method can be applied to a configuration file parsing device. The configuration file parsing device is located in an electronic device. The electronic device includes but is not limited to fixed devices and / or mobile devices. For example, the fixed device includes but is not limited to a server, which can be a cloud server or a general server. For example, the mobile device includes but is not limited to a mobile phone, a tablet computer, and a vehicle terminal. In some possible implementation manners, the configuration file parsing method can also be realized by a processor calling computer readable instructions stored in a memory. As shown in the figure, the configuration file parsing method includes the following steps. Figure 1

[0040] S101: In response to detecting a parsing instruction of a target type object, obtaining a configuration file and description information of the target type object;

[0041] S102: Based on the configuration file, determining configuration values corresponding to N members included in the target type object respectively, N being an integer not less than 1;

[0042] S103: Based on the description information, determining memory areas corresponding to the N members respectively;

[0043] S104: Writing the configuration values corresponding to the N members respectively into the memory areas corresponding to the N members respectively.

[0044] In the embodiment of the disclosure, the target type object is a custom type object, and the target type object includes at least one member. The target type object can be a type object created by a user or a type object generated by an algorithm. The above is only an exemplary description, which is not limited to the source of the target type object, but only here is not exhaustive.

[0045] In the embodiment of the disclosure, the configuration file is a reference file for configuring the target type object. Different target type objects correspond to different configuration files.

[0046] ​In the embodiments of the present disclosure, the description information is description information of the target type object. For example, the description information includes a name of the target type object. For another example, the description information includes member information of the target type object. For yet another example, the description information includes an order and a size of each member included in the target type object. The above are only exemplary descriptions, and are not intended to limit all possible information included in the description information. Here, an exhaustive enumeration is not performed.

[0047] In the embodiments of the present disclosure, the memory region can also be referred to as a memory offset address. It should be noted that, for N members included in a single target type object, a memory region of an (i-1)th member and a memory region of an ith member are adjacent in the N members. Memory regions corresponding to different target type objects can be non-adjacent.

[0048] In the embodiments of the present disclosure, taking a target type object demo as an example, where demo is a name of the target type object. It can be understood that different target type objects have different names. In response to detecting a parsing instruction of the demo type object, description information of the demo type object is obtained, the description information including sizes, orders and names of all members of the demo type object; according to the description information of the demo type object, memory offset addresses of the members a, b and c are sequentially determined; configuration values in the configuration file are sequentially read field by field to determine configuration values corresponding to the members a, b and c respectively; and the configuration values of the members a, b and c are sequentially written into the memory offset addresses corresponding to the members a, b and c respectively.

[0049] The configuration file parsing process of the demo type object can refer to the following code snippet 1, which is described as follows:

[0050]

[0051]

[0052] According to the above code snippet 1, the configuration file parsing of the demo type object can be completed without knowing the members of the demo type object in advance (i.e., there is no member name and type information of the members a, b and c in the Parse function). Therefore, the problem of poor generality of configuration file parsing of different custom type objects can be solved.

[0053] The technical solution of the embodiments of the present disclosure is that, in response to detecting a resolution instruction of a target type object, a configuration file and description information of the target type object are acquired; based on the configuration file, configuration values corresponding to N members included in the target type object are determined respectively; based on the description information, memory areas corresponding to the N members are determined respectively; and the configuration values corresponding to the N members are written into the memory areas corresponding to the N members respectively. By directly operating the memory where the object is located, inefficient operations of creating additional objects are avoided, and the efficiency of configuration file resolution is improved; more importantly, the generality of configuration file resolution of different custom type objects is improved.

[0054] In some embodiments, the description information includes the order and size of the N members. Before S103, the configuration file resolution method can further include S105: determining offset values of the N members based on the order and size of the N members.

[0055] In the embodiments of the present disclosure, since the memory of the target type object needs to be directly operated, the description information of the target type object needs to be acquired. The description information of the target type object specifically includes the size and order of the N members included in the target type object. The size of the member included in the target type object is the size of the memory occupied by each member. The order of the member included in the target type object is the order of the N members included in the target type object.

[0056] In the embodiments of the present disclosure, taking a target type object demo as an example, the way of acquiring the configuration file of the demo type object is shown in code snippet 2.

[0057] The code snippet 2 is described as follows:

[0058]

[0059] As shown in the code snippet 1, calling demo.get_descriptor() can obtain the description information of the demo type object. Further, as known from the code snippet 2, the members included in the demo type object are a, b and c; the type of the member a is int32, i.e., 32-bit integer, since int occupies 4 bytes, it is known that the memory size occupied by the member a is 4 bytes; the type of the member b is int32[5], the member b is an array of 5 elements, and it is known that the memory size occupied by the member b is 20 bytes; the type of the member c is sequence <int32>, which is the size of the member c in the vector <int>) bytes.

[0060] In the embodiments of the present disclosure, the offset values of the members a, b and c are determined based on the order and size of the members a, b and c included in the demo type object; the member a is the first member of the demo type object, and the offset value of the memory address of the member a is 0 by default; the member b is the second member of the demo type object, and the offset value of the memory address of the member b is 4 based on the offset value and size of 4 bytes of the member a; the member c is the third member of the demo type object, and the offset value of the memory address of the member c is 24 based on the offset value and size of 20 bytes of the member b.

[0061] The offset value of the memory address of the first member of any target type object can be 0 by default.

[0062] Figure 2 A schematic diagram of the description information of the target type object demo is shown. As shown in the figure, Figure 2 The description information of the demo type object includes the names of the three members included in the demo type object, which are denoted as a, b and c respectively; and the order of the three members is a, b and c. The configuration values corresponding to a, b and c are read in turn according to the order from head to tail. The demo type object can further include the sizes of the three members a, b and c; for example, the size of the member a is 4 bytes; and for another example, the size of the member b is 20 bytes. The offset values of the members can be determined according to the order from head to tail and the sizes of the members; that is, the member a is the first member of the demo type object, and the offset value of the memory address of the member a is 0; the member b is the second member of the demo type object, and the offset value of the memory address of the member b is 4 based on the offset value of 0 and the size of 4 bytes of the member a; and the member c is the third member of the demo type object, and the offset value of the memory address of the member c is 24 based on the offset value of 4 and the size of 20 bytes of the member b.

[0063] In this way, by obtaining the description information of the target type object, the memory where the object is located can be directly operated, and inefficient operations such as additional object creation and deserialization operations are avoided, thereby improving the efficiency of the configuration file parsing. Compared with the need to define a separate parsing configuration interface for each custom type object, the present solution does not need to obtain member information in advance, and new type objects do not need to be modified anywhere, and can be directly used, which is helpful to realize the parsing of configuration files of multiple formats and improve the universality of the configuration file parsing.

[0064] In some embodiments, S103 can include:

[0065] S103a: determining a memory region of the i th member based on the size of the i th member, and the size and offset value of the (i-1) th member, i being an integer greater than or equal to 1 and less than or equal to N.

[0066] In the embodiments of the present disclosure, determining the memory regions corresponding to the N members respectively comprises: determining the memory region of the first member according to the size of the first member; determining the memory region of the second member according to the size of the first member and the offset value of the first member; determining the memory region of the third member according to the size of the second member and the offset value of the second member; and so on until determining the memory region of the N th member according to the size of the (N-1) th member and the offset value of the (N-1) th member.

[0067] Figure 3 A memory layout diagram of each member of the target type object demo is shown as follows: Figure 3 As shown, according to the description information of the demo type object, the members a, b and c of the demo type object are obtained; the member a is the first member of the demo type object, that is, the offset value of the memory address of the field a is 0; the member b is the second member of the demo type object, based on the size of the member a being 4 bytes, the offset value of the memory address of the member b is 4; the member c is the third member of the demo type object, based on the size of the member b being 20 bytes, the offset value of the memory address of the member c is 24, and the memory size is Sizeof(vector <int>) bytes.

[0068] In this way, the memory layout of the target type object is determined based on the description information of the target type object, so that the speed of determining the memory layout of the target type object is improved, and the speed of parsing the configuration file is also improved.

[0069] In some embodiments, S101 can include:

[0070] S101a: determining, based on the parsing instruction, a configuration file storage address of the target type object;

[0071] S101b: taking the configuration file at the configuration file storage address as the configuration file of the target type object.

[0072] In some embodiments, the parsing instruction is an instruction for a specific target type, and one target type object corresponds to one parsing instruction. The parsing instruction is used to indicate the parsing of the configuration file of the target type, and can also be used to indicate the obtaining of the configuration file and the description information of the target type object. The above is only an exemplary description, and is not intended to limit all possible functions included in the parsing instruction, and only a non-exhaustive enumeration is made here.

[0073] In some embodiments, the configuration file can be obtained in various ways. For example, the configuration file is called by jumping to the configuration file storage address in the local folder. For another example, the configuration file at the configuration file storage address is called by querying from the database. The above is only an exemplary description, and is not intended to limit all possible ways of obtaining the configuration file, and only a non-exhaustive enumeration is made here.

[0074] In some embodiments, the name of the target type object is determined based on the parsing instruction, the configuration file storage address is determined based on the name of the target type object, and the configuration file at the configuration file storage address is called. For example, the name of the target type object is demo based on the parsing instruction for parsing the demo type object, and the configuration file named demo in the local folder is called.

[0075] In some embodiments, the configuration file storage address code of the target type object is obtained based on the parsing instruction, the configuration file storage address is determined based on the configuration file storage address code, and the configuration file at the configuration file storage address is called. For example, the configuration file storage address code of the demo type object is 0001 based on the parsing instruction, and the configuration file at the address named 0001 is called from the database.

[0076] In this way, the configuration file is obtained based on the configuration file parsing address of the target type object obtained based on the parsing instruction, so that the universality and efficiency of the configuration file parsing are improved.

[0077] In some embodiments, S102 can include:

[0078] S102a: In response to detecting that the configuration value of the i th member is written into the memory area of the i th member, read the configuration value of the i+1 th member from the configuration file, and so on until the configuration value of the N th member is read from the configuration file.

[0079] In some embodiments, the configuration values of each member in the configuration file are read in sequence field by field. Take the content of the configuration file of the target type object demo as an example for illustration:

[0080] a: 10

[0081] b: [1, 2, 3, 4, 5]

[0082] c: [1, 3, 5]

[0083] Figure 4 The memory layout of the configuration values of each member of the target type object demo is shown as follows: Figure 4 As shown in the figure, in response to the parsing instruction, the configuration values of each member in the configuration file are read in sequence field by field; first, the configuration values of field a and field a in the configuration file are read: 10; second, the configuration values of field b and field b in the configuration file are read: [1, 2, 3, 4, 5]; finally, the configuration values of field c and field c in the configuration file are read: [1, 3, 5].

[0084] In this way, by reading the configuration values of each member in the configuration file and writing the configuration values of each member into the memory area of each member, the efficiency of configuration file parsing is improved, and the versatility of configuration file parsing is also improved.

[0085] In some embodiments, S104 includes: in response to detecting that the configuration value of the i th member is written into the memory area of the i th member, writing the configuration value of the i+1 th member into the memory area of the i+1 th member, and so on until the configuration value of the N th member is written into the memory area of the N th member.

[0086] Code snippet 3 is described as follows:

[0087] / / Apollo IDL 2.0 configuration file

[0088] Demodemo;

[0089] demo.Parse("demo.config”);

[0090] The description information of the demo type object is acquired, and members a, b and c included in the demo type object are obtained; in combination with code snippet 3, the configuration value of the member a in the ApolloIDL2.0 configuration file is read, the member a is the first member of the demo type object, the offset value of the memory address of the field a is 0, the configuration value 10 of the member a is written into the memory area with the offset value of 0 and the memory size of 4 bytes, and the field setting of the member a is completed; the member b is returned to be read, the member b is the second member of the demo type object, based on the offset value 0 of the member a and the memory area with the size of 4 bytes, the offset value of the memory address of the member b is determined to be 4, the configuration value [1, 2, 3, 4, 5] of the member b is written into the memory area with the offset value of 4 and the memory size of 20 bytes, and the field setting of the member b is completed; the member c is returned to be read, the member c is the third member of the demo type object, based on the offset value 4 of the member b and the memory area with the size of 20 bytes, the offset value of the memory address of the member c is determined to be 24, the configuration value [1, 3, 5] of the member c is written into the memory area with the offset value of 24 and the memory size of Sizeof(vector <int>) bytes of memory region, the field of member c is set; the demo type object is configured. It can be understood that the configuration file parsing method of the scheme can be applied to Apollo IDLn.x version, n≥2.

[0091] In this way, based on the determined memory region of each member, the configuration value of each member in the configuration file is written into the memory region of each member, thereby helping to improve the accuracy of configuration file parsing.

[0092] In some embodiments, S101 can further include: S101c: in response to detecting that the configuration value of the ith member is obtained from the configuration file, reading the description information of the ith member.

[0093] Figure 5 The processing of the configuration file parsing method is shown Figure 1 As shown in Figure 5 The description information of the demo type object is obtained, and the members a, b and c of the demo type object are obtained. The configuration value of member a is read, member a is the first member of the demo type object, the offset value of the memory address of field a is 0, the configuration value 10 of member a is written into the memory region with an offset value of 0 and a memory size of 4 bytes, and the field of member a is set. Member b is returned to be read, member b is the second member of the demo type object, based on the offset value 0 of member a and the memory region with a size of 4 bytes, the memory address offset value of member b is determined to be 4, the configuration value [1, 2, 3, 4, 5] of member b is written into the memory region with an offset value of 4 and a memory size of 20 bytes, and the field of member b is set. Member c is returned to be read, member c is the third member of the demo type object, based on the offset value 4 of member b and the memory region with a size of 20 bytes, the memory address offset value of member c is determined to be 24, the configuration value [1, 3, 5] of member c is written into the memory region with an offset value of 24 and a memory size of sizeof(vector <int>) bytes of memory region, the field of member c is set; the demo type object is configured.

[0094] In this way, by obtaining the description information of the target type object while parsing the configuration values of each member included in the target type in the configuration file, the efficiency of the configuration file parsing is improved, and the generality of the configuration file parsing is also improved.

[0095] In some embodiments, S101 can further include:

[0096] S101d: Before determining the configuration value of the first member of the target type object from the configuration file, obtain the description information corresponding to each member included in the target type.

[0097] Figure 6 A processing schematic of the configuration file parsing method is shown Figure 2 As shown in Figure 6 The description information of the demo type object is obtained, and the member a, the member b and the member c of the demo type object are obtained. The description information of the member a, the member b and the member c is obtained, and it is obtained that the member a is the first member of the demo type object, the offset value of the memory address of the field a is 0; the member b is the second member of the demo type object, the size of the member a is 4 bytes, and the offset value of the memory address of the member b is 4; the member c is the third member of the demo type object, the size of the member b is 20 bytes, and the offset value of the memory address of the member c is 24. The configuration value 10 of the member a is written into the memory region with the offset value of 0 and the memory size of 4 bytes, and the field of the member a is set; the configuration value [1, 2, 3, 4, 5] of the member b is written into the memory region with the offset value of 4 and the memory size of 20 bytes, and the field of the member b is set; and the configuration value [1, 3, 5] of the member c is written into the memory region with the offset value of 24 and the memory size of Sizeof(vector <int>) bytes of memory region, the field of member c is set up; thus, the demo type object is configured.

[0098] In this way, by obtaining the configuration values corresponding to the members included in the target type object in advance, the efficiency of the configuration file parsing is improved, and the generality of the configuration file parsing is improved.

[0099] Embodiments of the present disclosure provide a configuration file parsing apparatus, as shown in the figure, the configuration file parsing apparatus can include: an obtaining module 701, configured to obtain a configuration file and description information of a target type object in response to detecting a parsing instruction of the target type object; a first determining module 702, configured to determine configuration values corresponding to N members included in the target type object based on the configuration file, N being an integer greater than or equal to 1; a second determining module 703, configured to determine memory regions corresponding to the N members based on the description information; and a writing module 704, configured to write the configuration values corresponding to the N members into the memory regions corresponding to the N members. Figure 7 In some embodiments, the description information includes orders and sizes of the N members. The configuration file parsing apparatus can further include a third determining module 705 (not shown in the figure), configured to determine offset values of the N members based on the orders and sizes of the N members.

[0100] Figure 7 In some embodiments, the second determining module 703 includes a first determining submodule, configured to determine a memory region of an i-th member based on a size of the i-th member, and a size and an offset value of an i-1-th member, i being an integer greater than or equal to 1 and less than or equal to N.

[0101] In some embodiments, the obtaining module 701 includes a second determining submodule, configured to determine a storage address of the configuration file of the target type object based on the parsing instruction; and a third determining submodule, configured to determine the configuration file at the storage address of the configuration file as the configuration file of the target type object.

[0102] In some embodiments, the first determining module 702 includes a first reading submodule, configured to read a configuration value of an i+1-th member from the configuration file in response to detecting that a configuration value of an i-th member is written into a memory region of the i-th member, and so on until a configuration value of an N-th member is read from the configuration file.

[0103]

[0104] ​​In some embodiments, the writing module 704 comprises a writing submodule, configured to: in response to detecting that the configuration value of the i th member is written into the memory region of the i th member, write the configuration value of the i+1 th member into the memory region of the i+1 th member, and so on until the configuration value of the N th member is written into the memory region of the N th member.

[0105] In some embodiments, the obtaining module 701 comprises a second reading submodule, configured to: in response to detecting that the configuration value of the i th member is obtained from the configuration file, read the description information of the i th member.

[0106] In some embodiments, the obtaining module 701 comprises an obtaining submodule, configured to: before determining the configuration value of the first member of the target type object from the configuration file, obtain the description information corresponding to each member included in the target type.

[0107] Those skilled in the art should understand that the functions of each processing module in the configuration file parsing apparatus of the embodiments of the present disclosure can be understood with reference to the foregoing description of the configuration file parsing method, and each processing module in the configuration file parsing apparatus of the embodiments of the present disclosure can be implemented by an analog circuit that implements the functions of the embodiments of the present disclosure, or can be implemented by software that executes the functions of the embodiments of the present disclosure running on an electronic device.

[0108] The configuration file parsing apparatus of the embodiments of the present disclosure can improve the versatility of configuration file parsing.

[0109] The embodiments of the present disclosure provide a scene schematic diagram of configuration file parsing, as shown in Figure 8

[0110] As described above, the configuration file parsing method provided by the embodiments of the present disclosure is applied to an electronic device. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices.

[0111] Specifically, the electronic device can specifically perform the following operations:

[0112] In response to detecting a parsing instruction of a target type object, obtaining a configuration file and description information of the target type object;

[0113] Based on the configuration file, determining configuration values corresponding to N members included in the target type object respectively;

[0114] Based on the description information, determining memory regions corresponding to the N members respectively;​

[0115] write the configuration value corresponding to each of the N members into the memory region corresponding to each of the N members.

[0116] The configuration file and the description information of the target type object can be obtained from a data source. The data source can be various forms of data storage devices, such as a laptop computer, a desktop computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The data source can also represent various forms of mobile devices, such as a personal digital assistant, a cellular phone, a smart phone, a wearable device, and other similar computing devices. In addition, the data source can be the same device as the user terminal.

[0117] It should be understood that, Figure 8 The illustrated scenario diagram is merely illustrative and non-limiting, and those skilled in the art can make various obvious changes and / or replacements based on the examples Figure 8 The resulting technical solutions still belong to the disclosure range of the present disclosure.

[0118] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information involved are in line with relevant legal regulations and do not violate public order and good customs.

[0119] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.

[0120] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.

[0121] As Figure 9 As shown, the device 900 includes a computing unit 901 that can perform various appropriate actions and processes in accordance with a computer program stored in a Read-Only Memory (ROM) 902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. Various programs and data required for the operation of the device 900 can also be stored in the RAM 903. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An Input / Output (I / O) interface 905 is also connected to the bus 904.

[0122] Various components in the device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, a mouse, etc., an output unit 907, such as various types of displays, speakers, etc., a storage unit 908, such as a magnetic disk, an optical disk, etc., and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0123] The computing unit 901 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various special-purpose Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs various methods and processes described above, such as the configuration file parsing method. For example, in some embodiments, the configuration file parsing method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the configuration file parsing method described above can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the configuration file parsing method by any other appropriate means, such as by means of firmware.

[0124] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0125] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as part of a separate software package, and partially on a remote machine or server.

[0126] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0127] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a Cathode Ray Tube (CRT) or Liquid Crystal Display (LCD) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0128] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0129] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0130] It should be understood that the various forms of flow shown above can be re-ordered, added to, or have steps deleted, using the steps described above. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure can be achieved, which is not limited herein.

[0131] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.< / int> < / int> < / int> < / int> < / int>

Claims

1. A configuration file parsing method, comprising: In response to a parsing instruction that detects a target type object, the configuration file and description information of the target type object are obtained, wherein the description information includes the memory length and physical storage order of each member of the target type object; Based on the configuration file, determine the configuration values ​​corresponding to each of the N members included in the target type object, where N is an integer not less than 1; Based on the physical storage order and memory length of each member, the memory offset of each member is dynamically calculated, with the memory offset of the first member set as the base value; the offset of the i-th member = the offset of the (i-1)-th member + the memory length of the (i-1)-th member. The memory region corresponding to each member is allocated based on the memory offset; In response to an event that the configuration value of the j-th member is written to its memory area, a configuration value write operation for the (j+1)-th member is triggered, and the configuration values ​​corresponding to each of the N members are written to the memory areas corresponding to each of the N members. The target type object contains array or nested structure members.

2. The method according to claim 1, wherein, In response to a parsing instruction that detects a target type object, the configuration file of the target type object is obtained, including: The storage address of the configuration file for the target type object is determined based on the parsing instructions; The configuration file at the storage address of the configuration file is used as the configuration file for the target type object.

3. The method according to claim 1, wherein, Obtaining the description information of the target type object includes: In response to detecting that the configuration value of the i-th member is obtained from the configuration file, the description information of the i-th member is read.

4. The method according to claim 1, wherein, Obtaining the description information of the target type includes: Before determining the configuration value of the first member of the target type object from the configuration file, obtain the description information corresponding to each member included in the target type.

5. A configuration file parsing device, comprising: The acquisition module is used to acquire the configuration file and description information of the target type object in response to a parsing instruction that detects a target type object; The description information includes the memory length and physical storage order of each member of the target type object; The first determining module is used to determine the configuration values ​​corresponding to each of the N members included in the target type object based on the configuration file, where N is an integer not less than 1; The second determining module is used to dynamically calculate the memory offset of each member according to the physical storage order and memory length of each member, with the memory offset of the first member set as the base value; the offset of the i-th member = the offset of the (i-1)-th member + the memory length of the (i-1)-th member; and to allocate the memory region corresponding to each member based on the memory offset. The write module is used to trigger the write operation of the configuration value of the (j+1)th member in response to the event that the configuration value of the j-th member is written to its memory area, and to write the configuration values ​​corresponding to each of the N members to the memory areas corresponding to the N members respectively, wherein the target type object contains array or nested structure members.

6. The apparatus according to claim 5, wherein, The acquisition module includes: The second determining submodule is used to determine the configuration file storage address of the target type object based on the parsing instructions; The third determination submodule is used to determine the configuration file under the configuration file storage address as the configuration file of the target type object.

7. The apparatus according to claim 5, wherein, The acquisition module includes: The second reading submodule is used to read the description information of the i-th member in response to detecting that the configuration value of the i-th member has been obtained from the configuration file.

8. The apparatus according to claim 5, wherein, The acquisition module includes: The acquisition submodule is used to acquire description information corresponding to each member of the target type before determining the configuration value of the first member of the target type object from the configuration file.

9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.

11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Loading method and device of memory structure configuration file and terminal

    CN114968263A