mirror of
https://github.com/xfarrow/lasd.git
synced 2025-02-16 20:20:37 +01:00
403 lines
10 KiB
C++
403 lines
10 KiB
C++
|
|
||
|
#ifndef CONTAINER_HPP
|
||
|
#define CONTAINER_HPP
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include <stdexcept>
|
||
|
#include <functional>
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
namespace lasd {
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
class Container {
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~Container() 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 Empty() specifiers; // (concrete function should not throw exceptions)
|
||
|
|
||
|
// type Size() specifiers; // (concrete function should not throw exceptions)
|
||
|
|
||
|
// type Clear() specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class LinearContainer { // Must extend Container
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~LinearContainer() 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 is possible.
|
||
|
// type operator!=(argument) specifiers; // Comparison of abstract types is possible.
|
||
|
|
||
|
/* ************************************************************************ */
|
||
|
|
||
|
// Specific member functions
|
||
|
|
||
|
// type Front() specifiers; // (concrete function must throw std::length_error when empty)
|
||
|
// type Back() specifiers; // (concrete function must throw std::length_error when empty)
|
||
|
|
||
|
// type operator[](argument) specifiers; // (concrete function must throw std::out_of_range when out of range)
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class TestableContainer { // Must extend Container
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~TestableContainer() 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 Exists(argument) specifiers; // (concrete function should not throw exceptions)
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class MappableContainer { // Must extend Container
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~MappableContainer() 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
|
||
|
|
||
|
// typedef std::function<void(Data&, void*)> MapFunctor;
|
||
|
|
||
|
// type MapPreOrder(arguments) specifiers;
|
||
|
// type MapPostOrder(arguments) specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class FoldableContainer { // Must extend TestableContainer
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~FoldableContainer() 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
|
||
|
|
||
|
// typedef std::function<void(const Data&, const void*, void*) noexcept> FoldFunctor;
|
||
|
|
||
|
// type FoldPreOrder(arguments) specifiers;
|
||
|
// type FoldPostOrder(arguments) specifiers;
|
||
|
|
||
|
// type Exists(argument) specifiers; // Override TestableContainer member
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class InOrderMappableContainer { // Must extend MappableContainer
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~InOrderMappableContainer() 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
|
||
|
|
||
|
// using typename MappableContainer<Data>::MapFunctor;
|
||
|
|
||
|
// type MapInOrder(arguments) specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class InOrderFoldableContainer { // Must extend FoldableContainer
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~InOrderFoldableContainer() 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
|
||
|
|
||
|
// using typename MappableContainer<Data>::MapFunctor;
|
||
|
|
||
|
// type FoldInOrder(arguments) specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class BreadthMappableContainer { // Must extend MappableContainer
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~BreadthMappableContainer() 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
|
||
|
|
||
|
// using typename MappableContainer<Data>::MapFunctor;
|
||
|
|
||
|
// type MapBreadth(arguments) specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
template <typename Data>
|
||
|
class BreadthFoldableContainer { // Must extend FoldableContainer
|
||
|
|
||
|
private:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// ...
|
||
|
|
||
|
public:
|
||
|
|
||
|
// Destructor
|
||
|
// ~BreadthFoldableContainer() 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
|
||
|
|
||
|
// using typename FoldableContainer<Data>::FoldFunctor;
|
||
|
|
||
|
// type FoldBreadth(arguments) specifiers;
|
||
|
|
||
|
};
|
||
|
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
}
|
||
|
|
||
|
#include "container.cpp"
|
||
|
|
||
|
#endif
|