CN114510334A - Class instance calling method and device, electronic equipment and automatic driving vehicle - Google Patents

Class instance calling method and device, electronic equipment and automatic driving vehicle Download PDF

Info

Publication number
CN114510334A
CN114510334A CN202210144111.4A CN202210144111A CN114510334A CN 114510334 A CN114510334 A CN 114510334A CN 202210144111 A CN202210144111 A CN 202210144111A CN 114510334 A CN114510334 A CN 114510334A
Authority
CN
China
Prior art keywords
target class
instance
class
factory
instances
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
CN202210144111.4A
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.)
Apollo Intelligent Technology Beijing Co Ltd
Original Assignee
Apollo Intelligent Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Apollo Intelligent Technology Beijing Co Ltd filed Critical Apollo Intelligent Technology Beijing Co Ltd
Priority to CN202210144111.4A priority Critical patent/CN114510334A/en
Publication of CN114510334A publication Critical patent/CN114510334A/en
Pending legal-status Critical Current

Links

Images

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Abstract

The disclosure provides a class instance calling method and device, electronic equipment and an automatic driving vehicle, and relates to the field of artificial intelligence, in particular to the field of automatic driving. The specific implementation scheme is as follows: in response to receiving a request indicating to invoke a target class, loading a dynamic library including the target class; instantiating the target class by using the factory instance indicated by the factory instance information under the condition that the cached data includes the factory instance information corresponding to the target class to obtain a plurality of target class instances; and performing a predetermined operation using the plurality of target class instances.

Description

