Skip to content

Plugin.cpp

Marco BARNIG edited this page Dec 18, 2019 · 6 revisions

The program code of the RadioLogicCreator Orthanc plugin is a mix of the following elements:

The C++ code is segmented in three files:

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.

CallbackStartJob()

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().

Job Unserializer()

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.

Clone this wiki locally