src/terralib/core/plugin/CppPluginProxy.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled applications.
5 
6  TerraLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License,
9  or (at your option) any later version.
10 
11  TerraLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with TerraLib. See COPYING. If not, write to
18  TerraLib Team at <terralib-team@terralib.org>.
19  */
20 
21 /*!
22  \file terralib/core/plugin/CppPluginProxy.cpp
23 
24  \brief A proxy class for C++ plugins.
25 
26  \author Gilberto Ribeiro de Queiroz
27  \author Matheus Cavassan Zaglia
28  */
29 
30 // TerraLib
31 #include "CppPluginProxy.h"
32 #include "../lib/Library.h"
33 #include "CppPlugin.h"
34 
36 {
37  std::shared_ptr<Library> slib;
38  std::unique_ptr<CppPlugin> real_plugin;
39 };
40 
41 te::core::CppPluginProxy::CppPluginProxy(const std::shared_ptr<Library>& slib,
42  std::unique_ptr<CppPlugin> real_plugin)
43  : m_pimpl(nullptr)
44 {
45  m_pimpl = new Impl;
46  m_pimpl->slib = slib;
47  m_pimpl->real_plugin = std::move(real_plugin);
48 }
49 
51 {
52  delete m_pimpl;
53 }
54 
57 {
58  return m_pimpl->real_plugin->info();
59 }
60 
61 bool
63 {
64  return m_pimpl->real_plugin->initialized();
65 }
66 
67 void
69 {
70  m_pimpl->real_plugin->startup();
71 }
72 
73 void
75 {
76  m_pimpl->real_plugin->shutdown();
77 }
bool initialized() const
It returns true or false if the CppPlugin was initialized.
const PluginInfo & info() const
It returns the PluginInfo of the CppPlugin.
Basic information about a plugin.
CppPluginProxy(const std::shared_ptr< Library > &slib, std::unique_ptr< CppPlugin > real_plugin)
Constructor.
A base class for C++ plugins in TerraLib.
A proxy class for C++ plugins.
void shutdown()
It shuts down the CppPlugin.