CN110275789A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN110275789A
CN110275789A CN201910551949.3A CN201910551949A CN110275789A CN 110275789 A CN110275789 A CN 110275789A CN 201910551949 A CN201910551949 A CN 201910551949A CN 110275789 A CN110275789 A CN 110275789A
Authority
CN
China
Prior art keywords
structural body
body object
member property
character string
target type
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
CN201910551949.3A
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.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
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 Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN201910551949.3A priority Critical patent/CN110275789A/en
Publication of CN110275789A publication Critical patent/CN110275789A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

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

Abstract

This application provides a kind of data processing methods, this method determines the target type of structural body object first, then the member property information of the structural body object of the target type is obtained, member property information includes the number of the title of the character string forms of member property, the data type of member property and member property, finally according to these member property information, structural body object instance sequence is turned into character string message example, and according to these member property information, character string message example is deserialized as structural body object instance.As it can be seen that serializing and the format conversion of unserializing may be implemented in this method, reduces the size of code that format conversion process is relied on and data-handling efficiency can be improved.In addition, present invention also provides a kind of data processing equipment, to guarantee the application and realization of the method in practice.

Description

Data processing method and device
Technical field
This application involves computer data processing technology fields, more specifically, being data processing method and device.
Background technique
In computer disposal field, different processing contextual datas there are formats may be different, two of them data Format is structural body object and message.When being communicated between different computer application systems, need between two kinds of data formats It is converted, conversion includes serializing and two kinds of unserializing.Serializing, which is referred to, is converted to byte sequence for structural body object Process;Unserializing refers to the process that byte sequence is reverted to structural body object.
Currently, conversion method of data format is based on manually writing serializing and unserializing respectively for each structural body object Function, each structural body object have respective serializing and inverted sequence array function, on the one hand cause size of code larger, on the other hand It serializes function and unserializing function to execute in the code operation phase, reduces data-handling efficiency.
Summary of the invention
In view of this, this method is for reducing serializing and unserializing this application provides a kind of data processing method The size of code and raising data-handling efficiency that process is relied on.In addition, present invention also provides a kind of data processing equipment, to Guarantee the application and realization of the method in practice.
In order to achieve the object, technical solution provided by the present application is as follows:
In a first aspect, this application provides a kind of data processing methods, comprising:
Determine the target type of structural body object;
It is predefined macro in compilation phase execution, to obtain the member property letter of the structural body object of the target type Breath;
If desired the structural body object instance of the target type is serialized in the execution stage, then according to it is described at Member's attribute information, turns to character string message example for the member property sequence in the structural body object instance;
It is real in if desired structural body object that character string message example is deserialized as the target type by the execution stage The character string message example, then according to the member property information, is deserialized as the structural body of the target type by example Object instance.
Second aspect, this application provides a kind of data processing equipments, comprising:
Target type determination unit, for determining the target type of structural body object;
Member property information acquisition unit, it is predefined macro for being executed in the compilation phase, to obtain the target type Structural body object member property information;
Serialization unit, for if desired carrying out sequence to the structural body object instance of the target type in the stage of execution Change, then according to the member property information, the member property sequence in the structural body object instance is turned into character string message Example;
Unserializing unit, for character string message example to be if desired deserialized as the target class in the execution stage The character string message example is deserialized as described by the structural body object instance of type then according to the member property information The structural body object instance of target type.
The third aspect, this application provides a kind of data processing equipments, comprising: processor and memory, the processor By software program, the data of calling storage in the memory of operation storage in the memory, at least execute such as Lower step:
Determine the target type of structural body object;
It is predefined macro in compilation phase execution, to obtain the member property letter of the structural body object of the target type Breath;
If desired the structural body object instance of the target type is serialized in the execution stage, then according to it is described at Member's attribute information, turns to character string message example for the member property sequence in the structural body object instance;
It is real in if desired structural body object that character string message example is deserialized as the target type by the execution stage The character string message example, then according to the member property information, is deserialized as the structural body of the target type by example Object instance.
Fourth aspect, this application provides a kind of storage mediums, are stored thereon with computer program, which is characterized in that institute When stating computer program and being executed by processor, above-mentioned data processing method is realized.
As can be seen from the above technical solutions, this application provides a kind of data processing methods, it is first determined structural body pair The target type of elephant, then obtains the member property information of the structural body object of the target type, and member property information includes into The number of member's title of character string forms of attribute, the data type of member property and member property, finally according to these at Member attribute information, structural body object instance sequence is turned into character string message example, can also according to these member property information, Character string message example is deserialized as structural body object instance.As it can be seen that serializing and unserializing may be implemented in this method Format conversion, reduce the size of code that is relied on of format conversion process and improve data-handling efficiency.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a flow chart of data processing method provided by the present application;
Fig. 2 is another flow chart of data processing method provided by the present application;
Fig. 3 is a structural schematic diagram of data processing equipment provided by the present application;
Fig. 4 is a structural schematic diagram of data processing equipment provided by the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall in the protection scope of this application.
In computer field, data format used in different software systems may be different, therefore in certain softwares In the data exchange process of system, need to carry out the conversion of data format.Data processing method provided by the present application, mainly exists It is converted between structural body object and JSON (JavaScript Object Notation, JS object numbered musical notation) message.Its The middle process that structural body object is converted to JSON message becomes serializing, and JSON message is converted to the process of structural body object Referred to as unserializing.
It should be noted that the application environment of the application be C++ programming language environment, performed program code be using The code that C++ programming language is write.It is primarily due to, there is many system code of high performance demands all to use C++ programming language Speech is write, and this language environment itself is not provided with " code reflection " function, therefore not can be carried out serializing and inverted sequence The process of column.
Currently, in order to execute serializing and unserializing process, a kind of common processing under this language environment Method be manually be that each structural body object writes serializing and unserializing function by programming personnel, in such software systems How many structural body objects used, it is necessary to write serializing and the unserializing function of respective numbers.More specifically, serializing letter It needs to write the code of splicing JSON message in number for each structural body object, needs in unserializing function for each structural body Object writes the assignment code from JSON message to structural body object.
This kind of processing method is the prior art has at least the following problems: first is that each structural body object has respective serializing and inverted sequence Columnization function, although the processing logic inside function is similar, since the specific structure difference of structural body object makes function not It can be multiplexed, and then cause size of code larger;Second is that serializing function and unserializing function were executed in the code operation phase, fortune The execution efficiency of row order section is lower, to reduce the whole efficiency of data processing.
Another kind carries out serializing and the method for unserializing does not need to write splicing for each structural body object The code of JSON message, but the member variable for each structural body object is needed to write the generation with the mapping relations of JSON message Code, then serializing unserializing function is executed, this mode can equally generate the problems in the first above-mentioned data processing method.
In order at least solve said one technical problem, this application provides a kind of data processing method, this method is used for Complete serializing and unserializing step.
See Fig. 1, it illustrates a flow charts of data processing method.As shown in Figure 1, the data processing method is specifically wrapped Include following steps S101~S104.
S101: the target type of structural body object is determined.
Wherein, a plurality of types of structural body objects can be pre-established in practical applications, and a structural body object is just made For a kind of type structure object.Different structural body object orienteds is different, therefore the title table of structural body object can be used Show the type of structural body object.
Structural body object include it is a variety of, need in specific implementation for which type of structural body object execute data processing Method just determines the type of the structural body object, for ease of description, the type of the structural body object is known as target type.
Target type can be determining according to the program of calling notebook data processing method.Specifically, it calls at notebook data The program of reason method can send to notebook data processing unit and instruct, and include the title of structural body object in instruction, and then will The name of the structural body object received is referred to as the target type of structural body object.
S102: it is predefined macro in compilation phase execution, to obtain the member property letter of the structural body object of target type Breath.
Wherein, macro is a kind of replacement of grammer, for illustrating how a certain specific input is converted into according to predefined rule Corresponding output.Macro executed in the compilation phase, referred to as macro expansion.
The present invention is pre-defined, and to have macro, macro input parameter include the target type of structural body object, and macro function is to obtain Take the information of the member property of structural body object.Member property information includes: the title of the character string forms of member property, member The data type of attribute and the number of member property.
In order to make it easy to understand, being briefly described to the member property of structural body object.One structural body object can wrap Containing several member properties, each member data has each customized data type.An entitled student described as follows Structural body object shown in, the structural body object include two member properties, respectively name and age.The wherein data of name Type is the character array comprising 10 elements;The data type of age is integer.
struct student{
char name[10];
int age;
}
It is executed macro to obtain target type in the compilation phase to the target type of predefined macro input structure body object The structural body object member property that is included above-mentioned attribute information.
In a kind of concrete implementation mode, it is predefined it is macro in include: macro, data type for stringification processing obtain Take function and for the macro of the number that gets parms.For ease of description, it may be respectively referred to as the first macro, first function and second It is macro.
Correspondingly, a kind of specific implementation of this step is as follows:
See Fig. 2, executes following step S201~S203 in the compilation phase.It should be noted that following steps are all in journey What the sequence code compilation stage completed.
S201: it the name for the member property that the structural body object of target type includes is referred to as parameter is passed to be used for character string Change the macro of processing, and executes for the macro of stringification processing, to obtain the title of the character string forms of member property.
Wherein, the name for each member property that the first macro incoming parameter includes by the structural body object of target type Claim, it is character string that the first macro function, which is by incoming parameter processing,.To, by title be passed to first it is macro after, execute first it is macro just The title of the character string forms of available each member property.
As shown in following examples:
#define PRINT_PARAMS (STRUCT_NAME, PROPERTY_NAME) // first parameter indicates structural body The target type of object, second parameter indicate the title of member variable
{
cout<<#STRUCT_NAME<<""<<#PROPERTY_NAME;// it is previous it is macro be by this parameter of target type into Line character string, it is latter it is macro be by this parameter of the title of member variable carry out stringification
}
It should be noted that input first it is macro be parametric form title, output be character string forms title, the One it is macro only title handle as character string, such as the entitled name of the member property to the first macro interior input, export Be title name labeled as character string.Why carrying out this processing is because carrying out serializing and antitone sequence subsequent When change, need using the title after stringification.
S202: the title for the member property that the structural body object of target type includes is input to data type and obtains function In, and execute data type and obtain function, to obtain the data type of member property.
Wherein, the present invention pre-defines first function, that is, data type and obtains function, and as its name suggests, the function of the function is Its data type is determined for the parameter of input.The parameter of this step input includes the member property that structural body object is included Title, therefore first function can be according to the title of member property, to determine the data type of member property.
The present invention applies in C++ programmed environment, and the function that C++ itself offer can be used realizes this function.Specifically Ground, data type, which obtains function, can specifically include two functions, and one is constexpr function, and one is decltype letter Number.
Wherein, the data type of each member property can have number-mark in advance.The function of constexpr function It is that the number-mark of the data type of member property can be determined according to the title of the member property of input;Decltype function Function be that the corresponding data type of the number-mark is determined according to the number-mark of data type.Therefore, in conjunction with two letters Number can determine the data type of member property.
A kind of realization code is as follows:
#define REGISTER_TYPE(Type,Index)
REGISTER_TYPE (unsigned short, 1) // corresponding number-mark of data type unsigned short It is 1
REGISTER_TYPE (unsigned int, 2) // corresponding number-mark of data type unsigned int is 2
REGISTER_TYPE (unsigned long long, 3) corresponding volume of data type unsigned long long Number it is identified as 3
constexprstd::size_ttype_to_id(identity<Type>){return Index;}
template<class T>
struct identity{};
For example, a specific calling process is as follows:
Std::size_tIdx=constexprstd::size_ttype_to_id (identity <unsigned int >);
// assume that the value of the Idx of constexpr function output is 2
decltype(Idx)type;//decltype function can determine that data type is according to number-mark 2 unsigned int
As it can be seen that the number-mark of the data type of member property is determined by constexpr function first, then by the volume Number mark is input in decltype function and obtains the particular content of data type.
S203: it the name for all member variables that the structural body object of target type includes is referred to as parameter is passed to be used to obtain The macro of number of parameters is taken, and is executed for the macro of the number that gets parms, to obtain the number of member property.
Specifically, pre-defined second is macro i.e. for the macro of the number that gets parms, which is all members The title of attribute, the macro function are that the number of member property is determined according to the title of all member properties.
In C++ programmed environment, the macro method that the variable length generated can be obtained with reference to variadic macros.
A kind of realization code is as follows:
#define ARG_N (a1, a2, a3, N ...) // preset interception four figures N
#define ARG_N_HELPER(...)ARG_N(__VA_ARGS__)
#define COUNT_ARG(...)ARG_N_HELPER(__VA_ARGS__,3,2,1,0)
With COUNT_ARG (x, y) citing, the title of the member property inputted in the example is respectively x and y.Specifically hold Row process is as follows:
COUNT_ARG(x,y)
->ARG_N_HELPER(X,Y,3,2,1,0)
-> ARG_N (X, Y, 3,2,1,0) // interception four figures is 2, to know that the number of the member property of input is 2 It is a.
To sum up, the present invention it is available to the information of member property include, the title of the stringification of member property, at Member's data type of attribute and the number of member property.
S103: if desired the structural body object instance of target type is serialized in the execution stage, then according to member Member property sequence in structural body object instance is turned to character string message example by attribute information.
Wherein, it needs to enter the execution stage after compiling, in the stage of execution, if receiving a certain tool to target type The serializing of the structural body object of body is requested, then demonstrates the need for serializing a certain specific structural body object.Specifically Structural body object be known as structural body object instance.
Specific serialization process includes that structural body object instance is passed into serializing function, serializing function according to The target type of structural body object instance obtains the member property information that the compilation phase corresponds to target type, by structural body object Member property sequence in example turns to character string message i.e. JSON message, wherein the character string message after conversion is known as character string Message example.
The implementation procedure for serializing function is to determine member property all in structural body object instance, by member property The names of character string forms be referred to as the key in character string message, and each member property is taken out from structural body object instance Attribute value is assigned to corresponding key by attribute value.Key-value pair is assembled according to the reference format of JSON message, to obtain Character string message example.
A kind of concrete implementation mode of this step is as follows:
If the request serialized to the structural body object instance of target type is received in the execution stage, by member The number of attribute successively recycles each member property and executes following steps as cycle-index cut-off condition:
The name of the character string forms of member property is referred to as key, and acquisition title is corresponding from structural body object instance Value, as the corresponding value of key;And the data type according to member property, the data type of the corresponding value of determination key;
Wherein, the key-value pair that each member property generates forms character string message example.
Specifically, it is asked if received in the execution stage to what the structural body object instance of target type was serialized It asks, then circulate operation is carried out to the member property of structural body object instance, the content of each circulate operation is, in word to be generated It accords with and adds a key-value pair in crossfire text example.
The specific adding procedure of key-value pair is that key is the title of the character string forms of member property, and value is from structural body pair As the value of the member property extracted in example.In addition, each value in key-value pair is it needs to be determined that data type, different data The data format of type, value is different.The data type of value from member property data type, therefore by member property Data type as value data type.
It should be noted that cyclic process is controlled by cycle-index, 1 initially is set by cycle-index, every circulation primary, By cycle-index plus 1, until the value of cycle-index is equal to the number of member property, circulation terminates, to generate character string Message example.
S104: real in if desired structural body object that character string message example is deserialized as target type by the execution stage Character string message example, then according to member property information, is deserialized as the structural body object instance of target type by example.
Wherein, it needs to enter the execution stage after compiling, in the stage of execution, if received a certain specific character string Message is deserialized as the request of the specific structural body object of target type one, then needs to be implemented unserializing process, antitone sequence Change process is to generate a specific structural body object.Wherein, specific character string message is known as character string message example, tool The structural body object of body is known as structural body object instance.
Specific unserializing process includes inputting character string message example into unserializing function and will being assigned Structural body object instance, for unserializing function according to the target type of structural body object instance, obtaining the compilation phase corresponds to mesh Character string message instance transfer is structural body object instance according to member property information by the member property information for marking type.
The implementation procedure of unserializing function is, according to segment identifiers such as " { } []: " etc. from character string message example Each key-value pair is extracted, each key is matched with the member property in the structural body object of target type, by each key Value is as the value with the matched member property of key.
More specifically, a kind of specific implementation of this step is as follows.
If receiving the structural body object instance that character string message example is deserialized as to target type in the execution stage Request successively each member property circulation is executed following then using the number of member property as cycle-index cut-off condition Step:
The name of the character string forms of member property is referred to as to the target designation of the member property of structural body object, and from word It accords with and extracts the corresponding value of title, the target value of the member property as structural body object instance in crossfire text example.
It should be noted that cyclic process is controlled by cycle-index, 1 initially is set by cycle-index, every circulation primary, By cycle-index plus 1, until the value of cycle-index is equal to the number of member property, circulation terminates, to be structural body pair As each member property of example is assigned to target value.
From the above technical scheme, this application provides a kind of data processing method, this method determines structural body first The type of object, it is predefined macro in compilation phase execution, to obtain the information of the member property of the structural body object of the type, Serializing or antitone sequence process are carried out in the execution stage according to the information of the member property.Compared with prior art, in this method Programming personnel is not necessarily to splice message for different structural body object manual compiling, macro can obtain each knot using predefined The information of the member property of structure body object, so as to greatly reduce size of code, and macro expansion be in the compilation phase rather than The execution stage, when executing stage needs serializing or unserializing, without repeating this process, so as to improve data processing Whole efficiency.
With above-mentioned data processing method embodiment correspondingly, present invention also provides data processing equipments.Related data The explanation of processing unit may refer to above method embodiment, not repeat below.
See Fig. 3, it illustrates a kind of structural schematic diagrams of data processing equipment.As shown in figure 3, the device specifically includes: Target type determination unit 301, member property information acquisition unit 302, serialization unit 303 and unserializing unit 304.
Target type determination unit 301, for determining the target type of structural body object;
Member property information acquisition unit 302, it is predefined macro for being executed in the compilation phase, to obtain the target class The member property information of the structural body object of type;
Serialization unit 303, for if desired being carried out to the structural body object instance of the target type in the stage of execution Serializing, then according to the member property information, turn to character string for the member property sequence in the structural body object instance Message example;
Unserializing unit 304, for character string message example to be if desired deserialized as the mesh in the execution stage The character string message example is deserialized as by the structural body object instance of mark type then according to the member property information The structural body object instance of the target type.
In one implementation, the member property information includes: the title of the character string forms of member property, member The data type of attribute and the number of member property.
In one implementation, it is described it is predefined it is macro in include: for stringification processing macro, data type obtain Take function and for the macro of the number that gets parms;Then member property information acquisition unit 302 includes: that string name obtains son Unit, member property data type obtain subelement and member property number obtains subelement.
String name obtains subelement, the name of the member property for including by the structural body object of the target type Referred to as parameter is incoming described for the macro of stringification processing, and execution is described for the macro of stringification processing, to obtain The title of the character string forms of member property;
Member property data type obtains subelement, and the member for including by the structural body object of the target type belongs to Property title be input to the data type and obtain in function, and execute the data type and obtain function, with obtain it is described at The data type of member's attribute;
Member property number obtains subelement, and all members for including by the structural body object of the target type become It is incoming described for the macro of number that get parms that the name of amount is referred to as parameter, and execute it is described for the macro of number that get parms, To obtain the number of the member property.
In one implementation, serialization unit 303 includes: that first circulation executes subelement.
First circulation executes subelement, if real to the structural body object of the target type for receiving in the execution stage The request that example is serialized, then using the number of the member property as cycle-index cut-off condition, successively to each member Attribute circulation executes following steps:
The name of the character string forms of member property is referred to as key, and obtains the name from the structural body object instance Claim corresponding value, as the corresponding value of the key;
According to the data type of the member property, the data type of the corresponding value of the key is determined;
Wherein, the key-value pair that each member property generates forms character string message example.
In one implementation, unserializing unit 304 includes: that second circulation executes subelement.
Second circulation executes subelement, if character string message example is deserialized as institute for receiving in the execution stage State the request of the structural body object instance of target type, then using the number of the member property as cycle-index cut-off condition, Successively each member property is recycled and executes following steps:
The name of the character string forms of member property is referred to as to the target designation of the member property of structural body object, and from institute It states and extracts the corresponding value of the title, the target value of the member property as structural body object instance in character string message example.
See Fig. 4, it illustrates a kind of data processing equipments provided by the present application, specifically include: memory 401, processor 402 and communication bus 403.
Wherein, memory 401, processor 402 complete mutual communication by communication bus 403.
Memory 401, for storing program;Memory 401 may include high speed RAM memory, it is also possible to further include non- Volatile memory (non-volatile memory), for example, at least a magnetic disk storage.
Processor 402, for executing program, program may include program code, and said program code includes processor Operational order.Wherein, program can be specifically used for:
Determine the target type of structural body object;
It is predefined macro in compilation phase execution, to obtain the member property letter of the structural body object of the target type Breath;
If desired the structural body object instance of the target type is serialized in the execution stage, then according to it is described at Member's attribute information, turns to character string message example for the member property sequence in the structural body object instance;
It is real in if desired structural body object that character string message example is deserialized as the target type by the execution stage The character string message example, then according to the member property information, is deserialized as the structural body of the target type by example Object instance.
Processor 402 may be a central processor CPU or specific integrated circuit ASIC (Application Specific Integrated Circuit), or be arranged to implement the integrated electricity of one or more of the embodiment of the present application Road.
It should be noted that the processor can execute each step relevant to above-mentioned data processing method, herein It does not repeat.
Present invention also provides a kind of readable storage medium storing program for executing, are stored thereon with computer program, the computer program can To be executed by processor, to realize each step in data processing method.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
It should also be noted that, herein, relational terms such as first and second and the like are used merely to one Entity or operation are distinguished with another entity or operation, without necessarily requiring or implying between these entities or operation There are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant are intended to contain Lid non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including above-mentioned element.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (10)

