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 <iostream> // for cout, ostream
28#include <ostream>
29#include <string> // for string
30
31#include <Ice/Properties.h> // for PropertiesPtr
32#include <IceUtil/Handle.h> // for Handle
33
34#include "../ArmarXDummyManager.h" // for ArmarXDummyManagerPtr
35#include "properties/PropertyUser.h" // for PropertyUserList
36
38{
39 class options_description;
40}
41
42namespace armarx
43{
44 // forward declarations
45 class Application;
46
47 /**
48 * \typedef ApplicationPtr shared pointer for armarx::Application
49 */
51} // namespace armarx
52
53/**
54 * This namespace contains all relevent methods to parse and print options and propertiesas used by the armarx::Application.
55 */
57{
58 /**
59 \brief Help format to display. Help format is set on commandline using the -f option.
60 \ingroup Application
61 */
71
72 /**
73 \brief Stucture containing the parsed options of the application.
74 \ingroup Application
75 */
76 struct Options
77 {
80 bool error;
81 std::string outfile;
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,
118 ArmarXDummyManagerPtr dummyManager,
119 Options options,
120 Ice::PropertiesPtr properties,
121 std::ostream& out = std::cout);
122
123 /**
124 * Return the list of property users.
125 * In this case all components are property users stored in the ComponentManager.
126 *
127 * \return PropertyUser List
128 */
130} // namespace armarx::ApplicationOptions
OptionsFormat
Help format to display.
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
This namespace contains all relevent methods to parse and print options and propertiesas used by the ...
PropertyUserList getPropertyUsers(ArmarXDummyManagerPtr dummyManager)
Return the list of property users.
Options parseHelpOptions(Ice::PropertiesPtr properties, int argc, char *argv[])
Parse the help options.
Ice::PropertiesPtr mergeProperties(Ice::PropertiesPtr properties, int argc, char *argv[])
Merge command line options into properties.
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.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::vector< PropertyUserPtr > PropertyUserList
UserProperty list type.
IceUtil::Handle< Application > ApplicationPtr
Definition Application.h:93
IceUtil::Handle< ArmarXDummyManager > ArmarXDummyManagerPtr
Stucture containing the parsed options of the application.
std::shared_ptr< boost::program_options::options_description > description