Major update:
- General bug fixes - Implement search for multi-character marker search in BufferCore Replaced FindChar() method with FindStr() method - Implemented LocalIO and LinkedIO in FunctionCore - Connect LocalIO with FD in SelectableCore - Implement Write buffer with Write Select in SelectableCore - Improve validation checks in SelectableCore - Use Handle ptr instead of Handle Names for Config methods
This commit is contained in:
@@ -12,30 +12,72 @@
|
||||
#include "BufferCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Preview
|
||||
typedef struct SLocalIO TLocalIO;
|
||||
typedef struct SLinkedIO TLinkedIO;
|
||||
|
||||
class CFunctionCore;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct SLocalIO
|
||||
{
|
||||
char * Name;
|
||||
|
||||
TLinkedIO * FirstInput;
|
||||
TLinkedIO * FirstOutput;
|
||||
|
||||
TLocalIO * Next;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct SLinkedIO
|
||||
{
|
||||
CFunctionCore * Function;
|
||||
char * IOName;
|
||||
|
||||
SLinkedIO * Next;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CFunctionCore
|
||||
{
|
||||
protected:
|
||||
// Function Definition
|
||||
char * Name;
|
||||
|
||||
CFunctionCore * OutFunction;
|
||||
// IOs
|
||||
TLocalIO * FirstIO;
|
||||
|
||||
// Manage IO
|
||||
inline TLocalIO * GetLocalIO( const char * Name ) {
|
||||
TLocalIO * LocalIO = FirstIO;
|
||||
while (LocalIO && strcmp( Name, LocalIO->Name )) {
|
||||
LocalIO = LocalIO->Next;
|
||||
}
|
||||
return LocalIO;
|
||||
}
|
||||
|
||||
public:
|
||||
// Life cycle
|
||||
CFunctionCore( const char * ObjectName );
|
||||
virtual ~CFunctionCore();
|
||||
|
||||
// Manage IOs
|
||||
virtual TLocalIO * AddLocalIO( const char * IOName );
|
||||
|
||||
// Manual Data Input/Output
|
||||
virtual int Input( int InputID, const char * Buffer, int MaxLen );
|
||||
virtual int Output( int OutputID, const char * Buffer, int Len );
|
||||
virtual int Input( const char * IOName, const char * Buffer, int MaxLen = -1 );
|
||||
virtual int Output( const char * IOName, const char * Buffer, int Len = -1 );
|
||||
|
||||
// Automated Data Input/Output
|
||||
virtual bool AddInput( int InputID, CFunctionCore * OutFunction, int OutputID );
|
||||
virtual bool AddOutput( int OutputID, CFunctionCore * InFunction, int InputID );
|
||||
virtual bool AddInput( const char * IOName, CFunctionCore * OutFunction, const char * OutputName );
|
||||
virtual bool AddOutput( const char * IOName, CFunctionCore * InFunction, const char * InputName );
|
||||
virtual bool Process() = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user