J4 ›› 2016, Vol. 38 ›› Issue (03): 437-442.
• 论文 • Previous Articles Next Articles
ZENG Yingchao,WANG Maozhi,FENG Weihuan
Received:
Revised:
Online:
Published:
Abstract:
When objects communicate with others across different DLLs or threads, the system coupling degree can be easily increased. In order to solve this problem, using the idea of Event model in Action Script 3.0 and the computer bus communication for reference, we design a lightweight object communication mechanism based on C++11. This lightweight object communication mechanism uses events as the message carrier, which can not only be transmitted and forms an event stream on the bus, but also can be caught by the objects with corresponding listener types. Objects or DLLs essentially interact with the bus, and the interface between the two is predefined events, thus the coupling between objects can be effectively reduced. This mechanism builds a twolayer architecture: the transport layer and the adaptation layer. The DLL belonging to the transport layer will load the DLL provided by the adaptation layer through implicit linking. The DLL provided by the adaptation layer contains a static object queue, a static event queue and a bus, thus all the individual objects in the adaptation layer can easily and safely complete the interaction between objects by calling its own member functions.
Key words: communication mechanism;crossDLL communication;software bus;crossthread communication;loose coupling
ZENG Yingchao,WANG Maozhi,FENG Weihuan. Design and implementation of a lightweight object communication mechanism [J]. J4, 2016, 38(03): 437-442.
0 / / Recommend
Add to citation manager EndNote|Ris|BibTeX
URL: http://joces.nudt.edu.cn/EN/
http://joces.nudt.edu.cn/EN/Y2016/V38/I03/437