Library 3

Added template
This commit is contained in:
Alessandro Ferro
2021-04-24 16:58:05 +02:00
parent d080cf6fcc
commit 31bf18d985
46 changed files with 4175 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
namespace lasd {
/* ************************************************************************** */
// ...
/* ************************************************************************** */
}

View File

@@ -0,0 +1,90 @@
#ifndef STACKLST_HPP
#define STACKLST_HPP
/* ************************************************************************** */
#include "../stack.hpp"
#include "../../list/list.hpp"
/* ************************************************************************** */
namespace lasd {
/* ************************************************************************** */
template <typename Data>
class StackLst { // Must extend Stack<Data> and List<Data>
private:
// ...
protected:
// using List<Data>::???;
// ...
public:
// Default constructor
// StackLst() specifier;
/* ************************************************************************ */
// Specific constructor
// StackLst(argument) specifiers; // A stack obtained from a LinearContainer
/* ************************************************************************ */
// Copy constructor
// StackLst(argument);
// Move constructor
// StackLst(argument);
/* ************************************************************************ */
// Destructor
// ~StackLst() specifier;
/* ************************************************************************ */
// Copy assignment
// type operator=(argument);
// Move assignment
// type operator=(argument);
/* ************************************************************************ */
// Comparison operators
// type operator==(argument) specifiers;
// type operator!=(argument) specifiers;
/* ************************************************************************ */
// Specific member functions (inherited from Stack)
// type Push(argument) specifiers; // Override Stack member (copy of the value)
// type Push(argument) specifiers; // Override Stack member (move of the value)
// type Top() specifiers; // Override Stack member (must throw std::length_error when empty)
// type Pop() specifiers; // Override Stack member (must throw std::length_error when empty)
// type TopNPop() specifiers; // Override Stack member (must throw std::length_error when empty)
/* ************************************************************************ */
// Specific member functions (inherited from Container)
// type Clear() specifiers; // Override Container member
};
/* ************************************************************************** */
}
#include "stacklst.cpp"
#endif

View File

@@ -0,0 +1,61 @@
#ifndef STACK_HPP
#define STACK_HPP
/* ************************************************************************** */
#include "../container/container.hpp"
/* ************************************************************************** */
namespace lasd {
/* ************************************************************************** */
template <typename Data>
class Stack { // Must extend Container
private:
// ...
protected:
// ...
public:
// Destructor
// ~Stack() specifiers
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // Move assignment of abstract types should not be possible.
/* ************************************************************************ */
// Comparison operators
// type operator==(argument) specifiers; // Comparison of abstract types might not be possible.
// type operator!=(argument) specifiers; // Comparison of abstract types might not be possible.
/* ************************************************************************ */
// Specific member functions
// type Push(argument) specifiers; // Copy of the value
// type Push(argument) specifiers; // Move of the value
// type Top() specifiers; // (concrete function must throw std::length_error when empty)
// type Pop() specifiers; // (concrete function must throw std::length_error when empty)
// type TopNPop() specifiers; // (concrete function must throw std::length_error when empty)
};
/* ************************************************************************** */
}
#endif

View File

@@ -0,0 +1,10 @@
namespace lasd {
/* ************************************************************************** */
// ...
/* ************************************************************************** */
}

View File

@@ -0,0 +1,101 @@
#ifndef STACKVEC_HPP
#define STACKVEC_HPP
/* ************************************************************************** */
#include "../stack.hpp"
#include "../../vector/vector.hpp"
/* ************************************************************************** */
namespace lasd {
/* ************************************************************************** */
template <typename Data>
class StackVec { // Must extend Stack<Data> and Vector<Data>
private:
// ...
protected:
// using Vector<Data>::???;
// ...
public:
// Default constructor
// StackVec() specifier;
/* ************************************************************************ */
// Specific constructor
// StackVec(argument) specifiers; // A stack obtained from a LinearContainer
/* ************************************************************************ */
// Copy constructor
// StackVec(argument);
// Move constructor
// StackVec(argument);
/* ************************************************************************ */
// Destructor
// ~StackVec() specifier;
/* ************************************************************************ */
// Copy assignment
// type operator=(argument);
// Move assignment
// type operator=(argument);
/* ************************************************************************ */
// Comparison operators
// type operator==(argument) specifiers;
// type operator!=(argument) specifiers;
/* ************************************************************************ */
// Specific member functions (inherited from Stack)
// type Push(argument) specifiers; // Override Stack member (copy of the value)
// type Push(argument) specifiers; // Override Stack member (move of the value)
// type Top() specifiers; // Override Stack member (must throw std::length_error when empty)
// type Pop() specifiers; // Override Stack member (must throw std::length_error when empty)
// type TopNPop() specifiers; // Override Stack member (must throw std::length_error when empty)
/* ************************************************************************ */
// Specific member functions (inherited from Container)
// type Empty() specifiers; // Override Container member
// type Size() specifiers; // Override Container member
// type Clear() specifiers; // Override Container member
protected:
// Auxiliary member functions
// type Expand() specifiers;
// type Reduce() specifiers;
};
/* ************************************************************************** */
}
#include "stackvec.cpp"
#endif