YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Searchable.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-FileCopyrightText: 2006, 2008 Arjan Gijsberts
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
9
10#include <yarp/os/Value.h>
11
12using namespace yarp::os;
13
17
19
20bool yarp::os::Searchable::check(const std::string& key,
21 yarp::os::Value*& result,
22 const std::string& comment) const
23{
24 yarp::os::Value& bit = find(key);
25 bool ok = !(bit.isNull());
26 if (ok) {
27 result = &bit;
28 }
29 return ok;
30}
31
33 const yarp::os::Value& fallback,
34 const std::string& comment) const
35{
36 yarp::os::Value& bit = find(key);
37 bool ok = !(bit.isNull());
38 if (ok) {
39 return bit;
40 }
41 return fallback;
42}
43
44bool yarp::os::Searchable::check(const std::string& key,
45 const std::string& comment) const
46{
47 return check(key);
48}
49
51 const std::string& comment) const
52{
53 return findGroup(key);
54}
55
57{
58 return false;
59}
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
virtual bool isNull() const
Checks if the object is invalid.
virtual ~Searchable()
Destructor.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
Searchable()
Default constructor.
A single value (typically within a Bottle).
Definition Value.h:43
An interface to the operating system, including Port based communication.