-
Notifications
You must be signed in to change notification settings - Fork 7
Plugin.cpp
The program code of the RadioLogicCreator Orthanc plugin is a mix of the following elements:
- Orthanc SDK functions (from the modules Toolbox, Orthanc, Callback and REST)
- members of the Orthanc C++ wrapper class
- specific C++ functions
The C++ code is segmented in three files:
- Plugin.cpp
- RadioLogicCreator.cpp
- RadioLogicTools.cpp
The Plugin.cpp file is located in the folder /RadioLogicCreator/Plugin/. The following files are included:
#include <string>
#include <stdlib.h>
#include <EmbeddedResources.h>
#include <Core/Toolbox.h>
#include <Core/Logging.h>
#include <Plugins/Samples/Common/OrthancPluginCppWrapper.h>
#include <orthanc/OrthancCPlugin.h>
#include "RadioLogicTools.h"
#include "RadioLogicCreator.h"
The plugin code contains the extern "C" section of the Orthanc SDK which is explained in lesson 9 of our small tutorial.
A callback function is registrated with the code
OrthancPlugins::RegisterRestCallback<CallbackStartJob>("/ralo/startjob", true);
The CallbackStartJob() function is called with a HTTP POST request to the RadioLogicArchive URL with the suffix /ralo/startjob. The JSON body embedded in the HTTP request is parsed and the included parameters are extracted. A new job is created from the class RadioLogicCreator. The member variable counter of the job is set to 0. The job is initialized with the other received parameters and submitted to the Orthanc job-engine. This engine makes a first call to the function RadioLogicCreator::Step().
The plugin code contains another function
OrthancPluginJob* Unserializer(const char* jobType, const char* serialized) {
...
}
which is currently disabled.
Let's dive into the code of the RadioLogicCreator.cpp file.