Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Merge requests
!441
Removed loading of packages from Problem
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Removed loading of packages from Problem
devel
into
master
Overview
0
Commits
11
Pipelines
1
Changes
6
Merged
Joan Vallvé Navarro
requested to merge
devel
into
master
3 years ago
Overview
0
Commits
11
Pipelines
1
Changes
6
Expand
0
0
Merge request reports
Viewing commit
6fc6337f
Prev
Next
Show latest version
6 files
+
308
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
6fc6337f
added gtest for generic factory
· 6fc6337f
Joan Vallvé Navarro
authored
3 years ago
test/dummy/dummy_object.h
0 → 100644
+
115
−
0
Options
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef WOLF_DUMMY_OBJECT_H_
#define WOLF_DUMMY_OBJECT_H_
/**************************
* WOLF includes *
**************************/
#include
"core/common/wolf.h"
#include
<core/utils/params_server.h>
#include
"factory_dummy_object.h"
namespace
wolf
{
WOLF_PTR_TYPEDEFS
(
DummyObject
);
/*
* Macro for defining Autoconf DummyObject creator for WOLF's high level API.
*
* Place a call to this macro inside your class declaration (in the DummyObject_class.h file),
* preferably just after the constructors.
*
* In order to use this macro, the derived DummyObject class, DummyObjectClass,
* must have a constructor available with the API:
*
* DummyObjectClass(const std::string& _unique_name,
* const ParamsServer& _server);
*/
#define WOLF_DUMMY_OBJECT_CREATE(DummyObjectClass) \
static DummyObjectPtr create(const std::string& _unique_name, \
const ParamsServer& _server) \
{ \
DummyObjectPtr sub = std::make_shared<DummyObjectClass>(_unique_name, _server); \
return sub; \
} \
class
DummyObject
{
protected:
//wolf
std
::
string
prefix_
;
std
::
string
name_
;
std
::
string
topic_
;
public:
DummyObject
(
const
std
::
string
&
_unique_name
,
const
ParamsServer
&
_server
)
:
prefix_
(
"ROS DummyObject/"
+
_unique_name
),
name_
(
_unique_name
)
{
//topic_ = _server.getParam<std::string>(prefix_ + "/topic");
}
virtual
~
DummyObject
(){};
//std::string getTopic() const;
std
::
string
getName
()
const
;
virtual
void
print
()
const
=
0
;
protected
:
template
<
typename
T
>
T
getParamWithDefault
(
const
ParamsServer
&
_server
,
const
std
::
string
&
_param_name
,
const
T
_default_value
)
const
;
};
// inline std::string DummyObject::getTopic() const
// {
// return topic_;
// }
inline
std
::
string
DummyObject
::
getName
()
const
{
return
name_
;
}
// template<typename T>
// inline T DummyObject::getParamWithDefault(const ParamsServer &_server,
// const std::string &_param_name,
// const T _default_value) const
// {
// try
// {
// return _server.getParam<T>(_param_name);
// }
// catch (...)
// {
// WOLF_INFO("DummyObject: Parameter ", _param_name, " is missing. Taking default value: ", _default_value);
// return _default_value;
// }
// }
}
#endif
Loading