Major Update:

- Implement consistent Function addition to application
  - Use TYPE_XXX constants to declare function type
  - Use NewXXXX() methods to call constructor correctly
  - Add FunctionType list (with constructor) to Application
  - Create Function by comparison to FunctionType list
- Simplify LoadConfig() and Init() methods for functions
  - Combine methods into Init() method
  - Pass relevant data member to Init() method
  - Remove all CDataMember references on functions
- ApplicationCore:
  - Split ReadParam() method from LoadConfig() method
  - Split main configuration into separate files:
    - config/ - main config file, general application settings
    - definition/ - application definition, e.g. function blocks
  - Definition and Address List files specified in config file
  - Load address file in address/ branch
  - Made DataTree & JSONparser private
  - Made Config, Definition & Address branches public
  - Removed unnecessary branch references
  - Improved event logging
- DataTreeCore:
  - Allow GetChFirstChild & GetChElement to create parent branches
    with correct type, ie. Object/Array
  - Remove unnecessary Create param from GetXxx functions
  - Bug fix: Print empty objects/arrays correct, ie. empty brackets
  - Bug fix: Adding element at specific index
  - Bug fix: Error when get/create string value with "null"
- FunctionCore:
  - Type param now set as constant via constructor
  - Create empty Handles & Channels objects if none in Config
- SelectableCore:
  - Add Queue length parameter to handles for UNIX and TCP sockets
- DeviceCore:
  - Bug fix: missing Process() method
This commit is contained in:
Charl Wentzel
2018-11-24 13:35:23 +02:00
parent 7434334280
commit a972fb9101
15 changed files with 518 additions and 469 deletions

View File

@@ -41,7 +41,7 @@ class CDataMember
CDataMember * CreateChild( const char * Name, const int Len = -1 );
// Set Member value
bool SetValue( EDataType Type, const char * Value = NULL, int Len = -1 );
bool SetValue( EDataType Type, const char * Value = NULL, int Len = -1 );
bool SetValuePtr( EDataType pType, const char * pValue, int pLen = -1 );
public:
@@ -67,11 +67,11 @@ public:
const int GetLen( const char * Path );
CDataMember * GetChild( const char * Path, bool Create = false );
CDataMember * GetChFirstChild( const char * Path );
CDataMember * GetChElement( const char * Path, const int Index );
CDataMember * GetChFirstChild( const char * Path, bool Create = false );
CDataMember * GetChElement( const char * Path, const int Index, bool Create = false );
inline CDataMember * GetFirstChild() { return FirstChild; };
inline CDataMember * GetElement( const int Index ) { return GetChElement( NULL, Index ); };
inline CDataMember * GetFirstChild() { return GetChFirstChild( NULL, false ); };
inline CDataMember * GetElement( const int Index ) { return GetChElement( NULL, Index, false ); };
inline CDataMember * GetParent() { return Parent; };
inline CDataMember * GetPrevPeer() { return PrevPeer; };
@@ -83,11 +83,11 @@ public:
const long GetChInt( const char * Path, long Default = 0, bool Create = false, const char * Mask = NULL );
const double GetChFloat( const char * Path, double Default = 0.0, bool Create = false, const char * Mask = NULL );
inline const char * GetStr( const char * Default = NULL, bool Create = false ) { return GetChStr( NULL, Default, Create ); };
inline const char * GetStr( int &Len, const char * Default = NULL, bool Create = false ) { return GetChStr( NULL, Len, Default, Create ); };
inline const bool GetBool( bool Default = false, bool Create = false ) { return GetChBool( NULL, Default, Create ); };
inline const long GetInt( long Default = 0, bool Create = false, const char * Mask = NULL ) { return GetChInt( NULL, Default, Create, Mask ); };
inline const double GetFloat( double Default = 0.0, bool Create = false, const char * Mask = NULL ) { return GetChFloat( NULL, Default, Create, Mask ); };
inline const char * GetStr( const char * Default = NULL ) { return GetChStr( NULL, Default, false ); };
inline const char * GetStr( int &Len, const char * Default = NULL ) { return GetChStr( NULL, Len, Default, false ); };
inline const bool GetBool( bool Default = false ) { return GetChBool( NULL, Default, false ); };
inline const long GetInt( long Default = 0, const char * Mask = NULL ) { return GetChInt( NULL, Default, false, Mask ); };
inline const double GetFloat( double Default = 0.0, const char * Mask = NULL ) { return GetChFloat( NULL, Default, false, Mask ); };
bool SetChBool( const char * Path, const bool Value );
bool SetChInt( const char * Path, const long Value, const char * Mask = NULL );