1 // Copyright 2014 Renato Tegon Forti, Antony Polukhin. 2 // Copyright 2015-2019 Antony Polukhin. 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 //[plugcpp_my_plugin_staic_impl 9 #include "static_plugin.hpp" // this is essential, BOOST_SYMBOL_ALIAS must be seen in this file 10 11 #include <boost/make_shared.hpp> 12 #include <iostream> 13 14 namespace my_namespace { 15 16 class my_plugin_static : public my_plugin_api { 17 public: my_plugin_static()18 my_plugin_static() { 19 std::cout << "Constructing my_plugin_static" << std::endl; 20 } 21 name() const22 std::string name() const { 23 return "static"; 24 } 25 calculate(float x,float y)26 float calculate(float x, float y) { 27 return x - y; 28 } 29 ~my_plugin_static()30 ~my_plugin_static() { 31 std::cout << "Destructing my_plugin_static" << std::endl; 32 } 33 }; 34 create_plugin()35boost::shared_ptr<my_plugin_api> create_plugin() { 36 return boost::make_shared<my_plugin_static>(); 37 } 38 39 } // namespace my_namespace 40 41 //] 42 43