コード例 #1
0
ファイル: Plugin.cpp プロジェクト: dhanzhang/orthanc
  ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
  {
    context = c;
    
    /* Check the version of the Orthanc core */
    if (OrthancPluginCheckVersion(c) == 0)
    {
      char info[256];
      sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
              c->orthancVersion,
              ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
              ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
              ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
      OrthancPluginLogError(context, info);
      return -1;
    }

    /* Register the callbacks */

#if ORTHANC_PLUGIN_STANDALONE == 1
    OrthancPluginLogInfo(context, "Serving static resources (standalone build)");
    OrthancPluginRegisterRestCallback(context, ORTHANC_PLUGIN_WEB_ROOT "(.*)", ServeStaticResource);
#else
    OrthancPluginLogInfo(context, "Serving resources from folder: " ORTHANC_PLUGIN_RESOURCES_ROOT);
    OrthancPluginRegisterRestCallback(context, ORTHANC_PLUGIN_WEB_ROOT "(.*)", ServeFolder);
#endif

    OrthancPluginRegisterRestCallback(context, "/", RedirectRoot);
 
    return 0;
  }
コード例 #2
0
ファイル: OrthancContext.cpp プロジェクト: vinayvenu/orthanc
void OrthancContext::Register(const std::string& uri,
                              OrthancPluginRestCallback callback)
{
    Check();
    OrthancPluginRegisterRestCallback(context_, uri.c_str(), callback);
}