Important Update:
- 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
This commit is contained in:
66
ItemBufferCore.h
Normal file
66
ItemBufferCore.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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_ */
|
||||
|
||||
Reference in New Issue
Block a user