- ItemBufferCore:
- New Class for storing items in a FIFO style buffer
- FunctionCore:
- Implemented pulled input:
- Function creates static output: StoredOutput & StoredOutputLen
- Other Function pulls static output from input linked functions
- FunctionCore-ChannelBuffer:
- Tried to create a processing buffer
- Abandoned for now
67 lines
1.5 KiB
C++
67 lines
1.5 KiB
C++
/*
|
|
* BufferCore.h
|
|
*
|
|
* Created on: 22 July 2017
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
#ifndef REDACORE_ITEMBUFFERCORE_H_
|
|
#define REDACORE_ITEMBUFFERCORE_H_
|
|
|
|
// Standard C/C++ Libraries
|
|
#include <stdlib.h>
|
|
|
|
// redA Libraries
|
|
/* none */
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//***** Data Structures *****//
|
|
|
|
typedef struct SBufferItem TBufferItem;
|
|
|
|
struct SBufferItem {
|
|
void * Entry;
|
|
int Size;
|
|
|
|
TBufferItem * NextItem;
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//***** Function Prototypes *****//
|
|
|
|
class CItemBufferCore
|
|
{
|
|
protected:
|
|
// Parameters
|
|
bool CopyEntries; // Make copies of entries and destroy them when done?
|
|
|
|
// Events
|
|
TBufferItem * FirstItem;
|
|
TBufferItem ** LastItem;
|
|
|
|
// Item Life cycle
|
|
TBufferItem * CreateItem( void * Entry, int Size );
|
|
bool DestroyItem( TBufferItem ** BufferItem );
|
|
|
|
virtual bool DestroyEntry( void ** Entry );
|
|
|
|
public:
|
|
// Initiate object
|
|
CItemBufferCore( bool pCopyEntries );
|
|
virtual ~CItemBufferCore();
|
|
|
|
// Buffer Operations
|
|
bool Push( void * Entry, int Size );
|
|
void * Pop( int * Size = NULL );
|
|
void * Peek( int * Size = NULL );
|
|
bool Delete();
|
|
void DeleteAll();
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_ITEMBUFFERCORE_H_ */
|
|
|