YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Property.h
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-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_PROPERTY_H
8#define YARP_OS_PROPERTY_H
9
10#include <yarp/os/Bottle.h>
11#include <yarp/os/Portable.h>
12#include <yarp/os/Searchable.h>
13
14#include <string>
15
16namespace yarp::os {
17
31 public Searchable,
32 public Portable
33{
34public:
35 using Searchable::check;
36 using Searchable::findGroup;
37
41 Property();
42
46 Property(const char* str);
47
48
52 Property(const Property& rhs);
53
57 Property(Property&& rhs) noexcept;
58
63 Property(std::initializer_list<std::pair<std::string, yarp::os::Value>> values);
67 ~Property() override;
68
72 Property& operator=(const Property& prop);
73
77 Property& operator=(Property&& prop) noexcept;
78
79 // documented in Searchable
80 bool check(const std::string& key) const override;
81
93 void put(const std::string& key, const std::string& value);
94
106 void put(const std::string& key, const Value& value);
107
119 void put(const std::string& key, Value* value);
120
132 void put(const std::string& key, int value);
133
145 void put(const std::string& key, double value);
146
157 Property& addGroup(const std::string& key);
158
167 void unput(const std::string& key);
168
169 // documented in Searchable
170 Value& find(const std::string& key) const override;
171
172 // documented in Searchable
173 Bottle& findGroup(const std::string& key) const override;
174
181 void clear();
182
204 void fromString(const std::string& txt, bool wipe = true);
205
230 void fromCommand(int argc, char* argv[], bool skipFirst = true, bool wipe = true);
231
256 void fromCommand(int argc, const char* argv[], bool skipFirst = true, bool wipe = true);
257
279 void fromArguments(const char* arguments, bool wipe = true);
280
357 bool fromConfigFile(const std::string& fname, bool wipe = true);
358
372 bool fromConfigFile(const std::string& fname,
374 bool wipe = true);
375
386 bool fromConfigDir(const std::string& dirname,
387 const std::string& section = std::string(),
388 bool wipe = true);
389
397 void fromConfig(const char* txt, bool wipe = true);
398
411 void fromConfig(const char* txt,
413 bool wipe = true);
414
424 void fromQuery(const char* url,
425 bool wipe = true);
426
427
428 // documented in Searchable
429 std::string toString() const override;
430
431 // documented in Portable
432 bool read(ConnectionReader& reader) override;
433
434 // documented in Portable
435 bool write(ConnectionWriter& writer) const override;
436
437#ifndef DOXYGEN_SHOULD_SKIP_THIS
438private:
439 class Private;
440 Private* mPriv;
441#endif // DOXYGEN_SHOULD_SKIP_THIS
442};
443
444} // namespace yarp::os
445
446#endif // YARP_OS_PROPERTY_H
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.
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition Portable.h:25
A class for storing options and configuration information.
Definition Property.h:33
A base class for nested structures that can be searched.
Definition Searchable.h:56
A single value (typically within a Bottle).
Definition Value.h:43
std::string toString(const T &value)
convert an arbitrary type to string.
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18