Statistics and time-series analytics API
Configuration APIs

Initialize the NumSDK Environment (e.g. Logging, configuration, database connection, Licensing, etc.) More...

Functions

int __stdcall NDK_Init (LPCWSTR szBaseName, LPCWSTR szDataPath, long consoleAppTimeout, unsigned int *pClientToken)
 This NDK_Init function must be called during client application initialization, and before calling other functions in the SDK. It does the following:
 
int __stdcall NDK_Shutdown (BOOL cleanup, unsigned int uClientToken)
 released resources used by the NDK library.
 

Detailed Description

Initialize the NumSDK Environment (e.g. Logging, configuration, database connection, Licensing, etc.)

Function Documentation

◆ NDK_Init()

int __stdcall NDK_Init ( LPCWSTR szBaseName,
LPCWSTR szDataPath,
long consoleAppTimeout,
unsigned int * pClientToken )

Initializes the ststistics and time-series (aka., NDK) Library.

Parameters
[in]szBaseName(Required) is the application name (user-defined), but must match the configuration base filename.
[in]szDataPath(Optional) is the full path of the data directory, where X12 and X13 files are created. If NULL, NDK uses to the temporary directory in the current user's profile.
[in]consoleAppTimeout(Optional) is the timeout setting (in milliseconds) for waiting on console applications (e.g., x12a or x13) to finish. If value set to zero, the function revert to a default value of 30000 milliseconds.
[out]pClientToken(Required) is a pointer to a variable that receives a unique integer value (token) to use during the shutdown.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
  • Examine the sdk licensing,
  • Setup the temporary folder for running X12 and X13 processes.
  • Set the timeout option for running external processes.
Return values
NDK_SUCCESSsuccess
NDK_SKIP_INITwarning (see remarks)
NDK_DATAPATH_INVALIDfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. This function must be called after you have initialized the logging and the licensing systems.
  2. If the custom application calls this function more than once (without calling NDK_Shutdown before), the function will ignore the new call, and return NDK_SKIP_INIT warning code.
  3. The argument szBaseName value must be a vaild base filename, so it can't include the following characters: backslash (\), slash(/), colon(:), astrick(*), question mark(?), double-quote("), left-angle(<), right-angle(>), or vertical pipeline(|).
  4. If the text in the szBaseName argument is shorter that 2 character, the function will fail and return NDK_INVALID_ARG.
  5. The client application should store the returned token value (in the variabble reference by pClientToken), and use it in the NDK_Shutdown call to shutdown the library later on.
  6. If the the argument ( szDataPath) value is not NULL, then it must point to an existing folder on the client machine, or the function will fail and return NDK_DATAPATH_INVALID.
  7. If the the argument ( szDataPath) value is NULL, then the function will use the following default value:
    • Target machine: Windows 7 or later : (c:\users\(username)\AppData\Local\MyApp)
    • Target machine: Windows XP :(c:\Local Settings\(username)\AppData\Local\MyApp)
  8. The argument pClientToken is a pointer to a variable, which the function use to save a unique value in it.
  9. If the value of the pClientToken argument is NULL, the function will fails and return NDK_INVALID_ARG.
  10. If the value of the consoleAppTimeout argument is 0L, then the function will use the default value of 30000L milliseconds.
Example
int nRet = NDK_FAILED;
wchar_t szAppName[]=L"MyApp";
unsigned int uClientToken=-1;
nRet = NDK_Init( szAppName,
NULL, // (Windows 7) (c:\\users\\‍(username)\\AppData\\Local\\MyApp)
// (Windows XP) (c:\\Local Settings\\‍(username)\\AppData\\Local\\MyApp)
0L, // default console timeout
&uClientToken);
if( nRet >= NDK_SUCCES){
...
....
}
int __stdcall NDK_Init(LPCWSTR szBaseName, LPCWSTR szDataPath, long consoleAppTimeout, unsigned int *pClientToken)
This NDK_Init function must be called during client application initialization, and before calling ot...
Definition SFSDK.cpp:85
#define NDK_FAILED
Requirements
Requirement Value
Target Platform Windows
Header SFSDK.h (include Windows.h)
Library SFSDK.lib
DLL SFSDK.dll
Since
v1.68
See also

◆ NDK_Shutdown()

int __stdcall NDK_Shutdown ( BOOL cleanup,
unsigned int uClientToken )

Frees and releases resources used by the SFSDK Library

Parameters
[in]cleanup(Required) is a flag. If true, the NDK_Shutdown() deletes all data files generated in the data directory
[in]uClientToken(Required) Is the NDK token id (acquired during initialization).
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_UNINITIALIZEDfailed (see remarks)
NDK_INVALID_TOKENfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. The client application should call the NDK_Shutdown(.), during its normal shutdown, but before calling the logging shutdown function (SFLOG_SHUTDOWN).
  2. The temp folder contains all models file for X12 and X13, so if left in the temp folder, the sdk will detect the files and use them, saving time for re-running the models.
  3. If the function was called, but the NDK_Init was not called earlier or failed, the function will fails and return NDK_UNINITIALIZED.
  4. If the value of the uClientToken argument is not the same one returned earlier by the NDK_Init, then the function will fail and return NDK_INVALID_TOKEN.
  5. To preserve the different X12 and/or X13 models and their outputs for later on use, set the value of the cleanup to FALSE. 6.
Example
int nRet = NDK_FAILED;
wchar_t szAppName[]=L"MyApp";
unsigned int uClientToken=-1;
nRet = NDK_Init( szAppName, NULL, 0L, &uClientToken);
if( nRet >= NDK_SUCCES){
...
...
// shutting down the NDK
nRet= NDK_Shutdown(FALSE, uClientToken);
if( nRet < NDK_SUCCESS){
...
}
}
int __stdcall NDK_Shutdown(BOOL cleanup, unsigned int uClientToken)
released resources used by the NDK library.
Definition SFSDK.cpp:232
#define NDK_SUCCESS
Requirements
Requirement Value
Target Platform Windows
Header SFSDK.h (include Windows.h)
Library SFSDK.lib
DLL SFSDK.dll
Since
v1.68
See also