Decoupling method and computer readable storage medium
A decoupling, receiver technology, applied in the computer field, can solve the problems of increasing the complexity of the project, relying on the moc meta-object compiler, etc., to achieve the effect of reducing the complexity
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0070] Such as figure 1 As shown, as follows:
[0071] Step S101: The transmitter and the receiver have or can be converted to a common base type.
[0072] The type of the transmitter is SenderType, and the type of the receiver is ReceiverType. Both SenderType and ReceiverType inherit from the GObject type, so they have a common base type GObject.
[0073] Specific definitions of transmitters and receivers are exemplified as follows:
[0074] SenderType sender; / / Define the sender
[0075] ReceiverType receiver; / / Define the receiver
[0076] The "has or can be converted to underlying type" feature is designed to facilitate storing multiple emitters (or receivers) into the same list. Therefore, in other embodiments, the transmitter has or can be converted to a base type A, and the receiver has or can be converted to a base type B. A and B can be different, as long as multiple transmitters ( or recipients) to the same list.
[0077] Step S102: The transmitter defines a sign...
Embodiment 2
[0181] Embodiment 1 has a known technical defect: when the receiver is destructed, the transmitter does not know that the receiver has been destructed. At this time, when the transmitter sends a signal, it will still call the receiver’s slot function , which often leads to system crashes.
[0182] In order to solve the above-mentioned technical defect of embodiment 1, make following improvement on the basis of embodiment 1:
[0183] Receiver contains a list of signals that store "variables that point to the list of slots for the signal"; during the connection of the signal, the receiver will "point to the slot for the signal variable of the list" to the list of signals;
[0184] During said disconnection, the receiver removes the "variable pointing to said slot list of said signal" from said signal list;
[0185] When the receiver is destructed, it will traverse the signal list, obtain the "variables pointing to the slot list of the signal", and delete all "pointin...
Embodiment 3
[0214] Embodiment 2 has a known technical defect: if the transmitter is destroyed first, and then the receiver is destroyed, since the receiver does not know that the transmitter has been destroyed when it is destroyed, the receiver still tries to point to the slot of the signal from " List" deletes all the slots of "the variable pointing to the base type points to the receiver", and this often causes the system to crash.
[0215] In order to solve the above-mentioned technical defect of embodiment 2, make following improvement on the basis of embodiment 1:
[0216] The receiver includes a list of "transmitter meta information" that includes variables pointing to the sender and variables pointing to the list of slots for the signal;
[0217] The transmitter includes a receiver list, and the receiver list is used to store variables pointing to receivers;
[0218] During the signal connection process, the receiver takes the variable pointing to the transmitter and the...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