Class instance calling method and device, electronic equipment and automatic driving vehicle
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and more particularly, to the field of autonomous driving, and more particularly, to a method and apparatus for invoking a class instance, an electronic device, a storage medium, a computer program product, and an autonomous driving vehicle.
Background
In the field of artificial intelligence, some algorithm modules need to be configured to realize the required functions. Taking automatic driving as an example, with the rapid development of an automatic driving technology, a plurality of algorithm modules (such as automatic start-stop and automatic parking) are developed in parallel, some algorithm modules are iterated continuously, and the algorithm modules need to be tested. In the testing process, codes for realizing the algorithm module can be compiled into a dynamic library, then the dynamic library is operated, and the dynamic library is adjusted according to the operation condition, so that the algorithm module is optimized.
Disclosure of Invention
The present disclosure provides a method, an apparatus, an electronic device, a storage medium, a computer program product, and an autonomous vehicle for invoking a class instance.
According to an aspect of the present disclosure, there is provided a method for calling a class instance, including: in response to receiving a request indicating to invoke a target class, loading a dynamic library including the target class; when the cached data is determined to include plant instance information corresponding to the target class, instantiating the target class by using a plant instance indicated by the plant instance information to obtain a plurality of target class instances; and performing a predetermined operation using the plurality of target class instances.
According to another aspect of the present disclosure, there is provided an invoking device of the kind example, including: the device comprises a determining module, a first instantiation module and an execution module. The loading module is used for responding to a received request indicating that a target class is called, and loading a dynamic library comprising the target class; the first instantiation module is used for instantiating the target class by using the plant instance indicated by the plant instance information to obtain a plurality of target class instances under the condition that the cache data is determined to include the plant instance information corresponding to the target class; the execution module is used for executing a predetermined operation by utilizing the plurality of target class instances.
According to another aspect of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods provided by the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform a method provided by the present disclosure.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method provided by the present disclosure.
According to another aspect of the present disclosure, an autonomous vehicle is provided that includes an electronic device provided by the present disclosure.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram of an application scenario of a method and apparatus for invoking class instances according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart diagram of a method of invoking a class instance in accordance with an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a method of invoking a class instance in accordance with an embodiment of the present disclosure;
FIG. 4 is a block schematic diagram of a calling device of a class instance according to an embodiment of the present disclosure; and
FIG. 5 is a schematic block diagram of an electronic device for implementing a method for calling class instances of embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic view of an application scenario of a class instance calling method and apparatus according to an embodiment of the present disclosure.
It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server can analyze and process the received data such as the user request and feed back the processing result to the terminal equipment.
It should be noted that the calling method of the class instance provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the calling device of the class instance provided by the embodiment of the present disclosure may be generally disposed in the server 105. The method for calling the class instance provided by the embodiment of the present disclosure may also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the invoking device of the class instance provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 2 is a schematic flow chart diagram of a method for invoking a class instance in accordance with an embodiment of the present disclosure.
As shown in FIG. 2, the calling method 200 of this class example may include operations S210-S230.
In operation S210, in response to receiving a request indicating to invoke a target class, a dynamic library including the target class is loaded.
For example, loading means loading a dynamic library into the memory, the dynamic library may include a plurality of classes, and the target class may include at least one of the plurality of classes.
In one example, a message indicating the start of the program may be used as a request to indicate that the target class is invoked. For example, a program may link multiple dynamic libraries, which may be loaded into memory at program startup.
In another example, the request indicating the invocation of the target class may include predetermined information, the predetermined information may include an address of the dynamic library, and receipt of the predetermined information indicates a need to use the target class or use the target class instance, thus loading the dynamic library. Compared with the scheme of loading the dynamic library when the application program is started, the technical scheme provided by the example can avoid the situation that the dynamic library which is not used currently occupies a memory.
In operation S220, in a case that it is determined that the cached data includes the plant instance information corresponding to the target class, the target class is instantiated by using the plant instance indicated by the plant instance information, and a plurality of target class instances are obtained.
In one example, factory instance (factory instance) information may include the factory instance itself, i.e., the factory instance is loaded into memory.
In another example, the plant instance information includes a pointer to an address of the plant instance, which may be stored in memory via a table or other format. The factory instance may be invoked according to the address pointed to by the pointer. Compared with the scheme of storing the factory instance in the cache, according to the embodiment of the disclosure, the pointer of the factory instance is stored in the cache, and when the method or the attribute of the factory instance needs to be modified, the factory instance information in the memory does not need to be modified, so that the convenience is improved.
The plant instance information corresponding to the target class may indicate: the plant instance indicated by the plant instance information is used to perform an operation of instantiating the target class.
It should be noted that multiple classes may be included in the dynamic library. For example, among the classes, one class is a target class that needs to be used, and the other class is a class that does not need to be used currently. After the dynamic library is loaded, only the target class may be instantiated, and classes that are not currently needed may not be instantiated.
In operation S230, a predetermined operation is performed using the plurality of target class instances.
Taking the automatic driving field as an example, the target class instance may implement the operation of the algorithm module in the automatic driving field by executing a predetermined operation. For example, some algorithm modules may determine output information based on input information, where the input information may include lane line information, traffic light information, and road sign information identified by a camera, and may also include vehicle speed, throttle control signals, and the like. The output information may include vehicle acceleration and deceleration information, steering information, and the like.
According to the technical scheme provided by the embodiment of the disclosure, under the condition that the cache data comprises the plant instance information corresponding to the target class, the target class is instantiated by using the plant instance indicated by the plant instance information. Therefore, the same factory class and factory instance do not need to be repeatedly created after each dynamic library loading, thereby improving the processing efficiency.
In one example, the dynamic library may not include a base class, only a target class. By adopting the technical scheme, the dynamic library can be normally loaded only by the header file containing the target class. Therefore, for the case that multiple dynamic libraries need to be linked in the running process of the program, if the header file of the target class in one dynamic library needs to be modified, the program needs to be stopped and the multiple dynamic libraries linked with the program need to be uninstalled. And then modifying the header file of the target class, restarting the program after the modification is finished, and reloading the plurality of dynamic libraries.
In another example, the dynamic library may further include a base class from which the target class may be derived. By adopting the technical scheme, the dynamic library can be loaded under the condition that the dynamic library only contains the head file of the base class and does not contain the head file of the target class. It will be appreciated that the base class involves less definitions and statements than the target class, and that the base class header is less likely to be modified than the target class header.
Therefore, for the condition that a plurality of dynamic libraries need to be linked in the program running process, if the header file of the target class of one dynamic library needs to be modified, the running state of other dynamic libraries cannot be influenced. For example, the dynamic library to be modified may be unloaded, the method of the target class in the dynamic library may be modified, and then the modified dynamic library may be reloaded, under the condition that the program continues to run and other dynamic libraries are not unloaded, thereby improving the test efficiency of the dynamic library.
According to another embodiment of the present disclosure, the method for calling the class instance may further include the following operations: under the condition that the cached data does not comprise the factory instance information corresponding to the target class, creating a factory instance corresponding to the target class; and instantiating the target class by utilizing the factory instance to obtain a plurality of target class instances.
For example, it may be determined that the cache data does not include the factory instance information corresponding to the target class when the target class is first loaded.
In one example, a plant instance corresponding to a target class may be created by: according to the dynamic library where the target class is located, establishing a factory class corresponding to the target class; and instantiating the factory class to obtain the factory instance.
For example, a factory class may be created from parameters in a dynamic library, which may include the class name of the target class, the class name of the base class, and the member variable type of the target class. Then, according to the parameters, the corresponding factory class is generated by using the factory mode, and the factory class can create a target class instance on the heap by using a new method according to the class name of the target class. In addition, the factory mode can be implemented by a template, for example, a variable parameter template is used to transmit the member variable type of the target class into the constructor of the target class through Perfect Forwarding (Perfect Forwarding), so that the method is suitable for the case that the member variable type and the number of the target class are not fixed.
According to the technical scheme provided by the embodiment of the disclosure, the cache data does not include the factory instance information, which indicates that the target class cannot be instantiated by using the cache data, so that the factory instance can be created, and then the factory instance is used for instantiating the target class, thereby ensuring that the target class instance is obtained.
According to another embodiment of the present disclosure, the method for calling the class instance may further include the following operations: and updating the cache data by using the factory instance information of the factory instance.
For example, after the dynamic library is unloaded, the plant instance and plant instance information may not be deleted and the plant instance information is transferred into the cache. When the target class instance needs to be instantiated again, the dynamic library is reloaded, at this time, the factory class does not need to be created, the factory instance can be called by directly using the factory instance information in the cache, and then the instantiation operation is carried out on the target class to obtain the target class instance.
The embodiment of the disclosure stores the factory instance information in the cache, and when the target class instance needs to be obtained again, the factory class does not need to be repeatedly created, so that the processing efficiency can be improved.
According to another embodiment of the present disclosure, the method for calling the class instance may further include the following operations: after obtaining the plurality of target class instances, releasing at least one target class instance under the condition that at least one target class instance in the plurality of target class instances is determined to complete a predetermined operation; determining a remaining number of unreleased target class instances in the plurality of target class instances; and in the event that it is determined that the remaining number is 0, uninstalling the dynamic library.
It should be noted that the number of target classes included in the dynamic library may be one or more. When the dynamic library includes multiple target classes and multiple target class instances result after each target class is instantiated, a remaining number of 0 may indicate that there are no target class instances in the dynamic library. For example, when the dynamic library includes 2 target classes, each target class having multiple target class instances after instantiation, the dynamic library may be unloaded if the remaining number of target class instances of the 2 target classes is 0. In the case where the remaining number of target class instances of the first target class is 0 and the remaining number of target class instances of the second target class is not 0, the dynamic library may not be unloaded, thereby ensuring proper operation of the target class instances of the second target class.
In one embodiment, after the dynamic library is loaded, the dynamic library may be unloaded at the end of the run time of the program. Compared with the technical scheme, the dynamic library is unloaded under the condition that the residual quantity of the target class instances in the dynamic library is 0, so that the dynamic library which is not required to be used is prevented from occupying the memory, and the effect of saving the memory is achieved.
According to another embodiment of the present disclosure, the operation of determining the remaining number of unreleased target class instances in the plurality of target class instances may include the operations of: determining the creating quantity of created target class instances in the process of executing instantiation operation on the target class; determining the destructuring quantity of the target class instances; and determining the residual quantity according to the creation quantity and the destructuring quantity.
Illustratively, this may be accomplished by reference counting and callback functions. For example, when a target class instance needs to be obtained, a factory class corresponding to the target class can be used to create the target class instance, a base class pointer can be generated after the target class instance is created, and the number of created target class instances can be determined according to the number of base class pointers. In addition, the base class pointer can be bound with a callback function, the callback function can be called when the target class instance is constructed, and atomic operation in a self-reducing form (atomic operation) can be performed inside the callback function. Reducing the reference count of each target class instance base class pointer by 1, then judging whether the reference count of the base class pointer is 0, and unloading the dynamic library if the reference count is 0; if the reference count is not 0, the dynamic library may be left running.
According to the technical scheme provided by the embodiment of the disclosure, the residual quantity is determined according to the created quantity and the destructed quantity, the residual quantity of the target class instances can be accurately obtained, and the dynamic library is unloaded in time under the condition that the target class instances are not included in the dynamic library.
FIG. 3 is a schematic diagram of a method of invoking a class instance according to an embodiment of the present disclosure.
In the embodiment 300 of the present disclosure, a preprocessing operation may be performed first, and the preprocessing operation may include: the target class is registered in an arbitrary position of the source code, resulting in a source code 310 comprising the target class. The process of registering may include defining a structure type and declaring a static global variable of the structure type. For example, after defining the structure type, the creation of a factory class may be completed in a constructor of the structure, the factory class may be an abstract factory class implemented by a template, and parameters of the template may include a base class name, a target class name, and a member variable type defined in the target class. The preprocessing operations may further include: the source code 310 containing the target class is compiled into a dynamic library 320.
After the preprocessing operation, a request is received indicating that the target class is called, indicating that the target class instance needs to be used, thus loading the precompiled dynamic library 320. Further, after loading the dynamic library 320, it may be determined whether factory instance information corresponding to the target class is included in the cache 350.
If the cache 350 does not include the factory instance information corresponding to the target class, indicating that the target class is loaded for the first time, a predefined static global variable may be initialized, a constructor may be called, a factory class corresponding to the target class may be created according to parameters (e.g., a class name of the target class, a class name of a base class, and a member variable type of the target class), the factory class may correspond to the target class one to one, then the factory class may be instantiated as a factory instance, and the factory instance information (e.g., a pointer) of the factory instance may be stored in the factory instance information list 340 in the memory 330.
If the cache 350 includes the factory instance information corresponding to the target class, which indicates that the target class is not first loaded, the factory instance information may be searched from the cache 350, and the factory instance may be invoked through the factory instance information.
After the plant instance is obtained, the target class may be instantiated with the plant instance to obtain a plurality of target class instances, and then the predetermined operation may be performed with the plurality of target class instances. And then releasing at least one target class instance in the plurality of target class instances in the case that the at least one target class instance is determined to complete the predetermined operation.
The remaining number of unreleased target class instances in the plurality of target classes included in the dynamic library 320 may also be counted, and the dynamic library 320 may be unloaded if it is determined that the remaining number of target class instances in the dynamic library 320 is 0.
After the dynamic library 320 is unloaded, the factory instance information may be transferred to the cache 350. Further, when reloading is required after the dynamic library 320 is unloaded, the plant class corresponding to the target class does not need to be repeatedly created.
When the dynamic library 320 needs to be loaded again, the above-described operation of determining whether the plant instance information corresponding to the target class is included in the cache 350 may be returned.
FIG. 4 is a block diagram of a schematic structure of a calling device of a class instance according to an embodiment of the disclosure.
As shown in fig. 4, the invoking device 400 of the class instance may include a loading module 410, a first instantiation module 420, and an execution module 430.
The loading module 410 is to load a dynamic library including a target class in response to receiving a request indicating to invoke the target class.
The first instantiation module 420 is configured to, in a case that it is determined that the cached data includes plant instance information corresponding to the target class, instantiate the target class by using the plant instance indicated by the plant instance information, so as to obtain a plurality of target class instances.
The execution module 430 is configured to perform a predetermined operation using the plurality of target class instances.
According to another embodiment of the present disclosure, the calling device of the class instance further includes a creating module and a second instantiating module. The creating module is used for creating the factory instance corresponding to the target class under the condition that the cached data does not comprise the factory instance information corresponding to the target class. The second instantiation module is used for instantiating the target class by using the factory instance to obtain a plurality of target class instances.
According to another embodiment of the present disclosure, the creating module includes a creating sub-module and an instantiating sub-module. And the creating submodule is used for creating the plant class corresponding to the target class according to the dynamic library where the target class is located. The instantiation sub-module is used for instantiating the plant class to obtain a plant instance.
According to another embodiment of the present disclosure, the class instance calling device further includes an updating module, configured to update the cache data with factory instance information of the factory instance.
According to another embodiment of the present disclosure, the plant instance information includes a pointer to an address of the plant instance.
According to another embodiment of the present disclosure, the calling device of the class instance further includes a releasing module, a remaining number determining module, and an unloading module. The releasing module is used for releasing at least one target class instance in the plurality of target class instances under the condition that the at least one target class instance is determined to complete the predetermined operation. The residual quantity determining module is used for determining the residual quantity of unreleased target class instances in the plurality of target class instances. The offload module is to offload the dynamic library if it is determined that the remaining number is 0.
According to another embodiment of the present disclosure, the remaining number determination module includes a created number determination submodule, a destructed number determination submodule, and a remaining number determination submodule. The creation quantity determining submodule is used for determining the creation quantity of the created target class instances in the process of executing the instantiation operation of the target class. And the destruct quantity determination submodule is used for determining the destruct quantity of the target class instance. And the residual quantity determining submodule is used for determining the residual quantity according to the created quantity and the destructed quantity.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
In the technical scheme of the disclosure, before the personal information of the user is acquired or collected, the authorization or the consent of the user is acquired.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 5 illustrates a schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the apparatus 500 comprises a computing unit 501 which may perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The calculation unit 501, the ROM 502, and the RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the device 500 are connected to the I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, or the like; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508, such as a magnetic disk, optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 501 performs the various methods and processes described above, such as calling methods for class instances. For example, in some embodiments, the calling method of the class instance may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the calling method of the class instance described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the calling method of the class instance by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The present disclosure also provides an autonomous vehicle that may include an electronic device such as that shown in fig. 5.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (18)

