- Converted CSocketCore to Class/Object - Implemented CFunctionCore as base class for CPortCore and CSocketCore - Moved common functions to CFunctionCore and renamed eg. Maintain() -> Process() - Pass Objects directly to each other as OutputFunction - New Input() method allows data transfer between objects
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
/*
|
|
* FunctionCore.h
|
|
*
|
|
* Created on: 18 May 2016
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
#ifndef REDACORE_FUNCTIONCORE_H_
|
|
#define REDACORE_FUNCTIONCORE_H_
|
|
|
|
// redA Libraries
|
|
#include "BufferCore.h"
|
|
|
|
// Standard C/C++ Libraries
|
|
#include <sys/time.h>
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
class CFunctionCore
|
|
{
|
|
protected:
|
|
// Function Definition
|
|
char * Name;
|
|
|
|
// Input/Outputs
|
|
CBuffer * Buffer;
|
|
CFunctionCore *OutFunction;
|
|
|
|
// Input Timer
|
|
timeval InStart;
|
|
long InTimeout; // millisecs
|
|
|
|
public:
|
|
// Life cycle
|
|
CFunctionCore( const char * ObjectName );
|
|
virtual ~CFunctionCore();
|
|
|
|
// Manual Data Input/Output
|
|
virtual int Input( int InputID, char * Buffer, int MaxLen );
|
|
virtual int Output( int OutputID, char * Buffer, int Len );
|
|
|
|
// Automated Data Input/Output
|
|
virtual bool AddInput( int InputID, CFunctionCore * OutFunction, int OutputID );
|
|
virtual bool AddOutput( int OutputID, CFunctionCore * InFunction, int InputID );
|
|
virtual bool Process();
|
|
|
|
// Device Interface
|
|
virtual bool Read( int FD );
|
|
virtual bool Write( int FD );
|
|
virtual bool ProcessBuffer( bool Force ) = 0;
|
|
|
|
int WriteToFD( int FD, char * Data, int Len );
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_FUNCTIONCORE_H_ */
|