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{
33public:
34 using Searchable::check;
35 using Searchable::findGroup;
36
40 Property();
41
45 Property(const char* str);
46
47
51 Property(const Property& rhs);
52
56 Property(Property&& rhs) noexcept;
57
62 Property(std::initializer_list<std::pair<std::string, yarp::os::Value>> values);
66 ~Property() override;
67
71 Property& operator=(const Property& prop);
72
76 Property& operator=(Property&& prop) noexcept;
77
78 // documented in Searchable
79 bool check(const std::string& key) const override;
80
92 void put(const std::string& key, const std::string& value);
93
105 void put(const std::string& key, const Value& value);
106
118 void put(const std::string& key, Value* value);
119
131 void put(const std::string& key, int value);
132
144 void put(const std::string& key, double value);
145
156 Property& addGroup(const std::string& key);
157
166 void unput(const std::string& key);
167
168 // documented in Searchable
169 Value& find(const std::string& key) const override;
170
171 // documented in Searchable
172 Bottle& findGroup(const std::string& key) const override;
173
180 void clear();
181
203 void fromString(const std::string& txt, bool wipe = true);
204
229 void fromCommand(int argc, char* argv[], bool skipFirst = true, bool wipe = true);
230
255 void fromCommand(int argc, const char* argv[], bool skipFirst = true, bool wipe = true);
256
278 void fromArguments(const char* arguments, bool wipe = true);
279
356 bool fromConfigFile(const std::string& fname, bool wipe = true);
357
371 bool fromConfigFile(const std::string& fname,
372 Searchable& env,
373 bool wipe = true);
374
385 bool fromConfigDir(const std::string& dirname,
386 const std::string& section = std::string(),
387 bool wipe = true);
388
396 void fromConfig(const char* txt, bool wipe = true);
397
410 void fromConfig(const char* txt,
411 Searchable& env,
412 bool wipe = true);
413
423 void fromQuery(const char* url,
424 bool wipe = true);
425
426
427 // documented in Searchable
428 std::string toString() const override;
429
430
431#ifndef DOXYGEN_SHOULD_SKIP_THIS
432private:
433 class Private;
434 Private* mPriv;
435#endif // DOXYGEN_SHOULD_SKIP_THIS
436};
437
438} // namespace yarp::os
439
440#endif // YARP_OS_PROPERTY_H
std::string toString(const T &value)
convert an arbitrary type to string.
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.
A class for storing options and configuration information.
Definition Property.h:32
A base class for nested structures that can be searched.
Definition Searchable.h:31
A single value (typically within a Bottle).
Definition Value.h:44
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18