Object access method and apparatus, storage medium, and electronic device

CN117573706BActive Publication Date: 2026-10-23QINGDAO HAIER TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311353745.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-17
Publication Date
2026-10-23
Estimated Expiration
2043-10-17

AI Technical Summary

Technical Problem

[0004]本发明实施例提供了一种对象访问方法和系统、存储介质及电子装置,以至少解决现有技术中,在加载IFC数据时,需要查询数据库中关联的所有表,然后将查询到的数据组织在一起返回给调用者,流程复杂,且全量加载导致可用的构件数量较少,用户体验差的问题

Benefits of technology

[0015]在本发明实施例中,响应于接收到的用于请求访问第三对象的访问请求,根据第一对象的第一对象指针获取第二对象的对象属性,其中,该第三对象为该第一对象的反向属性对象,第二对象为该第三对象的代理对象,该对象属性包括:对象类型,第三对象标识和对象弱指针;在确定该对象弱指针无效时,根据该第三对象标识在内存对象池中查询该第三对象是否存在,若不存在则根据对象类型和第三对象标识生成该第三对象,并将该第三对象存入内存对象池中;确定用于访问该第三对象的第二对象指针,从而可以通过该第二对象指针在内存对象池中访问该第三对象;采用上述方案,可以通过代理对象自动按需加载所需数据,无需经过复杂的数据连接组织过程即可实现数据访问;从而解决了相关技术中在加载IFC数据时,需要查询数据库中关联的所有表,然后将查询到的数据组织在一起返回给调用者,流程复杂,且全量加载导致可用的构件数量较少,用户体验差的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117573706B_ABST
    Figure CN117573706B_ABST
Patent Text Reader

Abstract

The application discloses an object access method and device, a storage medium and an electronic device, relates to the technical field of smart homes, and discloses the object access method, which comprises the following steps: in the case that an access request is received, the object attribute of a second object is acquired according to the first object pointer of a first object, wherein the access request is used for requesting access to a third object, the third object is a reverse attribute object of the first object, the second object is a proxy object of the third object, and the object attribute comprises an object type, a third object identifier and an object weak pointer; in the case that it is determined that the object weak pointer is invalid, it is determined whether the third object exists in a memory object pool according to the third object identifier; in the case that the third object does not exist, the third object is generated according to the object type and the third object identifier, and the third object is stored in the memory object pool; and in the case that the third object does not exist, the third object is generated according to the object type and the third object identifier, and the third object is stored in the memory object pool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart home technology, and more specifically, to an object access method and apparatus, a storage medium, and an electronic device. Background Technology

[0002] IFC (Industry Foundation Classes, a data exchange standard) has gained support from numerous software vendors as the data exchange standard for the BIM (Building Information Modeling) industry. With the widespread application of BIM technology in the construction industry, a large amount of IFC data has been generated. This data can be stored in two ways: files and databases. File storage requires reading the entire file during component loading, resulting in low memory utilization and has been replaced by more efficient database management methods. Database storage, on the other hand, often uses the attributes of the terminal entity class (such as IfcWall) as a basis, pre-creating corresponding data tables and then inserting values ​​into the appropriate fields. During loading, not only entity nodes but also related IFC reverse attribute nodes and other related nodes need to be loaded.

[0003] In existing technologies, loading IFC data requires querying all related tables in the database, then organizing the retrieved data and returning it to the caller. This process is complex, and the full loading results in a limited number of usable components and a poor user experience. No effective solution has yet been proposed. Summary of the Invention

[0004] This invention provides an object access method and system, storage medium, and electronic device to at least solve the problems in the prior art where, when loading IFC data, it is necessary to query all related tables in the database and then organize the queried data together and return it to the caller. This process is complex, and the full loading results in a small number of available components and a poor user experience.

