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/queue/lst/queuelst.cpp
Normal file
10
librerie/exercise3/queue/lst/queuelst.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
// ...
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
90
librerie/exercise3/queue/lst/queuelst.hpp
Normal file
90
librerie/exercise3/queue/lst/queuelst.hpp
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
#ifndef QUEUELST_HPP
|
||||
#define QUEUELST_HPP
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../queue.hpp"
|
||||
#include "../../list/list.hpp"
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename Data>
|
||||
class QueueLst { // Must extend Queue<Data> and List<Data>
|
||||
|
||||
private:
|
||||
|
||||
// ...
|
||||
|
||||
protected:
|
||||
|
||||
// using List<Data>::???;
|
||||
|
||||
// ...
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
// QueueLst() specifier;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific constructor
|
||||
// QueueLst(argument) specifiers; // A queue obtained from a LinearContainer
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Copy constructor
|
||||
// QueueLst(argument);
|
||||
|
||||
// Move constructor
|
||||
// QueueLst(argument);
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Destructor
|
||||
// ~QueueLst() 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 Queue)
|
||||
|
||||
// type Enqueue(argument) specifiers; // Override Queue member (copy of the value)
|
||||
// type Enqueue(argument) specifiers; // Override Queue member (move of the value)
|
||||
// type Head() specifiers; // Override Queue member (must throw std::length_error when empty)
|
||||
// type Dequeue() specifiers; // Override Queue member (must throw std::length_error when empty)
|
||||
// type HeadNDequeue() specifiers; // Override Queue member (must throw std::length_error when empty)
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific member functions (inherited from Container)
|
||||
|
||||
// type Clear() specifiers; // Override Container member
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
||||
#include "queuelst.cpp"
|
||||
|
||||
#endif
|
61
librerie/exercise3/queue/queue.hpp
Normal file
61
librerie/exercise3/queue/queue.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
#ifndef QUEUE_HPP
|
||||
#define QUEUE_HPP
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../container/container.hpp"
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename Data>
|
||||
class Queue { // Must extend Container
|
||||
|
||||
private:
|
||||
|
||||
// ...
|
||||
|
||||
protected:
|
||||
|
||||
// ...
|
||||
|
||||
public:
|
||||
|
||||
// Destructor
|
||||
// ~Queue() 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 Enqueue(argument) specifiers; // Copy of the value
|
||||
// type Enqueue(argument) specifiers; // Move of the value
|
||||
// type Head() specifiers; // (concrete function must throw std::length_error when empty)
|
||||
// type Dequeue() specifiers; // (concrete function must throw std::length_error when empty)
|
||||
// type HeadNDequeue() specifiers; // (concrete function must throw std::length_error when empty)
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
||||
#endif
|
10
librerie/exercise3/queue/vec/queuevec.cpp
Normal file
10
librerie/exercise3/queue/vec/queuevec.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
// ...
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
102
librerie/exercise3/queue/vec/queuevec.hpp
Normal file
102
librerie/exercise3/queue/vec/queuevec.hpp
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
#ifndef QUEUEVEC_HPP
|
||||
#define QUEUEVEC_HPP
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../queue.hpp"
|
||||
#include "../../vector/vector.hpp"
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename Data>
|
||||
class QueueVec { // Must extend Queue<Data> and Vector<Data>
|
||||
|
||||
private:
|
||||
|
||||
// ...
|
||||
|
||||
protected:
|
||||
|
||||
// using Vector<Data>::???;
|
||||
|
||||
// ...
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
// QueueVec() specifier;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific constructor
|
||||
// QueueVec(argument) specifiers; // A queue obtained from a LinearContainer
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Copy constructor
|
||||
// QueueVec(argument);
|
||||
|
||||
// Move constructor
|
||||
// QueueVec(argument);
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Destructor
|
||||
// ~QueueVec() 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 Queue)
|
||||
|
||||
// type Enqueue(argument) specifiers; // Override Queue member (copy of the value)
|
||||
// type Enqueue(argument) specifiers; // Override Queue member (move of the value)
|
||||
// type Head() specifiers; // Override Queue member (must throw std::length_error when empty)
|
||||
// type Dequeue() specifiers; // Override Queue member (must throw std::length_error when empty)
|
||||
// type HeadNDequeue() specifiers; // Override Queue 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;
|
||||
// type SwapVectors(arguments) specifiers;
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
||||
#include "queuevec.cpp"
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user