1. a kind of data processing method characterized by comprising
Determine the target type of structural body object;
It is predefined macro in compilation phase execution, to obtain the member property information of the structural body object of the target type;
If desired the structural body object instance of the target type is serialized in the execution stage, then is belonged to according to the member Property information, turns to character string message example for the member property sequence in the structural body object instance;
If desired character string message example is deserialized as to the structural body object instance of the target type in the execution stage, then According to the member property information, the structural body object that the character string message example is deserialized as the target type is real Example.
2. data processing method according to claim 1, which is characterized in that the member property information includes: that member belongs to The number of the title of character string forms of property, the data type of member property and member property.
3. data processing method according to claim 2, which is characterized in that it is described it is predefined it is macro in include: for word Macro, the data type for according with stringization processing obtain function and for the macro of the number that gets parms;
It is then described predefined macro in compilation phase execution, to obtain the member property letter of the structural body object of the target type Breath, comprising:
Following step is executed in the compilation phase:
The name for the member property that the structural body object of the target type includes is referred to as to parameter is incoming described to be used for character string Change the macro of processing, and execution is described for the macro of stringification processing, to obtain the title of the character string forms of member property;
The title for the member property that the structural body object of the target type includes is input to the data type and obtains function In, and execute the data type and obtain function, to obtain the data type of the member property;
The name for all member variables that the structural body object of the target type includes is referred to as to parameter is incoming described to be used to obtain The macro of number of parameters is taken, and execution is described for the macro of number that get parms, to obtain the number of the member property.
4. data processing method according to claim 2, which is characterized in that it is described execute the stage if desired to the mesh The structural body object instance of mark type is serialized, then according to the member property information, by the structural body object instance In member property sequence turn to character string message example, comprising:
It, will be described if receiving the request serialized to the structural body object instance of the target type in the execution stage The number of member property successively recycles each member property and executes following steps as cycle-index cut-off condition:
The name of the character string forms of member property is referred to as key, and obtains the title pair from the structural body object instance The value answered, as the corresponding value of the key;
According to the data type of the member property, the data type of the corresponding value of the key is determined;
Wherein, the key-value pair that each member property generates forms character string message example.
5. data processing method according to claim 2, which is characterized in that it is described execute the stage if desired by character string Message example is deserialized as the structural body object instance of the target type, then, will be described according to the member property information Character string message example is deserialized as the structural body object instance of the target type, comprising:
If receiving the structural body object instance that character string message example is deserialized as to the target type in the execution stage Request, then using the number of the member property as cycle-index cut-off condition, successively to each member property recycle execute Following steps:
The name of the character string forms of member property is referred to as to the target designation of the member property of structural body object, and from the word The corresponding value of the title, the target value of the member property as structural body object instance are extracted in symbol crossfire text example.
6. a kind of data processing equipment characterized by comprising
Target type determination unit, for determining the target type of structural body object;
Member property information acquisition unit, it is predefined macro for being executed in the compilation phase, to obtain the knot of the target type The member property information of structure body object;
Serialization unit, for if desired being serialized to the structural body object instance of the target type in the execution stage, Then according to the member property information, it is real that the member property sequence in the structural body object instance is turned into character string message Example;
Unserializing unit, for character string message example to be if desired deserialized as the target type in the execution stage The character string message example is deserialized as the target then according to the member property information by structural body object instance The structural body object instance of type.
7. data processing equipment according to claim 6, which is characterized in that the member property information includes: that member belongs to The number of the title of character string forms of property, the data type of member property and member property.
8. data processing equipment according to claim 7, which is characterized in that the member property information acquisition unit packet Include: string name obtains subelement, member property data type obtains subelement and member property number obtains subelement;
String name obtains subelement, and the name of the member property for including by the structural body object of the target type is referred to as It is incoming described for the macro of stringification processing for parameter, and execution is described for the macro of stringification processing, to obtain member The title of the character string forms of attribute;
Member property data type obtains subelement, the member property for including by the structural body object of the target type Title is input to the data type and obtains in function, and executes the data type and obtain function, is belonged to obtaining the member The data type of property;
Member property number obtains subelement, all member variables for including by the structural body object of the target type It is incoming described for the macro of number that get parms that name is referred to as parameter, and execute it is described for the macro of number that get parms, with To the number of the member property.
9. a kind of data processing equipment characterized by comprising processor and memory, the processor pass through operation storage Software program, the data of calling storage in the memory, at least execution following steps in the memory:
Determine the target type of structural body object;
It is predefined macro in compilation phase execution, to obtain the member property information of the structural body object of the target type;
If desired the structural body object instance of the target type is serialized in the execution stage, then is belonged to according to the member Property information, turns to character string message example for the member property sequence in the structural body object instance;
If desired character string message example is deserialized as to the structural body object instance of the target type in the execution stage, then According to the member property information, the structural body object that the character string message example is deserialized as the target type is real Example.
10. a kind of storage medium, is stored thereon with computer program, which is characterized in that the computer program is held by processor When row, the data processing method as described in claim 1-5 any one is realized.
CN201910551949.3A 2019-06-24 2019-06-24 Data processing method and device Pending CN110275789A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910551949.3A CN110275789A (en) 2019-06-24 2019-06-24 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910551949.3A CN110275789A (en) 2019-06-24 2019-06-24 Data processing method and device

