ManagedIceObjectPlugin.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2021, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXCore::core
19 * @author Raphael Grimm (raphael dot grimm at kit dot edu)
20 * @author Rainer Kartmann (rainer dot kartmann at kit dot edu)
21 * @date 2021
22 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
23 * GNU General Public License
24 */
25 
26 #include "ManagedIceObjectPlugin.h"
27 
28 #include <experimental/memory>
31 
32 
33 namespace armarx
34 {
35 
37  _parent{&parent},
38  _prefix{pre}
39  {}
40 
41 
43  {
44  ARMARX_CHECK_NOT_NULL(dependedOn);
45  _dependsOn.emplace_back(dependedOn);
46  }
47 
49  {
50  addPluginDependency(dependedOn.get());
51  }
52 
53  std::string ManagedIceObjectPlugin::makePropertyName(const std::string& name)
54  {
55  if (_prefix.empty())
56  {
57  return name;
58  }
59  return _prefix + '_' + name;
60  }
61 
62 
63  const std::string& ManagedIceObjectPlugin::prefix() const
64  {
65  return _prefix;
66  }
67 
68 
70  {
71  return *_parent;
72  }
73 
74 
76  {
77  return *_parent;
78  }
79 
80 
81  std::unique_ptr<ManagedIceObjectPlugin>& ManagedIceObjectPlugin::getPlugin(const std::type_info& typeInfo, const std::string prefix)
82  {
83  return parent().getPluginPointer(typeInfo, prefix);
84  }
85 
86 
87  void ManagedIceObjectPlugin::checkOutParameter(void* targ)
88  {
89  ARMARX_CHECK_NULL(targ) << "This is an out parameter";
90  }
91 
92 }
ManagedIceObjectPlugin.h
armarx::ManagedIceObjectPlugin::addPluginDependency
void addPluginDependency(ManagedIceObjectPlugin *dependedOn)
Definition: ManagedIceObjectPlugin.cpp:42
armarx::ManagedIceObjectPlugin::prefix
const std::string & prefix() const
Definition: ManagedIceObjectPlugin.cpp:63
armarx::ManagedIceObjectPlugin::parent
ManagedIceObject & parent()
Definition: ManagedIceObjectPlugin.cpp:69
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
std::experimental::fundamentals_v2::observer_ptr
Definition: ManagedIceObject.h:53
armarx::ManagedIceObject::getPluginPointer
std::unique_ptr< ManagedIceObjectPlugin > & getPluginPointer(std::type_info const &type, std::string const &prefix)
Definition: ManagedIceObject.cpp:85
ManagedIceObject.h
ExpressionException.h
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:163
armarx::ManagedIceObjectPlugin::ManagedIceObjectPlugin
ManagedIceObjectPlugin(ManagedIceObject &parent, std::string pre)
Definition: ManagedIceObjectPlugin.cpp:36
ARMARX_CHECK_NULL
#define ARMARX_CHECK_NULL(ptr)
Definition: ExpressionException.h:212
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:53
armarx::ManagedIceObjectPlugin
Definition: ManagedIceObjectPlugin.h:50
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28