Writing a plug-in class

Create Plug-In Class

In order to create a plug-in, you must first decide which plug-in interface you would like to implement. The available plug-in types and sub-types are:

You can directly subclass one of those interfaces and implement all of the abstract functions in order to create a plug-in. However, it is highly recommended that you subclass one of our Shell classes. These Shell classes implement large portions of these interfaces for you and require you write less code. A complete list of Shell classes is shown below:

Accessing Opticks Services

While writing your plug-in you will need access to the rest of the plug-in API. The way that you access the rest of the plug-in API is to use our Services. The complete list of our Services is:

1 - DesktopServices and SessionExplorer are only available when ApplicationServices::isBatch() returns false.

The easiest method to access these Services is to use the Service template specialization, so

#include "ConfigurationSettings.h"
#include <string>

void foo()
   std::string version = Service<ConfigurationSettings>()->getVersion(); //Fetch the application version # from the ConfigurationSettings Service.

   //OR, another way to do the above

   Service<ConfigurationSettings> pConfSett;
   std::string version = pConfSett->getVersion(); 

   //OR, yet another way to do the above

   ConfigurationSettings* pConfPointer = pConfSett.get();
   version = pConfPointer->getVersion();

There is a Service template specialization for each of the Services mentioned above. The Service classes can be used anywhere inside your plug-in library (i.e. .dll, .so).

Now that you have created a plug-in subclass, you need to register it with the application. Please read Registering your plug-in for more details.

Software Development Kit - Opticks 4.9.1 Build 16498