*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2014 Core Developer Team
+ * @copyright Copyright (c) 2015 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class FiFoFileStack extends BaseFileStack implements StackableFile, Registerable {
+class FiFoFileStack extends BaseFileStack implements StackableFile, CalculatableBlock, Registerable {
/**
* Protected constructor
*
* Creates an instance of this class
*
* @param $fileName Absolute Name of stack file
+ * @param $type Type of this stack (e.g. url_source for URL sources)
* @return $stackInstance An instance of a Stackable class
*/
- public final static function createFiFoFileStack ($fileName) {
+ public final static function createFiFoFileStack ($fileName, $type) {
// Get new instance
$stackInstance = new FiFoFileStack();
// Init this stack
- $stackInstance->initFileStack($fileName);
+ $stackInstance->initFileStack($fileName, $type);
// Return the prepared instance
return $stackInstance;
* @throws StackerFullException If the stack is full
*/
public function pushNamed ($stackerName, $value) {
- $this->partialStub('stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . $value);
+ // Call the protected method
+ parent::addValue($stackerName, $value);
}
/**
- * 'Pops' a value from a named stacker
+ * 'Pops' a value from a named stacker and returns it's value
*
* @param $stackerName Name of the stack
- * @return void
+ * @return $value Value of the current stack entry
* @throws NoStackerException If the named stacker was not found
* @throws EmptyStackerException If the named stacker is empty
*/
public function popNamed ($stackerName) {
- $this->partialStub('stackerName=' . $stackerName);
+ // Get the value
+ $value = $this->getNamed($stackerName);
+
+ // Call the protected method
+ parent::popFirst($stackerName);
+
+ // Return the value
+ return $value;
}
/**
* @throws EmptyStackerException If the named stacker is empty
*/
public function getNamed ($stackerName) {
- $this->partialStub('stackerName=' . $stackerName);
+ // Call the protected method
+ return parent::getFirstValue($stackerName);
}
/**
* @return $size Size (in bytes) of file
*/
public function size () {
- $this->partialStub();
+ // Call the iterator instance
+ return $this->getIteratorInstance()->size();
}
}