- DataTreeCore: - Merge TDataMember and CDataTree into => CDataMember - Each node, incl root is now CDataMember object - Modified function to not require BaseMember (Object is basemember) - Split/duplicat most functions to require, or not require child path - Added isNull/Object/Array/Sting() etc methods - Many other methods removed or restructured - Updated DataTree usage in: JSONparseCore, ApplicationCore, FunctionCore, SelectableCore, WatchdogCore
97 lines
2.2 KiB
C++
97 lines
2.2 KiB
C++
/*
|
|
* Application.h
|
|
*
|
|
* Created on: 13 Jul 2017
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
#ifndef REDACORE_APPLICATIONCORE_H_
|
|
#define REDACORE_APPLICATIONCORE_H_
|
|
|
|
// Standard C/C++ Libraries
|
|
/* none */
|
|
|
|
// redA Libraries
|
|
#include "SignalCore.h"
|
|
#include "TimingCore.h"
|
|
#include "LogCore.h"
|
|
#include "DataTreeCore.h"
|
|
#include "JSONparseCore.h"
|
|
#include "FunctionCore.h"
|
|
#include "SelectableCore.h"
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Preview
|
|
typedef struct SFunctionItem TFunctionItem;
|
|
|
|
class Application;
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
struct SFunctionItem
|
|
{
|
|
CFunctionCore * Function;
|
|
|
|
SFunctionItem * Next;
|
|
};
|
|
//---------------------------------------------------------------------------
|
|
|
|
class CApplication
|
|
{
|
|
protected:
|
|
// Variables used for configuration
|
|
char * ConfigFile;
|
|
char * AddressFile;
|
|
|
|
// List
|
|
TFunctionItem * FirstFunction;
|
|
|
|
// Output
|
|
EDebugLevel LogLevel;
|
|
int LogOutput;
|
|
|
|
// Configuration
|
|
CDataMember * ConfigMember;
|
|
CDataMember * FunctionConfigMember;
|
|
CDataMember * LinkConfigMember;
|
|
|
|
bool LoadConfigData();
|
|
|
|
public:
|
|
// Public function vars
|
|
CDataMember * DataTree;
|
|
CLogCore * Log;
|
|
CSelect * Selector;
|
|
CJSONparse * JSONparser = NULL;
|
|
|
|
// Life Cycle
|
|
CApplication( EDebugLevel pDebugLevel );
|
|
virtual ~CApplication();
|
|
|
|
// Manage Config File
|
|
void GetProcessName( char ** ProcessName, char * pFilePath );
|
|
bool LoadConfig( int argc, char *argv[], const char * pConfigPath );
|
|
bool SaveConfig();
|
|
|
|
// Manually set configuration
|
|
bool SetLogParam( EDebugLevel pDebugLevel, int pOutputDisplay );
|
|
|
|
// Init application
|
|
virtual bool Init();
|
|
|
|
bool InitConfig( const char * pConfigPath );
|
|
bool InitFunctions( const char * pConfigPath );
|
|
bool InitFunctionLinks( const char * pConfigPath );
|
|
|
|
// Manage Functions
|
|
bool AddFunction( CFunctionCore * Function );
|
|
CFunctionCore * GetFunction( const char * Name );
|
|
|
|
// Run Application
|
|
bool Run( bool TerminateOnError );
|
|
};
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_APPLICATIONCORE_H_ */
|