Advanced Chunk Processing Library 0.2.0
A comprehensive C++ library for advanced data chunking strategies and processing operations
Loading...
Searching...
No Matches
ChunkList< T > Class Template Reference

#include <data_structures.hpp>

+ Collaboration diagram for ChunkList< T >:

Public Member Functions

void append_chunk (const std::vector< T > &chunk_data)
 
void clear ()
 
bool empty () const
 
std::vector< T > flatten () const
 
void prepend_chunk (const std::vector< T > &chunk_data)
 
size_t size () const
 

Private Attributes

std::shared_ptr< ChunkNode< T > > head_
 
size_t size_ = 0
 
std::shared_ptr< ChunkNode< T > > tail_
 

Detailed Description

template<typename T>
class ChunkList< T >

Definition at line 192 of file data_structures.hpp.

Member Function Documentation

◆ append_chunk()

template<typename T >
void ChunkList< T >::append_chunk ( const std::vector< T > &  chunk_data)
inline

Definition at line 199 of file data_structures.hpp.

199 {
200 auto new_node = std::make_shared<ChunkNode<T>>(chunk_data);
201 if (!head_) {
202 head_ = tail_ = new_node;
203 } else {
204 new_node->prev = tail_;
205 tail_->next = new_node;
206 tail_ = new_node;
207 }
208 ++size_;
209 }
std::shared_ptr< ChunkNode< T > > tail_
std::shared_ptr< ChunkNode< T > > head_

References ChunkList< T >::head_, ChunkList< T >::size_, and ChunkList< T >::tail_.

Referenced by TEST().

◆ clear()

template<typename T >
void ChunkList< T >::clear ( )
inline

Definition at line 240 of file data_structures.hpp.

240 {
241 head_ = tail_ = nullptr;
242 size_ = 0;
243 }

References ChunkList< T >::head_, ChunkList< T >::size_, and ChunkList< T >::tail_.

◆ empty()

template<typename T >
bool ChunkList< T >::empty ( ) const
inline

Definition at line 236 of file data_structures.hpp.

236 {
237 return size_ == 0;
238 }

References ChunkList< T >::size_.

◆ flatten()

template<typename T >
std::vector< T > ChunkList< T >::flatten ( ) const
inline

Definition at line 223 of file data_structures.hpp.

223 {
224 std::vector<T> result;
225 auto current = head_;
226 while (current) {
227 result.insert(result.end(), current->data.begin(), current->data.end());
228 current = current->next;
229 }
230 return result;
231 }

References ChunkList< T >::head_.

Referenced by TEST().

◆ prepend_chunk()

template<typename T >
void ChunkList< T >::prepend_chunk ( const std::vector< T > &  chunk_data)
inline

Definition at line 211 of file data_structures.hpp.

211 {
212 auto new_node = std::make_shared<ChunkNode<T>>(chunk_data);
213 if (!head_) {
214 head_ = tail_ = new_node;
215 } else {
216 new_node->next = head_;
217 head_->prev = new_node;
218 head_ = new_node;
219 }
220 ++size_;
221 }

References ChunkList< T >::head_, ChunkList< T >::size_, and ChunkList< T >::tail_.

Referenced by TEST().

◆ size()

template<typename T >
size_t ChunkList< T >::size ( ) const
inline

Definition at line 233 of file data_structures.hpp.

233 {
234 return size_;
235 }

References ChunkList< T >::size_.

Member Data Documentation

◆ head_

template<typename T >
std::shared_ptr<ChunkNode<T> > ChunkList< T >::head_
private

◆ size_

template<typename T >
size_t ChunkList< T >::size_ = 0
private

◆ tail_

template<typename T >
std::shared_ptr<ChunkNode<T> > ChunkList< T >::tail_
private

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