[0005] According to one embodiment of the present invention, an object access method is provided, comprising: upon receiving an access request, obtaining object attributes of a second object based on a first object pointer of a first object, wherein the access request is for requesting access to a third object, the third object being a reverse attribute object of the first object, the second object being a proxy object of the third object, and the object attributes including: object type, third object identifier, and object weak pointer; if it is determined that the object weak pointer is invalid, querying in a memory object pool whether the third object exists based on the third object identifier; if the third object does not exist, generating the third object based on the object type and the third object identifier, and storing the third object in the memory object pool; determining a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0006] In an exemplary embodiment, before obtaining the object attributes of the second object based on the first object pointer of the first object, the method further includes: querying the memory object pool to see if the first object exists based on the second object identifier of the first object carried in the access request; if the first object exists, determining the first object pointer of the first object; if the first object does not exist, generating the first object based on the second object identifier and determining the first object pointer of the first object.

[0007] In an exemplary embodiment, generating the first object based on the second object identifier and determining the first object pointer of the first object includes: obtaining object data of the first object based on the second object identifier; performing a deserialization operation on the object data to generate the first object and storing the first object in the memory object pool; and determining the first object pointer for accessing the first object.

[0008] In one exemplary embodiment, after determining a second object pointer for accessing the third object in the memory object pool via the second object pointer, the method further includes: accessing the third object via the second object pointer; adding the third object identifier of the third object to the header of access record data, wherein the access record data includes access records of objects in the memory object pool, and a plurality of access records in the access record data are sorted by access time, with the latest access record stored in the header of the access record data.

[0009] In an exemplary embodiment, adding the third object identifier of the third object to the beginning of the access record data includes: when the number of multiple access records in the access record data is equal to a preset threshold, determining whether the object data of the fourth object corresponding to the first access record stored at the end of the access record data has changed; when the object data of the fourth object has changed, storing the object data of the fourth object in a database and deleting the first access record; and adding the third object identifier to the beginning of the access record data.

[0010] In one exemplary embodiment, generating the third object based on the object type and the third object identifier when the third object does not exist includes: obtaining the reverse object data of the third object based on the object type and the third object identifier; and performing a reverse serialization operation on the reverse object data to generate the third object.

[0011] In an exemplary embodiment, after storing the third object in the memory object pool, the method further includes: establishing an association between the weak pointer of the object and the third object, wherein the association is used to access the third object through the weak pointer of the object.

[0012] According to another embodiment of the present invention, an object access device is also provided, comprising: an acquisition module, configured to, upon receiving an access request, acquire object attributes of a second object based on a first object pointer of a first object, wherein the access request is for requesting access to a third object, the third object being a reverse attribute object of the first object, the second object being a proxy object of the third object, and the object attributes including: an object type, a third object identifier, and a weak pointer to the object; a query module, configured to, if it is determined that the weak pointer to the object is invalid, query whether the third object exists in a memory object pool based on the third object identifier; a generation module, configured to, if the third object does not exist, generate the third object based on the object type and the third object identifier, and store the third object in the memory object pool; and a determination module, configured to determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0013] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the above-described object access method at runtime.

[0014] According to another aspect of the present invention, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the object access method described above through the computer program.

[0015] In this embodiment of the invention, in response to a received access request for accessing a third object, the object attributes of the second object are obtained based on the first object pointer of the first object. The third object is the reverse attribute object of the first object, and the second object is a proxy object of the third object. The object attributes include: object type, third object identifier, and weak pointer. If the weak pointer is determined to be invalid, the existence of the third object is queried in the memory object pool based on the third object identifier. If it does not exist, the third object is generated based on the object type and the third object identifier, and stored in the memory object pool. A second object pointer for accessing the third object is determined, allowing access to the third object from the memory object pool via the second object pointer. Using this scheme, the required data can be automatically loaded on demand via the proxy object, achieving data access without a complex data connection organization process. This solves the problem in related technologies where, when loading IFC data, it is necessary to query all related tables in the database and then organize the queried data together and return it to the caller, resulting in a complex process and a small number of usable components due to full loading, leading to a poor user experience. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the hardware environment for an optional object access method according to an embodiment of the present invention;

