• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

J4 ›› 2016, Vol. 38 ›› Issue (03): 437-442.

• 论文 • Previous Articles     Next Articles

Design and implementation of a lightweight
object communication mechanism  

ZENG Yingchao,WANG Maozhi,FENG Weihuan   

  1. (Geomathematics Key Laboratory of Sichuan Province,Chengdu University of Technology,Chengdu 610059,China)
  • Received:2015-04-07 Revised:2015-05-26 Online:2016-03-25 Published:2016-03-25

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 twolayer 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;crossDLL communication;software bus;crossthread communication;loose coupling