Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
gpu committed Apr 1, 2024
1 parent ffb4bf1 commit e3b7a73
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ e2e_provider_impl::~e2e_provider_impl()
void* e2e_provider_impl::get_plugin_impl_ptr()
{
auto e2e_provider_plugin = dynamic_cast<e2e_provider *>(this);

printf("nullptr == configuration_plugin_p:%d\n", e2e_provider_plugin == nullptr);

return e2e_provider_plugin;
}

Expand Down
21 changes: 13 additions & 8 deletions implementation/routing/src/routing_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@

namespace vsomeip_v3 {

#ifdef ANDROID
namespace sd {
runtime::~runtime() {}
}
#endif

routing_manager_impl::routing_manager_impl(routing_manager_host *_host) :
routing_manager_base(_host),
version_log_timer_(_host->get_io()),
Expand Down Expand Up @@ -170,8 +164,19 @@ void routing_manager_impl::init() {
plugin_type_e::SD_RUNTIME_PLUGIN, VSOMEIP_SD_LIBRARY);
if (its_plugin) {
VSOMEIP_INFO << "Service Discovery module loaded.";
discovery_ = std::dynamic_pointer_cast<sd::runtime>(its_plugin)->create_service_discovery(this, configuration_);
discovery_->init();
auto runtime_plugin = std::dynamic_pointer_cast<sd::runtime>(its_plugin);
if (nullptr == runtime_plugin) {
runtime_plugin = its_plugin->get_ptr<sd::runtime>();
}

if (nullptr == runtime_plugin) {
VSOMEIP_ERROR << "Invalid Service Discovery module!" << std::endl;
std::exit(EXIT_FAILURE);
} else {
discovery_ = runtime_plugin->create_service_discovery(this, configuration_);
discovery_->init();
}

} else {
VSOMEIP_ERROR << "Service Discovery module could not be loaded!";
std::exit(EXIT_FAILURE);
Expand Down
39 changes: 27 additions & 12 deletions implementation/runtime/src/application_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,9 @@ bool application_impl::init() {
auto its_configuration_plugin
= std::dynamic_pointer_cast<configuration_plugin>(its_plugin);

if(its_configuration_plugin == nullptr) {
its_configuration_plugin = its_plugin->get_ptr<configuration_plugin>();
}

std::cerr << "get_ptr!" << (its_configuration_plugin != nullptr)<< std::endl;

if (its_configuration_plugin == nullptr) {
its_configuration_plugin = its_plugin->get_ptr<configuration_plugin>();
}

if (its_configuration_plugin) {
configuration_ = its_configuration_plugin->get_configuration(name_, path_);
Expand Down Expand Up @@ -368,8 +365,15 @@ bool application_impl::init() {
if (its_application_plugin) {
VSOMEIP_INFO << "Client 0x" << std::hex << get_client()
<< " Loading plug-in library: " << its_library << " succeeded!";
std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
on_application_state_change(name_, application_plugin_state_e::STATE_INITIALIZED);

auto application_plugin_t = std::dynamic_pointer_cast<application_plugin>(its_application_plugin);
if (nullptr == application_plugin_t) {
application_plugin_t = its_application_plugin->get_ptr<application_plugin>();
}

if (nullptr != application_plugin_t) {
application_plugin_t->on_application_state_change(name_, application_plugin_state_e::STATE_INITIALIZED);
}
}
}
}
Expand Down Expand Up @@ -488,9 +492,15 @@ void application_impl::start() {
for (const auto& its_library : its_app_plugin_info->second) {
auto its_application_plugin = plugin_manager::get()->get_plugin(
plugin_type_e::APPLICATION_PLUGIN, its_library);

if (its_application_plugin) {
std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
on_application_state_change(name_, application_plugin_state_e::STATE_STARTED);
auto application_plugin_t = std::dynamic_pointer_cast<application_plugin>(its_application_plugin);
if (nullptr == application_plugin_t) {
application_plugin_t = its_application_plugin->get_ptr<application_plugin>();
}
if (nullptr != application_plugin_t) {
application_plugin_t->on_application_state_change(name_, application_plugin_state_e::STATE_STARTED);
}
}
}

Expand Down Expand Up @@ -577,8 +587,13 @@ void application_impl::stop() {
auto its_application_plugin = plugin_manager::get()->get_plugin(
plugin_type_e::APPLICATION_PLUGIN, its_library);
if (its_application_plugin) {
std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
on_application_state_change(name_, application_plugin_state_e::STATE_STOPPED);
auto application_plugin_t = std::dynamic_pointer_cast<application_plugin>(its_application_plugin);
if (nullptr == application_plugin_t) {
application_plugin_t = its_application_plugin->get_ptr<application_plugin>();
}
if (nullptr != application_plugin_t) {
application_plugin_t->on_application_state_change(name_, application_plugin_state_e::STATE_STOPPED);
}
}
}

Expand Down
9 changes: 2 additions & 7 deletions implementation/service_discovery/include/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ class service_discovery_host;

class runtime {
public:
virtual ~runtime()
#ifndef ANDROID
{}
#else
;
#endif

virtual ~runtime() {}

virtual std::shared_ptr<service_discovery> create_service_discovery(
service_discovery_host *_host,
std::shared_ptr<configuration> _configuration) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion implementation/service_discovery/include/runtime_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class runtime_impl
void * get_plugin_impl_ptr() override;
std::shared_ptr<service_discovery> create_service_discovery(
service_discovery_host *_host,
std::shared_ptr<configuration> _configuration) const;
std::shared_ptr<configuration> _configuration) const override;
};

} // namespace sd
Expand Down
5 changes: 1 addition & 4 deletions interface/vsomeip/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ class VSOMEIP_IMPORT_EXPORT_PLUGIN plugin {
std::shared_ptr<T> plugin_sp(configuration_plugin_ptr, [](T *) {
});

std::shared_ptr<T> ret_ptr = std::dynamic_pointer_cast<T>(plugin_sp);
printf("xxxxxxxx222222222:%d,%p,%p,%p\n", ret_ptr != nullptr, ret_ptr.get(), get_plugin_impl_ptr(), this);

return ret_ptr;
return std::dynamic_pointer_cast<T>(plugin_sp);
}
};

Expand Down

0 comments on commit e3b7a73

Please sign in to comment.