[0019] Figure 2 This is a flowchart of an optional object access method according to an embodiment of the present invention;

[0020] Figure 3 This is a structural diagram of an optional object access method according to an embodiment of the present invention;

[0021] Figure 4 This is an optional IFC node dynamic unloading flowchart according to an embodiment of the present invention;

[0022] Figure 5 This is an optional access node flowchart according to an embodiment of the present invention;

[0023] Figure 6 This is a sequence diagram of an optional access to object data according to an embodiment of the present invention;

[0024] Figure 7 This is a flow chart of an optional method for accessing the reverse attribute data of an object according to an embodiment of the present invention;

[0025] Figure 8 This is an optional flowchart of dynamic loading of proxy objects according to an embodiment of the present invention;

[0026] Figure 9 A structural block diagram of an optional object access device according to an embodiment of the present invention. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] According to one aspect of the present invention, an object access method is provided. This object access method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned object access method can be applied to, for example... Figure 1The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0030] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. Terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0031] This embodiment provides an object access method applied to a computer terminal. Figure 2 This is a flowchart of an optional object access method according to an embodiment of the present invention, the process including the following steps:

[0032] Step S202: Upon receiving an access request, obtain the object attributes of the second object based on the first object pointer of the first object. The access request is used to request access to a third object, the third object is the reverse attribute object of the first object, the second object is the proxy object of the third object, and the object attributes include: object type, third object identifier, and object weak pointer.

[0033] It should be noted that the aforementioned third object identifier is the object identifier of the second object. Since the second object is a proxy object of the third object, the third object identifier is also the object identifier of the third object.

[0034] Step S204: If it is determined that the weak pointer of the object is invalid, query the memory object pool to see if the third object exists based on the third object identifier;

[0035] It should be noted that the aforementioned weak pointer establishes a connection with a third object in the memory object pool. Therefore, if the weak pointer is valid, it means that the third object definitely exists in the memory object pool, and the third object can be accessed directly through the weak pointer.

[0036] Step S206: If the third object does not exist, generate the third object according to the object type and the third object identifier, and store the third object in the memory object pool;

[0037] Step S208: Determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0038] In this embodiment of the invention, in response to a received access request for accessing a third object, the object attributes of the second object are obtained based on the first object pointer of the first object. The third object is the reverse attribute object of the first object, and the second object is a proxy object of the third object. The object attributes include: object type, third object identifier, and weak pointer. If the weak pointer is determined to be invalid, the existence of the third object is queried in the memory object pool based on the third object identifier. If it does not exist, the third object is generated based on the object type and the third object identifier, and stored in the memory object pool. A second object pointer for accessing the third object is determined, allowing access to the third object from the memory object pool via the second object pointer. Using this scheme, the required data can be automatically loaded on demand via the proxy object, achieving data access without a complex data connection organization process. This solves the problem in related technologies where, when loading IFC data, it is necessary to query all related tables in the database and then organize the queried data together and return it to the caller, resulting in a complex process and a small number of usable components due to full loading, leading to a poor user experience.

[0039] The entities included in the above scheme and the relationships between them are as follows: Figure 3 As shown, Figure 3 This is a structural diagram of an optional object access method according to an embodiment of the present invention, specifically including the following five parts:

[0040] 1. IfcObject (First Object): Includes three types of data: GlobalId (Second Object Identifier), properties, and reverse properties. GlobalId is the object's unique identifier; properties exist as objects and their content is directly stored in the database; reverse properties exist as a collection of proxy objects, storing only the object type and GlobalId, while the object content is stored in a separate table; all types inheriting from IfcObject can utilize this mechanism.

[0041] 2. Proxy Object (Second Object): Includes three types of data: object type, object GlobalId (third object identifier), and object weak pointer. Provides proxy functionality for reverse property objects (third objects) and instance objects.