1. A method for invoking a class instance, comprising:
in response to receiving a request indicating to invoke a target class, loading a dynamic library including the target class;
when the cached data is determined to include plant instance information corresponding to the target class, instantiating the target class by using a plant instance indicated by the plant instance information to obtain a plurality of target class instances; and
and executing the predetermined operation by utilizing the plurality of target class instances.
2. The method of claim 1, further comprising:
in the case that the cached data is determined not to include the factory instance information corresponding to the target class, creating a factory instance corresponding to the target class; and
and instantiating the target class by utilizing the factory instance to obtain a plurality of target class instances.
3. The method of claim 2, wherein the creating the plant instance corresponding to the target class comprises:
according to the dynamic library, creating a factory class corresponding to the target class; and
and instantiating the factory class to obtain the factory instance.
4. The method of claim 2, further comprising:
updating the cached data with plant instance information for the plant instance.
5. The method of claim 2, wherein the plant instance information comprises a pointer to an address of the plant instance.
6. The method of any of claims 1 to 5, further comprising:
in the event that at least one of the plurality of target class instances is determined to complete the predetermined operation, releasing the at least one target class instance;
determining a remaining number of unreleased target class instances in the plurality of target class instances; and
in a case where it is determined that the remaining number is 0, uninstalling the dynamic library.
7. The method of claim 6, wherein the determining the remaining number of unreleased target class instances in the plurality of target class instances comprises:
determining the number of created target class instances in the process of executing the instantiation operation of the target class;
determining the destructor quantity of the target class instance; and
and determining the residual quantity according to the creation quantity and the destructuring quantity.
8. An invoking device of a class instance, comprising:
the loading module is used for responding to a received request for indicating to call a target class and loading a dynamic library comprising the target class;
the first instantiation module is used for instantiating the target class by using the plant instance indicated by the plant instance information to obtain a plurality of target class instances under the condition that the cache data is determined to include the plant instance information corresponding to the target class; and
and the execution module is used for executing the predetermined operation by utilizing the target class instances.
9. The apparatus of claim 8, further comprising:
a creating module, configured to create a plant instance corresponding to the target class if it is determined that the cached data does not include plant instance information corresponding to the target class; and
and the second instantiation module is used for instantiating the target class by utilizing the factory instance to obtain a plurality of target class instances.
10. The apparatus of claim 9, wherein the creation module comprises:
the creating sub-module is used for creating a factory class corresponding to the target class according to the dynamic library; and
and the instantiation sub-module is used for instantiating the plant class to obtain the plant instance.
11. The apparatus of claim 9, further comprising:
and the updating module is used for updating the cache data by utilizing the factory instance information of the factory instance.
12. The apparatus of claim 9, wherein the plant instance information comprises a pointer to an address of the plant instance.
13. The apparatus of any of claims 8 to 12, further comprising:
a releasing module, configured to release at least one target class instance of the plurality of target class instances if it is determined that the at least one target class instance completes the predetermined operation;
a residual quantity determining module, configured to determine a residual quantity of unreleased target class instances in the plurality of target class instances; and
an uninstalling module to uninstall the dynamic library if it is determined that the remaining number is 0.
14. The apparatus of claim 13, wherein the remaining number determination module comprises:
a creation number determination submodule, configured to determine a creation number of created target class instances in a process of performing the instantiation operation on the target class;
the deconstruction quantity determining submodule is used for determining the deconstruction quantity of the target class example; and
and the residual quantity determining submodule is used for determining the residual quantity according to the created quantity and the destructed quantity.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1 to 7.
17. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.
18. An autonomous vehicle comprising the electronic device of claim 15.
CN202210144111.4A 2022-02-16 2022-02-16 Class instance calling method and device, electronic equipment and automatic driving vehicle Pending CN114510334A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210144111.4A CN114510334A (en) 2022-02-16 2022-02-16 Class instance calling method and device, electronic equipment and automatic driving vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210144111.4A CN114510334A (en) 2022-02-16 2022-02-16 Class instance calling method and device, electronic equipment and automatic driving vehicle

