Session and Modules

Top  Previous  Next

This section describes the concepts of the SDK session, modules and their general operations.

The SDK building blocks are modules: I/O modules and algorithm modules. An SDK session is the context that holds these modules. Every SDK application creates a single or multiple SDK sessions. Each session maintains its own context for I/O and algorithm models and is not aware of other sessions.

Within an SDK session, there are multiple I/O and algorithm modules that implement certain SDK interfaces. In some cases, there might be multiple implementations of the same SDK interface. You can create an instance of the module from the session, use it, and then destroy it. The module's life cycle is the duration of its use.

The SDK session must be the first instance to create before any module operations and the last to destroy after all modules are destroyed.

Example 12 shows how to create an SDK session and print the SDK version in C++, C# and Java.

C++ Example 12: Create an SDK Session and Print the SDK Version

PXCSession *session=PXCSession::CreateInstance();

...

PXCSession::ImplVersion ver=session->QueryVersion();

wprintf_s(L"SDK Version %d.%d\n",ver.major, ver.minor);

...

session->Release();

C# Example 12: Create an SDK Session and Print the SDK Version

PXCMSession session=PXCMSession.CreateInstance();

...

Console.WriteLn("SDK Version {0}.{1}",session.version.major,session.version.minor);

...

session.Dispose();

Java Example 12: Create an SDK Session and Print the SDK Version

PXCMSession session=PXCMSession.CreateInstance();

...

PXCMSession.ImplVersion ver=session.QueryVersion();

System.out.printf("SDK Version %d.%d%n",ver.major,ver.minor);

...

session.close();