[0042] 3. Memory Object Pool: A hash table is built using GlobalId as the primary key to provide retrieval and management functions for all objects. Simultaneously, when the number of nodes or memory usage exceeds the limit, the Least Recently Used (LRU) algorithm is used to remove the least recently used node.

[0043] 4. Data Reading and Writing: Provides interfaces for interacting with the database, such as query interfaces, insert interfaces, update interfaces, and delete interfaces.

[0044] 5. Database: Provides the actual storage function for data. All object data needs to be stored in the corresponding tables according to the mapping rules, and all tables use the object's GlobalId as the primary key.

[0045] Optionally, before performing step S202 above: obtaining the object attributes of the second object based on the first object pointer of the first object, the method further includes: querying whether the first object exists in the memory object pool based on the second object identifier of the first object carried in the access request; if the first object exists, determining the first object pointer of the first object; if the first object does not exist, generating the first object based on the second object identifier, and determining the first object pointer of the first object.

[0046] Before obtaining the object attributes of the second object based on the first object pointer of the first object, it is necessary to obtain the first object pointer of the first object first. The access request only carries the second object identifier of the first object. The second object identifier needs to be passed to the object management layer first. The management layer uses the second object identifier to query whether the first object exists in the memory object pool. If it exists, the first object pointer of the first object is obtained directly. If it does not exist, the first object needs to be generated based on the second object identifier, and then the first object pointer of the first object is determined.

[0047] The above steps—generating the first object based on the second object identifier and determining the first object pointer of the first object—can be implemented through the following scheme: obtaining the object data of the first object based on the second object identifier; performing a deserialization operation on the object data to generate the first object and storing the first object in the memory object pool; and determining the first object pointer used to access the first object.

[0048] The process of generating a first object based on a second object identifier includes: calling the data operation module, loading the object data of the first object based on the second object identifier, creating the first object through the deserialization function of the object management layer, and placing the first object into the memory object pool. Then, the pointer to the first object is determined.

[0049] It should be noted that the object data of the first object mentioned above is loaded using a minimized loading method, which only loads the object itself.

[0050] After performing step S208 above: determining a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer, the method further includes: accessing the third object through the second object pointer; adding the third object identifier of the third object to the header of access record data, wherein the access record data includes access records of objects in the memory object pool, and the multiple access records in the access record data are sorted according to access time, with the latest access time access record stored in the header of the access record data.

[0051] After obtaining the pointer to the second object, the third object is accessed through the second object; then the identifier of the third object is added to the head of the access record data, which can be stored in the form of a linked list. The storage space of the linked list is fixed, the data in the linked list is sorted by time, and new data is inserted at the head of the linked list.

[0052] Optionally, adding the third object identifier of the third object to the beginning of the access record data includes: when the number of multiple access records in the access record data is equal to a preset threshold, determining whether the object data of the fourth object corresponding to the first access record stored at the end of the access record data has changed; when the object data of the fourth object has changed, storing the object data of the fourth object in the database and deleting the first access record; and adding the third object identifier to the beginning of the access record data.

[0053] When adding a new object identifier, first check if the number of nodes stored in the linked list (the number of access records) or the memory usage of the linked list exceeds the limit. If it does not exceed the limit, directly add the third object identifier to the head of the linked list. If it exceeds the limit, continue to check if the object data of the fourth object indicated by the tail node of the linked list has changed. If it has changed, first save the node data to the database, and then delete the tail node. If it has not changed, directly delete the tail node. Then add the third object identifier to the head of the linked list.

[0054] The process of adding access records as described above is as follows: Figure 4As shown, Figure 4 This is an optional IFC node dynamic unloading flowchart according to an embodiment of the present invention, which specifically includes the following steps:

[0055] Step 4.1: Before adding a node (access record), check if the number of nodes or memory usage exceeds the limit. If it does, proceed to step 4.2; if it does not, proceed to step 4.5.

[0056] Step 4.2: Determine if the accessed tail node of the linked list has been changed; if it has been changed, proceed to step 4.3; if it has not been changed, proceed to step 4.4.