Publications (1)

Publication Number Publication Date
CN114510334A true CN114510334A (en) 2022-05-17

Family

ID=81550974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210144111.4A Pending CN114510334A (en) 2022-02-16 2022-02-16 Class instance calling method and device, electronic equipment and automatic driving vehicle

Country Status (1)

Country Link
CN (1) CN114510334A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645327A (en) * 2005-01-12 2005-07-27 上海科泰世纪科技有限公司 Module life period managing method
CN101639777A (en) * 2009-09-07 2010-02-03 李元 Plug and play method of member, application and system thereof
US20100083219A1 (en) * 2008-10-01 2010-04-01 Microsoft Corporation Runtime Object Composition
CN110442404A (en) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 A kind of object method for releasing, device, equipment and storage medium
CN110597570A (en) * 2019-09-26 2019-12-20 深圳市元征科技股份有限公司 Communication mode adaptation method and related device
CN110750315A (en) * 2019-12-23 2020-02-04 武汉斗鱼鱼乐网络科技有限公司 Class loading method, device, equipment and storage medium in Android system
CN111752551A (en) * 2020-06-29 2020-10-09 广东浪潮大数据研究有限公司 Method and system for generating instantiation object, electronic equipment and storage medium
CN112732205A (en) * 2020-12-18 2021-04-30 航天信息股份有限公司 Universal printing equipment control method, electronic equipment, storage medium and system
CN113536242A (en) * 2021-07-09 2021-10-22 深圳市元征未来汽车技术有限公司 Dynamic library calling method and device, terminal equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645327A (en) * 2005-01-12 2005-07-27 上海科泰世纪科技有限公司 Module life period managing method
US20100083219A1 (en) * 2008-10-01 2010-04-01 Microsoft Corporation Runtime Object Composition
CN101639777A (en) * 2009-09-07 2010-02-03 李元 Plug and play method of member, application and system thereof
CN110442404A (en) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 A kind of object method for releasing, device, equipment and storage medium
CN110597570A (en) * 2019-09-26 2019-12-20 深圳市元征科技股份有限公司 Communication mode adaptation method and related device
CN110750315A (en) * 2019-12-23 2020-02-04 武汉斗鱼鱼乐网络科技有限公司 Class loading method, device, equipment and storage medium in Android system
CN111752551A (en) * 2020-06-29 2020-10-09 广东浪潮大数据研究有限公司 Method and system for generating instantiation object, electronic equipment and storage medium
CN112732205A (en) * 2020-12-18 2021-04-30 航天信息股份有限公司 Universal printing equipment control method, electronic equipment, storage medium and system
CN113536242A (en) * 2021-07-09 2021-10-22 深圳市元征未来汽车技术有限公司 Dynamic library calling method and device, terminal equipment and storage medium

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
HELLODEVELOPER: "Apollo3.5车辆配置方案", 《HTTPS://DEVELOPER.BAIDU.COM/ARTICLE/DETAIL.HTML?_=1659612668729&ID=290463》 *
全国计算机职业技能教材编写委员会: "《计算机程序设计员(中级)》", 31 May 2009 *
刘彦明等: "《JAVA语言及其程序设计》", 31 March 1997 *
小威威__: "C++:浅谈工厂模式与抽象工厂模式", 《HTTPS://BLOG.CSDN.NET/LINWH8/ARTICLE/DETAILS/51232834》 *
庄严: "《白话C++之练功》", 31 May 2019 *
王伟等: "《数据结构基础实验指导》", 30 June 2019 *
知行合一2018: "Apollo项目类对象创建之工厂模式分析", 《HTTPS://BLOG.CSDN.NET/DAVIDHOPPER/ARTICLE/DETAILS/79197075》 *

