Behavior control method and device of control, equipment and medium
By determining and controlling target control objects within device interfaces using class templates, the method addresses the inflexibility of existing smoke testing processes, enabling precise and adaptable control behaviors.
Patent Information
- Application Number
- CN202311258619.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
Current automation schemes for device testing rely heavily on screen coordinates, making the smoke testing process uncontrolled and inflexible, leading to difficulties in maintaining smoke scripts when the user interface changes.
A method that determines the target control object in a device interface, uses class templates to match and filter control operations, enabling precise control of control behaviors through the conversion of base class pointers to specific control type pointers.
This approach allows for programmable smoke scripts and controlled smoke testing processes, ensuring precise control of control behaviors and adaptability to changing interfaces.
Smart Images

Figure CN119718116A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a control behavior control method, device, equipment and medium. Background Art
[0002] In the device interface, the automation solution generates a smoke script by recording the movement of the trackball and clicking the control at a certain position of the trackball. Then, by executing a series of smoke scripts, it can simulate and restore manual operations to achieve the purpose of testing the functions of each module of the device. For example, in an ultrasound device, a smoke script is generated by clicking the ultrasound control at a certain position of the trackball, and the smoke script can be executed later to test the functions of each module of the ultrasound.
[0003] The current automation solution only mechanically records the trackball position information, resulting in a strong dependence on screen coordinate points. The smoking process cannot know the meaning of the current behavior operation. The smoking process is poorly controllable and the smoking behavior cannot be customized. When the user interface changes, all related smoking scripts will become invalid, making it difficult to maintain the smoking scripts.
[0004] In summary, how to provide a general solution for the behavior control of controls to implement programmable smoke scripts, control the smoke process, and accurately control the behavior of controls is a problem that needs to be solved. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a control behavior control method, device, equipment and medium, which can provide a general solution for the control behavior of the control, so as to realize a programmable smoke script, realize the controllable smoke process, and accurately control the control behavior. The specific scheme is as follows:
[0006] In a first aspect, the present application discloses a control behavior control method, comprising:
[0007] Determine the target control object being used in the device interface;
[0008] Determine a target base class pointer that matches the target feature information of the target control object using a class template, and determine a target class type of the target base class pointer;
[0009] Instantiating the class template using the target class type to obtain a template class, and screening out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class;
[0010] The target base class pointer is converted into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer.
[0011] Optionally, the target feature information is the target class object name of the target control object.
[0012] Optionally, the using a class template to determine a target base class pointer that matches the target feature information of the target control object, and determining a target class type of the target base class pointer, includes:
[0013] Using the class template to traverse the preset control object linked list to determine the target base class pointer that matches the target class object name;
[0014] Determine a target class identification number corresponding to the target base class pointer, and determine a target class type corresponding to the target class identification number according to a mapping relationship between the class identification number and the class type;
[0015] The preset control object linked list stores base class pointers of all control objects in the current device interface; the characteristic information in the base class pointer includes a class object name and a class identification number.
[0016] Optionally, the control behavior control method further includes:
[0017] If a control object is constructed on the current device interface, inserting a base class pointer and feature information corresponding to the newly constructed control object into the preset control object linked list;
[0018] If a control object is destroyed in the current device interface, the corresponding base class pointer is deleted from the preset control object linked list according to the base class pointer and feature information corresponding to the destroyed control object.
[0019] Optionally, the step of screening out a target functional interface that matches a target behavior operation to be executed by the target control object from among all current functional interfaces of the template class includes:
[0020] Acquire the behavior operation information to be executed by the target control object passed in by the user through the data acquisition interface, and determine the corresponding target behavior operation according to the behavior operation parameters;
[0021] A target functional interface matching the target behavior operation is screened out from all current functional interfaces of the template class.
[0022] Optionally, the process of instantiating the class template using the target class type to obtain the template class further includes:
[0023] For each functional interface of the class template, using a preset inheritance relationship extraction template to determine an inheritance relationship extraction result of the functional interface;
[0024] Determine whether to enable the functional interface based on the inheritance relationship extraction result.
[0025] Optionally, the determining the inheritance relationship extraction result of the functional interface by using a preset inheritance relationship extraction template includes:
[0026] Determine whether the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship by using a preset inheritance relationship extraction template, so as to obtain an inheritance relationship extraction result;
[0027] Accordingly, determining whether to enable the functional interface based on the inheritance relationship extraction result includes:
[0028] If the class type corresponding to the functional interface satisfies the inheritance relationship with the target class type, the functional interface is enabled using a preset interface management template;
[0029] If the class type corresponding to the functional interface does not satisfy the inheritance relationship with the target class type, the functional interface is disabled using the preset interface management template.
[0030] Optionally, the control behavior control method further includes:
[0031] The current functional interfaces of the template class are constructed based on all the enabled functional interfaces.
[0032] In a second aspect, the present application discloses a behavior control device for a control, comprising:
[0033] A control object determination module is used to determine the target control object being used in the device interface;
[0034] A first matching module, used to determine a target base class pointer that matches the target feature information of the target control object by using a class template, and determine a target class type of the target base class pointer;
[0035] An instantiation module, used to instantiate the class template using the target class type to obtain a template class;
[0036] A second matching module is used to filter out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class;
[0037] The operation execution module is used to convert the target base class pointer into a target control type pointer corresponding to the target function interface, so as to execute the target behavior operation using the target control type pointer.
[0038] In a third aspect, the present application discloses an electronic device, including:
[0039] Memory, used to store computer programs;
[0040] The processor is used to execute the computer program to implement the steps of the control behavior control method disclosed above.
[0041] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned control behavior control method disclosed above are implemented.
[0042] It can be seen that the present application determines the target control object being used in the device interface; determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer; instantiates the class template using the target class type to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class; converts the target base class pointer into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer. It can be seen that the present application first determines the target control object being used in the device interface, and determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer, and then uses the target class type as an input parameter to instantiate the class template to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class, so as to convert the target base class pointer into a target control type pointer corresponding to the target function interface, and finally uses the target control type pointer to perform the above target behavior operation. Through the above scheme, the target feature information of all target control objects in use in the device interface can be obtained in real time, so that the target base class pointer that matches the target feature information is determined by the class template, realizing the decoupling of the specific control object to the base class pointer; then an instance class control type pointer is constructed based on the target base class pointer, realizing the conversion from the base class pointer to the specific control type pointer, and finally executing various behavior operations of the control through the control type pointer, thereby accurately controlling the control behavior. Furthermore, the above scheme can realize a programmable smoke script, realizing the controllable smoke process. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A flow chart of a behavior control method of a control disclosed in this application;
[0045] Figure 2 A flowchart of a behavior control method for a specific control disclosed in this application;
[0046] Figure 3 A schematic diagram of a behavior control flow of a control disclosed in this application;
[0047] Figure 4 A schematic diagram of updating a control object linked list disclosed in this application;
[0048] Figure 5 A schematic diagram of a specific linked list structure disclosed in this application;
[0049] Figure 6 A simplified diagram of the inheritance relationship of a button class disclosed in this application;
[0050] Figure 7 This is a schematic diagram of the structure of a behavior control device of a control disclosed in this application;
[0051] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0053] Currently, the automation solution generates a smoke script by recording the movement of the trackball and clicking the control at a certain position of the trackball, and then simulates and restores the manual operation by executing a series of smoke scripts to achieve the purpose of detecting the functions of each module of the equipment. However, this method only mechanically records the position information of the trackball, strongly relies on the screen coordinate points, and the smoke process cannot know the meaning of the current behavior operation, and the controllability of the smoke process is poor. To this end, the embodiments of the present application disclose a control behavior control method, device, equipment and medium, which can provide a general solution for the control of the control behavior, so as to realize programmable smoke scripts, realize controllable smoke process, and accurately control the control behavior.
[0054] See also Figure 1 As shown, the embodiment of the present application discloses a behavior control method of a control, the method comprising:
[0055] Step S11: Determine the target control object being used in the device interface.
[0056] In this embodiment, the device interface takes the ultrasound device interface as an example, and the target control object is the control object currently being used in the ultrasound device interface. It should be noted that this application is not limited to ultrasound device interfaces, and various electronic device interfaces can be applied.
[0057] Step S12: using the class template to determine a target base class pointer that matches the target feature information of the target control object, and determining the target class type of the target base class pointer.
[0058] In this embodiment, the class template is used to determine the target base class pointer that matches the target feature information of the target control object, and to determine the target class type of the target base class pointer. In a specific implementation, the target feature information of the target control object is passed to the class template, and then the class template matches the target base class pointer according to the passed target feature information. Therefore, the target feature information of all target control objects being used in the device interface can be obtained in real time through the above scheme. In addition, the class template in this embodiment is designed using C++11 templates.
[0059] The above target feature information is specifically the target class object name of the target control object. It should be pointed out that the class object name of the control object is globally unique, so the class template can match the corresponding target base class pointer Kobject* through the unique class object name, realizing the decoupling of the specific control object to the base class pointer. It can be understood that, taking the ultrasound device interface as an example, the specific type refers to the various control classes on the ultrasound device interface, such as buttons, tables, drop-down boxes, text boxes, etc. The general type can be understood as the base class KObject, all classes of the interface inherit from this class, and KObject is the bottom-level base class.
[0060] Step S13: Instantiating the class template using the target class type to obtain a template class, and screening out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class.
[0061] In this embodiment, the target class type of the target base class pointer is used as an input parameter to instantiate the class template to obtain the template class, and the target function interface that matches the target behavior operation to be executed by the target control object is screened out from all current function interfaces of the template class.
[0062] In a specific implementation, the above-mentioned filtering out the target function interface that matches the target behavior operation to be executed by the target control object from all current function interfaces of the template class includes: obtaining the behavior operation information to be executed by the target control object passed in by the user through the data acquisition interface, and determining the corresponding target behavior operation according to the behavior operation parameters; filtering out the target function interface that matches the target behavior operation from all current function interfaces of the template class. That is, the user will pass in the behavior operation information to be executed by the target control object, thereby determining the corresponding target behavior operation according to the behavior operation parameters, and then filtering out the target function interface that matches the target behavior operation from all current function interfaces of the template class.
[0063] Step S14: converting the target base class pointer into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer.
[0064] In this embodiment, the target base class pointer is converted into a target control type pointer corresponding to the target functional interface, and the target control type pointer is finally used to perform the above target behavior operation. That is, the present application realizes the conversion from the base class pointer to the specific control type pointer, and finally executes various behavior operations of the control through the control type pointer, thereby accurately controlling the control behavior. Moreover, the above scheme can realize a programmable smoke script, and realize the controllable smoke process.
[0065] It can be seen that the present application determines the target control object being used in the device interface; determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer; instantiates the class template using the target class type to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class; converts the target base class pointer into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer. It can be seen that the present application first determines the target control object being used in the device interface, and determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer, and then uses the target class type as an input parameter to instantiate the class template to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class, so as to convert the target base class pointer into a target control type pointer corresponding to the target function interface, and finally uses the target control type pointer to perform the above target behavior operation. Through the above scheme, the target feature information of all target control objects in use in the device interface can be obtained in real time, so that the target base class pointer that matches the target feature information is determined by the class template, realizing the decoupling of the specific control object to the base class pointer; then an instance class control type pointer is constructed based on the target base class pointer, realizing the conversion from the base class pointer to the specific control type pointer, and finally executing various behavior operations of the control through the control type pointer, thereby accurately controlling the control behavior. Furthermore, the above scheme can realize a programmable smoke script, realizing the controllable smoke process.
[0066] See also Figure 2 and Figure 3 As shown, the embodiment of the present application discloses a specific behavior control method of a control. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution.
[0067] Specifically include:
[0068] Step S21: Determine the target control object being used in the device interface.
[0069] Step S22: traverse the preset control object linked list using the class template to determine a target base class pointer that matches the target class object name of the target control object.
[0070] In this embodiment, the class template traverses the preset control object linked list according to the target class object name of the incoming target control object, thereby determining a target base class pointer that matches the target class object name.
[0071] It should be noted that the above method also includes: if a control object is constructed in the current device interface, inserting a base class pointer and feature information corresponding to the newly constructed control object into the preset control object linked list; if a control object is destroyed in the current device interface, deleting the corresponding base class pointer in the preset control object linked list according to the base class pointer and feature information corresponding to the destroyed control object. That is, this embodiment manages all control objects in the device interface in a unified manner, thereby constructing a preset control object linked list. When a control object is constructed or destroyed in the device interface, the preset control object linked list is updated, such as Figure 4 As shown. Specifically, when a control object is constructed, the base class pointer and feature information corresponding to the newly constructed control object are inserted into the preset control object linked list. When a control object is destroyed, the corresponding base class pointer is deleted from the preset control object linked list according to the base class pointer and feature information corresponding to the destroyed control object. In this way, the information stored in the preset control object linked list can be updated in real time during the program running process, ensuring that the control objects recorded in the preset control object linked list are consistent with the control objects existing in the current device interface.
[0072] It should be further pointed out that the preset control object linked list stores the base class pointers of all control objects in the current device interface; the characteristic information in the base class pointer includes the class object name and the class identification number. In this embodiment, the linked list type of the preset control object linked list is the base class pointer KObject*. When managing control objects in the preset control object linked list, all interface control classes inherit from the base class KObject. The base class has member variables of the class identification number (ID) and the class object name (name) as characteristic information, and has a linked list with an element type of KObject*. The IDs of all control class types are defined in the header file, and a relationship mapping is made between the ID and the class type. Each control class type has a globally unique ID, such as Figure 5 In the system, ID32356 can be mapped to class_A. The system also has a naming rule. When each control object is initialized, a globally unique name is set, such as Figure 5 In the program, class_C is used to construct two class objects obj0 and obj1, with names xx-xx-xx and yy-yy-yy respectively. When the program is running, the preset control object linked list is updated in real time. Whenever a new control object is constructed, the new control object and its corresponding base class pointer are inserted into the preset control object linked list. When the control object is destroyed, the element in the preset control object linked list is matched through the feature information ID and name and deleted.
[0073] It should be noted that the class identification number is a fixed default value, that is, it is determined according to the agreed rules when each class is designed, and different control classes have globally unique IDs. The ID is automatically initialized and assigned when the class is initialized. The ID is not perceptible to the user of the class. The class object name (name) is the value passed in by the user when the user constructs the class object, such as Figure 5 Two class_C objects are constructed, namely obj0 and obj1. The name is globally unique according to the agreed rules and can be named by the user according to the naming rules.
[0074] Step S23: Determine the target class identification number corresponding to the target base class pointer, and determine the target class type corresponding to the target class identification number according to the mapping relationship between the class identification number and the class type.
[0075] In this embodiment, it can be known from the above content that the base class pointer has member variables of the class identification number and the class object name as characteristic information, and the class identification number and the class object name are both globally unique. Therefore, by first determining the target class identification number corresponding to the target base class pointer, the target class type corresponding to the target class identification number can be determined according to the mapping relationship between the class identification number and the class type.
[0076] Step S24: Instantiate the class template using the target class type to obtain a template class, and screen out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class.
[0077] In this embodiment, the process of instantiating the class template using the target class type to obtain the template class also includes: for each functional interface of the class template, using a preset inheritance relationship extraction template to determine the inheritance relationship extraction result of the functional interface; and determining whether to enable the functional interface based on the inheritance relationship extraction result. That is, in the process of instantiating the class template using the target class type to obtain the template class, it is necessary to use the preset inheritance relationship extraction template to perform inheritance relationship extraction on each functional interface of the class template, and determine whether to enable the corresponding functional interface based on the inheritance relationship extraction result.
[0078] The above inheritance relationship extraction template is "std::<is_base_of> ", and extracting the type according to the position of the class where the functional interface is located. In a specific implementation, the above-mentioned use of a preset inheritance relationship extraction template to determine the inheritance relationship extraction result of the functional interface includes: using a preset inheritance relationship extraction template to determine whether the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship, so as to obtain the inheritance relationship extraction result; correspondingly, determining whether to enable the functional interface based on the inheritance relationship extraction result includes: if the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship, enabling the functional interface using a preset interface management template; if the class type corresponding to the functional interface and the target class type do not satisfy the inheritance relationship, disabling the functional interface using the preset interface management template. That is, it is judged in turn whether the class type corresponding to each functional interface and the target class type satisfy the inheritance relationship. If the inheritance relationship is satisfied, the extraction result of the inheritance relationship extraction template is true at this time, and the functional interface is enabled using the preset interface management template; if the inheritance relationship is not satisfied, the extraction result of the inheritance relationship extraction template is false at this time, and the functional interface is disabled using the preset interface management template.
[0079] It is understandable that c++11 provides a rich type extraction template class to support the function customization of template classes at compile time. Type extraction uses template technology to extract certain characteristics of types, including custom types and built-in types, to determine whether the type contains certain characteristics, so as to perform special processing on the type in the generic algorithm to achieve certain purposes. It can realize calculation, query, judgment, conversion and selection at compile time, and enhance the ability of generic programming. Various functional interfaces of various controls are distributed in different classes. For example, the click function interface is located in the lower-level base class, and the scroll function interface is located in the slider class. Therefore, it is necessary to initialize the template type based on the position of the class where the interface is located. There is no need to implement the interface for each specific control type, which can reduce a lot of repeated interface design. Using std::<is_base_of> Templates can extract inheritance relationships. After a class template is instantiated, the instantiated template class will have all the member functions of the class template, but this will cause the class to incorrectly include unsupported functional interfaces. For example, the instantiated button class includes a scrolling functional interface. At the same time, there will be problems such as passing compilation but causing assertions due to abnormal calls during runtime. Therefore, the present application determines whether the functional interface can be enabled based on the inheritance relationship extraction results, which can ensure that the instantiated class always contains the correct and available functional interfaces, and does not contain unavailable functional interfaces.
[0080] like Figure 6The following is a simplified diagram of the inheritance relationship of a button class. Taking the click operation of the button class as an example, its function interface clicked() is located in the base class AbstrackBtn. When updating and presetting the control object linked list list, the linked list element is a KObject* implicitly converted from ImageBtn*. After matching the target KObject* through feature information, it needs to be forced to be converted downward to the subclass type containing the clicked() method. The inheritance relationship extraction template "std::is_base_of" determines whether the two types are in an inheritance relationship during compilation. The main purposes of inheritance relationship extraction include: 1. Ensure that the obtained KObject* can be correctly converted to the target control type. For example, ImageBtn* can be implicitly converted to KObject*, but forcing KObject* down to other control types will fail; 2. Extracting types according to the position of the class where the functional interface is located can simplify the template interface and support inheritance extension. For example, after obtaining KObject* through feature information, although it is implicitly converted from ImageBtn*, its base class type AbstrackBtn* can be extracted. At this time, not only can the clicked() functional interface be called normally, but all scenes inherited from AbstrackBtn* can also be directly supported. As shown in the figure, PushBtn*, etc., is simplified to a template class interface to support all click operations inherited from AbstrackBtn; 3. Through inheritance relationship extraction, a template return value can also be obtained. The return value can be used as an input parameter for subsequent interface clipping, so as to determine whether to enable the corresponding functional interface.
[0081] The above preset interface management template is "std::<enable_if> ", when the extraction result of the inheritance relationship extraction template is true, the corresponding functional interface is enabled, and when the extraction result of the inheritance relationship extraction template is false, the corresponding functional interface is disabled. That is, "std::<enable_if> " is used to disable or enable a certain type when a certain condition is met. Therefore, this feature can be used to trim the template function interface. If the template parameter is specified as ImageBtn when the template class is instantiated, the template class is a button-related class after instantiation. The button class can only execute the function interface it contains, such as button click, etc., but does not contain the function interface of other control types, such as page turning, etc. Therefore, in this case, the function interface that does not belong to the button class needs to be trimmed, and the result extracted by using the inheritance relationship is used as the condition result judgment, and the function interface that matches the instantiated control type is selectively used. In this way, the effect achieved is: the template class supports the functions of all controls and provides the function interfaces of all controls. When the template class is instantiated, the interface available for the corresponding control type is trimmed according to the instantiated template type, ensuring the correctness of the function.
[0082] Furthermore, the method further comprises: forming all current functional interfaces of the template class based on all the enabled functional interfaces. That is, all current functional interfaces of the template class are all enabled functional interfaces.
[0083] by Figure 5 For example, for the function interface func0(), the corresponding class type is class_A (referred to as type A), then the extraction result of the inheritance relationship of instantiated types A, B, C, and D is true, and the extraction result of type E is false. For template classes, this process ensures the functional correctness of template classes, that is, after instantiating using a certain class type, the instantiated class can always contain the correct and available functional interfaces, and will not contain unavailable functional interfaces, such as Figure 5 If the instantiation type is type C, it will not include the func3() functional interface in D, but will include func0()~func2() and other functional interfaces. If the instantiation type is type A, it will only include the func0() interface.
[0084] Step S25: converting the target base class pointer into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer.
[0085] In this embodiment, it can be understood that the preset control object linked list caches all control object pointers in the interface in real time. The linked list type is KObject*. Through the characteristic information of name, the target base class pointer object KObject*obj can be matched by traversing the linked list. However, the obj pointer obtained from the linked list can only execute the functions of the base class KObject. Therefore, the obj pointer needs to be converted into the correct target class type so that the member function of the target class can be executed. Therefore, the obj pointer needs to be type converted.
[0086] For more specific processing procedures of the above steps S21 and S25, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0087] The technical solution of the present application can be applied to the following two scenarios: Scenario 1, conversion of feature information to control type pointer. The caller can obtain the feature information of all objects in the object list according to the needs, pass the feature information to the class template, and finally get the control type pointer. The template class member function can be used to perform various operations on the control; Scenario 2, the association of the control type pointer to the feature information. The template class monitors the operation behavior of all control objects by signal triggering. When the control is operated, such as switching data items in the drop-down box, its feature information and the selected data item are recorded. The same operation can be reproduced through the parameter package in conjunction with the template class in the future, thereby achieving controllable smoking process.
[0088] It can be seen that the embodiment of the present application uniformly manages all control objects in the device interface, thereby constructing a preset control object linked list, which stores the base class pointers of all control objects in the current device interface; the characteristic information in the base class pointer includes the class object name and the class identification number. During the program running process, if the control object construction or control object destruction occurs in the device interface, the preset control object linked list is updated to ensure that the control object recorded in the preset control object linked list is consistent with the control object existing in the current device interface. Therefore, the class template can traverse the preset control object linked list according to the target class object name of the target control object passed in, so as to determine the target base class pointer that matches the target class object name. Further, the target class type corresponding to the target class identification number of the target base class pointer can be determined according to the mapping relationship between the class identification number and the class type. In the process of instantiating the class template using the target class type to obtain the template class, it is necessary to use the preset inheritance relationship extraction template to extract the inheritance relationship of each functional interface of the class template, and determine whether to enable the corresponding functional interface based on the inheritance relationship extraction result, so as to ensure that the instantiated class can always contain the correct and available functional interface, and will not contain the unavailable functional interface.
[0089] Combine the following Figure 5, the technical solution of this application is explained with a specific example.
[0090] Assuming that the func0() operation needs to be performed on the obj0 control on the ultrasound device interface, the name xx-xx-xx of obj0 needs to be passed to the class template. The class template can match the target base class pointer Kobject* through the unique name, and the specific target class type class_C can be obtained according to the characteristic information class_C class identification ID (32358).
[0091] Then, class_C is used to instantiate the class template to obtain the template class. During the instantiation process, for each functional interface of the class template, i.e., func0() to func4() in the figure, the inheritance relationship extraction results of these functional interfaces are determined using the preset inheritance relationship extraction template, specifically, to determine whether the class type corresponding to each functional interface satisfies the inheritance relationship with the target class type class_C. Figure 4 Among them, class_A, class_B and class_C all satisfy the inheritance relationship, so the corresponding functional interfaces func0() to func2() are enabled; while class_D and class_E do not satisfy the inheritance relationship with class_C, so the corresponding functional interfaces func3() to func4() are disabled.
[0092] Therefore, after the inheritance relationship extraction process, the template class will have func0()~func2() functional interfaces, and at this time it is necessary to perform func0() operation on the obj0 control, that is, the target functional interface corresponding to the target behavior operation to be executed by the target control object is func0(), so in the func0() of the template class, the target base class true value Kobject* is converted to the target control type pointer A* corresponding to the target functional interface, and finally func0() is executed through A*.
[0093] It can be seen that in the above scheme, the class template matches the member function according to the passed-in feature information, selects the member function functional interface that matches the feature information, and finally constructs an instance class control object, realizing the transformation from the base class KOject* to the specific control object, and finally executes various behaviors of the control through the object, such as clicking, turning pages, interface refresh, etc.
[0094] See also Figure 7 As shown, the embodiment of the present application discloses a behavior control device of a control, the device comprising:
[0095] A control object determination module 11 is used to determine a target control object being used in a device interface;
[0096] A first matching module 12 is used to determine a target base class pointer that matches the target feature information of the target control object using a class template, and determine a target class type of the target base class pointer;
[0097] An instantiation module 13, used to instantiate the class template using the target class type to obtain a template class;
[0098] The second matching module 14 is used to filter out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class;
[0099] The operation execution module 15 is used to convert the target base class pointer into a target control type pointer corresponding to the target function interface, so as to execute the target behavior operation using the target control type pointer.
[0100] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.
[0101] It can be seen that the present application determines the target control object being used in the device interface; determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer; instantiates the class template using the target class type to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class; converts the target base class pointer into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer. It can be seen that the present application first determines the target control object being used in the device interface, and determines the target base class pointer that matches the target feature information of the target control object using the class template, and determines the target class type of the target base class pointer, and then uses the target class type as an input parameter to instantiate the class template to obtain the template class, and screens out the target function interface that matches the target behavior operation to be performed by the target control object from all current function interfaces of the template class, so as to convert the target base class pointer into a target control type pointer corresponding to the target function interface, and finally uses the target control type pointer to perform the above target behavior operation. Through the above scheme, the target feature information of all target control objects in use in the device interface can be obtained in real time, so that the target base class pointer that matches the target feature information is determined by the class template, realizing the decoupling of the specific control object to the base class pointer; then an instance class control type pointer is constructed based on the target base class pointer, realizing the conversion from the base class pointer to the specific control type pointer, and finally executing various behavior operations of the control through the control type pointer, thereby accurately controlling the control behavior. Furthermore, the above scheme can realize a programmable smoke script, realizing the controllable smoke process.
[0102] In some specific embodiments, the target feature information is the target class object name of the target control object.
[0103] In some specific embodiments, the first matching module 12 may specifically include:
[0104] A linked list traversal unit, used to traverse the preset control object linked list using the class template to determine a target base class pointer that matches the target class object name;
[0105] A target class type determination unit is used to determine a target class identification number corresponding to the target base class pointer, and determine a target class type corresponding to the target class identification number according to a mapping relationship between the class identification number and the class type; wherein the preset control object linked list stores base class pointers of all control objects in the current device interface; and the characteristic information in the base class pointer includes a class object name and a class identification number.
[0106] In some specific embodiments, the device further comprises:
[0107] An object construction unit, configured to insert a base class pointer and feature information corresponding to a newly constructed control object into the preset control object linked list if a control object construction occurs on the current device interface;
[0108] The object destructing unit is used to delete the corresponding base class pointer in the preset control object linked list according to the base class pointer and feature information corresponding to the destructed control object if the control object is destroyed in the current device interface.
[0109] In some specific embodiments, the second matching module 14 may specifically include:
[0110] A behavior operation determination unit, used to obtain the behavior operation information to be executed by the target control object transmitted by the user through the data acquisition interface, and determine the corresponding target behavior operation according to the behavior operation parameters;
[0111] The function interface screening unit is used to screen out a target function interface matching the target behavior operation from all current function interfaces of the template class.
[0112] In some specific embodiments, the instantiation module 13 is specifically used to determine the inheritance relationship extraction result of each functional interface of the class template using a preset inheritance relationship extraction template; and determine whether to enable the functional interface based on the inheritance relationship extraction result.
[0113] In some specific embodiments, the instantiation module 13 is specifically used to use a preset inheritance relationship extraction template to determine whether the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship, so as to obtain an inheritance relationship extraction result; if the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship, the preset interface management template is used to enable the functional interface; if the class type corresponding to the functional interface and the target class type do not satisfy the inheritance relationship, the preset interface management template is used to disable the functional interface.
[0114] In some specific embodiments, the device is further configured to construct all current functional interfaces of the template class based on all the enabled functional interfaces.
[0115] Figure 8A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the behavior control method of the control executed by the electronic device disclosed in any of the aforementioned embodiments.
[0116] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0117] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0118] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0119] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the processor 21 on the massive data 223 in the memory 22, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the behavior control method of the control executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0120] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the method steps performed in the behavior control process of the control disclosed in any of the aforementioned embodiments are implemented.
[0121] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0122] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0123] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0124] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0125] The above is a detailed introduction to the behavior control method, device, equipment and storage medium of a control provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A control behavior control method, characterized in that: include: Determine the target control object being used in the device interface; Determine a target base class pointer that matches the target feature information of the target control object using a class template, and determine a target class type of the target base class pointer; Instantiating the class template using the target class type to obtain a template class, and screening out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class; The target base class pointer is converted into a target control type pointer corresponding to the target function interface, so as to perform the target behavior operation using the target control type pointer.
2. The control behavior control method according to claim 1, characterized in that: The target feature information is the target class object name of the target control object.
3. The control behavior control method according to claim 2, characterized in that: The method of using a class template to determine a target base class pointer that matches the target feature information of the target control object and determining a target class type of the target base class pointer includes: Using the class template to traverse the preset control object linked list to determine the target base class pointer that matches the target class object name; Determine a target class identification number corresponding to the target base class pointer, and determine a target class type corresponding to the target class identification number according to a mapping relationship between the class identification number and the class type; The preset control object linked list stores base class pointers of all control objects in the current device interface; the characteristic information in the base class pointer includes a class object name and a class identification number.
4. The control behavior control method according to claim 3, characterized in that: Also includes: If a control object is constructed on the current device interface, inserting a base class pointer and feature information corresponding to the newly constructed control object into the preset control object linked list; If a control object is destroyed in the current device interface, the corresponding base class pointer is deleted from the preset control object linked list according to the base class pointer and feature information corresponding to the destroyed control object.
5. The control behavior control method according to claim 1, characterized in that: The step of screening out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class includes: Acquire the behavior operation information to be executed by the target control object passed in by the user through the data acquisition interface, and determine the corresponding target behavior operation according to the behavior operation parameters; A target functional interface matching the target behavior operation is screened out from all current functional interfaces of the template class.
6. The control behavior control method according to any one of claims 1 to 5, characterized in that: The process of instantiating the class template using the target class type to obtain the template class also includes: For each functional interface of the class template, using a preset inheritance relationship extraction template to determine an inheritance relationship extraction result of the functional interface; Determine whether to enable the functional interface based on the inheritance relationship extraction result.
7. The control behavior control method according to claim 6, characterized in that: The using a preset inheritance relationship extraction template to determine the inheritance relationship extraction result of the functional interface includes: Determine whether the class type corresponding to the functional interface and the target class type satisfy the inheritance relationship by using a preset inheritance relationship extraction template, so as to obtain an inheritance relationship extraction result; Accordingly, determining whether to enable the functional interface based on the inheritance relationship extraction result includes: If the class type corresponding to the functional interface satisfies the inheritance relationship with the target class type, the functional interface is enabled using a preset interface management template; If the class type corresponding to the functional interface does not satisfy the inheritance relationship with the target class type, the functional interface is disabled using the preset interface management template.
8. The control behavior control method according to claim 7, characterized in that: Also includes: The current functional interfaces of the template class are constructed based on all the enabled functional interfaces.
9. A behavior control device for a control, characterized in that: include: A control object determination module is used to determine the target control object being used in the device interface; A first matching module, used to determine a target base class pointer that matches the target feature information of the target control object by using a class template, and determine a target class type of the target base class pointer; An instantiation module, used to instantiate the class template using the target class type to obtain a template class; A second matching module is used to filter out a target functional interface that matches the target behavior operation to be executed by the target control object from all current functional interfaces of the template class; The operation execution module is used to convert the target base class pointer into a target control type pointer corresponding to the target function interface, so as to execute the target behavior operation using the target control type pointer.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the behavior control method of the control as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the behavior control method of the control as described in any one of claims 1 to 8 are implemented.