]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/file_directories/class_BaseAbstractFile.php
Continued:
[core.git] / framework / main / classes / file_directories / class_BaseAbstractFile.php
index 29517f425c0b0c942cf38585d882d9b9c4572f14..69b15b06e72c62750a7cef99579a1ed09b66a95b 100644 (file)
@@ -13,7 +13,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @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
         *