]> git.mxchange.org Git - hub.git/commitdiff
Added unfinished stuff for multiple messages.
authorRoland Haeder <roland@mxchange.org>
Fri, 14 Mar 2014 23:59:01 +0000 (00:59 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 14 Mar 2014 23:59:01 +0000 (00:59 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/interfaces/package/assembler/class_Assembler.php
application/hub/interfaces/package/class_Receivable.php
application/hub/main/package/assembler/class_PackageAssembler.php
application/hub/main/package/class_NetworkPackage.php
application/hub/main/tasks/network/class_NetworkPackageReaderTask.php

index 0cf5d9fe89867cf3794e1df9b02d610b6a0faba2..b87a91992cdb68536d79b565149f719e217eb5c8 100644 (file)
@@ -45,6 +45,20 @@ interface Assembler extends FrameworkInterface {
         * @return      void
         */
        function handlePendingData ();
+
+       /**
+        * Checks whether the assembler has multiple messages pending
+        *
+        * @return      $isPending      Whether the assembler has multiple messages pending
+        */
+       function ifMultipleMessagesPending ();
+
+       /**
+        * Handles multiple messages.
+        *
+        * @return      void
+        */
+       function handleMultipleMessages ();
 }
 
 // [EOF]
index 33bd24c1fe3c85e19b838005700feb28e114a65e..55e081b5fcd459d9bad8a231932040967345c5cd 100644 (file)
@@ -121,6 +121,20 @@ interface Receivable extends FrameworkInterface {
         * @return      void
         */
        function handleRawData (array $decodedData);
+
+       /**
+        * Checks whether the assembler has multiple messages pending
+        *
+        * @return      $isPending      Whether the assembler has multiple messages pending
+        */
+       function ifMultipleMessagesPending ();
+
+       /**
+        * Handles multiple messages.
+        *
+        * @return      void
+        */
+       function handleMultipleMessages ();
 }
 
 // [EOF]
index 2325b9f99d06e0cbf5c1261d44eeb072585764ce..263300aa00b6e74d881fa6f962a343c7c96eb27a 100644 (file)
@@ -194,6 +194,29 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable,
                return $ifPendingDataIsEmpty;
        }
 
+       /**
+        * Checks whether the assembler has multiple messages pending
+        *
+        * @return      $isPending      Whether the assembler has multiple messages pending
+        */
+       public function ifMultipleMessagesPending () {
+               // Determine it
+               $isPending = (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_MULTIPLE_MESSAGE);
+
+               // Return it
+               return $isPending;
+       }
+
+       /**
+        * Handles multiple messages.
+        *
+        * @return      void
+        * @todo        0% done
+        */
+       public function handleMultipleMessages () {
+               $this->partialStub('Unfinished method.');
+       }
+
        /**
         * Handles the assembler's pending data
         *
index faf9f17035151bfb904e3fd708d52d655e393e06..d6ee7e20d0911648e3ce2ff1792f8011c07a6033 100644 (file)
@@ -1009,6 +1009,19 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                return $isHandled;
        }
 
+       /**
+        * Checks whether the assembler has multiple packages pending
+        *
+        * @return      $isPending      Whether the assembler has multiple packages pending
+        */
+       public function ifMultipleMessagesPending () {
+               // Determine if the stack is not empty
+               $isPending = (!$this->getAssemblerInstance()->ifMultipleMessagesPending());
+
+               // Return it
+               return $isPending;
+       }
+
        /**
         * Handles the attached assemler's pending data queue to be finally
         * assembled to the raw package data back.
@@ -1020,6 +1033,16 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                $this->getAssemblerInstance()->handlePendingData();
        }
 
+       /**
+        * Handles multiple messages.
+        *
+        * @return      void
+        */
+       public function handleMultipleMessages () {
+               // Handle it
+               $this->getAssemblerInstance()->handleMultipleMessages();
+       }
+
        /**
         * Assembles incoming decoded data so it will become an abstract network
         * package again. The assembler does later do it's job by an other task,
index 98386f01539af6fc690fceacf3e5cba865ed2b5f..820a0d9ac5c34613aba8db0b6398ea50ba6a3edb 100644 (file)
@@ -100,6 +100,11 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
                         * for further details (what array elements are required et cetera).
                         */
                        $packageInstance->assembleDecodedDataToPackage();
+               } elseif ($packageInstance->ifMultipleMessagesPending()) {
+                       /*
+                        * Some raw data contained multiple messages which where now splitted.
+                        */
+                       $packageInstance->handleMultipleMessages();
                } elseif ($packageInstance->isNewRawDataPending($this->getListenerPoolInstance())) {
                        // Raw, decoded data has been received
                        $packageInstance->handleIncomingDecodedData();