mirror of
https://github.com/xfarrow/lasd.git
synced 2025-06-05 21:49:14 +02:00
Library 3
Added template
This commit is contained in:
10
librerie/exercise3/stack/lst/stacklst.cpp
Normal file
10
librerie/exercise3/stack/lst/stacklst.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
// ...
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
90
librerie/exercise3/stack/lst/stacklst.hpp
Normal file
90
librerie/exercise3/stack/lst/stacklst.hpp
Normal 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
|
61
librerie/exercise3/stack/stack.hpp
Normal file
61
librerie/exercise3/stack/stack.hpp
Normal 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
|
10
librerie/exercise3/stack/vec/stackvec.cpp
Normal file
10
librerie/exercise3/stack/vec/stackvec.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
// ...
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
101
librerie/exercise3/stack/vec/stackvec.hpp
Normal file
101
librerie/exercise3/stack/vec/stackvec.hpp
Normal 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
|
Reference in New Issue
Block a user