9 #include <boost/filesystem.hpp>
19 , apiNumber( _def.apiNumber )
20 , apiVersion( _def.apiVersion )
21 , clientUserAuth( _def.clientUserAuth )
22 , proxyUserAuth( _def.proxyUserAuth )
23 , inPackInstruct( _def.inPackInstruct )
24 , inBsFlag( _def.inBsFlag )
25 , outPackInstruct( _def.outPackInstruct )
26 , outBsFlag( _def.outBsFlag )
27 , call_wrapper(_def.call_wrapper)
28 , operation_name(_def.operation_name)
29 , clearInStruct( _def.clearInStruct )
38 , apiNumber( _rhs.apiNumber )
39 , apiVersion( _rhs.apiVersion )
40 , clientUserAuth( _rhs.clientUserAuth )
41 , proxyUserAuth( _rhs.proxyUserAuth )
42 , inPackInstruct( _rhs.inPackInstruct )
43 , inBsFlag( _rhs.inBsFlag )
44 , outPackInstruct( _rhs.outPackInstruct )
45 , outBsFlag( _rhs.outBsFlag )
46 , call_wrapper(_rhs.call_wrapper)
47 , in_pack_key(_rhs.in_pack_key)
48 , out_pack_key(_rhs.out_pack_key)
49 , in_pack_value(_rhs.in_pack_value)
50 , out_pack_value(_rhs.out_pack_value)
51 , operation_name(_rhs.operation_name)
52 , extra_pack_struct(_rhs.extra_pack_struct)
53 , clearInStruct( _rhs.clearInStruct )
61 if (
this == &_rhs ) {
83 for (
size_t i = 0; i < num; ++i) {
90 const auto end = std::cend(loaded_plugins_);
91 return std::find(std::cbegin(loaded_plugins_),
end, plugin_name) !=
end;
96 if (!is_plugin_loaded(plugin_name)) {
97 loaded_plugins_.push_back(plugin_name.data());
109 std::string plugin_home;
115 namespace fs = boost::filesystem;
119 if (
const fs::path so_dir(plugin_home);
fs::exists(so_dir)) {
120 for (fs::directory_iterator it(so_dir); it != fs::directory_iterator(); ++it) {
121 const auto path = it->path();
125 const auto* msg =
"init_api_table :: API plugin [%s] has already been loaded. Skipping ...";
132 std::string
name = path.stem().string();
136 if (std::string::npos !=
name.find(_cli_flg ?
"_server" :
"_client")) {
143 size_t pos =
name.find(
"lib" );
144 if ( std::string::npos == pos ) {
150 error ret = load_plugin<api_entry>(
159 "init_api_table :: adding %d - [%s] - [%s]",
161 entry->operation_name.c_str(),
171 if ( !
entry->in_pack_key.empty() ) {
172 _pack_tbl[
entry->in_pack_key ].packInstruct =
entry->in_pack_value;
173 entry->inPackInstruct =
entry->in_pack_key.c_str();
178 if ( !
entry->out_pack_key.empty() ) {
179 _pack_tbl[
entry->out_pack_key ].packInstruct =
entry->out_pack_value;
180 entry->outPackInstruct =
entry->out_pack_key.c_str();
186 if (!
entry->extra_pack_struct.empty()) {
187 for (
auto&& [key,
value] :
entry->extra_pack_struct) {
188 _pack_tbl[key].packInstruct =
value;