]> git.mxchange.org Git - core.git/commitdiff
Also these methods must go through iterator.
authorRoland Haeder <roland@mxchange.org>
Sat, 31 May 2014 11:42:39 +0000 (13:42 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 31 May 2014 11:42:39 +0000 (13:42 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/interfaces/block/class_Block.php
inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php
inc/classes/main/file_directories/class_BaseFile.php
inc/classes/main/index/class_BaseIndex.php
inc/classes/main/iterator/file/class_FileIterator.php
inc/classes/main/stacker/file/class_BaseFileStack.php

index 59b9f4fc9c93c44e47ca472a18ad2af57a7dcdff..056785a931effae2cc61b681ed7696624559107e 100644 (file)
@@ -59,6 +59,53 @@ interface Block extends FrameworkInterface {
         * @return      $fileName       The current file name
         */
        function getFileName ();
+
+       /**
+        * Initializes counter for valid entries, arrays for damaged entries and
+        * an array for gap seek positions. If you call this method on your own,
+        * please re-analyze the file structure. So you are better to call
+        * analyzeFile() instead of this method.
+        *
+        * @return      void
+        */
+       function initCountersGapsArray ();
+
+       /**
+        * Getter for header size
+        *
+        * @return      $totalEntries   Size of file header
+        */
+       function getHeaderSize ();
+
+       /**
+        * Setter for header size
+        *
+        * @param       $headerSize             Size of file header
+        * @return      void
+        */
+       function setHeaderSize ($headerSize);
+
+       /**
+        * Getter for header array
+        *
+        * @return      $totalEntries   Size of file header
+        */
+       function getHeader ();
+
+       /**
+        * Setter for header
+        *
+        * @param       $header         Array for a file header
+        * @return      void
+        */
+       function setHeader (array $header);
+
+       /**
+        * Updates seekPosition attribute from file to avoid to much access on file.
+        *
+        * @return      void
+        */
+       function updateSeekPosition ();
 }
 
 // [EOF]
index 4cc67da68ea7008a7bfd28c7b27cfd25778be199..7a642c7e786c1b172f1fdbe36fc75128b8a8b879 100644 (file)
@@ -110,6 +110,28 @@ interface SeekableWritableFileIterator extends SeekableIterator {
         * @return      void
         */
        function setHeaderSize ($headerSize);
+
+       /**
+        * Getter for header array
+        *
+        * @return      $totalEntries   Size of file header
+        */
+       function getHeader ();
+
+       /**
+        * Setter for header
+        *
+        * @param       $header         Array for a file header
+        * @return      void
+        */
+       function setHeader (array $header);
+
+       /**
+        * Updates seekPosition attribute from file to avoid to much access on file.
+        *
+        * @return      void
+        */
+       function updateSeekPosition ();
 }
 
 // [EOF]
index a04877c869ea40fbe7b8f60f526400f508c92a2c..7d07de9af4ebc55cdebaf7c29d359c1118f8d3da 100644 (file)
@@ -231,7 +231,7 @@ y    * @return      void
         *
         * @return      $totalEntries   Size of file header
         */
-       protected final function getHeade () {
+       public final function getHeader () {
                // Get it
                return $this->header;
        }
@@ -242,7 +242,7 @@ y    * @return      void
         * @param       $header         Array for a file header
         * @return      void
         */
-       protected final function setHeader (array $header) {
+       public final function setHeader (array $header) {
                // Set it
                $this->header = $header;
        }
@@ -273,7 +273,7 @@ y    * @return      void
         *
         * @return      void
         */
-       protected function updateSeekPosition () {
+       public function updateSeekPosition () {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
 
                // Get key (= seek position)
index 45bbebceef49527940185ca56126e4bfeb2c25ac..9791051eb918a387761368aa013341e52d1a5eab 100644 (file)
@@ -66,7 +66,7 @@ class BaseIndex extends BaseFrameworkSystem {
                $data = substr($data, 0, -1);
 
                // And update seek position
-               $this->updateSeekPosition();
+               $this->getIteratorInstance()->updateSeekPosition();
 
                /*
                 * Now split it:
@@ -77,7 +77,7 @@ class BaseIndex extends BaseFrameworkSystem {
                $header = explode(chr(BaseFile::SEPARATOR_HEADER_DATA), $data);
 
                // Set it here
-               $this->setHeader($header);
+               $this->getIteratorInstance()->setHeader($header);
 
                // Check if the array has only 3 elements
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE)));
index dce60bfd7edab3d1e9ea19a9c49b088cbf723bd8..35ceedd7b0e1505441977bdda03adfdecf90fe07 100644 (file)
@@ -227,6 +227,37 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator
                // Call block instance
                $this->getBlockInstance()->setHeaderSize($headerSize);
        }
+
+       /**
+        * Getter for header array
+        *
+        * @return      $totalEntries   Size of file header
+        */
+       public final function getHeader () {
+               // Call block instance
+               return $this->getBlockInstance()->getHeader();
+       }
+
+       /**
+        * Setter for header
+        *
+        * @param       $header         Array for a file header
+        * @return      void
+        */
+       public final function setHeader (array $header) {
+               // Call block instance
+               $this->getBlockInstance()->setHeader($header);
+       }
+
+       /**
+        * Updates seekPosition attribute from file to avoid to much access on file.
+        *
+        * @return      void
+        */
+       public function updateSeekPosition () {
+               // Call block instance
+               $this->getBlockInstance()->updateSeekPosition();
+       }
 }
 
 // [EOF]
index abbcc775c66ea1430307cd72c894015f3a4f9a46..5601d92923d005ad2c1796b9b54107a0ebef0c64 100644 (file)
@@ -67,7 +67,7 @@ class BaseFileStack extends BaseStacker {
                $data = substr($data, 0, -1);
 
                // And update seek position
-               $this->updateSeekPosition();
+               $this->getIteratorInstance()->updateSeekPosition();
 
                /*
                 * Now split it:
@@ -79,7 +79,7 @@ class BaseFileStack extends BaseStacker {
                $header = explode(chr(BaseFile::SEPARATOR_HEADER_DATA), $data);
 
                // Set header here
-               $this->setHeader($header);
+               $this->getIteratorInstance()->setHeader($header);
 
                // Check if the array has only 3 elements
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE)));