- Implemented global var DebugLevel - Update LogCore to check DebugLevel - Added many log messages and standadised all log messages - Further improved validation checks on all methods - Updated SelectCore, only remove SelectHandle from list during Test() - Close Handles in SelectableCore destructor Bug fixes: - Non-blocking Client Socket Connection now working correctly - Remove FD from Select lists at the correct time
90 lines
2.1 KiB
C++
90 lines
2.1 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 <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;
|
|
|
|
// 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();
|
|
|
|
// Miscellaneous
|
|
inline const char * GetName() { return Name; };
|
|
|
|
// Manage IOs
|
|
virtual TLocalIO * AddLocalIO( const char * IOName );
|
|
|
|
// Manual Data Input/Output
|
|
virtual int Input( const char * IOName, const char * Data, int MaxLen = -1 );
|
|
virtual int Output( const char * IOName, const char * Data, int Len = -1 );
|
|
|
|
// Automated Data Input/Output
|
|
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;
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_FUNCTIONCORE_H_ */
|