[0057] Step 4.3: Save the node data to the database;

[0058] Step 4.4: Delete the tail node;

[0059] Step 4.5: Add the node to the head;

[0060] Step 4.6: End.

[0061] Through the above steps, when adding a node, the system first checks whether the current number of nodes or memory usage exceeds the limit. If it does, it checks whether the tail node of the linked list has changed. If it has, the data is written to the database and the tail node is deleted; otherwise, the tail node is deleted directly, and then the node is added. If the limit is not exceeded, the node object is directly added to the memory object pool. In this way, the automatic unloading process of nodes is achieved.

[0062] In an optional embodiment, before performing the above-described node addition process, it is also necessary to determine whether the accessed node exists in the memory object pool, such as... Figure 5 As shown, the specific steps include:

[0063] Step 5.1: Access the node;

[0064] It should be noted that the above process of accessing nodes can be either directly accessing objects in the memory object pool through object weak pointers (i.e., accessing the third object), or it can be understood as accessing object attribute data through object GlobalId (accessing the first object).

[0065] Step 5.2: Determine if the node exists in the memory object pool. If it exists, proceed to step 5.3; otherwise, proceed to step 5.5.

[0066] Step 5.3: Add the node object to the head of the access list;

[0067] Step 5.4: Return the object data;

[0068] Step 5.5: Return NULL to indicate that the object does not exist in the memory object pool, and proceed with the object creation process;

[0069] Step 5.6: End.

[0070] Optionally, step S206 above: generating the third object based on the object type and the third object identifier when the third object does not exist can be achieved by the following scheme: obtaining the reverse object data of the third object based on the object type and the third object identifier; performing a reverse serialization operation on the reverse object data to generate the third object.

[0071] The process of generating a third object includes: obtaining the reverse object data of the third object based on the object type and the third object identifier; and then creating the third object through the deserialization function of the object management layer.

[0072] Based on the above steps, after executing step S206: storing the third object into the memory object pool, the method further includes: establishing an association between the weak pointer of the object and the third object, wherein the association is used to access the third object through the weak pointer of the object.

[0073] After the third object is stored in the memory object pool, the weak pointer of the object becomes invalid. It is necessary to re-establish the association between the weak pointer of the object and the third object so that the third object can be accessed directly through the weak pointer the next time it is accessed.

[0074] In an optional embodiment, the present invention provides a sequence diagram of the process for accessing object data, such as... Figure 6 As shown:

[0075] Step 6.1: Initiate a request to access object attribute data. The management layer queries the object from the memory object pool using the GlobalId;

[0076] Step 6.2: If the object exists, request the data directly from the memory object pool and return the object data;

[0077] Step 6.3: If the object does not exist, minimize the loading of object data and only load the object itself;

[0078] Step 6.4: Deserialize the returned data to generate an object;

[0079] Step 6.5: Place the object into the memory object pool;

[0080] Step 6.6: Access the specific attribute data through the object pointer, assemble it, and return it to the caller.

[0081] If the caller wants to access the reverse property data of an object, it needs to obtain the object pointer based on steps 6.1-6.6 above, and then dereference the reverse property proxy object to obtain the specific object pointer (the second object pointer). During dereferencing, the caller first checks if the object exists in the memory object pool. If it exists, the object pointer is returned; otherwise, the data operation module is called to load the specific reverse object data, deserialize it, generate the specific object (the third object), and place it in the memory object pool. Simultaneously, the weak pointer of the proxy object is associated with the specific object, and the object pointer is returned. Finally, the object management layer assembles the data and returns it to the caller.

[0082] The above process is as follows: Figure 7 As shown, it includes the following steps:

[0083] Step 7.1: Initiate a request to access the reverse attribute data of the object;

[0084] Step 7.2: Check if the object exists in the memory object pool;

[0085] Step 7.3: If the object exists in the memory object pool, request to obtain the object pointer and receive the object pointer returned by the memory object pool;

