HK1175552B - Method and device for creating and invoking common components - Google Patents
Method and device for creating and invoking common components Download PDFInfo
- Publication number
- HK1175552B HK1175552B HK13102774.3A HK13102774A HK1175552B HK 1175552 B HK1175552 B HK 1175552B HK 13102774 A HK13102774 A HK 13102774A HK 1175552 B HK1175552 B HK 1175552B
- Authority
- HK
- Hong Kong
- Prior art keywords
- component
- general
- instance
- creating
- generic
- Prior art date
Links
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for creating a generic component and calling the created generic component.
Background
With the continuous development of computer software technology, software is developing towards a larger and more complex direction, and in order to effectively use the larger and more complex software, the software can be divided into a series of components which can be realized in advance and are easy to develop, understand and adjust. And finally, assembling a plurality of components together to finish the operation of the software.
In the software development process, in order to improve reusability of software codes and improve development efficiency, common Interface elements can be packaged into a group of relatively independent components, and a Graphical User Interface (GUI) library or a GUI platform is formed by the components. There may be tens or even hundreds of available components in the GUI platform, each component capable of performing one visible or invisible function on the interface.
Components in the GUI platform can exist in a tree structure, and any one component can take other components as sub-components of the component to form a nested relation among the components. Referring to FIG. 1, which is a diagram illustrating the nesting relationship between components within a GUI platform, it can be seen from FIG. 1 that component 2 and component 3 are nested within component 1, and component 4 is further nested within component 2. Component 4, which is a sub-component, can be called by component 2, and likewise, component 2 and component 3, which are sub-components, can be called by component 1.
In fact, the functions of some components that are nested are universal, that is, the components are often nested into multiple components, and when the components are nested into each Component, the properties of the components are the same, and these components with the Common functions are called Common components (Common Component).
For example, a border component in the instant messaging software may be nested by various window class components for drawing a border of the window class components, and a background component may also be nested by various window class components for drawing a background of the window class components, so that the border component and the background component may be referred to as a general component.
Assuming that the window type component has a session window component and a system message window component, according to the current component nesting mode, as shown in fig. 2, the session window component is to implement nesting of a frame component and a background component by creating the frame component and the background component, so as to obtain functions of the frame component and the background component; the system message window component also needs to realize nesting of the frame component and the background component by creating the frame component and the background component, so as to obtain the functions of the frame component and the background component.
As can be seen from the nesting structure shown in fig. 2, for a general-purpose component, when the general-purpose component is nested by a plurality of other components, even if the general-purpose components are nested in the other components with the same properties, the other components must be respectively nested in the general-purpose component, and only the general-purpose component nested in itself can be called to achieve the purpose of running the functions of the general-purpose component. In such a nested manner, the system needs to create a common component for each other component and allocate the system resources for creation, and even when the same common component is created by a plurality of other components, the system needs to allocate the system resources for each creation process, resulting in a great waste of memory resources; meanwhile, each component needs to be created before running the general component, and because each creation process takes a certain time, the normal running speed of the component is also greatly influenced.
Disclosure of Invention
The purpose of this application lies in: the method and the device for creating and calling the universal component are provided for solving the problems of large waste of memory resources and low component running speed caused by nesting and creating the universal component in the prior art.
A method for creating a generic component for use in a software system having encapsulated components, comprising:
generating a general component library when software is initialized;
creating a universal component according to the attribute information of the universal component recorded in the configuration file;
and storing the created general component and the identification of the general component in the general component library.
A method of invoking a generic component, comprising:
determining the identification of the universal component to be called;
according to the determined identification, searching a general component represented by the identification from a general component library which stores a plurality of general components;
and calling the searched general components.
An apparatus for creating a generic component for use in a software system having encapsulated components, comprising:
the library creating module is used for generating a general component library when software is initialized;
the component creating module is used for creating the general component according to the attribute information of the general component recorded in the configuration file;
and the storage module is used for storing the created general components and the identification of the general components into the general component library.
An apparatus for invoking a generic component, comprising:
the identification determining module is used for determining the identification of the universal component to be called;
the searching module is used for searching the general component represented by the identification from a general component library which stores a plurality of general components according to the determined identification;
and the calling module is used for calling the searched general components.
The beneficial effect of this application is as follows:
according to the scheme provided by the embodiment of the application, the process of uniformly creating the universal components and uniformly storing the universal components in the universal component library is completed in the software initialization process, and when other common components need to call the universal components, the universal components do not need to be created respectively, and only the created universal components need to be called directly. In the scheme of the embodiment of the application, the universal component is only required to be created once, so that the number of the created universal components is reduced, system resources occupied in the process of creating the universal component can be effectively reduced, and the running speed of other common components is improved.
Drawings
FIG. 1 is a diagram illustrating a nesting relationship between components in the background art;
FIG. 2 is a diagram illustrating a nesting relationship between components in the background art;
FIG. 3 is a diagram illustrating steps of a method for creating a generic component according to an embodiment of the present application;
FIG. 4 is a diagram illustrating steps of a method for invoking a generic component according to a second embodiment of the present application;
FIG. 5 is a diagram illustrating method steps for invoking a generic component in the third embodiment of the present application;
fig. 6 is a schematic diagram of a call relationship between a common component and a common component in the third embodiment of the present application;
FIG. 7 is a schematic structural diagram of an apparatus for creating a generic component according to a fourth embodiment of the present application;
fig. 8 is a schematic structural diagram of a device for invoking a general component in the fifth embodiment of the present application.
Detailed Description
In order to achieve the purpose of the present application, the embodiments of the present application provide a new scheme for creating and calling a generic component, in an initialization stage of software, a generic component is created, and the generic component that is successfully created and an identifier thereof are stored in a generic component library, and when a generic component needs to use a function of the generic component, the generic component does not need to be nested again, but a generic component in the generic component library is directly called. According to the scheme of the embodiment of the application, the common components in the software program do not need to be created respectively, the functions of the common components can be obtained only by calling the common components in the common component library, the common components can be freely called at any time only by creating the common components once in the initialization stage of the software, the creation times of the common components are reduced, the occupation of system memory resources during the creation of the common components can be effectively reduced, meanwhile, the common components do not need to be created respectively, and only the common components need to be called, the operation speed of the components is greatly improved, and further the operation speed of the software is improved.
The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
It should be noted that, in order to distinguish from the created and called general-purpose components, other components in the software program related to the embodiments of the present application that need to call the general-purpose components are referred to as general components.
Example one
Fig. 3 is a schematic diagram illustrating steps of a method for creating a generic component according to an embodiment of the present application, where the method includes the following steps:
step 101: when the software starts to initialize, a general component library is generated.
The method and the device for creating the universal component are characterized in that the operation of creating the universal component is started to be executed when software is initialized, and the creation process of the universal component is completed before the initialization is finished. The purpose of this is: the operation of creating the general components is completed before the normal operation of the software, so that the general components in the software can directly call the created general components according to the requirements during the normal operation of the software. If the operation of creating the general component is not completed when the software initialization is finished, or even if the general component in the software needs to be created when the general component needs to be called, the creation of the general component needs to occupy a certain time, so that the procedure causes a large time delay in the process of calling the general component by the general component.
When the software is initially started, a generic component library is generated for the software in execution of step 101.
Taking the example that the software is instant messaging software, the specific implementation process of this step 101 is as follows:
firstly, whether the instant messaging software is started initially, namely whether the instant messaging software is started in the installed equipment is detected in real time.
Then, when the instant messaging software is detected to be initialized and started, scanning the memory resource of the equipment where the instant messaging software is located, and allocating a certain amount of memory resource to serve as the memory resource of the universal component library, wherein the allocated memory resource is used for storing the subsequently created universal component in the universal component library.
After memory resources are allocated for a general component library of the instant messaging software, a process is allocated for read-write operation of the general component library, and an entry address of the general component library and other information used for operating contents in the general component library are recorded, the general component library is generated.
In order to improve the access speed of the generic component library, a mapping (map) or hash mapping (hashmap) data structure may be used in the generic component library generated in this embodiment.
Step 102: and creating the universal component according to the attribute information of the universal component recorded in the configuration file.
During the development process of the software, some common elements are packaged into relatively independent components, the packaged relatively independent components comprise the common components, therefore, when the software development is completed, the attribute information of the common components is recorded in a configuration file, the attribute information capable of being used for creating the common components is recorded in the configuration file, and the configuration file is stored in a text storage area of the software.
The attribute information includes, but is not limited to, a combination of one or more of the following:
1. the type of the generic component, the component indicating what function the generic component is.
For example: if the type of the general component is Background, indicating that the general component is a component for generating the Background; if the type of the common component is Border, it indicates that the common component is a component for generating a bounding box.
2. Name of the common component.
Still taking a Background type generic component as an example, its name may be a name defined during software development.
3. And the storage address of the data required by the operation of the general-purpose component is used for indicating the storage address of other data required to be called when the general-purpose component is called to operate.
For example, when a Background type general component is called to generate a Background, Background pictures need to be called at the same time, so that the storage address of each Background picture needs to be recorded in the attribute information of the Background type general component, so that each Background picture can be called and displayed quickly when the Background is generated.
In the execution process of step 102, since the configuration file records attribute information of a plurality of general components, and each set of attribute information represents an attribute of one general component, when each set of attribute information recorded in the configuration file is correctly read, a plurality of general components can be respectively created by using the attribute information, and the specific creation process is as follows:
the first step is as follows: and creating an instance of the general component according to the set instance creating mode.
In the solution of this embodiment, the creation process of each instance of the general component is the same, and the specific process includes:
finding out a corresponding class factory (class factor) according to the type of the general component to be created, completing the creation of the general component of the same type by calling a member function of a creation instance (CreateInstance) of the class factory, and returning the created instance of the general component.
The essence of the class factory is an object in a Component Object Model (COM), an IClasFactory interface is defined in the class factory, and instantiation of the general component is completed through a CreateInstance member function in the IClasFactory interface.
In addition, according to the definition of the COM specification, a component object type (COM Class) and a Class factory are paired, that is, if a certain type of general component is to be instantiated, the component object type and the Class factory are implemented by the Class factory corresponding to the general component of the type.
The second step is that: and setting attributes for the created examples according to the attribute information of the universal components recorded in the configuration file to obtain the created universal components.
The setting of the attributes for the example means that: the purpose of applying the attributes to the universal component instances is achieved by calling the initialization (initialization) algorithm of the components and transmitting a group of attribute information into the instances.
The following describes the process of creating a generic component using attribute information, taking a generic component of Background type as an example:
assuming that there are two Background general-purpose components in the configuration file, the attribute information of the two general-purpose components are different, the first Background general-purpose component loads a picture to fill the Background, and the second Background general-purpose component fills the Background with white color.
The attribute information of the two backsgound common components recorded in the configuration file may be as follows:
in the process of creating, after reading the attribute information of the first universal component in the configuration file, determining that the type of the universal component is Background, and finding out the corresponding class factory Background.
And calling a CreateInstance member function of backgroundefactery to complete the creation of the first background general component, and assuming that the returned instance of the first background general component is stored in spBackground 1.
Then, setting the attribute of the first backsGound general component, calling the Initialize algorithm of the general component, and transmitting the attribute information of the first backsGound general component into the instance of the first backsGound general component. The specific transmission mode is as follows:
and operating an Initialize algorithm, sequentially reading each attribute information of the first Backgound universal component, and calling a corresponding attribute setting function for transmitting the attribute information read each time.
For example, if the read attribute information is the filling mode (Style) of the first backsgound general component, a SetStyle function is called, and the filling mode "Image filling Image" of the first backsgound general component is transmitted to the instance; for another example, if the read attribute information is the image filling mode (FillType) of the first Backgound general component, the SetFillType function is called, and the image filling mode "Tile" of the first Backgound general component is transferred into the instance.
After the creation of the first general component is completed, continuing to read the attribute information of the second general component, wherein the creation mode of the second general component is the same as the creation mode of the first general component, but when the attribute information of the second backsgound general component is transmitted into the instance of the second backsgound general component, because the contents of the attribute information of the first general component and the second general component are different, the finally created two backsgound general components can realize backgrounds with different appearance effects.
Step 103: storing the created generic components and the identities of the generic components in the generic component library.
As can be seen from the implementation manner of step 102, in the embodiment of the present application, when an instance is created, the instance is created by a class factory corresponding to a certain type of general component, and there may be multiple instances of the created general component of the same type, so in order to distinguish the general components in detail, after the instance is created, an Identifier (ID) may be assigned to each created instance.
In the scheme of the embodiment of the present application, the ID is assigned for the instance of the general component, and the purpose of this is: the same type of general components are created through the same class factory, although the types of the general components are the same, the attribute information of the general components are not completely the same, and the generated behavior results are different, so if the ID is allocated to the same type of components in a generalized manner, errors may occur in the subsequent calling process, but by using the method of allocating the ID to the example in the embodiment, investigation on the general components of different examples can be avoided, and the calling accuracy of the general components can be ensured.
Specifically, in this step 103, storage may be performed in a storage manner of distributed Key-Value (Key-Value pair), which is implemented as follows:
the first step is as follows: a content pointer is determined that points to a storage location of the created instance in the common component library.
Taking the creation of a Background type general component (referred to as general component _1) as an example, after an instance (referred to as instance _1) is created in step 102 according to the attribute information of the general component _1, the instance _1 is stored in a general component library, and a content pointer (referred to as content pointer _1) pointing to the storage location of the instance _1 is defined.
The second step is that: an identification is assigned to the created instance of the generic component.
Still taking the example of creating a Background type generic component _1, after creating an instance _1 according to the attribute information of the generic component _1 in step 102, the instance _1 is assigned an ID uniquely representing the instance _1, for example, the identifier assigned to the instance _1 is "ID _ COMMON _ BKGND 1".
The order of implementing the first step and the second step is not fixed, the second step may be executed first and then the first step, or the first step and the second step may be executed in parallel.
The third step: a correspondence between the identity of the instance of the generic component and the content pointer is established.
After an ID is assigned to instance _1 of generic component _1 in the first step and a content pointer _1 pointing to the storage location of instance _1 in the generic component library is defined in the second step, a correspondence between the ID and the content pointer _1 can be established, the instance represented by the identifier in the correspondence being the same as the instance pointed to by the corresponding content pointer.
The fourth step: storing the corresponding relation between the identification of the instance and the content pointer in the general component library.
At this time, not only the contents of the general components are stored in the general component library, but also the correspondence between the identifiers and the content pointers is stored in the general component library in the form of a key-value distributed storage system at the same time.
In step 102 and step 103 of the first embodiment of the present application, attribute information of each general component recorded in a configuration file is sequentially read and operated, and corresponding general components are respectively created and stored in a general component library until all general components corresponding to each attribute information recorded in the configuration file are created and stored.
According to the scheme of the first embodiment of the application, the processes of unified creation and unified storage of the universal components are completed in the software program initialization process, and compared with the existing mode that the universal components are created by common components respectively, the times of creating the universal components can be effectively reduced, so that the memory quantity occupied by the creation process of the universal components is reduced, and the running speed of the common components is improved; meanwhile, the embodiment completes the creation operation of the general components in the software initialization process, so that the general components can directly call the created general components according to the requirements without waiting for the creation process of the general components, and in the embodiment, the general components are created in a way of creating examples, and unique identifiers are allocated to the examples.
Example two
After the general component is created by using the scheme of the first embodiment, the general component in the general component library may be further called, as shown in fig. 4, which is a schematic diagram of a method step for calling the general component in the second embodiment of the present application, where the method includes the following steps:
step 201: an identification of a generic component to be invoked is determined.
In the scheme of this embodiment, the general component stores an identifier of a general component that can be called, and when the general component needs to call the general component, the identifier of the general component stored in the general component is read to perform a call operation.
Step 202: according to the determined identification, searching the general component represented by the identification from a general component library which stores a plurality of general components.
The specific implementation of this step is different according to the form of the general components stored in the general component library. Assuming that, in the first embodiment, the instance of the general component and the corresponding relationship between the identifier of the instance and the content pointer are stored in the general component library, in this step, a specific implementation process of searching the general component represented by the identifier from the general component library is as follows:
the first step is as follows: and determining the content pointer corresponding to the identifier of the example of the general component to be called according to the corresponding relation between the identifier of the example of the general component and the content pointer.
The identifier of the to-be-called generic component determined in step 201 is an identifier capable of uniquely representing the generic component, and if an identifier of an instance of the generic component is stored in a generic component library in an embodiment, the identifier of the generic component determined in step 201 is the identifier of the instance of the generic component.
After the identification of the general component to be called is determined, the content pointer corresponding to the identification can be inquired from the general component library.
The second step is that: the instance pointed to by the determined content pointer is taken as an instance of the found generic component.
Since the common component is created by the instance, after the instance of the common component is found, the created common component is found.
Step 203: and calling the searched general components.
If the instance of the generic component is found in step 202, the purpose of calling and running the generic component is achieved by calling the instance entry of the generic component and running the instance in this step.
According to the scheme of the second embodiment of the application, when the common component needs to operate the common component and obtain the functions of the common component, the common component does not need to be created respectively, but the created common component in the common component library is directly called, so that the time consumption and the memory resource consumption of the common component when the common component creates the common component respectively are eliminated, and the component operation efficiency is improved; in the scheme of the embodiment of the application, the general component is accessed by aiming at the stored fixed ID of each instance in the general component library, the ID does not need to be dynamically allocated to the instance by the system, and the occupation of resources is reduced on the basis of ensuring the correct calling of the general component.
EXAMPLE III
The embodiment of the present application is described in detail with reference to a specific example.
Suppose that: the general component to be called is a session window component, the general components which can be called by the session window component are a background general component and a border general component, and the background general component is identified as background ID and used for indicating which background general component the background of the session window component is drawn by; the identification of the frameset generic component is BorderID, which is used to indicate by which frameset generic component the frameset of the session window component is drawn. The identification of these two general components is documented within the session window component.
As shown in fig. 5, which is a schematic diagram of the three embodiments of the present invention, the step of the session window component invoking the corresponding general component in the general component library includes the following steps:
step 301: when the conversation window component is to begin drawing a window, an identification backgroup id of a background general component for drawing a background is determined, and an identification BorderID of a bezel general component for drawing a bezel is determined.
Step 302: the session window component respectively judges whether the backgroup ID and the BorderID are valid, if yes, the step 303 is executed; otherwise, if only one identifier is valid, the valid identifier continues to execute step 303; and if the two identifications are invalid, stopping calling the operation of the general component, and drawing by using the drawing function of the session window component.
In the scheme of this embodiment, although the session window component stores the identifiers of the background general component and the border general component, the stored identifiers of the general components may be invalid identifiers, in order to ensure that the session window component can correctly call the general components and avoid the situation that the invalid identifiers fail to call and additionally occupy system resources, in this step, validity of the identifiers used for querying the general components is checked, only the valid identifiers of the general components can perform a subsequent general component searching process, and the invalid identifiers of the general components are not allowed to be used.
For example, the judgment on whether the backgroup id is valid includes, but is not limited to, the following:
the first step is as follows: the range value of the character string length of the effective universal component identification content is preset.
In the solution of the embodiments of the present application, the content of the identifier of the general component (specifically, the identifier of the general component instance) is a character string, and for an effective identifier, the length of the character string in the content should be within a certain range, so that the range value of the length of the character string of the effective identifier content can be preset. The mark with the character string length in the content within the range value is a valid mark, otherwise, the mark is an invalid mark.
The second step is that: judging whether the background ID content is empty, if so, determining that the background ID is invalid; otherwise, the third step is executed.
The third step: judging whether the length of the character string of the background ID content is within a set range value or not; if yes, determining that the backgroup ID is valid; otherwise, determining that the backgroup ID is invalid.
Step 303: and the session window component finds out a corresponding content pointer from the universal component library through the effective backgroup ID and the BorderID.
In the solution of this embodiment, the session window component may search a plurality of content pointers through a preset function in a synchronous manner, and perform instance calling.
And finding out a content pointer pointing to the instance of the background general component through the effective background ID, and finding out a content pointer pointing to the instance of the border general component through the effective BorderID.
Step 304: and the conversation window component calls the pointed instance of the background general component and the pointed instance of the border general component from the general component library by utilizing the searched content pointer.
Because the instance of the background general component can be determined through the content pointer corresponding to the background ID, the session window component calls and runs the instance of the background general component to draw the background of the window; similarly, the border of the window is drawn by calling and running the instance of the border general component.
As shown in fig. 6, which is a schematic diagram of a calling relationship between a common component and a common component according to the third embodiment, where the common component in the solid line on the left is the common component created and stored in the common component library; the common component of the right dashed line is the common component that is called by the common component. In addition to the conversation window component, other common components, such as the system message window component, may also be able to invoke the background common component and the bezel common component in the manner described above.
Example four
The fourth embodiment of the present application further provides a device for creating a general component, which belongs to the same inventive concept as the first embodiment, as shown in fig. 7, and is applied to a software system with a packaged component, where the device includes: a library creation module 11, a component creation module 12, and a storage module 13, wherein: the library creating module 11 is used for generating a general component library when software is initialized; the component creating module 12 is configured to create a general component according to the attribute information of the general component recorded in the configuration file; the storage module 13 is configured to store the created generic component and the identifier of the generic component in the generic component library.
The component creation module 12 includes: an instance creating sub-module 21 and an attribute setting sub-module 22, wherein: the instance creating submodule 21 is used for creating an instance of the general component according to a set instance creating mode; the attribute setting submodule 22 is configured to set an attribute for the created instance according to the attribute information of the generic component recorded in the configuration file.
The storage module 13 includes: a corresponding relationship establishing submodule 23 and an executing submodule 24, wherein: the corresponding relation establishing submodule 23 is configured to determine a content pointer pointing to a storage location of the created instance in the general component library, allocate an identifier to the created instance, and establish a corresponding relation between the identifier of the instance and the content pointer; the execution sub-module 24 is configured to store the correspondence between the identifier of the instance and the content pointer in the general component library.
The device for creating the general component in the fourth embodiment may be a device capable of executing each step in the first embodiment, and logical components of each step in the first embodiment are not described in detail.
The device for creating the general-purpose component in the fourth embodiment may be a client integrated in the software, or may be a client independent of the software and capable of calling various pieces of information in the software.
EXAMPLE five
The fifth embodiment of the present application further provides a device for invoking a general component, which belongs to the same inventive concept as the second and third embodiments, as shown in fig. 8, including: an identity determination module 31, a lookup module 32, and a calling module 33, wherein: the identification determining module 31 is used for determining the identification of the general component to be called; the searching module 32 is used for searching the general component represented by the identification from a general component library which stores a plurality of general components according to the determined identification; the calling module 33 is used for calling the found general-purpose component.
The device further comprises a judging module 34, configured to judge whether the content of the identifier determined by the identifier determining module 31 is empty, and trigger the searching module 32 when the content of the identifier is not empty and it is determined that the length of the character string of the identifier content is within a set range value.
The lookup module 32 includes: a pointer determination submodule 41 and an operation submodule 42, wherein: the pointer determining submodule 41 is configured to determine, according to a correspondence between an identifier of an instance of the general component and a content pointer, a content pointer corresponding to the identifier of the instance of the general component to be called; the operation sub-module 42 is used to take the instance pointed to by the determined content pointer as an instance of the found generic component.
The invoking module 33 is specifically configured to invoke an instance entry of the found general component, and run the instance.
The device for calling the general component in the fifth embodiment may be a device capable of executing the steps of the second embodiment and the third embodiment, and the logic components of the steps of the second embodiment and the third embodiment are not described again.
In the fifth embodiment, the device for calling the general components may be integrated in each general component in software, and when a general component needs to be called, the calling may be completed according to the function of the device for calling the general component that is locally integrated; the device for calling the general components can also be independent of the general components of the software, when a certain general component needs to call the general components, the device for calling the general components is operated firstly, and the call of the general components is completed through the device.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (9)
1. A method for creating a generic component, applied to a software system having a packaged component, includes:
generating a general component library when software is initialized;
creating a universal component according to the attribute information of the universal component recorded in the configuration file;
storing the created general component and the identification of the general component in the general component library;
creating a general component according to the attribute information of the general component recorded in the configuration file, specifically comprising:
and creating an instance of the general component according to the set instance creating mode, and setting the attribute for the created instance according to the attribute information of the general component recorded in the configuration file.
2. The method of claim 1, wherein the attribute information comprises one or more combinations of the following information:
the type of the generic component, the name of the generic component and the memory address of the data needed to run the generic component.
3. The method of claim 1, wherein storing the created generic component and the identification of the generic component in the generic component library specifically comprises:
determining a content pointer pointing to a storage position of the created instance in the general component library, distributing an identifier for the created instance, and establishing a corresponding relation between the identifier of the instance and the content pointer;
storing the corresponding relation between the identification of the instance and the content pointer in the general component library.
4. A method of invoking a generic component, comprising:
determining the identification of the universal component to be called;
according to the determined identification, searching a general component represented by the identification from a general component library which stores a plurality of general components, wherein the general component library is created by the method in claim 1;
and calling the searched general components.
5. The method of claim 4, wherein after determining the identity of the generic component to be invoked and before looking up the generic component represented by the identity from a generic component library, the method further comprises:
judging whether the content of the identifier is empty or not;
and when the content of the identification is not empty, further determining that the length of the character string of the content of the identification is within a set range value.
6. The method according to claim 4, wherein searching for the generic component represented by the identifier from a generic component library according to the determined identifier specifically comprises:
determining a content pointer corresponding to the identifier of the example of the universal component to be called according to the corresponding relation between the identifier of the example of the universal component and the content pointer;
the instance pointed to by the determined content pointer is taken as an instance of the found generic component.
7. The method of claim 6, wherein invoking the looked-up generic component specifically comprises:
an instance entry of the generic component is invoked and the instance is run.
8. An apparatus for creating a generic component, applied to a software system having a packaged component, comprising:
the library creating module is used for generating a general component library when software is initialized;
the component creating module is used for creating the general component according to the attribute information of the general component recorded in the configuration file;
the storage module is used for storing the created general components and the identification of the general components into the general component library;
the component creation module includes: an instance creating sub-module and an attribute setting sub-module, wherein: the instance creating submodule is used for creating an instance of the universal component according to a set instance creating mode; and the attribute setting submodule is used for setting attributes for the created examples according to the attribute information of the universal components recorded in the configuration file.
9. An apparatus for invoking a generic component, comprising:
the identification determining module is used for determining the identification of the universal component to be called;
a searching module, configured to search, according to the determined identifier, the general component represented by the identifier from a general component library that stores a plurality of general components, where the stored general component library is created by using the apparatus for creating general components according to claim 8;
and the calling module is used for calling the searched general components.
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110170947.3A CN102841780B (en) | 2011-06-23 | 2011-06-23 | A kind ofly create and call the method and apparatus of general purpose module |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1175552A1 HK1175552A1 (en) | 2013-07-05 |
| HK1175552B true HK1175552B (en) | 2016-07-08 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102841780B (en) | A kind ofly create and call the method and apparatus of general purpose module | |
| CN109976761B (en) | Software development kit generation method and device and terminal equipment | |
| US9442897B2 (en) | Screenshot method and device | |
| US11520606B2 (en) | Dynamic generation of user interface components based on hierarchical component factories | |
| KR102852281B1 (en) | Techniques for displaying shader tables associated with image ray tracing | |
| EP3123316B1 (en) | Supporting dynamic behavior in statically compiled programs | |
| CN110764901A (en) | Data processing method based on GPU (graphics processing Unit) resources, electronic equipment and system | |
| US20230409182A1 (en) | Rule-based user interface layout rearrangement | |
| US9836290B2 (en) | Supporting dynamic behavior in statically compiled programs | |
| CN111408138B (en) | Rendering method and device based on game engine and electronic equipment | |
| US20160077850A1 (en) | Methods, systems, and media for binary compatibility | |
| WO2019238145A1 (en) | Webgl-based graphics rendering method, apparatus and system | |
| CN112487092A (en) | Intelligent contract calling method and device based on block chain | |
| JP2019525321A (en) | Workflow-based object destruction | |
| CN108376066B (en) | Code processing device and code processing method | |
| CN105164636B (en) | Method, device and processor for data communication in a virtualized environment | |
| US11928489B2 (en) | Extension application mechanisms through intra-process operation systems | |
| CN111414150B (en) | Game engine rendering method and device, electronic equipment and computer storage medium | |
| CN116521181A (en) | Script data processing method, device, equipment and medium based on game system | |
| CN110879748A (en) | Shared resource allocation method, device and equipment | |
| HK1175552B (en) | Method and device for creating and invoking common components | |
| US12481524B2 (en) | Uniform addressing in business process engine | |
| CN104199642B (en) | A kind of implementation method and device in target platform operation original platform code | |
| CN116757287A (en) | Inference engine calling methods, devices, computer equipment, storage media and programs | |
| CN115408003B (en) | Data access methods, devices, electronic equipment and media in virtual machines |