X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ffile_directories%2Fclass_BaseAbstractFile.php;h=69b15b06e72c62750a7cef99579a1ed09b66a95b;hb=510a849a26904971bf3f5b58cf7eca73375c6859;hp=29517f425c0b0c942cf38585d882d9b9c4572f14;hpb=868c877607670760eb36e63ebeb1a04237907be9;p=core.git diff --git a/framework/main/classes/file_directories/class_BaseAbstractFile.php b/framework/main/classes/file_directories/class_BaseAbstractFile.php index 29517f42..69b15b06 100644 --- a/framework/main/classes/file_directories/class_BaseAbstractFile.php +++ b/framework/main/classes/file_directories/class_BaseAbstractFile.php @@ -13,7 +13,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -36,17 +36,57 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint */ private $totalEntries = 0; + /** + * An instance of a file I/O pointer class (not handler) + */ + private $pointerInstance = NULL; + /** * Protected constructor * * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } + /** + * Setter for FilePointer instance + * + * @param $pointerInstance An instance of an FilePointer class + * @return void + */ + protected final function setPointerInstance (FilePointer $pointerInstance) { + $this->pointerInstance = $pointerInstance; + } + + /** + * Getter for FilePointer instance + * + * @return $pointerInstance An instance of an FilePointer class + */ + public final function getPointerInstance () { + return $this->pointerInstance; + } + + /** + * Unsets pointer instance which triggers a call of __destruct() if the + * instance is still there. This is surely not fatal on already "closed" + * file pointer instances. + * + * I don't want to mess around with above setter by giving it a default + * value NULL as setter should always explicitly only set (existing) object + * instances and NULL is NULL. + * + * @return void + */ + protected final function unsetPointerInstance () { + // Simply it to NULL + $this->pointerInstance = NULL; + } + /** * Destructor for cleaning purposes, etc *