[0086] Step 7.4: If the object does not exist in the memory object pool, the reverse object data needs to be loaded;

[0087] Step 7.5: Generate an object based on the returned data;

[0088] Step 7.6: Place the object into the memory object pool;

[0089] Step 7.7: Return the reverse property object;

[0090] Step 7.8: Assemble the data and return the data.

[0091] Optionally, embodiments of the present invention also provide an optional flowchart for dynamically loading proxy objects, such as... Figure 8 As shown, the specific steps include:

[0092] Step 801: Begin;

[0093] Step 802: Access the proxy object (second object);

[0094] Step 803: Determine if the weak pointer (object weak pointer) is valid. If invalid, proceed to step 804; if valid, proceed to step 810.

[0095] Step 804: Query the memory object pool based on the GlobalId (third object identifier);

[0096] Step 805: Determine if the object (third object) exists. If it does not exist, proceed to step 806; if it exists, proceed to step 809.

[0097] Step 806: Load data based on object type and GlobalId;

[0098] Step 807: Perform deserialization to generate a concrete object;

[0099] Step 808: Add to the memory object pool;

[0100] Step 809: Associate the object with a weak pointer;

[0101] Step 810: Return the specific object;

[0102] Step 811: End.

[0103] When accessing a proxy object, first determine if the weak pointer of the proxy object is valid. If it is valid, return the object pointer directly. If it is invalid, first search in the memory object pool. If it exists, associate the weak pointer with it and then return the object pointer. Otherwise, load the object from the database based on the object type and GlobalId, deserialize it to generate the specific object, put it into the memory object pool, associate it with the weak pointer, and then return the object pointer.

[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0105] This embodiment also provides an object access device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0106] Figure 9 A structural block diagram of an optional object access device according to an embodiment of the present invention; as shown. Figure 9 As shown, it includes:

[0107] The acquisition module 92 is used to obtain the object attributes of the second object based on the first object pointer of the first object when an access request is received. The access request is used to request access to the third object, the third object is the reverse attribute object of the first object, the second object is the proxy object of the third object, and the object attributes include: object type, third object identifier and object weak pointer.

[0108] It should be noted that the aforementioned third object identifier is the object identifier of the second object. Since the second object is a proxy object of the third object, the third object identifier is also the object identifier of the third object.

[0109] Query module 94 is used to query whether the third object exists in the memory object pool based on the third object identifier when it is determined that the weak pointer of the object is invalid;

[0110] It should be noted that the aforementioned weak pointer establishes a connection with a third object in the memory object pool. Therefore, if the weak pointer is valid, it means that the third object definitely exists in the memory object pool, and the third object can be accessed directly through the weak pointer.

[0111] The generation module 96 is used to generate the third object according to the object type and the third object identifier when the third object does not exist, and to store the third object in the memory object pool;

[0112] The determination module 98 is used to determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0113] Through the above-described device, in response to a received access request for accessing a third object, the object attributes of the second object are obtained based on the first object pointer of the first object. The third object is the reverse attribute object of the first object, and the second object is a proxy object of the third object. The object attributes include: object type, third object identifier, and weak pointer. If the weak pointer is determined to be invalid, the existence of the third object is queried in the memory object pool based on the third object identifier. If it does not exist, the third object is generated based on the object type and the third object identifier and stored in the memory object pool. A second object pointer for accessing the third object is determined, allowing access to the third object from the memory object pool via this pointer. Using this scheme, the required data can be automatically loaded on demand through the proxy object, achieving data access without a complex data connection organization process. This solves the problem in related technologies where loading IFC data requires querying all related tables in the database and then organizing the queried data together to return to the caller, resulting in a complex process and a limited number of usable components due to full loading, leading to a poor user experience.

[0114] Optionally, the acquisition module 92 is further configured to query whether the first object exists in the memory object pool based on the second object identifier of the first object carried in the access request; if the first object exists, determine the first object pointer of the first object; if the first object does not exist, generate the first object based on the second object identifier and determine the first object pointer of the first object.

