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>
29 
32 
33 namespace armarx
34 {
35 
37  _parent{&parent}, _prefix{pre}
38  {
39  }
40 
41  void
43  {
44  ARMARX_CHECK_NOT_NULL(dependedOn);
45  _dependsOn.emplace_back(dependedOn);
46  }
47 
48  void
51  {
52  addPluginDependency(dependedOn.get());
53  }
54 
55  std::string
57  {
58  if (_prefix.empty())
59  {
60  return name;
61  }
62  return _prefix + '_' + name;
63  }
64 
65  const std::string&
67  {
68  return _prefix;
69  }
70 
73  {
74  return *_parent;
75  }
76 
77  const ManagedIceObject&
79  {
80  return *_parent;
81  }
82 
83  std::unique_ptr<ManagedIceObjectPlugin>&
84  ManagedIceObjectPlugin::getPlugin(const std::type_info& typeInfo, const std::string prefix)
85  {
86  return parent().getPluginPointer(typeInfo, prefix);
87  }
88 
89  void
90  ManagedIceObjectPlugin::checkOutParameter(void* targ)
91  {
92  ARMARX_CHECK_NULL(targ) << "This is an out parameter";
93  }
94 
95 } // namespace armarx
ManagedIceObjectPlugin.h
armarx::ManagedIceObjectPlugin::addPluginDependency
void addPluginDependency(ManagedIceObjectPlugin *dependedOn)
Definition: ManagedIceObjectPlugin.cpp:42
armarx::ManagedIceObjectPlugin::prefix
const std::string & prefix() const
Definition: ManagedIceObjectPlugin.cpp:66
armarx::ManagedIceObjectPlugin::parent
ManagedIceObject & parent()
Definition: ManagedIceObjectPlugin.cpp:72
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:86
ManagedIceObject.h
ExpressionException.h
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:162
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:56
armarx::ManagedIceObjectPlugin
Definition: ManagedIceObjectPlugin.h:49
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27