YARP
Yet Another Robot Platform
Loading...
Searching...
No Matches
yarpconfig.cpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
6
#include <
yarp/os/Property.h
>
7
#include <
yarp/os/Network.h
>
8
#include <
yarp/conf/version.h
>
9
#include <
yarp/os/Time.h
>
10
#include <
yarp/os/impl/NameConfig.h
>
11
#include "
yarpcontext.h
"
12
#include "
yarprobot.h
"
13
#include <cstdio>
14
#include <cstring>
15
16
void
show_help
() {
17
printf(
"Usage: yarp-config [OPTION]\n\n"
);
18
printf(
"Known values for OPTION are:\n\n"
);
19
printf(
" --help display this help and exit\n"
);
20
printf(
" --version report version information\n"
);
21
printf(
" --namespace report file that caches the current YARP namespace\n"
);
22
printf(
" --nameserver report file that caches nameserver contact information\n"
);
23
printf(
"\n"
);
24
yarp_context_help
();
25
yarp_robot_help
();
26
}
27
28
int
main
(
int
argc,
char
*argv[]) {
29
// Configure system clock
30
yarp::os::Network::initMinimum
(
yarp::os::YARP_CLOCK_SYSTEM
);
31
32
yarp::os::Property
options;
33
options.
fromCommand
(argc,argv);
34
if
(options.
check
(
"help"
)) {
35
show_help
();
36
return
0;
37
}
38
if
(argc>=2) {
39
if
(!strcmp(argv[1],
"context"
)) {
40
return
yarp_context_main
(argc,argv);
41
}
42
if
(!strcmp(argv[1],
"robot"
)) {
43
return
yarp_robot_main
(argc,argv);
44
}
45
}
46
if
(options.
check
(
"version"
)) {
47
printf(
"%s\n"
,
YARP_VERSION
);
48
return
0;
49
}
50
if
(options.
check
(
"namespace"
)) {
51
yarp::os::impl::NameConfig
nc;
52
printf(
"%s\n"
,nc.
getConfigFileName
(
YARP_CONFIG_NAMESPACE_FILENAME
).c_str());
53
return
0;
54
}
55
if
(options.
check
(
"nameserver"
)) {
56
yarp::os::impl::NameConfig
nc;
57
printf(
"%s\n"
,nc.
getConfigFileName
().c_str());
58
return
0;
59
}
60
show_help
();
61
return
1;
62
}
NameConfig.h
YARP_CONFIG_NAMESPACE_FILENAME
#define YARP_CONFIG_NAMESPACE_FILENAME
Definition
NameConfig.h:16
Network.h
Property.h
Time.h
yarp::os::NetworkBase::initMinimum
static void initMinimum()
Basic system initialization, not including plugins.
Definition
Network.cpp:871
yarp::os::Property
A class for storing options and configuration information.
Definition
Property.h:33
yarp::os::Property::check
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition
Property.cpp:1013
yarp::os::Property::fromCommand
void fromCommand(int argc, char *argv[], bool skipFirst=true, bool wipe=true)
Interprets a list of command arguments as a list of properties.
Definition
Property.cpp:1046
yarp::os::impl::NameConfig
Small helper class to help deal with legacy YARP configuration files.
Definition
NameConfig.h:23
yarp::os::impl::NameConfig::getConfigFileName
std::string getConfigFileName(const char *stem=nullptr, const char *ns=nullptr)
Definition
NameConfig.cpp:121
yarp::os::YARP_CLOCK_SYSTEM
@ YARP_CLOCK_SYSTEM
Definition
Time.h:28
version.h
YARP_VERSION
#define YARP_VERSION
Definition
version.h:14
main
int main(int argc, char *argv[])
Definition
yarpconfig.cpp:28
show_help
void show_help()
Definition
yarpconfig.cpp:16
yarp_context_help
void yarp_context_help()
Definition
yarpcontext.cpp:19
yarp_context_main
int yarp_context_main(int argc, char *argv[])
Definition
yarpcontext.cpp:37
yarpcontext.h
yarp_robot_main
int yarp_robot_main(int argc, char *argv[])
Definition
yarprobot.cpp:35
yarp_robot_help
void yarp_robot_help()
Definition
yarprobot.cpp:18
yarprobot.h
YARP
3.11.100+20250603.4+gitaa77f8b5c
src
commands
yarp-config
yarpconfig.cpp
Generated on Wed Jun 4 2025 02:39:56 for YARP by
1.9.8