ApplicationOptions.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package ArmarXCore::core
19
* @author Jan Issac (jan dot issac at gmail dot com)
20
* @date 2012
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
25
#pragma once
26
27
#include <Ice/Properties.h>
// for PropertiesPtr
28
#include <IceUtil/Handle.h>
// for Handle
29
30
#include <iostream>
// for cout, ostream
31
#include <ostream>
32
#include <string>
// for string
33
34
#include "../ArmarXDummyManager.h"
// for ArmarXDummyManagerPtr
35
#include "
properties/PropertyUser.h
"
// for PropertyUserList
36
37
namespace
boost::program_options
38
{
39
class
options_description;
40
}
41
42
namespace
armarx
43
{
44
// forward declarations
45
class
Application;
46
47
/**
48
* \typedef ApplicationPtr shared pointer for armarx::Application
49
*/
50
using
ApplicationPtr
=
IceUtil::Handle<Application>
;
51
}
52
53
/**
54
* This namespace contains all relevent methods to parse and print options and propertiesas used by the armarx::Application.
55
*/
56
namespace
armarx::ApplicationOptions
57
{
58
/**
59
\brief Help format to display. Help format is set on commandline using the -f option.
60
\ingroup Application
61
*/
62
enum
OptionsFormat
63
{
64
eHelpBrief
,
65
eOptionsDetailed
,
66
eDoxygen
,
67
eDoxygenComponentPages
,
68
eConfig
,
69
eXml
70
};
71
72
/**
73
\brief Stucture containing the parsed options of the application.
74
\ingroup Application
75
*/
76
struct
Options
77
{
78
bool
showHelp
;
79
bool
showVersion
;
80
bool
error
;
81
std::string
outfile
;
82
OptionsFormat
format
;
83
std::shared_ptr<boost::program_options::options_description>
description
;
84
};
85
86
/**
87
* Merge command line options into properties.
88
* Command line options override already set properties.
89
*
90
* \param properties initialized properties object (see Ice::createProperties())
91
* \param argc number of command line arguments
92
* \param argv command line arguments
93
*
94
* \return merged properties
95
*/
96
Ice::PropertiesPtr
mergeProperties
(
Ice::PropertiesPtr
properties,
int
argc,
char
* argv[]);
97
98
/**
99
* Parse the help options.
100
*
101
* \param properties properties object from Application
102
* \param argc number of command line arguments
103
* \param argv command line arguments
104
*
105
* \return the parsed options structure
106
*/
107
Options
parseHelpOptions
(
Ice::PropertiesPtr
properties,
int
argc,
char
* argv[]);
108
109
/**
110
* Prints help according to the format selection in options.
111
*
112
* \param application pointer to application in order to display application properties
113
* \param dummyManager pointer to dummyManager in order to display properties of add ManagedIceObjects
114
* \param options the parsed help options
115
* \param out optional output stream (default: std::cout)
116
*/
117
void
showHelp
(
ApplicationPtr
application,
ArmarXDummyManagerPtr
dummyManager,
Options
options,
Ice::PropertiesPtr
properties, std::ostream& out = std::cout);
118
119
/**
120
* Return the list of property users.
121
* In this case all components are property users stored in the ComponentManager.
122
*
123
* \return PropertyUser List
124
*/
125
PropertyUserList
getPropertyUsers
(
ArmarXDummyManagerPtr
dummyManager);
126
}
armarx::ApplicationOptions::getPropertyUsers
PropertyUserList getPropertyUsers(ArmarXDummyManagerPtr dummyManager)
Return the list of property users.
Definition:
ApplicationOptions.cpp:265
armarx::ApplicationOptions::mergeProperties
Ice::PropertiesPtr mergeProperties(Ice::PropertiesPtr properties, int argc, char *argv[])
Merge command line options into properties.
Definition:
ApplicationOptions.cpp:59
armarx::ApplicationOptions::eHelpBrief
@ eHelpBrief
Definition:
ApplicationOptions.h:64
armarx::ApplicationOptions::parseHelpOptions
Options parseHelpOptions(Ice::PropertiesPtr properties, int argc, char *argv[])
Parse the help options.
Definition:
ApplicationOptions.cpp:68
boost::program_options
Definition:
ApplicationOptions.h:37
armarx::ApplicationOptions::OptionsFormat
OptionsFormat
Help format to display.
Definition:
ApplicationOptions.h:62
armarx::ApplicationOptions::Options::showHelp
bool showHelp
Definition:
ApplicationOptions.h:78
armarx::ApplicationOptions::eConfig
@ eConfig
Definition:
ApplicationOptions.h:68
armarx::ApplicationOptions::Options::description
std::shared_ptr< boost::program_options::options_description > description
Definition:
ApplicationOptions.h:83
IceInternal::Handle< ::Ice::Properties >
armarx::ApplicationOptions::eDoxygenComponentPages
@ eDoxygenComponentPages
Definition:
ApplicationOptions.h:67
armarx::ApplicationOptions::eDoxygen
@ eDoxygen
Definition:
ApplicationOptions.h:66
armarx::PropertyUserList
std::vector< PropertyUserPtr > PropertyUserList
UserProperty list type.
Definition:
PropertyUser.h:262
PropertyUser.h
armarx::ApplicationOptions::Options::format
OptionsFormat format
Definition:
ApplicationOptions.h:82
armarx::ApplicationOptions::Options::showVersion
bool showVersion
Definition:
ApplicationOptions.h:79
armarx::ApplicationOptions::eXml
@ eXml
Definition:
ApplicationOptions.h:69
armarx::ApplicationOptions::Options
Stucture containing the parsed options of the application.
Definition:
ApplicationOptions.h:76
armarx::ApplicationPtr
IceUtil::Handle< Application > ApplicationPtr
Definition:
Application.h:93
armarx::ApplicationOptions
This namespace contains all relevent methods to parse and print options and propertiesas used by the ...
Definition:
ApplicationOptions.h:56
armarx::ApplicationOptions::Options::error
bool error
Definition:
ApplicationOptions.h:80
IceUtil::Handle< Application >
armarx::ApplicationOptions::showHelp
void showHelp(ApplicationPtr application, ArmarXDummyManagerPtr dummyManager, Options options, Ice::PropertiesPtr properties, std::ostream &out=std::cout)
Prints help according to the format selection in options.
Definition:
ApplicationOptions.cpp:169
armarx::ApplicationOptions::Options::outfile
std::string outfile
Definition:
ApplicationOptions.h:81
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
armarx::ApplicationOptions::eOptionsDetailed
@ eOptionsDetailed
Definition:
ApplicationOptions.h:65
ArmarXCore
core
application
ApplicationOptions.h
Generated on Sat Oct 12 2024 09:14:01 for armarx_documentation by
1.8.17