dummy

0.1 框架图


        +-------------------+     +----------------+              |      RingBuffer       |
        |  MessageHandler   |     |    DataSink    |         ---->|-----------------------|
        |-------------------|     |----------------|        /     |      mBufHead         |
        |  mMessageQueue    |     |   mRingBuffer  |-------/      |      mBufLength       |
        |  mMessageHandler  |     |   m_dataSize   | mRingBuffer  |-----------------------|
        |-------------------|     |----------------|              |  get[Write/Read]Head  |
        |   handleMessage   |     |  onDataArrive  |              |  submit[Write/Read]   |
        +-------------------+     +----------------+              +-----------------------+
                △                       △   ^
                |                       |   |
                +-----------+-----------+   +-------------------------------------------------------------------------------+
                            |                                                  +------------+                               |
                            |                                                  |            |                               |
                   +-----------------+                                         |            |                               |
         +-------> |    LogPool      |                                         v            |                               |
         |         |-----------------|  mFilterHead                      +-----------+      |                               |
         |         |   mFilterHead   |◇ -------------------------------->| LogFilter |      |                               |
         |         |-----------------|                                   |-----------|      |                               |
         |         |   attachFilter  |                                   |  m_next   |◇ ----+                               |
         |         |   detachFilter  |                                   |-----------|  m_next                              |
         |         |                 |                                   | pushBlock |                                      |
         |         |   onDataArrive  |                                   +-----------+                                      |
         |         |   receiveData   |                                     △   △   △                                        |
         |         |                 |                                     |   |   |                                        |
         |         |  handleMessage  |                                     |   |   |                                        |
         |         +-----------------+              +----------------------+   |   +-----------------------+                |
         |                                          |                          |                           |                |
         |                                          |                          |                           |                |
         |         +-----------+           +-----------------+        +----------------+          +-----------------+       |
         |         | LogThread |           |  ConsoleFilter  |        |   FileFilter   |          |  NetworkFilter  |       |
         |         |-----------|           |-----------------|        |----------------|          |-----------------|       |
         |         |           |           |                 |        |                |          |                 |       |
         | Create  |-----------|           |    pushBlock    |        |   pushBlock    |          |    pushBlock    |       |
         +---------|   run     |           +-----------------+        +----------------+          +-----------------+       |
                   +-----------+                                                                                            |
                         |                                                                                                  |
                         |                                                                                                  |
                         |                                                                                                  |
                         ▽                                                                                                  |
              +----------------------+                   +---------------+                                                  |
              |    MessageLooper     |                   |    Logger     |                                                  |
              |----------------------|                   |---------------|    mDataSink                                     |
              |       mMsgQueue      |                   |   mDataSink   |◇ ------------------------------------------------+
              |----------------------|                   |---------------|
              |        run           |                   |     log       |
              +----------------------+                   +---------------+