Initializing and Deinitializing the API


The first thing you must do when using the SCA is to start the 3rd party libraries startup functions:

(see also Initialization of 3rd party libraries)

Next step is to set up a dca::DcaInstance object. This class encapsulates the API as a whole.

To create the instance fill out a dca::InitData structure, and call the function dca::DcaInstance::create().

Note that the provided directories are (once initialized) not changeable for this instance.

The use of two or more DcaInstance objects in the same process (using the same initialization directory) is currently not supported.


The SCA will be deinitialized automatically once the DcaInstance object goes out of scope. For more information on DCA startup and shutdown, Please refer to Startup/Shutdown sequence.

Before going out of scope, call the Deinitilization functions of the 3rd party libraries in reverse order:

Sample code

The following code demonstrates how to initialize the SCA.

#include <dca_base.h>
#include <dca_callbacks.h>

// assume the DCA has been installed to the ~/dca directory
#define DCA_INSTALLDIR  "~/dca"
#define DCA_BINDIR      DCA_INSTALLDIR"/bin/linux"
#define DCA_LOGDIR      "./logs"

void main()
        try {
                // required 3rd party library startups
                // set up the required directories
                dca::InitData myInitData;
                myInitData.binDir       = DCA_BINDIR;
                myInitData.initDir      = DCA_INITDIR;
                myInitData.logDir       = DCA_LOGDIR;

                // start up DCA API
                dca::DcaInstance myDca = dca::DcaInstance::create( myInitData );
                // when going out of scope, myDca will be automatically deinitialized
        catch( const dca::ExDca& ex ) {
                cout << "DCA error occurred (Error code: " << ex.getReturnCode() <<
                        ", Description: " << ex.getDescription() << ")." << endl;
        // required 3rd party library shutdowns

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1