The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
capi_pluginservice.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 2013-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#include "capi_pluginservice.h"
12
13#define GAUDI_PLUGIN_SERVICE_V2
14#include <Gaudi/PluginService.h>
15
16#include <algorithm>
17#include <vector>
18
19#include <iostream>
20
22
24 static Registry& cxxreg = Registry::instance();
25 return { &cxxreg };
26}
27
29 const Registry::FactoryMap& fmap = static_cast<const Registry*>( self.registry )->factories();
30 return int( fmap.size() );
31}
32
34 const Registry* reg = static_cast<const Registry*>( self.registry );
35 const auto& factories = reg->factories();
36 if ( n >= static_cast<int>( factories.size() ) ) return { self, nullptr };
37 return { self, next( begin( factories ), n )->first.c_str() };
38}
39
41 Registry& reg = Registry::instance();
42 return reg.getInfo( self.id ).library.c_str();
43}
44
46 Registry& reg = Registry::instance();
47 static std::string cache;
48 cache = demangle( reg.getInfo( self.id ).factory.type() );
49 return cache.c_str();
50}
51
53 Registry& reg = Registry::instance();
54 static std::string cache;
55 cache = reg.getInfo( self.id ).getprop( "ClassName" );
56 return cache.c_str();
57}
58
60 Registry& reg = Registry::instance();
61 const Registry::FactoryInfo& fi = reg.getInfo( self.id );
62 return int( fi.properties.size() );
63}
64
66 cgaudi_property_t cprop{ self.registry, self.id, nullptr };
67 Registry& reg = Registry::instance();
68 const Registry::FactoryInfo& fi = reg.getInfo( cprop.id );
69 if ( n < static_cast<int>( fi.properties.size() ) ) cprop.key = next( begin( fi.properties ), n )->first.c_str();
70 return cprop;
71}
72
73const char* cgaudi_property_get_key( cgaudi_property_t self ) { return self.key; }
74
76 Registry& reg = Registry::instance();
77 const Registry::FactoryInfo& fi = reg.getInfo( self.id );
78 auto prop = fi.properties.find( self.key );
79 return prop != fi.properties.end() ? prop->second.c_str() : nullptr;
80}
const char * cgaudi_factory_get_library(cgaudi_factory_t self)
cgaudi_pluginsvc_t cgaudi_pluginsvc_instance()
const char * cgaudi_factory_get_classname(cgaudi_factory_t self)
const char * cgaudi_factory_get_type(cgaudi_factory_t self)
int cgaudi_pluginsvc_get_factory_size(cgaudi_pluginsvc_t self)
const char * cgaudi_property_get_key(cgaudi_property_t self)
cgaudi_factory_t cgaudi_pluginsvc_get_factory_at(cgaudi_pluginsvc_t self, int n)
const char * cgaudi_property_get_value(cgaudi_property_t self)
int cgaudi_factory_get_property_size(cgaudi_factory_t self)
cgaudi_property_t cgaudi_factory_get_property_at(cgaudi_factory_t self, int n)
std::string demangle(const std::string &id)