Important Update:
- Library Clean up: - Removed all unused C/C++ libraries from source - First C/C++ libraries then redA libraries - Library changes: - renamed BufferCore -> CharBufferCore - added ItemBufferCore - CharBufferCore: - Derive RollingBuffer & ShiftBuffer from common class CharBuffer - CharBuffer is mostly a virtual class (interface)
This commit is contained in:
@@ -5,16 +5,14 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "WatchdogCore.h"
|
||||
#include "FileCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#ifndef REDACORE_APPLICATIONCORE_H_
|
||||
#define REDACORE_APPLICATIONCORE_H_
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "SignalCore.h"
|
||||
#include "TimingCore.h"
|
||||
@@ -17,10 +20,6 @@
|
||||
#include "FunctionCore.h"
|
||||
#include "SelectableCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Preview
|
||||
|
||||
130
BufferCore.h
130
BufferCore.h
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* BufferCore.h
|
||||
*
|
||||
* Created on: 18 May 2016
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
#ifndef REDACORE_BUFFERCORE_H_
|
||||
#define REDACORE_BUFFERCORE_H_
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/** Shift and Rolling buffer class
|
||||
*
|
||||
* Shifting buffer:
|
||||
* Data is either set at start of buffer or appended to buffer
|
||||
* Start of buffered data is always at beginning of buffer
|
||||
* Never rolls over (option to over overwrite if data longer than buffer)
|
||||
* Shifts unsused data to left when clearing used data
|
||||
* Always zero terminates buffer
|
||||
* Can look directly at buffer
|
||||
*
|
||||
* Rolling buffer:
|
||||
* Data is continuosly assigned to buffer
|
||||
* Start of buffer is tracked by references (can be anywhere)
|
||||
* Data rolls over to start of buffer if end of buffer reached (option to overwrite start)
|
||||
* Data is never shifted/moved inside buffer, only references are adjusted
|
||||
* Never zero terminates buffer
|
||||
* Can only look at data by copying (stitching) to another buffer
|
||||
*/
|
||||
|
||||
class CRollingBuffer
|
||||
{
|
||||
private:
|
||||
// Buffer Definition
|
||||
char * Buffer; // Memory allocated to buffer
|
||||
const int BufSize; // Size of allocated buffer
|
||||
int BufLen; // Total unread characters in buffer
|
||||
|
||||
// Temporary output buffer
|
||||
char * OutBuffer; // Temporary output buffer for "stitched" (rollover) data
|
||||
|
||||
// Buffer pointers
|
||||
int BufStart; // First unread characters in buffer
|
||||
int BufEnd; // Next write position for new data (End of unread data + 1)
|
||||
|
||||
public:
|
||||
// Life Cycle
|
||||
CRollingBuffer( int BufferSize );
|
||||
~CRollingBuffer();
|
||||
|
||||
// Direct Operations
|
||||
int Reset(); // Clear buffer and reset all pointers to start of buffer
|
||||
|
||||
// Reading from buffer
|
||||
char PeekChar( int Pos = 0 ); // Return one character from buffer (do not remove from buffer
|
||||
int PeekDirect( char ** Data, int PeekPos = 0 ); // Return contiguous data pointer direct to buffer (continguous data couont returned)
|
||||
int Peek( char ** Data, int PeekPos = 0, int MaxLen = -1 ); // Return stiched data copied to temporary output buffer
|
||||
int PeekCopy( char ** Data, int PeekPos = 0, int MaxLen = -1 ); // Return stiched data copied to supplied pointer (create if not exist)
|
||||
|
||||
bool FindStr( const char * SearchStr, int SearchLen, int &FoundPos, int StartPos = 0 ); // Search buffer directly
|
||||
|
||||
// Change data on buffer
|
||||
int Push( bool Overwrite, const char * Data, int Len = -1 );
|
||||
int Clear( int ClearLen = -1 );
|
||||
|
||||
int Pop( char ** Data, int MaxLen = -1 );
|
||||
int PopCopy( char ** Data, int MaxLen = -1 );
|
||||
|
||||
// File operations
|
||||
int ReadFromFD( int Handle, int MaxRead = -1, bool Overwrite = false );
|
||||
int WriteToFD( int Handle, int MaxWrite = -1 );
|
||||
|
||||
// Miscellaneous
|
||||
int Size() { return BufSize; };
|
||||
int Len() { return BufLen; };
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CShiftBuffer
|
||||
{
|
||||
private:
|
||||
// Buffer Definition
|
||||
char * Buffer; // Memory allocated to buffer
|
||||
const int BufSize; // Size of allocated buffer
|
||||
int BufLen; // Total unread characters in buffer
|
||||
|
||||
// Temporary output buffer
|
||||
char * OutBuffer; // Temporary output buffer for "stitched" (rollover) data
|
||||
|
||||
public:
|
||||
// Life Cycle
|
||||
CShiftBuffer( int BufferSize );
|
||||
~CShiftBuffer();
|
||||
|
||||
// Direct Operations
|
||||
int Reset(); // Clear buffer and reset all pointers to start of buffer
|
||||
|
||||
// Reading from buffer
|
||||
char PeekChar( int Pos = 0 ); // Return one character from buffer (do not remove from buffer
|
||||
int PeekDirect( char ** Data, int PeekPos = 0 ); // Return contiguous data pointer direct to buffer (continguous data couont returned)
|
||||
int Peek( char ** Data, int PeekPos = 0, int MaxLen = -1 ); // Return stiched data copied to temporary output buffer
|
||||
int PeekCopy( char ** Data, int PeekPos = 0, int MaxLen = -1 ); // Return stiched data copied to supplied pointer (create if not exist)
|
||||
|
||||
bool FindStr( const char * SearchStr, int SearchLen, int &FoundPos, int StartPos = 0 ); // Search buffer directly
|
||||
|
||||
// Change data on buffer
|
||||
int Push( bool Overwrite, const char * Data, int Len = -1 );
|
||||
int Clear( int ClearLen = -1 );
|
||||
|
||||
int Pop( char ** Data, int MaxLen = -1 );
|
||||
int PopCopy( char ** Data, int MaxLen = -1 );
|
||||
|
||||
// File operations
|
||||
int ReadFromFD( int Handle, int MaxRead = -1, bool Overwrite = false );
|
||||
int WriteToFD( int Handle, int MaxWrite = -1 );
|
||||
|
||||
// Miscellaneous
|
||||
int Size() { return BufSize; };
|
||||
int Len() { return BufLen; };
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#endif /* REDACORE_BUFFERCORE_H_ */
|
||||
@@ -1,4 +1,4 @@
|
||||
PROJECT(lib_redAcore)
|
||||
|
||||
ADD_LIBRARY(redAcore TimingCore.cpp DateTimeCore.cpp LogCore.cpp SignalCore.cpp DataTreeCore.cpp JSONparseCore.cpp BufferCore.cpp LiteProtocolCore.cpp
|
||||
ADD_LIBRARY(redAcore TimingCore.cpp DateTimeCore.cpp LogCore.cpp SignalCore.cpp DataTreeCore.cpp JSONparseCore.cpp CharBufferCore.cpp LiteProtocolCore.cpp
|
||||
ApplicationCore.cpp FunctionCore.cpp FileCore.cpp SelectCore.cpp SelectableCore.cpp WatchdogCore.cpp DeviceCore.cpp )
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
/*
|
||||
* BufferCore.cpp
|
||||
* CharBufferCore.cpp
|
||||
*
|
||||
* Created on: 18 May 2016
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "BufferCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "CharBufferCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/***** Rolling Buffer *****/
|
||||
/***** Char Buffer *****/
|
||||
|
||||
CRollingBuffer::CRollingBuffer( int BufferSize ) : BufSize( BufferSize )
|
||||
CCharBuffer::CCharBuffer( int BufferSize ) : BufSize( BufferSize )
|
||||
{
|
||||
// Create Buffer
|
||||
if (BufSize)
|
||||
@@ -38,13 +37,11 @@ CRollingBuffer::CRollingBuffer( int BufferSize ) : BufSize( BufferSize )
|
||||
}
|
||||
|
||||
// Set pointers
|
||||
BufStart = 0;
|
||||
BufEnd = 0;
|
||||
BufLen = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CRollingBuffer::~CRollingBuffer()
|
||||
CCharBuffer::~CCharBuffer()
|
||||
{
|
||||
// Destroy Buffer
|
||||
if (Buffer) {
|
||||
@@ -57,19 +54,68 @@ CRollingBuffer::~CRollingBuffer()
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Clear all data from buffer
|
||||
int CRollingBuffer::Reset()
|
||||
int CCharBuffer::Reset()
|
||||
{
|
||||
int BytesCleared = 0;
|
||||
|
||||
// Clear buffer
|
||||
// Reset buffer
|
||||
BytesCleared = BufLen;
|
||||
BufLen = 0;
|
||||
Buffer[0] = 0;
|
||||
|
||||
return BytesCleared;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data in temporary buffer
|
||||
int CCharBuffer::Pop( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Read & clear data
|
||||
BytesWritten = Peek( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
// Return temp buffer
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data copied to pointer which if created if NULL
|
||||
int CCharBuffer::PopCopy( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Copy & clear data
|
||||
BytesWritten = PeekCopy( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
// Return temp buffer
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/***** Rolling Buffer *****/
|
||||
|
||||
CRollingBuffer::CRollingBuffer( int BufferSize ) : CCharBuffer( BufferSize )
|
||||
{
|
||||
// Set pointers
|
||||
BufStart = 0;
|
||||
BufEnd = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Clear all data from buffer
|
||||
int CRollingBuffer::Reset()
|
||||
{
|
||||
// Reset pointers
|
||||
BufStart = 0;
|
||||
BufEnd = 0;
|
||||
BufLen = 0;
|
||||
|
||||
return BytesCleared;
|
||||
return CCharBuffer::Reset();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -357,36 +403,6 @@ int CRollingBuffer::Push( bool Overwrite, const char * Data, int Len )
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data in temporary buffer
|
||||
int CRollingBuffer::Pop( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Read & clear data
|
||||
BytesWritten = Peek( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
// Return temp buffer
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data copied to pointer which if created if NULL
|
||||
int CRollingBuffer::PopCopy( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Copy & clear data
|
||||
BytesWritten = PeekCopy( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
// Return temp buffer
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read File descriptor directly into rolling buffer
|
||||
int CRollingBuffer::ReadFromFD( int Handle, int MaxRead, bool Overwrite )
|
||||
{
|
||||
@@ -476,52 +492,9 @@ int CRollingBuffer::WriteToFD( int Handle, int MaxLen )
|
||||
|
||||
/***** Shifting Buffer *****/
|
||||
|
||||
CShiftBuffer::CShiftBuffer( int BufferSize ) : BufSize( BufferSize )
|
||||
CShiftBuffer::CShiftBuffer( int BufferSize ) :
|
||||
CCharBuffer( BufferSize )
|
||||
{
|
||||
// Create Buffer
|
||||
if (BufSize)
|
||||
{
|
||||
// Create Buffer
|
||||
Buffer = (char *)malloc( BufSize+1 );
|
||||
Buffer[0] = 0;
|
||||
|
||||
// Create temp output buffer big enough to handle all data
|
||||
OutBuffer = (char *)malloc( BufSize+1 );
|
||||
}
|
||||
else {
|
||||
// No buffers created
|
||||
Buffer = NULL;
|
||||
OutBuffer = NULL;
|
||||
}
|
||||
|
||||
// Set vars
|
||||
BufLen = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CShiftBuffer::~CShiftBuffer()
|
||||
{
|
||||
// Destroy Buffer
|
||||
if (Buffer) {
|
||||
free( Buffer );
|
||||
}
|
||||
if (OutBuffer) {
|
||||
free( OutBuffer );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Clear all data from buffer
|
||||
int CShiftBuffer::Reset()
|
||||
{
|
||||
int BytesCleared = 0;
|
||||
|
||||
// Reset buffer
|
||||
BytesCleared = BufLen;
|
||||
BufLen = 0;
|
||||
Buffer[0] = 0;
|
||||
|
||||
return BytesCleared;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -749,35 +722,6 @@ int CShiftBuffer::Push( bool Overwrite, const char * Data, int Len )
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data in temporary buffer
|
||||
int CShiftBuffer::Pop( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Read and clear bytes
|
||||
BytesWritten = Peek( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read first-in bytes from buffer
|
||||
// Return "stitched" buffer data copied to pointer which if created if NULL
|
||||
int CShiftBuffer::PopCopy( char ** Data, int MaxLen )
|
||||
{
|
||||
int BytesWritten = 0;
|
||||
|
||||
// Copy and clear bytes
|
||||
BytesWritten = PeekCopy( Data, 0, MaxLen );
|
||||
Clear( BytesWritten );
|
||||
|
||||
// Return temp buffer
|
||||
return BytesWritten;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Read File descriptor directly into buffer
|
||||
int CShiftBuffer::ReadFromFD( int Handle, int MaxRead, bool Overwrite )
|
||||
{
|
||||
146
CharBufferCore.h
Normal file
146
CharBufferCore.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* CharBufferCore.h
|
||||
*
|
||||
* Created on: 18 May 2016
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
#ifndef REDACORE_CHARBUFFERCORE_H_
|
||||
#define REDACORE_CHARBUFFERCORE_H_
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/** Shift and Rolling buffer class
|
||||
*
|
||||
* Char Buffer:
|
||||
* Virtual definition of core parameters and buffer interface
|
||||
*
|
||||
* Shifting buffer:
|
||||
* Data is either set at start of buffer or appended to buffer
|
||||
* Start of buffered data is always at beginning of buffer
|
||||
* Never rolls over (option to over overwrite if data longer than buffer)
|
||||
* Shifts unsused data to left when clearing used data
|
||||
* Always zero terminates buffer
|
||||
* Can look directly at buffer
|
||||
*
|
||||
* Rolling buffer:
|
||||
* Data is continuosly assigned to buffer
|
||||
* Start of buffer is tracked by references (can be anywhere)
|
||||
* Data rolls over to start of buffer if end of buffer reached (option to overwrite start)
|
||||
* Data is never shifted/moved inside buffer, only references are adjusted
|
||||
* Never zero terminates buffer
|
||||
* Can only look at data by copying (stitching) to another buffer
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CCharBuffer
|
||||
{
|
||||
protected:
|
||||
// Buffer Definition
|
||||
char * Buffer; // Memory allocated to buffer
|
||||
const int BufSize; // Size of allocated buffer
|
||||
int BufLen; // Total unread characters in buffer
|
||||
|
||||
// Temporary output buffer
|
||||
char * OutBuffer; // Temporary output buffer for "stitched" (rollover) data
|
||||
|
||||
public:
|
||||
// Life Cycle
|
||||
CCharBuffer( int BufferSize );
|
||||
virtual ~CCharBuffer();
|
||||
|
||||
// Direct Operations
|
||||
virtual int Reset(); // Clear buffer and reset all pointers to start of buffer
|
||||
|
||||
// Reading from buffer
|
||||
virtual char PeekChar( int Pos = 0 ) = 0; // Return one character from buffer (do not remove from buffer
|
||||
virtual int PeekDirect( char ** Data, int PeekPos = 0 ) = 0; // Return contiguous data pointer direct to buffer (continguous data couont returned)
|
||||
virtual int Peek( char ** Data, int PeekPos = 0, int MaxLen = -1 ) = 0; // Return stiched data copied to temporary output buffer
|
||||
virtual int PeekCopy( char ** Data, int PeekPos = 0, int MaxLen = -1 ) = 0; // Return stiched data copied to supplied pointer (create if not exist)
|
||||
|
||||
virtual bool FindStr( const char * SearchStr, int SearchLen, int &FoundPos, int StartPos = 0 ) = 0; // Search buffer directly
|
||||
|
||||
// Change data on buffer
|
||||
virtual int Push( bool Overwrite, const char * Data, int Len = -1 ) = 0; // Add Bytes to the end of the buffer
|
||||
virtual int Clear( int ClearLen = -1 ) = 0; // Clear Bytes from start of buffer
|
||||
|
||||
virtual int Pop( char ** Data, int MaxLen = -1 ); // Read and remove bytes from start of buffer
|
||||
virtual int PopCopy( char ** Data, int MaxLen = -1 ); // Same as Pop() except it returns a copy of the bytes in a new pointer
|
||||
|
||||
// File operations
|
||||
virtual int ReadFromFD( int Handle, int MaxRead = -1, bool Overwrite = false ) = 0; // Read directly from file descriptor into buffer (speed advantage)
|
||||
virtual int WriteToFD( int Handle, int MaxWrite = -1 ) = 0; // Write directly to file descriptor from buffer (speed advantage)
|
||||
|
||||
// Miscellaneous
|
||||
int Size() { return BufSize; }; // Returns number of total size of buffer (used and empty)
|
||||
int Len() { return BufLen; }; // Returns number of bytes stored in buffer
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CRollingBuffer : public CCharBuffer
|
||||
{
|
||||
protected:
|
||||
// Buffer pointers
|
||||
int BufStart; // First unread characters in buffer
|
||||
int BufEnd; // Next write position for new data (End of unread data + 1)
|
||||
|
||||
public:
|
||||
// Life Cycle
|
||||
CRollingBuffer( int BufferSize );
|
||||
virtual ~CRollingBuffer() {};
|
||||
|
||||
// Direct Operations
|
||||
virtual int Reset();
|
||||
|
||||
// Reading from buffer
|
||||
virtual char PeekChar( int Pos = 0 );
|
||||
virtual int PeekDirect( char ** Data, int PeekPos = 0 );
|
||||
virtual int Peek( char ** Data, int PeekPos = 0, int MaxLen = -1 );
|
||||
virtual int PeekCopy( char ** Data, int PeekPos = 0, int MaxLen = -1 );
|
||||
|
||||
virtual bool FindStr( const char * SearchStr, int SearchLen, int &FoundPos, int StartPos = 0 );
|
||||
|
||||
// Change data on buffer
|
||||
virtual int Push( bool Overwrite, const char * Data, int Len = -1 );
|
||||
virtual int Clear( int ClearLen = -1 );
|
||||
|
||||
// File operations
|
||||
virtual int ReadFromFD( int Handle, int MaxRead = -1, bool Overwrite = false );
|
||||
virtual int WriteToFD( int Handle, int MaxWrite = -1 );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CShiftBuffer : public CCharBuffer
|
||||
{
|
||||
public:
|
||||
// Life Cycle
|
||||
CShiftBuffer( int BufferSize );
|
||||
virtual ~CShiftBuffer() {};
|
||||
|
||||
// Reading from buffer
|
||||
virtual char PeekChar( int Pos = 0 );
|
||||
virtual int PeekDirect( char ** Data, int PeekPos = 0 );
|
||||
virtual int Peek( char ** Data, int PeekPos = 0, int MaxLen = -1 );
|
||||
virtual int PeekCopy( char ** Data, int PeekPos = 0, int MaxLen = -1 );
|
||||
|
||||
virtual bool FindStr( const char * SearchStr, int SearchLen, int &FoundPos, int StartPos = 0 );
|
||||
|
||||
// Change data on buffer
|
||||
virtual int Push( bool Overwrite, const char * Data, int Len = -1 );
|
||||
virtual int Clear( int ClearLen = -1 );
|
||||
|
||||
// File operations
|
||||
virtual int ReadFromFD( int Handle, int MaxRead = -1, bool Overwrite = false );
|
||||
virtual int WriteToFD( int Handle, int MaxWrite = -1 );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#endif /* REDACORE_CHARBUFFERCORE_H_ */
|
||||
@@ -5,15 +5,12 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "DataTreeCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "DataTreeCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
#ifndef REDACORE_DATATREECORE_H_
|
||||
#define REDACORE_DATATREECORE_H_
|
||||
|
||||
// redA Libraries
|
||||
#include <BufferCore.h>
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "CharBufferCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "DateTimeCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "DateTimeCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Variable used to temp values with
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#ifndef REDACORE_DATETIMECORE_H_
|
||||
#define REDACORE_DATETIMECORE_H_
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <cstdlib>
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Get and set System Date and Time
|
||||
|
||||
@@ -8,12 +8,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#ifndef REDACORE_DEVICECORE_H_
|
||||
#define REDACORE_DEVICECORE_H_
|
||||
|
||||
// redA Libraries
|
||||
#include "FunctionCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "FunctionCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Enumerated types
|
||||
|
||||
12
FileCore.cpp
12
FileCore.cpp
@@ -5,19 +5,15 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "FileCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "FileCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#ifndef JOANETELEMETRY_FILECORE_H_
|
||||
#define JOANETELEMETRY_FILECORE_H_
|
||||
|
||||
// redA Libraries
|
||||
#include "FunctionCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "FunctionCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const int NO_FD = -1;
|
||||
|
||||
@@ -5,15 +5,13 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "FunctionCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#ifndef REDACORE_FUNCTIONCORE_H_
|
||||
#define REDACORE_FUNCTIONCORE_H_
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "LogCore.h"
|
||||
#include "BufferCore.h"
|
||||
#include "DataTreeCore.h"
|
||||
#include "CharBufferCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "JSONparseCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "JSONparseCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CJSONparse::CJSONparse( CDataTree * pDataTree )
|
||||
|
||||
@@ -8,15 +8,13 @@
|
||||
#ifndef REDACORE_JSONPARSECORE_H_
|
||||
#define REDACORE_JSONPARSECORE_H_
|
||||
|
||||
// redA Libraries
|
||||
#include <BufferCore.h>
|
||||
#include <DataTreeCore.h>
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "DataTreeCore.h"
|
||||
#include "CharBufferCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
11
LogCore.cpp
11
LogCore.cpp
@@ -5,17 +5,14 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "LogCore.h"
|
||||
#include "DateTimeCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global vars
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#ifndef REDACORE_LOGCORE_H_
|
||||
#define REDACORE_LOGCORE_H_
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Debug options
|
||||
|
||||
@@ -5,16 +5,13 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "SelectableCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
|
||||
@@ -5,15 +5,8 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "SelectableCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -28,6 +21,10 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "SelectableCore.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#define REDACORE_SELECTABLECORE_H_
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <sys/wait.h>
|
||||
#include <string.h>
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "FunctionCore.h"
|
||||
|
||||
@@ -5,18 +5,14 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "SignalCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global vars
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#ifndef REDACORE_SIGNALCORE_H_
|
||||
#define REDACORE_SIGNALCORE_H_
|
||||
|
||||
// redA Libraries
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <time.h>
|
||||
|
||||
// redA Libraries
|
||||
#include "TimingCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Set time
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#ifndef REDACORE_TIMINGCORE_H_
|
||||
#define REDACORE_TIMINGCORE_H_
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <sys/time.h>
|
||||
|
||||
// redA Libraries
|
||||
/* none */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Manage as Interval
|
||||
|
||||
@@ -5,17 +5,13 @@
|
||||
* Author: wentzelc
|
||||
*/
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "WatchdogCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global vars
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#ifndef REDACORE_WATCHDOGCORE_H_
|
||||
#define REDACORE_WATCHDOGCORE_H_
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/* none */
|
||||
|
||||
// redA Libraries
|
||||
#include "SelectableCore.h"
|
||||
#include "LiteProtocolCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
/*none*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CWatchdogCore : public CSelectableCore
|
||||
|
||||
Reference in New Issue
Block a user