2 // Import framework stuff
3 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
6 * A ??? file-based stack
8 * @author Roland Haeder <webmaster@ship-simu.org>
10 * @copyright Copyright (c) 2023 Core Developer Team
11 * @license GNU GPL 3.0 or any newer version
12 * @link http://www.ship-simu.org
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 class ???FileStack extends BaseFileStack implements StackableFile, Registerable {
29 * Protected constructor
33 private function __construct () {
34 // Call parent constructor
35 parent::__construct(__CLASS__);
39 * Creates an instance of this class
41 * @param $fileName Absolute Name of stack file
42 * @return $stackInstance An instance of a StackableFile class
44 public final static function create???FileStack ($fileName) {
46 $stackInstance = new ???FileStack();
49 $stackInstance->initStack($fileName);
51 // Return the prepared instance
52 return $stackInstance;
56 * Pushs a value on a named stacker
58 * @param $stackerName Name of the stack
59 * @param $value Value to push on it
61 * @throws StackerFullException If the stack is full
63 public function pushNamed ($stackerName, $value) {
64 DebugMiddleware::getSelfInstance()->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value);
68 * 'Pops' a value from a named stacker
70 * @param $stackerName Name of the stack
72 * @throws NoStackerException If the named stacker was not found
73 * @throws EmptyStackerException If the named stacker is empty
75 public function popNamed ($stackerName) {
76 DebugMiddleware::getSelfInstance()->partialStub('stackerName=' . $stackerName);
80 * Get value from named stacker
82 * @param $stackerName Name of the stack
83 * @return $value Value of last added value
84 * @throws NoStackerException If the named stacker was not found
85 * @throws EmptyStackerException If the named stacker is empty
87 public function getNamed ($stackerName) {
88 DebugMiddleware::getSelfInstance()->partialStub('stackerName=' . $stackerName);
92 * Seeks to given position
94 * @param $seekPosition Seek position in file
97 public function seek ($seekPosition) {
98 DebugMiddleware::getSelfInstance()->partialStub('seekPosition=' . $seekPosition);
104 * @return $size Size (in bytes) of file
106 public function size () {
107 DebugMiddleware::getSelfInstance()->partialStub();