[0115] Before obtaining the object attributes of the second object based on the first object pointer of the first object, it is necessary to obtain the first object pointer of the first object first. The access request only carries the second object identifier of the first object. The second object identifier needs to be passed to the object management layer first. The management layer uses the second object identifier to query whether the first object exists in the memory object pool. If it exists, the first object pointer of the first object is obtained directly. If it does not exist, the first object needs to be generated based on the second object identifier, and then the first object pointer of the first object is determined.

[0116] Optionally, the acquisition module 92 is further configured to acquire object data of the first object according to the second object identifier; perform a deserialization operation on the object data to generate the first object, and store the first object in the memory object pool; and determine a first object pointer for accessing the first object.

[0117] The process of generating a first object based on a second object identifier includes: calling the data operation module, loading the object data of the first object based on the second object identifier, creating the first object through the deserialization function of the object management layer, and placing the first object into the memory object pool. Then, the pointer to the first object is determined.

[0118] It should be noted that the object data of the first object mentioned above is loaded using a minimized loading method, which only loads the object itself.

[0119] Optionally, the determining module 98 is further configured to access the third object through the second object pointer; add the third object identifier of the third object to the header of the access record data, wherein the access record data includes access records of objects in the memory object pool, and the multiple access records in the access record data are sorted according to access time, with the latest access time access record stored in the header of the access record data.

[0120] After obtaining the pointer to the second object, the third object is accessed through the second object; then the identifier of the third object is added to the head of the access record data, which can be stored in the form of a linked list. The storage space of the linked list is fixed, the data in the linked list is sorted by time, and new data is inserted at the head of the linked list.

[0121] Optionally, the determining module 98 is further configured to, when the number of multiple access records in the access record data is equal to a preset threshold, determine whether the object data of the fourth object corresponding to the first access record stored at the end of the access record data has changed; when the object data of the fourth object has changed, store the object data of the fourth object in the database and delete the first access record; and add the third object identifier to the beginning of the access record data.

[0122] When adding a new object identifier, first check if the number of nodes stored in the linked list (the number of access records) or the memory usage of the linked list exceeds the limit. If it does not exceed the limit, directly add the third object identifier to the head of the linked list. If it exceeds the limit, continue to check if the object data of the fourth object indicated by the tail node of the linked list has changed. If it has changed, first save the node data to the database, and then delete the tail node. If it has not changed, directly delete the tail node. Then add the third object identifier to the head of the linked list.

[0123] Optionally, the generation module 96 is further configured to obtain the reverse object data of the third object according to the object type and the third object identifier; and perform a reverse serialization operation on the reverse object data to generate the third object.

[0124] The process of generating a third object includes: obtaining the reverse object data of the third object based on the object type and the third object identifier; and then creating the third object through the deserialization function of the object management layer.

[0125] Optionally, the generation module 96 is further configured to establish an association between the weak pointer of the object and the third object, wherein the association is used to access the third object through the weak pointer of the object.

[0126] After the third object is stored in the memory object pool, the weak pointer of the object becomes invalid. It is necessary to re-establish the association between the weak pointer of the object and the third object so that the third object can be accessed directly through the weak pointer the next time it is accessed.

[0127] Embodiments of the present invention also provide a storage medium comprising a stored program, wherein the program, when executed, performs any of the methods described above.

[0128] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0129] S1, Upon receiving an access request, the object attributes of the second object are obtained based on the first object pointer of the first object. The access request is used to request access to a third object, the third object is the reverse attribute object of the first object, the second object is the proxy object of the third object, and the object attributes include: object type, third object identifier, and object weak pointer.

[0130] S2, if it is determined that the weak pointer of the object is invalid, query the memory object pool to see if the third object exists based on the third object identifier;

[0131] S3, if the third object does not exist, generate the third object according to the object type and the third object identifier, and store the third object in the memory object pool;