Publications (1)

Publication Number Publication Date
CN110275789A true CN110275789A (en) 2019-09-24

Family

ID=67961770

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910551949.3A Pending CN110275789A (en) 2019-06-24 2019-06-24 Data processing method and device

Country Status (1)

Country Link
CN (1) CN110275789A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306473A (en) * 2020-10-27 2021-02-02 深圳市元征科技股份有限公司 Program interface parameter transmission method, system and related equipment
WO2021097785A1 (en) * 2019-11-22 2021-05-27 云图技术有限公司 Data serialization and data deserialization methods and apparatuses, and computer device
CN112989139A (en) * 2019-12-13 2021-06-18 北京国基科技股份有限公司 Data searching method and device
WO2022062510A1 (en) * 2020-09-28 2022-03-31 中科寒武纪科技股份有限公司 Device and method for implementing live migration
CN114697402A (en) * 2020-12-29 2022-07-01 中移物联网有限公司 Internet of things protocol serialization method and device and electronic equipment
CN116737135A (en) * 2023-06-25 2023-09-12 上海同星智能科技有限公司 Parameter configuration method and system for graphic program

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122852A (en) * 2006-08-08 2008-02-13 华为技术有限公司 On-line business processing system middleware package method
CN101387984A (en) * 2007-09-10 2009-03-18 施耐德电器工业公司 Memory management method and apparatus
CN102609293B (en) * 2012-01-17 2015-03-04 深圳天源迪科信息技术股份有限公司 Method for instantiating C/C++ dynamically
CN104993906A (en) * 2015-05-18 2015-10-21 中国船舶重工集团公司第七二二研究所 Message transmission method and system
US20160224581A1 (en) * 2015-02-02 2016-08-04 Quantum Corporation Recursive Multi-Threaded File System Scanner For Serializing File System Metadata Exoskeleton
CN107463668A (en) * 2017-08-02 2017-12-12 湖南新航动力信息科技有限公司 Serializing and method and device, computer equipment and the storage medium of unserializing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122852A (en) * 2006-08-08 2008-02-13 华为技术有限公司 On-line business processing system middleware package method
CN101387984A (en) * 2007-09-10 2009-03-18 施耐德电器工业公司 Memory management method and apparatus
CN102609293B (en) * 2012-01-17 2015-03-04 深圳天源迪科信息技术股份有限公司 Method for instantiating C/C++ dynamically
US20160224581A1 (en) * 2015-02-02 2016-08-04 Quantum Corporation Recursive Multi-Threaded File System Scanner For Serializing File System Metadata Exoskeleton
CN104993906A (en) * 2015-05-18 2015-10-21 中国船舶重工集团公司第七二二研究所 Message transmission method and system
CN107463668A (en) * 2017-08-02 2017-12-12 湖南新航动力信息科技有限公司 Serializing and method and device, computer equipment and the storage medium of unserializing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
缤纷冷泪: "C/C++使用宏在编译期计算可变参数个数", 《CSDN》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021097785A1 (en) * 2019-11-22 2021-05-27 云图技术有限公司 Data serialization and data deserialization methods and apparatuses, and computer device
CN112989139A (en) * 2019-12-13 2021-06-18 北京国基科技股份有限公司 Data searching method and device
CN112989139B (en) * 2019-12-13 2023-10-27 北京国基科技股份有限公司 Data searching method and device
WO2022062510A1 (en) * 2020-09-28 2022-03-31 中科寒武纪科技股份有限公司 Device and method for implementing live migration
CN112306473A (en) * 2020-10-27 2021-02-02 深圳市元征科技股份有限公司 Program interface parameter transmission method, system and related equipment
CN112306473B (en) * 2020-10-27 2023-10-20 深圳市元征科技股份有限公司 Program interface parameter transmission method, system and related equipment
CN114697402A (en) * 2020-12-29 2022-07-01 中移物联网有限公司 Internet of things protocol serialization method and device and electronic equipment
CN114697402B (en) * 2020-12-29 2023-07-14 中移物联网有限公司 Internet of things protocol serialization method and device and electronic equipment
CN116737135A (en) * 2023-06-25 2023-09-12 上海同星智能科技有限公司 Parameter configuration method and system for graphic program
CN116737135B (en) * 2023-06-25 2024-01-30 上海同星智能科技有限公司 Parameter configuration method and system for graphic program

