ORIGINAL
Loading...
Searching...
No Matches
original::set< K_TYPE, ALLOC > Class Template Referenceabstract

Abstract base class for unique element containers. More...

#include <set.h>

Inheritance diagram for original::set< K_TYPE, ALLOC >:
Inheritance graph
Collaboration diagram for original::set< K_TYPE, ALLOC >:
Collaboration graph

Public Member Functions

virtual bool add (const K_TYPE &e)=0
 Adds a new element to the set.
 
virtual bool remove (const K_TYPE &e)=0
 Removes an element from the set.
 
 ~set () override
 Destructor implementation.
 
- Public Member Functions inherited from original::container< TYPE, ALLOC >
virtual u_integer size () const =0
 Gets the number of elements in the container.
 
bool empty () const
 Checks if the container is empty.
 
virtual bool contains (const TYPE &e) const =0
 Checks if an element is contained in the container.
 
virtual ~container ()=default
 Destructor for the container class.
 

Protected Member Functions

 set (ALLOC alloc=ALLOC{})
 Constructor implementation.
 
- Protected Member Functions inherited from original::container< TYPE, ALLOC >
 container (ALLOC alloc=ALLOC{})
 Constructs a container with specified allocator.
 
TYPE * allocate (u_integer size)
 Allocates raw memory for elements.
 
void deallocate (TYPE *ptr, u_integer size)
 Deallocates memory previously allocated by allocate()
 
template<typename O_TYPE, typename... Args>
void construct (O_TYPE *o_ptr, Args &&... args)
 Constructs an element in-place.
 
template<typename O_TYPE>
void destroy (O_TYPE *o_ptr)
 Destroys an element.
 

Additional Inherited Members

- Protected Attributes inherited from original::container< TYPE, ALLOC >
ALLOC allocator
 The allocator instance used for memory management.
 

Detailed Description

template<typename K_TYPE, typename ALLOC = allocator<K_TYPE>>
class original::set< K_TYPE, ALLOC >

Abstract base class for unique element containers.

Template Parameters
K_TYPEThe element type (must support equality comparison)
ALLOCAllocator type for memory management (default: allocator)

This abstract class defines the common interface for all set implementations in the framework. Concrete implementations should inherit from this class and provide the actual storage mechanism.

The set guarantees:

  • Unique elements (no duplicates)
  • Efficient membership testing
  • Type-safe operations
  • Exception safety
Note
This class is not meant to be instantiated directly - use concrete implementations like hashSet or treeSet instead.

Constructor & Destructor Documentation

◆ set()

template<typename K_TYPE, typename ALLOC>
original::set< K_TYPE, ALLOC >::set ( ALLOC alloc = ALLOC{})
explicitprotected

Constructor implementation.

Template Parameters
K_TYPEThe element type
ALLOCThe allocator type
Parameters
allocAllocator to use for memory management

Initializes the base container with the provided allocator

◆ ~set()

template<typename K_TYPE, typename ALLOC>
original::set< K_TYPE, ALLOC >::~set ( )
overridedefault

Destructor implementation.

Template Parameters
K_TYPEThe element type
ALLOCThe allocator type

Default implementation allows proper destruction through base pointer

Member Function Documentation

◆ add()

template<typename K_TYPE, typename ALLOC = allocator<K_TYPE>>
virtual bool original::set< K_TYPE, ALLOC >::add ( const K_TYPE & e)
pure virtual

Adds a new element to the set.

Parameters
eThe element to add
Returns
true if the element was added successfully, false if the element already exists

◆ remove()

template<typename K_TYPE, typename ALLOC = allocator<K_TYPE>>
virtual bool original::set< K_TYPE, ALLOC >::remove ( const K_TYPE & e)
pure virtual

Removes an element from the set.

Parameters
eThe element to remove
Returns
true if the element was removed, false if the element didn't exist

The documentation for this class was generated from the following file: