From: Roland Haeder Date: Sat, 31 May 2014 11:42:39 +0000 (+0200) Subject: Also these methods must go through iterator. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6139ad59a501171e42f9766eb61f8a9113dd65de;p=core.git Also these methods must go through iterator. Signed-off-by: Roland Häder --- diff --git a/inc/classes/interfaces/block/class_Block.php b/inc/classes/interfaces/block/class_Block.php index 59b9f4fc..056785a9 100644 --- a/inc/classes/interfaces/block/class_Block.php +++ b/inc/classes/interfaces/block/class_Block.php @@ -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] diff --git a/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php b/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php index 4cc67da6..7a642c7e 100644 --- a/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php +++ b/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php @@ -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] diff --git a/inc/classes/main/file_directories/class_BaseFile.php b/inc/classes/main/file_directories/class_BaseFile.php index a04877c8..7d07de9a 100644 --- a/inc/classes/main/file_directories/class_BaseFile.php +++ b/inc/classes/main/file_directories/class_BaseFile.php @@ -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) diff --git a/inc/classes/main/index/class_BaseIndex.php b/inc/classes/main/index/class_BaseIndex.php index 45bbebce..9791051e 100644 --- a/inc/classes/main/index/class_BaseIndex.php +++ b/inc/classes/main/index/class_BaseIndex.php @@ -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))); diff --git a/inc/classes/main/iterator/file/class_FileIterator.php b/inc/classes/main/iterator/file/class_FileIterator.php index dce60bfd..35ceedd7 100644 --- a/inc/classes/main/iterator/file/class_FileIterator.php +++ b/inc/classes/main/iterator/file/class_FileIterator.php @@ -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] diff --git a/inc/classes/main/stacker/file/class_BaseFileStack.php b/inc/classes/main/stacker/file/class_BaseFileStack.php index abbcc775..5601d929 100644 --- a/inc/classes/main/stacker/file/class_BaseFileStack.php +++ b/inc/classes/main/stacker/file/class_BaseFileStack.php @@ -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)));