PapillonSDK Class Reference

Detailed Description

The PapillonSDK class provides global functions to initialise and finalise the Papillon SDK.

PapillonSDK::Initialise() must be called before starting using Papillon.

This class cannot be instantiated.

Definition at line 34 of file PapillonSDK.h.

#include <PapillonSDK.h>

Member Enumeration Documentation

◆ EPapillonOptions

Flags used by the PapillonSDK::Initialise() function to set the startup behaviour of this SDK.



initialise PapillonSDK without any option


create a console logger, named "console" with level INFO


create a console logger, named "console" with level LEVEL


create a console logger, named "console" with level INFO if and only if DEBUG build


do not load Papillon plugins at startup


do not log Papillon startup information (messages related to plugins loading, licensing, Papillon version, etc.)

Definition at line 42 of file PapillonSDK.h.

Member Function Documentation

◆ EnableMonitoring()

static void PapillonSDK::EnableMonitoring ( const PProperties parameters)


See also

◆ Finalise()

static PResult PapillonSDK::Finalise ( )

Frees all resources allocated by the Papillon SDK.

WARNING: this function will try to unload all Papillon plugins. You MUST release/destroy all objects associated with Papillon plugins before calling this method(), otherwise it will fail.

Returns PResult::C_OK if success, another result otherwise.

See also

◆ GetVersion()

static PVersion PapillonSDK::GetVersion ( )

Returns the version number of this SDK.

◆ Initialise()

static PResult PapillonSDK::Initialise ( papillon::int32  flags = E_CONSOLE_LOGGER_INFO_LEVEL)

Initialises the Papillon SDK with flags E_CONSOLE_LOGGER_INFO_LEVEL by default.

This function must be called once before using the SDK. If the function has already been called with success, Initialise() will return PResult::C_OK.

WARNING: this method is not thread-safe.

The following flags are available:

  • E_DONT_LOAD_PLUGINS: Papillon will not load plugins at startup (you can use PPluginManager::GetInstance().LoadAll() later, for example)
  • E_CONSOLE_LOGGER_XXX: open console logger, named "console"
  • E_SILENT_START: starts Papillon silently, without logging all information related to plugins, licenses, etc.

See PapillonSDK::EPapillonOptions to learn more.

If E_LOAD_PLUGINS flag has been used, Papillon will try to load plugins using the following rules:

  1. Try to load plugins from the path specified by PapillonSDK::SetPluginsPath() if used before PapillonSDK::Initialise()
  2. If SetPluginsPath() not used OR no plugins found, then try to load plugins from the path $PAPILLON_INSTALL_DIR/plugins where PAPILLON_INSTALL_DIR is an environment variable
  3. If PAPILLON_INSTALL_DIR environment variable is not set OR no plugins found, then try to load plugins from the local /plugins path
  4. If no /plugins folder OR no plugins found, try to load plugins from /plugins in the same folder than current executable.

Returns PResult::C_OK if success, another result otherwise.

See also

◆ IsInitialised()

static bool PapillonSDK::IsInitialised ( )

Returns true if the Papillon SDK has been initialised, false otherwise.

◆ SetLicense()

static PResult PapillonSDK::SetLicense ( const PString license)

Sets the license to be used by the license manager (must be called before PapillonSDK::Initialise()).

The specified license string can be:

  1. A license file
  2. OR A folder which contain one or more license file(s)
  3. OR "port @ server", the license server to contact to checkout licenses (typically "2764@")

If SetLicense() is not called, then the license manager will try to automatically find license files, first in current working directory, then in the directory specified by PAPILLON_INSTALL_DIR environment variable.

Returns PResult::C_OK if success, another result otherwise (e.g. if Initialise() has already been called).

◆ SetNumberOfThreads()

static void PapillonSDK::SetNumberOfThreads ( papillon::int32  numberOfThreads)

Sets the number of threads.

By default Papillon will use as many threads as cores on the current machine. The numberOfThreads can be set to:

  • < 0 : System default (usually as many cores as there are)
  • 0 or 1: Do everything sequentially
  • 2 or more: Use this many threads

Note, only some routines of Papillon are parallel.

◆ SetPluginsPath()

static void PapillonSDK::SetPluginsPath ( const PString pluginsPath)

Sets the path where to find Papillon plugins (must be called before calling Initialise().

Note: plugins are loaded by Initialise() if and only if E_LOAD_PLUGINS flag is used as argument (it is the case by default).