Similar Documents

Publication Publication Date Title
US9928038B2 (en) Dynamically building locale objects or subsections of locale objects based on historical data
US10324734B2 (en) Application containers
CN111090536A (en) Method, device, medium and electronic equipment for acquiring memory leakage information
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
CN109684573B (en) Target picture display method and device, storage medium and electronic equipment
US9141353B2 (en) Dynamically building locale objects at run-time
CN116662039B (en) Industrial information parallel detection method, device and medium based on shared memory
CN113050984A (en) Resource calling method and device, electronic equipment and storage medium
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN112860235B (en) Method, device, equipment and storage medium for processing text
CN113127050B (en) Application resource packaging process monitoring method, device, equipment and medium
CN112506781B (en) Test monitoring method, device, electronic equipment, storage medium and program product
CN114647411A (en) Programming interface loading method and device, electronic equipment and storage medium
CN114510334A (en) Class instance calling method and device, electronic equipment and automatic driving vehicle
CN114237743A (en) Interface loading method and device, electronic equipment and storage medium
CN113127051B (en) Application resource packaging process monitoring method, device, equipment and medium
CN116561075B (en) Method for generating dynamic link library file, method and device for calling operator
CN111124627A (en) Method, device, terminal and storage medium for determining application program caller
EP4227796A1 (en) Service deployment processing method and apparatus, electronic device, and storage medium
CN114237624A (en) Go language-based error processing method, device, equipment, medium and product
US9778917B2 (en) Dynamically building subsections of locale objects at run-time
CN113760321A (en) View updating method and device, electronic equipment and storage medium
CN116795867A (en) Data processing method, device, electronic equipment and medium
CN116185521A (en) Data driving method, apparatus, device, computer readable medium, and program product
CN116055463A (en) Method and device for realizing open interface

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

Application publication date: 20220517

RJ01 Rejection of invention patent application after publication