diff options
author | Patrick Venture <venture@google.com> | 2018-11-14 14:01:36 -0800 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-11-14 16:17:02 -0800 |
commit | 6c415c67011532fc0fb7c3051a4cf657ea93dfe0 (patch) | |
tree | 109191a7715367eb5c7dd40ddd479b29825a5139 /example/example.cpp | |
parent | df209fa4ebac387417fc617511a199f7484bd103 (diff) | |
download | phosphor-ipmi-blobs-6c415c67011532fc0fb7c3051a4cf657ea93dfe0.tar.gz phosphor-ipmi-blobs-6c415c67011532fc0fb7c3051a4cf657ea93dfe0.zip |
bugfix: load handlers and use factory symbol
Use a predefined factory symbol to build each handler after loading the
library.
Change-Id: I0369c6e46a57c2e8533409d8b06eb74a3962434c
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'example/example.cpp')
-rw-r--r-- | example/example.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/example/example.cpp b/example/example.cpp index 929e4d1..cc36e88 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -181,11 +181,17 @@ void setupExampleHandler() __attribute__((constructor)); void setupExampleHandler() { - auto* manager = getBlobManager(); - if (!manager->registerHandler(std::make_unique<ExampleBlobHandler>())) - { - log<level::ERR>("Failed to register Example Handler"); - } + // You don't need to do anything in the constructor. } } // namespace blobs + +/** + * This method is required by the blob manager. + * + * It is called to grab a handler for registering the blob handler instance. + */ +std::unique_ptr<blobs::GenericBlobInterface> createHandler() +{ + return std::make_unique<blobs::ExampleBlobHandler>(); +} |