Similar Documents

Publication Publication Date Title
CN110275789A (en) Data processing method and device
US8898651B2 (en) Automatic generation of instruction-set documentation
CN103593194B (en) Object serialization method and apparatus
CN107463668B (en) Method and device, computer equipment and the storage medium of serializing and unserializing
US8756407B2 (en) Configuration rule prototyping tool
CN104615667A (en) Basic data generation method and device and test data generation method and device
CN106462425A (en) Complex constants
Grif et al. Methods of desingning and modeling of man-machine systems
CN110377291A (en) Structural data conversion method, device, computer equipment and storage medium
Sagebaum et al. Expression templates for primal value taping in the reverse mode of algorithmic differentiation
CN105706092A (en) Methods and systems of four-valued simulation
CN102591787B (en) The data processing method of JAVA card and device
Raju et al. Automatic conversion of CSP to CTJ, JCSP, and CCSP
Torsello bimEX: A Mathematica package for exact computations in 3+ 1 bimetric relativity
CN102929853A (en) DCS (Data Communication System) project data generating system and method based on Excel sheet association
CN110941655A (en) Data format conversion method and device
CN105867886A (en) Method and device for writing table
CN105793842B (en) Conversion method and device between serialized message
CN111125996A (en) Method for realizing instruction set based on bidirectional constraint tree of pseudo-random excitation generator
CN109298857A (en) Method for building up, medium, device and the calculating equipment of DSL statement model
EP2321739A2 (en) Flexible base class library
You et al. Unified formal derivation and automatic verification of three binary-tree traversal non-recursive algorithms
ZOBAČ Implementation of provenance chains traversal
Bhullar et al. Exploration of UML diagrams based code generation methods
CN116628067B (en) Form data processing method, device, equipment 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190924