[0132] S4, determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0133] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0134] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0135] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0136] S1, Upon receiving an access request, the object attributes of the second object are obtained based on the first object pointer of the first object. The access request is used to request access to a third object, the third object is the reverse attribute object of the first object, the second object is the proxy object of the third object, and the object attributes include: object type, third object identifier, and object weak pointer.

[0137] S2, if it is determined that the weak pointer of the object is invalid, query the memory object pool to see if the third object exists based on the third object identifier;

[0138] S3, if the third object does not exist, generate the third object according to the object type and the third object identifier, and store the third object in the memory object pool;

[0139] S4, determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

[0140] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0141] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0142] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0143] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An object access method, characterized in that, include: Upon receiving an access request, the object attributes of the second object are obtained based on the first object pointer of the first object. The access request is used to request access to a third object, the third object being the reverse attribute object of the first object, and the second object being the proxy object of the third object. The object attributes include: object type, third object identifier, and object weak pointer. If it is determined that the weak pointer to the object is invalid, the existence of the third object is queried in the memory object pool based on the identifier of the third object. If the third object does not exist, the third object is generated according to the object type and the third object identifier, and the third object is stored in the memory object pool; A second object pointer is determined for accessing the third object, so that the third object can be accessed in the memory object pool through the second object pointer.

2. The object access method according to claim 1, characterized in that, Before retrieving the object property of the second object based on the first object pointer of the first object, the method further includes: Based on the second object identifier of the first object carried in the access request, query the memory object pool to see if the first object exists; If the first object exists, determine the first object pointer of the first object; If the first object does not exist, the first object is generated based on the second object identifier, and the first object pointer of the first object is determined.

3. The object access method according to claim 2, characterized in that, Generating the first object based on the second object identifier and determining the first object pointer of the first object includes: Obtain the object data of the first object based on the second object identifier; Perform a deserialization operation on the object data to generate the first object, and store the first object in the memory object pool; Determine the first object pointer used to access the first object.

4. The object access method according to claim 1, characterized in that, After determining a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer, the method further includes: Access the third object through the second object pointer; The third object identifier of the third object is added to the header of the access record data, wherein the access record data includes access records of objects in the memory object pool, and the multiple access records in the access record data are sorted according to access time, with the latest access record stored in the header of the access record data.

5. The object access method according to claim 4, characterized in that, Adding the third object identifier of the third object to the header of the access record data includes: If the number of multiple access records in the access record data is equal to a preset threshold, determine whether the object data of the fourth object corresponding to the first access record stored at the end of the access record data has changed. If the object data of the fourth object changes, the object data of the fourth object is stored in the database, and the first access record is deleted. Add the third object identifier to the header of the access record data.

6. The object access method according to claim 1, characterized in that, If the third object does not exist, the third object is generated based on the object type and the third object identifier, including: Obtain the reverse object data of the third object based on the object type and the third object identifier; Perform a deserialization operation on the reverse object data to generate the third object.

7. The object access method according to claim 1, characterized in that, After storing the third object into the memory object pool, the method further includes: Establish an association between the weak pointer of the object and the third object, wherein the association is used to access the third object through the weak pointer of the object.

8. An object access device, characterized in that, include: The acquisition module is used to obtain the object attributes of the second object based on the first object pointer of the first object when an access request is received. The access request is used to request access to the third object, the third object is the reverse attribute object of the first object, the second object is the proxy object of the third object, and the object attributes include: object type, third object identifier and object weak pointer. The query module is used to query whether the third object exists in the memory object pool based on the identifier of the third object if it is determined that the weak pointer of the object is invalid. A generation module is configured to generate a third object based on the object type and the third object identifier when the third object does not exist, and store the third object in the memory object pool; a determination module is configured to determine a second object pointer for accessing the third object, so as to access the third object in the memory object pool through the second object pointer.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • System running method and operation system

    CN107301095A

  • Texture management method and device, equipment and storage medium

    CN114549727A