Major update:

- 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
This commit is contained in:
Charl Wentzel
2016-05-19 15:10:55 +02:00
parent e222d51997
commit 0d1c46ac53
8 changed files with 370 additions and 205 deletions

57
FunctionCore.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* 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_ */