]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/dll/example/tutorial1/my_plugin_sum.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / dll / example / tutorial1 / my_plugin_sum.cpp
CommitLineData
7c673cae 1// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
1e59de90 2// Copyright Antony Polukhin, 2015-2022.
7c673cae
FG
3//
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt
6// or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8#include <iostream>
9
10
11//[plugcpp_my_plugin_sum
12#include <boost/config.hpp> // for BOOST_SYMBOL_EXPORT
13#include "../tutorial_common/my_plugin_api.hpp"
14
15namespace my_namespace {
16
17class my_plugin_sum : public my_plugin_api {
18public:
19 my_plugin_sum() {
20 std::cout << "Constructing my_plugin_sum" << std::endl;
21 }
22
23 std::string name() const {
24 return "sum";
25 }
26
27 float calculate(float x, float y) {
28 return x + y;
29 }
30
31 ~my_plugin_sum() {
32 std::cout << "Destructing my_plugin_sum ;o)" << std::endl;
33 }
34};
35
36// Exporting `my_namespace::plugin` variable with alias name `plugin`
37// (Has the same effect as `BOOST_DLL_ALIAS(my_namespace::plugin, plugin)`)
38extern "C" BOOST_SYMBOL_EXPORT my_plugin_sum plugin;
39my_plugin_sum plugin;
40
41} // namespace my_namespace
42
43//]