From daabeaa03bc5360c4ef50e539191e85e493e7032 Mon Sep 17 00:00:00 2001 From: johan Date: Sun, 11 Aug 2013 11:54:16 +0200 Subject: [PATCH 1/7] project hyperion-remote created; getoptPlusPlus dependency added; small changes to getOptPlusPlus; --- .../build/getoptPlusPlus/CMakeLists.txt | 17 + dependencies/build/getoptPlusPlus/COPYING | 66 + dependencies/build/getoptPlusPlus/Makefile | 16 + dependencies/build/getoptPlusPlus/README | 8 + .../build/getoptPlusPlus/config.doxygen | 1630 +++++++++++++++++ dependencies/build/getoptPlusPlus/getoptpp.cc | 325 ++++ dependencies/build/getoptPlusPlus/test.cc | 196 ++ .../getoptPlusPlus-master-20130810.zip | Bin 0 -> 33117 bytes .../include/getoptPlusPlus/getoptpp.h | 414 +++++ .../getoptPlusPlus/parameter.include.cc | 203 ++ src/hyperion-remote/CMakeLists.txt | 32 + src/hyperion-remote/hyperion-remote.cpp | 49 + 12 files changed, 2956 insertions(+) create mode 100644 dependencies/build/getoptPlusPlus/CMakeLists.txt create mode 100644 dependencies/build/getoptPlusPlus/COPYING create mode 100644 dependencies/build/getoptPlusPlus/Makefile create mode 100644 dependencies/build/getoptPlusPlus/README create mode 100644 dependencies/build/getoptPlusPlus/config.doxygen create mode 100644 dependencies/build/getoptPlusPlus/getoptpp.cc create mode 100644 dependencies/build/getoptPlusPlus/test.cc create mode 100644 dependencies/getoptPlusPlus-master-20130810.zip create mode 100644 dependencies/include/getoptPlusPlus/getoptpp.h create mode 100644 dependencies/include/getoptPlusPlus/parameter.include.cc create mode 100644 src/hyperion-remote/CMakeLists.txt create mode 100644 src/hyperion-remote/hyperion-remote.cpp diff --git a/dependencies/build/getoptPlusPlus/CMakeLists.txt b/dependencies/build/getoptPlusPlus/CMakeLists.txt new file mode 100644 index 00000000..3d471e22 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2012 TNO, The Netherlands. +# +# This file contains information proprietary to TNO. +# +# Any disclosure or use of this information or any reproduction of this document or any part thereof for +# other than the specified purpose for which it is intended is expressly prohibited except as TNO may +# otherwise agree to in writing. + +project(getoptPlusPlus) + +include_directories( + ../../include/getoptPlusPlus) + +add_library(getoptPlusPlus + ../../include/getoptPlusPlus/getoptpp.h + ../../include/getoptPlusPlus/parameter.include.cc + getoptpp.cc) diff --git a/dependencies/build/getoptPlusPlus/COPYING b/dependencies/build/getoptPlusPlus/COPYING new file mode 100644 index 00000000..641905ac --- /dev/null +++ b/dependencies/build/getoptPlusPlus/COPYING @@ -0,0 +1,66 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. +0. Additional Definitions. + +As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License. + +“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”. + +The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. +1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. +2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + + * a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or + * b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + + * a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. + * b) Accompany the object code with a copy of the GNU GPL and this license document. + +4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + + * a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. + * b) Accompany the Combined Work with a copy of the GNU GPL and this license document. + * c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. + * d) Do one of the following: + o 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + o 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. + * e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) + +5. Combined Libraries. + +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + + * a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. + * b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + diff --git a/dependencies/build/getoptPlusPlus/Makefile b/dependencies/build/getoptPlusPlus/Makefile new file mode 100644 index 00000000..d6be12e2 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/Makefile @@ -0,0 +1,16 @@ +SOURCES=getoptpp.cc test.cc +HEADERS=getoptpp.h +OBJECTS=$(SOURCES:.cc=.o) +LDFLAGS= +CXXFLAGS=-O0 -ggdb -Wall +CFLAGS=$(CXXFLAGS) +CC=g++ +TARGET=getopt-test + +all: $(TARGET) +$(TARGET): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $(TARGET) $(OBJECTS) +$(SOURCES): $(HEADERS) + +clean: + rm -rf $(TARGET) $(OBJECTS) *~ diff --git a/dependencies/build/getoptPlusPlus/README b/dependencies/build/getoptPlusPlus/README new file mode 100644 index 00000000..0ef16591 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/README @@ -0,0 +1,8 @@ +A very small class library that replaces getopt() and +getopt_long()-functionality with a more C++-friendly approach. + +Additionally, it does not rely on UNIX-specific code. + +See test.cc for a sample application and COPYING for license information. + + diff --git a/dependencies/build/getoptPlusPlus/config.doxygen b/dependencies/build/getoptPlusPlus/config.doxygen new file mode 100644 index 00000000..9ac6e568 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/config.doxygen @@ -0,0 +1,1630 @@ +# Doxyfile 1.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans.ttf + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/dependencies/build/getoptPlusPlus/getoptpp.cc b/dependencies/build/getoptPlusPlus/getoptpp.cc new file mode 100644 index 00000000..3b2cb9e3 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/getoptpp.cc @@ -0,0 +1,325 @@ + /* (C) 2011 Viktor Lofgren + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + + +#include "getoptpp.h" +#include + +using namespace std; + +namespace vlofgren { + +/* + * + * Class OptionsParser + * + * + */ + + +OptionsParser::OptionsParser(const char* programDesc) : fprogramDesc(programDesc) {} +OptionsParser::~OptionsParser() {} + +ParameterSet& OptionsParser::getParameters() { + return parameters; +} + +void OptionsParser::parse(int argc, const char* argv[]) throw(runtime_error) +{ + argv0 = argv[0]; + + if(argc == 1) return; + + vector v(&argv[1], &argv[argc]); + + ParserState state(*this, v); + + for(; !state.end(); state.advance()) { + + std::list::iterator i; + + for(i = parameters.parameters.begin(); + i != parameters.parameters.end(); i++) + { + if((*i)->receive(state)) break; + } + + if(i == parameters.parameters.end()) { + std::string file = state.get(); + if(file == "--") { + state.advance(); + break; + } + else if(file.at(0) == '-') + throw Parameter::ParameterRejected(string("Bad parameter: ") + file); + else files.push_back(state.get()); + } + } + + if(!state.end()) for(; !state.end(); state.advance()) { + files.push_back(state.get()); + } + +} + +void OptionsParser::usage() const { + cerr << "Usage: " << programName() << " arguments" << endl; + + cerr << fprogramDesc << endl << endl; + + cerr << "Parameters: " << endl; + + std::list::const_iterator i; + for(i = parameters.parameters.begin(); + i != parameters.parameters.end(); i++) + { + cerr.width(30); + cerr << std::left << " " + (*i)->usageLine(); + + cerr.width(40); + cerr << std::left << (*i)->description() << endl; + + } + +} + +const vector& OptionsParser::getFiles() const { + return files; +} + +const string& OptionsParser::programName() const { + return argv0; +} + +/* + * Parameter set + * + * + */ + +ParameterSet::ParameterSet(const ParameterSet& ps) { + throw new runtime_error("ParameterSet not copyable"); +} + +ParameterSet::~ParameterSet() { + for(std::list::iterator i = parameters.begin(); + i != parameters.end(); i++) + { + delete *i; + } + +} + +/* The typical use case for command line arguments makes linear searching completely + * acceptable here. + */ + +Parameter& ParameterSet::operator[](char c) const { + for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { + if((*i)->shortOption() == c) return *(*i); + } + throw out_of_range("ParameterSet["+c+string("]")); +} + + +Parameter& ParameterSet::operator[](const string& param) const { + for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { + if((*i)->longOption() == param) return *(*i); + } + throw out_of_range("ParameterSet["+param+"]"); +} + + + +/* + * + * Class ParserState + * + * + */ + + +ParserState::ParserState(OptionsParser &opts, vector& args) : + opts(opts), arguments(args), iterator(args.begin()) +{ + +} + +const string ParserState::peek() const { + vector::const_iterator next = iterator+1; + if(next != arguments.end()) return *next; + else return ""; + +} + +const string ParserState::get() const { + if(!end()) return *iterator; + else return ""; +} + +void ParserState::advance() { + iterator++; +} + +bool ParserState::end() const { + return iterator == arguments.end(); +} + + +/* + * + * Class Parameter + * + * + */ + + + +Parameter::Parameter(char shortOption, const std::string & longOption, const std::string & description) : + fshortOption(shortOption), flongOption(longOption), fdescription(description) +{ + +} + +Parameter::~Parameter() {} + +const string& Parameter::description() const { return fdescription; } +const string& Parameter::longOption() const { return flongOption; } +char Parameter::shortOption() const { return fshortOption; } + +/* + * + * Class Switchable + * + * + */ + +bool Switchable::isSet() const { return fset; } +Switchable::~Switchable() {}; +Switchable::Switchable() : fset(false) {} + +void MultiSwitchable::set() throw (Switchable::SwitchingError) { fset = true; } +MultiSwitchable::~MultiSwitchable() {} + + +void UniquelySwitchable::set() throw (Switchable::SwitchingError) { + if(UniquelySwitchable::isSet()) throw Switchable::SwitchingError(); + fset = true; +} +UniquelySwitchable::~UniquelySwitchable() {} + + +PresettableUniquelySwitchable::~PresettableUniquelySwitchable() {} +bool PresettableUniquelySwitchable::isSet() const { + return UniquelySwitchable::isSet() || fpreset.isSet(); +} +void PresettableUniquelySwitchable::set() throw (Switchable::SwitchingError) +{ + UniquelySwitchable::set(); +} +void PresettableUniquelySwitchable::preset() { + fpreset.set(); +} + +/* + * + * Class SwitchParameter + * + * + */ + + +SwitchParameter::SwitchParameter(char shortOption, const char *longOption, + const char* description) : CommonParameter(shortOption, longOption, description) {} +SwitchParameter::~SwitchParameter() {} + +void SwitchParameter::receiveSwitch() throw(Parameter::ParameterRejected) { + set(); +} + +void SwitchParameter::receiveArgument(const string &arg) throw(Parameter::ParameterRejected) { + throw UnexpectedArgument(); +} + +/* + * + * PODParameter specializations + * + * + * + */ + + +template<> +PODParameter::PODParameter(char shortOption, const char *longOption, + const char* description) : CommonParameter(shortOption, longOption, description) { + preset(); +} + + +template<> +int PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) +{ + // This is sadly necessary for strto*-functions to operate on + // const char*. The function doesn't write to the memory, though, + // so it's quite safe. + + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); + + long l = strtol(cstr, &cstr, 10); + if(*cstr != '\0') throw ParameterRejected("Expected int"); + + if(l > INT_MAX || l < INT_MIN) { + throw ParameterRejected("Expected int"); + } + + return l; +} + +template<> +long PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) +{ + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); + + long l = strtol(cstr, &cstr, 10); + if(*cstr != '\0') throw ParameterRejected("Expected long"); + + return l; +} + +template<> +double PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) +{ + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); + + double d = strtod(cstr, &cstr); + if(*cstr != '\0') throw ParameterRejected("Expected double"); + + return d; +} + +template<> +string PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) +{ + return s; +} + + +} //namespace diff --git a/dependencies/build/getoptPlusPlus/test.cc b/dependencies/build/getoptPlusPlus/test.cc new file mode 100644 index 00000000..adb34ff8 --- /dev/null +++ b/dependencies/build/getoptPlusPlus/test.cc @@ -0,0 +1,196 @@ + /* (C) 2011 Viktor Lofgren + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + + +#include "getoptpp.h" +#include +#include +#include +#include + +using namespace std; +using namespace vlofgren; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/* + * + * This is one way of adding new parameter types, + * inheriting existing types and adding new validation. + * + * In this case, StringParameter (which is a typedef of PODParameter gets + * a new validator that only accepts strings with only letters. + * + */ + + +class AlphabeticParameter : public StringParameter { +public: + AlphabeticParameter(char shortName, const char* longName, const char* description) : + StringParameter(shortName, longName, description) {} + virtual ~AlphabeticParameter() {} + + void receiveSwitch() throw(Parameter::ParameterRejected) { + throw Parameter::ParameterRejected(); + } + + + /* isalpha may be a macro */ + static bool isNotAlpha(char c) { return !isalpha(c); } + + virtual string validate(const string& arg) throw(Parameter::ParameterRejected) { + int nonalpha = count_if(arg.begin(), arg.end(), isNotAlpha); + + + if(nonalpha) throw Parameter::ParameterRejected("I only want numbers"); + else return arg; + } + +}; + +/* + * + * The other way is to specialize the PODParameter class + * + */ + +enum RockPaperScissor { ROCK, PAPER, SCISSOR } ; + +namespace vlofgren { + // needs to live in the vlofgren namespace for whatever reason + template<> enum RockPaperScissor + PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) + { + if(s == "rock") + return ROCK; + else if(s == "paper") + return PAPER; + else if(s == "scissor") + return SCISSOR; + else { + throw ParameterRejected("Invalid argument"); + } + + } +} +typedef PODParameter RockPaperScissorParameter; + + +/* + * + * Dummy program + * + */ + + +int main(int argc, const char* argv[]) { + + // Create a parser + + OptionsParser optp("An example program (that also runs some tests)"); + ParameterSet& ps = optp.getParameters(); + + /* An alternative option is to simply extend the options parser and set all this up + * in the constructor. + */ + + ps.add('f', "foo", "Enable the foo system (no argument)"); + ps.add('b', "bar", "Enable the bar system (string argument)"); + ps.add >('z', "baz", "Enable the baz system (floating point argument"); + + PODParameter& i = ps.add >('i', "foobar", "Enable the foobar system (integer argument"); + i.setDefault(15); + + ps.add('a', "alpha", "Custom parameter that requires a string of letters"); + ps.add('r', "rps", "Takes the values rock, paper or scissor"); + ps.add('h', "help", "Display help screen"); + + + // Register the parameters with the parser + + try { + // Parse argv + optp.parse(argc, argv); + + // Test for the help flag + if(ps['h'].isSet()) { + optp.usage(); + return EXIT_SUCCESS; + } + + // Print out what values the parameters were given + + cout << "The following parameters were set:" << endl; + + cout << "foo: " << (ps['f'].isSet() ? "true" : "false") << endl; + cout << "bar: \"" << ps['b'].get() << "\""<< endl; + cout << "baz: "; + + if(ps['z'].isSet()) { + cout << ps['z'].get() << endl; + } else { + cout << "not set" << endl; + } + + /* You can also save the return value from ParserSet::add() if + * you feel the operator[].get() stuff is a bit much */ + cout << "foobar: "; + if(i.isSet()) { + cout << i.get() << endl; + } else { + cout << "not set" << endl; + } + cout << "alpha: "; + if(ps["alpha"].isSet()) { + cout << ps["alpha"].get() << endl; + } else { + cout << "not set" << endl; + } + + cout << "rps: "; + if(ps["rps"].isSet()) { + cout << ps["rps"].get() << endl; + } else { + cout << "not set" << endl; + } + + } catch(Parameter::ParameterRejected &p){ + // This will happen if the user has fed some malformed parameter to the program + cerr << p.what() << endl; + optp.usage(); + return EXIT_FAILURE; + } catch(runtime_error &e) { + // This will happen if you try to access a parameter that hasn't been set + cerr << e.what() << endl; + + return EXIT_FAILURE; + } + + + // List what non-parameter options were given (typically files) + cout << "The following file arguments were given:" << endl; + + vector files = optp.getFiles(); + for(vector::iterator i = files.begin(); i != files.end(); i++) { + cout << "\t" << *i << endl; + } + + + return EXIT_SUCCESS; +} + +#endif diff --git a/dependencies/getoptPlusPlus-master-20130810.zip b/dependencies/getoptPlusPlus-master-20130810.zip new file mode 100644 index 0000000000000000000000000000000000000000..fe33242948a9f8e3ac8a4d1d7fee57dbff82df8d GIT binary patch literal 33117 zcmZ^~V{k4^ur2(=$&RsO+qP}nwry+2w(Xr{$4;Kuwr$(_-h1n-Q+0owsp_fu(^Ivk zR!y(&o>7zm1OEm1Kcf~7SK$9H{{IOb00Xcvb9HcZRkU?;`9DTyXXN5)=FFg`3IPC- z`qq+H{QsSy|F3hkhrdt>3;;lf2LRyxug)S0ids_g692PDx7LO|NjtLNipH(omEfEw z{Tg93Vc@|NC#omKuqTBOe&u!2psa@q(OOb!`CGyi)FH<`)dLxqnrZ7Qot6nh5?sCJ z2640-m)m(lhu4qNmj2F;L4YF1%1xbs?sipYd~dIxN9pa()5pif*x}4!*S}bAKD9dk z;_p@V5`8`0PjBY-hKpR52{px^@AOZpZa2~MZTfz79%To+jTCOf8`W-`sLb~(>d+?- z27TI3WAm;1p&Rn#3;6cjFsXy3EL}U{0%eHmUzi#lRBBefj^^8t%9=cXy0ZjW4^#Cj z>idVs(H1?GOX=3LvKZAgYok)_)5^4{QCGc9Lgv-XT2-gXlL@?b$i>LrCAS>uM}3^n z!?B$^ls&F+hnMWQ`&h%=Y%W~;&br9@%oyy^Td3eisO{a-3{G0&adN45YFB>$JAn4< zNq*{xS+3We-|x<-O@PxEjWA(v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HyrgIYV%7=m$4MYO$~ zwfYg>G!H$#LZ#6T#zM&xI_qbjYbFZ-yHjJ$dabq8gio6KsNNiXW5i#b`~7Jt&ubY3 z!;?mL9D(w~=IC2jO!B5aN7PPL$rL1#~1W59Qv>wl@aQTfcKZj(q^c-{YR@dD1 zvvsbv>{=h9K2-Cdw~bk)1F*#1^;e?zR68JCpw}7NjH!@rF~+!QA{u+h6s04%18q0)~kZw1w7jxt`@V)mQjS^A&__oL~{E2(rDlPz5w*OS*noJ=muz(Tzg z-%y8aw`FxGA+4v*d7G&@1*kk&pXp#k;|dLM$(dXJ_&q!~*PBh1VjNk_sH!oferd?f z?i|(xj`qJ?ePG9iz!bUDhe$>05^&SA%6p#14BYF*)fH&7b(Et7bON7p44dE~hOas(qZrGk_{< zT53eT<$(VCp?`9_RJTFzPVwWgb|-16=+@cR0w1K;+Z5D$IzoVFR*)VD;HD{k$UWDZ zK5F;uQr+($dgd{!5J#}m+O-!bqRM|k@`r!S$regWVGi~~RlZR0XVG(>M-W4xy;JBE zjRP%vbpc)(_lVWbLNUnc-s-p)N#pyjoZ-I;Y~?Z(WHpcxI-&i zl_SbNWqq-5(cGTkE6URTrG@O(*~)R3*eF}-8OLSvl~!@}OA8!*J<27NYsXkH>ND^b z-sazU54AU&hNC}{YOlMY@K2Dpws|{S<=F#ox!Bn-E3deM_?h28a#Dam0093v82%>( z^XCKqUzh(rCjNiH{(VsV|D^m}cz(YBK6Cz`vGM=9!T)0ZGnDjSOp>2p@$Z@cPekcI zq5lm1{1+4x>OVpM5dr#7B>O+YH2;M}`H_JC{eAw2Xw843|2g3HFZ71me?tGeakqbR z|EW*^i|efa-*W$@R{s. + */ + + /* + * Modifications: + * + * - Removed using namespace std from header + * - Changed Parameter container type from std::set to std::list to presume order + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef GETOPTPP_H +#define GETOPTPP_H + +namespace vlofgren { + +class Parameter; +class ParserState; + +class OptionsParser; + +/** Container for a set of parameters */ + +class ParameterSet { +public: + + /** Find a parameter by short option form */ + Parameter& operator[](char c) const; + + /** Find a parameter by long option form. */ + Parameter& operator[](const std::string &s) const; + + /** Factory method that adds a new parameter of + * type T to the set. + * + * This is just for convenience. It allows ParameterSet + * to manage the pointers, as well as (usually) making the + * code slightly easier to read. + * + * Do not try to add non-Parameter types lest you will invoke + * the wrath of gcc's template error messages. + * + * @returns The created parameter. The reference is valid + * as long as ParameterSet exists. + */ + template + T &add(char shortName, const char* longName, const char* description); + + ParameterSet() {} + ~ParameterSet(); +protected: + friend class OptionsParser; + std::list parameters; + +private: + ParameterSet(const ParameterSet& ps); +}; + +/** getopt()-style parser for command line arguments + * + * Matches each element in argv against given + * parameters, and collects non-parameter arguments + * (typically files) in a vector. + * + */ + +class OptionsParser { +public: + OptionsParser(const char *programDesc); + virtual ~OptionsParser(); + + ParameterSet& getParameters(); + + /** Parse command line arguments */ + void parse(int argc, const char* argv[]) throw(std::runtime_error); + + /** Generate a usage screen */ + void usage() const; + + /** Return the name of the program, as + * given by argv[0] + */ + const std::string& programName() const; + + /** Return a vector of each non-parameter */ + const std::vector& getFiles() const; +protected: + std::string argv0; + std::string fprogramDesc; + + ParameterSet parameters; + std::vector files; + + friend class ParserState; +}; + +/** + * Corresponds to the state of the parsing, basically just a wrapper + * for a const_iterator that handles nicer. + */ + +class ParserState { +public: + const std::string peek() const; + const std::string get() const; + void advance(); + bool end() const; +protected: + ParserState(OptionsParser &opts, std::vector& args); +private: + friend class OptionsParser; + + OptionsParser &opts; + const std::vector &arguments; + std::vector::const_iterator iterator; +}; + +/** + * + * Abstract base class of all parameters + * + */ + +class Parameter { +public: + + /** Generic exception thrown when a parameter is malformed + */ + class ParameterRejected : public std::runtime_error { + public: + ParameterRejected(const std::string& s) : std::runtime_error(s) {} + ParameterRejected() : runtime_error("") {} + }; + + /** Exception thrown when a parameter did not expect an argument */ + class UnexpectedArgument : public ParameterRejected { + public: + UnexpectedArgument(const std::string &s) : ParameterRejected(s) {} + UnexpectedArgument() {} + }; + + /** Exception thrown when a parameter expected an argument */ + class ExpectedArgument : public ParameterRejected { + public: + ExpectedArgument(const std::string &s) : ParameterRejected(s) {} + ExpectedArgument() {} + }; + + Parameter(char shortOption, const std::string & longOption, const std::string & description); + + virtual ~Parameter(); + + /** Test whether the parameter has been set */ + virtual bool isSet() const = 0; + + + /** Attempt to down-cast to PODParameter. + * + * This is very convenient, but also an unholy crime against + * most principles of sane OOP design. + */ + template + T get() const; + + /** This parameter's line in OptionsParser::usage() */ + virtual std::string usageLine() const = 0; + + /** Description of the parameter (rightmost field in OptionsParser::usage()) */ + const std::string& description() const; + + /** The long name of this parameter (e.g. "--option"), without the dash. */ + const std::string& longOption() const; + + /** The short name of this parameter (e.g. "-o"), without the dash. */ + char shortOption() const; + +protected: + + /** Receive a potential parameter from the parser (and determien if it's ours) + * + * The parser will pass each potential parameter through it's registered parameters' + * receive function. + * + * @throw ParameterRejected if the parameter belongs to us, but is malformed somehow. + * + * @param state Allows access to the current argument. This is a fairly powerful + * iterator that technically allows for more complex grammar than what is + * presently used. + */ + virtual bool receive(ParserState& state) throw(ParameterRejected) = 0; + + friend class OptionsParser; + + char fshortOption; + const std::string flongOption; + const std::string fdescription; +private: + +}; + +/* + * + * Abstract base class of all parameters + * + */ + +class Switchable; + +/** Base class for most parameter implementations. + * + * It parses the argument in receive() and if it matches, + * calls receiveSwitch() or receiveArgument() which are implemented + * in child classes. + * + * The SwitchingBehavior mixin determines what happens if the argument + * is set multiple times. + */ + +template +class CommonParameter : public Parameter, protected SwitchingBehavior { +public: + + /** Test whether the parameter has been set */ + virtual bool isSet() const; + + CommonParameter(char shortOption, const char *longOption, + const char* description); + virtual ~CommonParameter(); + + virtual std::string usageLine() const; + +protected: + /** Parse the argument given by state, and dispatch either + * receiveSwitch() or receiveArgument() accordingly. + * + * @param state The current argument being parsed. + */ + virtual bool receive(ParserState& state) throw(ParameterRejected); + + /** + * Called when a parameter does not have an argument, e.g. + * either -f or --foo + */ + virtual void receiveSwitch() throw (ParameterRejected) = 0; + + /** + * Called when a parameter does have an argument, .e.g + * -fbar or --foo=bar + */ + virtual void receiveArgument(const std::string& argument) throw (ParameterRejected) = 0; +}; + +/** This class (used as a mixin) defines how a parameter + * behaves when switched on, specifically when switched on multiple times. + * + */ +class Switchable { +public: + class SwitchingError : public Parameter::ParameterRejected {}; + + /** Test whether the parameter has been set */ + virtual bool isSet() const; + + /** Set the parameter + * + */ + virtual void set() throw (SwitchingError) = 0; + + virtual ~Switchable(); + Switchable(); +protected: + bool fset; +}; + +/** Switching behavior that does not complain when set multiple times. */ +class MultiSwitchable : public Switchable { +public: + virtual ~MultiSwitchable(); + virtual void set() throw(SwitchingError); + +}; + +/** Switching behavior that allows switching only once. + * + * This is typically what you want if your parameter has an argument. + * + */ +class UniquelySwitchable : public Switchable { +public: + + virtual ~UniquelySwitchable(); + + /** Set the parameter + * + * @throw SwitchingError Thrown if the parameter is already set. + */ + virtual void set() throw (SwitchingError); +}; + +/** Switching behavior that makes possible allows presettable parameters, + * that is, it can either be set by the program, or by a command line argument, + * and the command-line part is UniquelySwitchable, but the program part + * is MultiSwitchable (and is set by preset()) + * + * + */ +class PresettableUniquelySwitchable : public UniquelySwitchable { +public: + + /** Test whether the parameter has been set OR preset */ + virtual bool isSet() const; + + /** Call if the parameter has been set. + * + * @throw SwitchingError thrown if the parameter is already set + * (doesn't care if it's been pre-set) + */ + virtual void set() throw (Switchable::SwitchingError); + + /** Call if the parameter has been preset */ + virtual void preset(); + + virtual ~PresettableUniquelySwitchable(); +private: + MultiSwitchable fpreset; +}; + +/* Parameter that does not take an argument, and throws an exception + * if an argument is given */ + +class SwitchParameter : public CommonParameter { +public: + SwitchParameter(char shortOption, const char *longOption, + const char* description); + virtual ~SwitchParameter(); + +protected: + virtual void receiveSwitch() throw (Parameter::ParameterRejected); + virtual void receiveArgument(const std::string& argument) throw (Parameter::ParameterRejected); +}; + +/** Plain-Old-Data parameter. Performs input validation. + * + * Currently only supports int, long and double, but extending + * it to other types (even non-POD) is as easy as partial template specialization. + * + * Specifically, you need to specialize validate(). + */ + +template +class PODParameter : public CommonParameter { +public: + PODParameter(char shortOption, const char *longOption, + const char* description); + virtual ~PODParameter(); + + /* Retreive the value of the argument. Throws an exception if + * the value hasn't been set (test with isSet()) + */ + T getValue() const; + + /** Type-casting operator, for convenience. */ + operator T() const; + + /** Set a default value for this parameter */ + virtual void setDefault(T value); + + std::string usageLine() const; +protected: + /** Validation function for the data type. + * + * @throw ParameterRejected if the argument does not conform to this data type. + * @return the value corresponding to the argument. + */ + virtual T validate(const std::string& s) throw (ParameterRejected); + virtual void receiveArgument(const std::string &argument) throw(ParameterRejected); + virtual void receiveSwitch() throw (Parameter::ParameterRejected); + + T value; +}; + + +typedef PODParameter IntParameter; +typedef PODParameter LongParameter; +typedef PODParameter DoubleParameter; +typedef PODParameter StringParameter; + +#include "parameter.include.cc" + +} //namespace + +#endif diff --git a/dependencies/include/getoptPlusPlus/parameter.include.cc b/dependencies/include/getoptPlusPlus/parameter.include.cc new file mode 100644 index 00000000..199ed6ee --- /dev/null +++ b/dependencies/include/getoptPlusPlus/parameter.include.cc @@ -0,0 +1,203 @@ + /* (C) 2011 Viktor Lofgren + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifdef GETOPTPP_H + + +/* This file contains template voodoo, and due to the unique way GCC handles + * templates, it needs to be included as a header (and it -is-). Do not attempt to + * compile this file directly! + */ + +template +T &ParameterSet::add(char shortName, const char* longName, const char* description) { + T* p = new T(shortName, longName, description); + parameters.push_back(p); + return *p; +} + +template +T Parameter::get() const{ + const PODParameter *ppt = dynamic_cast*>(this); + if(ppt) { + return ppt->getValue(); + } + throw new std::runtime_error("Type conversion not possible"); +} + + +/* + * + * Class CommonParameter implementation + * + * + */ + +template +CommonParameter::~CommonParameter() {} + +template +CommonParameter::CommonParameter(char shortOption, const char *longOption, + const char* description) : Parameter(shortOption, longOption, description) {} + +template +bool CommonParameter::isSet() const{ + return SwitchingBehavior::isSet(); +} + +template +std::string CommonParameter::usageLine() const { + std::stringstream strstr; + + strstr.width(10); + strstr << std::left<< std::string("-") + shortOption(); + strstr.width(20); + strstr << std::left << "--" + longOption(); + + return strstr.str(); +} + + + +template +bool CommonParameter::receive(ParserState& state) throw(Parameter::ParameterRejected) { + + const std::string arg = state.get(); + + try { + if(arg.at(0) != '-') return false; + + if(arg.at(1) == '-') { /* Long form parameter */ + + try { + unsigned int eq = arg.find_first_of("="); + + if(eq == std::string::npos) { + if(arg.substr(2) != longOption()) + return false; + + this->receiveSwitch(); + } else { + if(arg.substr(2, eq-2) != longOption()) + return false; + + this->receiveArgument(arg.substr(eq+1)); + } + return true; + } catch(Parameter::ExpectedArgument &ea) { + throw ExpectedArgument("--" + longOption() + ": expected an argument"); + } catch(Parameter::UnexpectedArgument &ua) { + throw UnexpectedArgument("--" + longOption() + ": did not expect an argument"); + } catch(Switchable::SwitchingError &e) { + throw ParameterRejected("--" + longOption() + ": parameter already set"); + } catch(Parameter::ParameterRejected &pr) { + + std::string what = pr.what(); + if(what.length()) + throw Parameter::ParameterRejected("--" + longOption() + ": " + what); + throw Parameter::ParameterRejected("--" + longOption() + " (unspecified error)"); + } + } + + try { + if(arg.at(1) == shortOption()) { + /* Matched argument on the form -f or -fsomething */ + if(arg.length() == 2) { /* -f */ + this->receiveSwitch(); + + return true; + } else { /* -fsomething */ + this->receiveArgument(arg.substr(2)); + + return true; + } + } + } catch(Parameter::ExpectedArgument &ea) { + throw ExpectedArgument(std::string("-") + shortOption() + ": expected an argument"); + } catch(Parameter::UnexpectedArgument &ua) { + throw UnexpectedArgument(std::string("-") + shortOption() + ": did not expect an argument"); + } catch(Switchable::SwitchingError &e) { + throw ParameterRejected(std::string("-") + shortOption() + ": parameter already set"); + } + + } catch(std::out_of_range& o) { + return false; + } + + return false; +} + + + +/* + * PODParameter stuff + * + */ + + +template +PODParameter::PODParameter(char shortOption, const char *longOption, + const char* description) : CommonParameter(shortOption, longOption, description) {} + +template +PODParameter::~PODParameter() {} + +template +PODParameter::operator T() const { return getValue(); } + +template +void PODParameter::setDefault(T value) { + PresettableUniquelySwitchable::preset(); + this->value = value; +} + +template +T PODParameter::getValue() const { + if(!isSet()) { + throw runtime_error( + std::string("Attempting to retreive the argument of parameter") + longOption() + " but it hasn't been set!"); + } + return value; + +} + + +template +std::string PODParameter::usageLine() const { + std::stringstream strstr; + + strstr.width(10); + strstr << std::left<< std::string("-") + shortOption() +"arg"; + strstr.width(20); + strstr << std::left << "--" + longOption() + "=arg"; + + return strstr.str(); +} + +template +void PODParameter::receiveSwitch() throw (Parameter::ParameterRejected) { + throw Parameter::ExpectedArgument(); +} + +template +void PODParameter::receiveArgument(const std::string &argument) throw(Parameter::ParameterRejected) { + set(); + value = this->validate(argument); +} + + +#endif diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt new file mode 100644 index 00000000..a6eee382 --- /dev/null +++ b/src/hyperion-remote/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 2.8) +project(hyperion-remote) + +find_package(Qt4 REQUIRED QtCore QtNetwork) + +# The following I do not undrstand completely... +# libQtCore.so uses some hardcoded library path inside which are incorrect after copying the file RPi file system +# Therefor, an extra path is needed on which to find the required libraries +LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) + +include_directories(${QT_INCLUDE_DIR}) + +set(hyperion-remote_HEADERS) + +set(hyperion-remote_SOURCES + hyperion-remote.cpp) + +qt4_wrap_cpp(HYPERION_REMOTE_MOC_SOURCES + ${hyperion-remote_HEADERS}) + +add_executable(hyperion-remote + ${hyperion-remote_HEADERS} + ${hyperion-remote_SOURCES} + ${HYPERION_REMOTE_MOC_SOURCES}) + +qt4_use_modules(hyperion-remote + Core + Network) + +target_link_libraries(hyperion-remote + hyperion-utils + getoptPlusPlus) diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp new file mode 100644 index 00000000..2b9a97a0 --- /dev/null +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -0,0 +1,49 @@ +#include +#include + +#include + +using namespace vlofgren; + +int main(int argc, const char * argv[]) +{ + // some settings + QString defaultServerAddress = "localhost:19444"; + int defaultPriority = 100; + + OptionsParser optionParser("Simple application to send a command to hyperion using the Json interface"); + ParameterSet & parameters = optionParser.getParameters(); + StringParameter & argAddress = parameters.add('a', "address" , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toAscii().constData()); + IntParameter & argPriority = parameters.add ('p', "priority" , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toAscii().constData()); + IntParameter & argDuration = parameters.add ('d', "duration" , "Specify how long the leds should be switched on in millseconds. Without this parameter, the leds will be switched on without end time."); + StringParameter & argColor = parameters.add('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)"); + StringParameter & argImage = parameters.add('i', "image" , "Set the leds to the colors according to the given image file"); + SwitchParameter & argList = parameters.add('l', "list" , "List all priority channels which are in use"); + SwitchParameter & argClear = parameters.add('x', "clear" , "Clear data for the priority channel provided by the -p option"); + SwitchParameter & argClearAll = parameters.add('y', "clear-all" , "Clear data for all priority channels"); + DoubleParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); + DoubleParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 values between 0.0 and 1.0)"); + DoubleParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); + DoubleParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); + SwitchParameter & argPrint = parameters.add('z', "print" , "Print the json input and output messages on stdout"); + SwitchParameter & argHelp = parameters.add('h', "help" , "Show this help message and exit"); + try + { + optionParser.parse(argc, argv); + } + catch (const std::runtime_error & e) + { + qWarning() << e.what(); + optionParser.usage(); + return 1; + } + + if (argHelp.isSet()) + { + optionParser.usage(); + return 0; + } + + + return 0; +} From 29f6e419230f13e2dcc1ba54a6c1e9f77a5f3ca7 Mon Sep 17 00:00:00 2001 From: johan Date: Sun, 11 Aug 2013 13:13:19 +0200 Subject: [PATCH 2/7] Added the option to leave out the short parameter option --- CMakeLists.txt | 3 +- dependencies/build/CMakeLists.txt | 1 + dependencies/build/getoptPlusPlus/getoptpp.cc | 6 +- .../include/getoptPlusPlus/getoptpp.h | 12 +-- .../getoptPlusPlus/parameter.include.cc | 88 ++++++++++--------- src/CMakeLists.txt | 2 + src/hyperion-remote/hyperion-remote.cpp | 4 +- 7 files changed, 59 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d42a4d63..9486fbd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ # define the minimum cmake version (as required by cmake) cmake_minimum_required(VERSION 2.8) -#set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake) + +set(CMAKE_TOOLCHAIN_FILE /home/johan/raspberrypi/Toolchain-RaspberryPi.cmake) # Define the main-project name project(Hyperion) diff --git a/dependencies/build/CMakeLists.txt b/dependencies/build/CMakeLists.txt index 58e98e7f..00e5ed43 100644 --- a/dependencies/build/CMakeLists.txt +++ b/dependencies/build/CMakeLists.txt @@ -7,3 +7,4 @@ # otherwise agree to in writing. add_subdirectory(jsoncpp) +add_subdirectory(getoptPlusPlus) diff --git a/dependencies/build/getoptPlusPlus/getoptpp.cc b/dependencies/build/getoptPlusPlus/getoptpp.cc index 3b2cb9e3..aae499a9 100644 --- a/dependencies/build/getoptPlusPlus/getoptpp.cc +++ b/dependencies/build/getoptPlusPlus/getoptpp.cc @@ -14,10 +14,9 @@ * along with this program. If not, see . */ - - #include "getoptpp.h" #include +#include using namespace std; @@ -199,7 +198,8 @@ Parameter::~Parameter() {} const string& Parameter::description() const { return fdescription; } const string& Parameter::longOption() const { return flongOption; } -char Parameter::shortOption() const { return fshortOption; } +bool Parameter::hasShortOption() const { return fshortOption != 0x0; } +char Parameter::shortOption() const { assert(hasShortOption()); return fshortOption; } /* * diff --git a/dependencies/include/getoptPlusPlus/getoptpp.h b/dependencies/include/getoptPlusPlus/getoptpp.h index 902f50c9..23d0aeba 100644 --- a/dependencies/include/getoptPlusPlus/getoptpp.h +++ b/dependencies/include/getoptPlusPlus/getoptpp.h @@ -175,15 +175,6 @@ public: /** Test whether the parameter has been set */ virtual bool isSet() const = 0; - - /** Attempt to down-cast to PODParameter. - * - * This is very convenient, but also an unholy crime against - * most principles of sane OOP design. - */ - template - T get() const; - /** This parameter's line in OptionsParser::usage() */ virtual std::string usageLine() const = 0; @@ -193,6 +184,9 @@ public: /** The long name of this parameter (e.g. "--option"), without the dash. */ const std::string& longOption() const; + /** Check if this parameters has a short option */ + bool hasShortOption() const; + /** The short name of this parameter (e.g. "-o"), without the dash. */ char shortOption() const; diff --git a/dependencies/include/getoptPlusPlus/parameter.include.cc b/dependencies/include/getoptPlusPlus/parameter.include.cc index 199ed6ee..4564d5ec 100644 --- a/dependencies/include/getoptPlusPlus/parameter.include.cc +++ b/dependencies/include/getoptPlusPlus/parameter.include.cc @@ -30,16 +30,6 @@ T &ParameterSet::add(char shortName, const char* longName, const char* descripti return *p; } -template -T Parameter::get() const{ - const PODParameter *ppt = dynamic_cast*>(this); - if(ppt) { - return ppt->getValue(); - } - throw new std::runtime_error("Type conversion not possible"); -} - - /* * * Class CommonParameter implementation @@ -63,8 +53,15 @@ template std::string CommonParameter::usageLine() const { std::stringstream strstr; - strstr.width(10); + strstr.width(10); + if (hasShortOption()) + { strstr << std::left<< std::string("-") + shortOption(); + } + else + { + strstr << " "; + } strstr.width(20); strstr << std::left << "--" + longOption(); @@ -82,21 +79,20 @@ bool CommonParameter::receive(ParserState& state) throw(Param if(arg.at(0) != '-') return false; if(arg.at(1) == '-') { /* Long form parameter */ - try { unsigned int eq = arg.find_first_of("="); if(eq == std::string::npos) { - if(arg.substr(2) != longOption()) - return false; + if(arg.substr(2) != longOption()) + return false; - this->receiveSwitch(); - } else { - if(arg.substr(2, eq-2) != longOption()) - return false; + this->receiveSwitch(); + } else { + if(arg.substr(2, eq-2) != longOption()) + return false; - this->receiveArgument(arg.substr(eq+1)); - } + this->receiveArgument(arg.substr(eq+1)); + } return true; } catch(Parameter::ExpectedArgument &ea) { throw ExpectedArgument("--" + longOption() + ": expected an argument"); @@ -112,28 +108,29 @@ bool CommonParameter::receive(ParserState& state) throw(Param throw Parameter::ParameterRejected("--" + longOption() + " (unspecified error)"); } } + else if (hasShortOption()) + { + try { + if(arg.at(1) == shortOption()) { + /* Matched argument on the form -f or -fsomething */ + if(arg.length() == 2) { /* -f */ + this->receiveSwitch(); - try { - if(arg.at(1) == shortOption()) { - /* Matched argument on the form -f or -fsomething */ - if(arg.length() == 2) { /* -f */ - this->receiveSwitch(); - - return true; - } else { /* -fsomething */ - this->receiveArgument(arg.substr(2)); - - return true; - } - } - } catch(Parameter::ExpectedArgument &ea) { - throw ExpectedArgument(std::string("-") + shortOption() + ": expected an argument"); - } catch(Parameter::UnexpectedArgument &ua) { - throw UnexpectedArgument(std::string("-") + shortOption() + ": did not expect an argument"); - } catch(Switchable::SwitchingError &e) { - throw ParameterRejected(std::string("-") + shortOption() + ": parameter already set"); - } + return true; + } else { /* -fsomething */ + this->receiveArgument(arg.substr(2)); + return true; + } + } + } catch(Parameter::ExpectedArgument &ea) { + throw ExpectedArgument(std::string("-") + shortOption() + ": expected an argument"); + } catch(Parameter::UnexpectedArgument &ua) { + throw UnexpectedArgument(std::string("-") + shortOption() + ": did not expect an argument"); + } catch(Switchable::SwitchingError &e) { + throw ParameterRejected(std::string("-") + shortOption() + ": parameter already set"); + } + } } catch(std::out_of_range& o) { return false; } @@ -180,8 +177,15 @@ template std::string PODParameter::usageLine() const { std::stringstream strstr; - strstr.width(10); - strstr << std::left<< std::string("-") + shortOption() +"arg"; + strstr.width(10); + if (hasShortOption()) + { + strstr << std::left << std::string("-") + shortOption() +"arg"; + } + else + { + strstr << ""; + } strstr.width(20); strstr << std::left << "--" + longOption() + "=arg"; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbf76456..c7777ac4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,3 +52,5 @@ if(PNG_FOUND) endif(PNG_FOUND) add_subdirectory(dispmanx-png) +add_subdirectory(hyperion-remote) + diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index 2b9a97a0..2311ffef 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -20,12 +20,12 @@ int main(int argc, const char * argv[]) StringParameter & argImage = parameters.add('i', "image" , "Set the leds to the colors according to the given image file"); SwitchParameter & argList = parameters.add('l', "list" , "List all priority channels which are in use"); SwitchParameter & argClear = parameters.add('x', "clear" , "Clear data for the priority channel provided by the -p option"); - SwitchParameter & argClearAll = parameters.add('y', "clear-all" , "Clear data for all priority channels"); + SwitchParameter & argClearAll = parameters.add(0x0, "clear-all" , "Clear data for all priority channels"); DoubleParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); DoubleParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 values between 0.0 and 1.0)"); DoubleParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); DoubleParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); - SwitchParameter & argPrint = parameters.add('z', "print" , "Print the json input and output messages on stdout"); + SwitchParameter & argPrint = parameters.add(0x0, "print" , "Print the json input and output messages on stdout"); SwitchParameter & argHelp = parameters.add('h', "help" , "Show this help message and exit"); try { From cc3baec0229f4c4e40d03cffa6058cdd25693358 Mon Sep 17 00:00:00 2001 From: johan Date: Sun, 11 Aug 2013 21:49:11 +0200 Subject: [PATCH 3/7] Special command line option classes added --- dependencies/build/getoptPlusPlus/getoptpp.cc | 340 +++++++++--------- .../include/getoptPlusPlus/getoptpp.h | 33 +- .../getoptPlusPlus/parameter.include.cc | 168 ++++----- src/hyperion-remote/CMakeLists.txt | 12 +- src/hyperion-remote/connection.cpp | 71 ++++ src/hyperion-remote/connection.h | 31 ++ src/hyperion-remote/hyperion-remote.cpp | 108 +++++- src/hyperion-remote/specialoptions.h | 102 ++++++ 8 files changed, 559 insertions(+), 306 deletions(-) create mode 100644 src/hyperion-remote/connection.cpp create mode 100644 src/hyperion-remote/connection.h create mode 100644 src/hyperion-remote/specialoptions.h diff --git a/dependencies/build/getoptPlusPlus/getoptpp.cc b/dependencies/build/getoptPlusPlus/getoptpp.cc index aae499a9..eca180a7 100644 --- a/dependencies/build/getoptPlusPlus/getoptpp.cc +++ b/dependencies/build/getoptPlusPlus/getoptpp.cc @@ -1,18 +1,18 @@ - /* (C) 2011 Viktor Lofgren - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +/* (C) 2011 Viktor Lofgren + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "getoptpp.h" #include @@ -23,175 +23,207 @@ using namespace std; namespace vlofgren { /* - * - * Class OptionsParser - * - * - */ +* +* Class OptionsParser +* +* +*/ OptionsParser::OptionsParser(const char* programDesc) : fprogramDesc(programDesc) {} OptionsParser::~OptionsParser() {} ParameterSet& OptionsParser::getParameters() { - return parameters; + return parameters; } void OptionsParser::parse(int argc, const char* argv[]) throw(runtime_error) { - argv0 = argv[0]; + argv0 = argv[0]; - if(argc == 1) return; + if(argc == 1) return; - vector v(&argv[1], &argv[argc]); + vector v(&argv[1], &argv[argc]); - ParserState state(*this, v); + ParserState state(*this, v); - for(; !state.end(); state.advance()) { + for(; !state.end(); state.advance()) { - std::list::iterator i; + std::list::iterator i; - for(i = parameters.parameters.begin(); - i != parameters.parameters.end(); i++) - { - if((*i)->receive(state)) break; - } + for(i = parameters.parameters.begin(); + i != parameters.parameters.end(); i++) + { + int n = 0; + try + { + n = (*i)->receive(state); + } + catch(Parameter::ExpectedArgument &) + { + throw Parameter::ExpectedArgument(state.get() + ": expected an argument"); + } + catch(Parameter::UnexpectedArgument &) + { + throw Parameter::UnexpectedArgument(state.get() + ": did not expect an argument"); + } + catch(Switchable::SwitchingError &) + { + throw Parameter::ParameterRejected(state.get() + ": parameter already set"); + } + catch(Parameter::ParameterRejected & pr) { + std::string what = pr.what(); + if(what.length()) + { + throw Parameter::ParameterRejected(state.get() + ": " + what); + } + throw Parameter::ParameterRejected(state.get() + " (unspecified error)"); + } - if(i == parameters.parameters.end()) { - std::string file = state.get(); - if(file == "--") { - state.advance(); - break; - } - else if(file.at(0) == '-') - throw Parameter::ParameterRejected(string("Bad parameter: ") + file); - else files.push_back(state.get()); - } - } + for (int j = 1; j < n; ++j) + { + state.advance(); + } - if(!state.end()) for(; !state.end(); state.advance()) { - files.push_back(state.get()); - } + if(n != 0) + { + break; + } + } + + if(i == parameters.parameters.end()) { + std::string file = state.get(); + if(file == "--") { + state.advance(); + break; + } + else if(file.at(0) == '-') + throw Parameter::ParameterRejected(string("Bad parameter: ") + file); + else files.push_back(state.get()); + } + } + + if(!state.end()) for(; !state.end(); state.advance()) { + files.push_back(state.get()); + } } void OptionsParser::usage() const { - cerr << "Usage: " << programName() << " arguments" << endl; + cerr << fprogramDesc << endl; + cerr << "Usage: " << programName() << " [OPTIONS]" << endl << endl; - cerr << fprogramDesc << endl << endl; + cerr << "Parameters: " << endl; - cerr << "Parameters: " << endl; + std::list::const_iterator i; + for(i = parameters.parameters.begin(); + i != parameters.parameters.end(); i++) + { + cerr.width(30); + cerr << std::left << " " + (*i)->usageLine(); - std::list::const_iterator i; - for(i = parameters.parameters.begin(); - i != parameters.parameters.end(); i++) - { - cerr.width(30); - cerr << std::left << " " + (*i)->usageLine(); - - cerr.width(40); - cerr << std::left << (*i)->description() << endl; - - } + cerr.width(40); + cerr << std::left << (*i)->description() << endl; + } } const vector& OptionsParser::getFiles() const { - return files; + return files; } const string& OptionsParser::programName() const { - return argv0; + return argv0; } /* - * Parameter set - * - * - */ +* Parameter set +* +* +*/ ParameterSet::ParameterSet(const ParameterSet& ps) { - throw new runtime_error("ParameterSet not copyable"); + throw new runtime_error("ParameterSet not copyable"); } ParameterSet::~ParameterSet() { - for(std::list::iterator i = parameters.begin(); - i != parameters.end(); i++) - { - delete *i; - } + for(std::list::iterator i = parameters.begin(); + i != parameters.end(); i++) + { + delete *i; + } } /* The typical use case for command line arguments makes linear searching completely - * acceptable here. - */ +* acceptable here. +*/ Parameter& ParameterSet::operator[](char c) const { - for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { - if((*i)->shortOption() == c) return *(*i); - } - throw out_of_range("ParameterSet["+c+string("]")); + for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { + if((*i)->shortOption() == c) return *(*i); + } + throw out_of_range("ParameterSet["+c+string("]")); } Parameter& ParameterSet::operator[](const string& param) const { - for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { - if((*i)->longOption() == param) return *(*i); - } - throw out_of_range("ParameterSet["+param+"]"); + for(std::list::const_iterator i = parameters.begin(); i!= parameters.end(); i++) { + if((*i)->longOption() == param) return *(*i); + } + throw out_of_range("ParameterSet["+param+"]"); } /* - * - * Class ParserState - * - * - */ +* +* Class ParserState +* +* +*/ ParserState::ParserState(OptionsParser &opts, vector& args) : - opts(opts), arguments(args), iterator(args.begin()) + opts(opts), arguments(args), iterator(args.begin()) { - + } const string ParserState::peek() const { - vector::const_iterator next = iterator+1; - if(next != arguments.end()) return *next; - else return ""; - + vector::const_iterator next = iterator+1; + if(next != arguments.end()) return *next; + else return ""; + } const string ParserState::get() const { - if(!end()) return *iterator; - else return ""; + if(!end()) return *iterator; + else return ""; } void ParserState::advance() { - iterator++; + iterator++; } bool ParserState::end() const { - return iterator == arguments.end(); + return iterator == arguments.end(); } /* - * - * Class Parameter - * - * - */ +* +* Class Parameter +* +* +*/ Parameter::Parameter(char shortOption, const std::string & longOption, const std::string & description) : - fshortOption(shortOption), flongOption(longOption), fdescription(description) + fshortOption(shortOption), flongOption(longOption), fdescription(description) { - + } Parameter::~Parameter() {} @@ -202,11 +234,11 @@ bool Parameter::hasShortOption() const { return fshortOption != 0x0; } char Parameter::shortOption() const { assert(hasShortOption()); return fshortOption; } /* - * - * Class Switchable - * - * - */ +* +* Class Switchable +* +* +*/ bool Switchable::isSet() const { return fset; } Switchable::~Switchable() {}; @@ -217,108 +249,88 @@ MultiSwitchable::~MultiSwitchable() {} void UniquelySwitchable::set() throw (Switchable::SwitchingError) { - if(UniquelySwitchable::isSet()) throw Switchable::SwitchingError(); - fset = true; + if(UniquelySwitchable::isSet()) throw Switchable::SwitchingError(); + fset = true; } UniquelySwitchable::~UniquelySwitchable() {} PresettableUniquelySwitchable::~PresettableUniquelySwitchable() {} bool PresettableUniquelySwitchable::isSet() const { - return UniquelySwitchable::isSet() || fpreset.isSet(); + return UniquelySwitchable::isSet() || fpreset.isSet(); } void PresettableUniquelySwitchable::set() throw (Switchable::SwitchingError) { - UniquelySwitchable::set(); + UniquelySwitchable::set(); } void PresettableUniquelySwitchable::preset() { - fpreset.set(); + fpreset.set(); } /* - * - * Class SwitchParameter - * - * - */ - - -SwitchParameter::SwitchParameter(char shortOption, const char *longOption, - const char* description) : CommonParameter(shortOption, longOption, description) {} -SwitchParameter::~SwitchParameter() {} - -void SwitchParameter::receiveSwitch() throw(Parameter::ParameterRejected) { - set(); -} - -void SwitchParameter::receiveArgument(const string &arg) throw(Parameter::ParameterRejected) { - throw UnexpectedArgument(); -} - -/* - * - * PODParameter specializations - * - * - * - */ +* +* PODParameter specializations +* +* +* +*/ template<> PODParameter::PODParameter(char shortOption, const char *longOption, - const char* description) : CommonParameter(shortOption, longOption, description) { - preset(); + const char* description) : CommonParameter(shortOption, longOption, description) { + preset(); } template<> int PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) { - // This is sadly necessary for strto*-functions to operate on - // const char*. The function doesn't write to the memory, though, - // so it's quite safe. + // This is sadly necessary for strto*-functions to operate on + // const char*. The function doesn't write to the memory, though, + // so it's quite safe. - char* cstr = const_cast(s.c_str()); - if(*cstr == '\0') throw ParameterRejected("No argument given"); + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); - long l = strtol(cstr, &cstr, 10); - if(*cstr != '\0') throw ParameterRejected("Expected int"); + long l = strtol(cstr, &cstr, 10); + if(*cstr != '\0') throw ParameterRejected("Expected int"); - if(l > INT_MAX || l < INT_MIN) { - throw ParameterRejected("Expected int"); - } + if(l > INT_MAX || l < INT_MIN) { + throw ParameterRejected("Expected int"); + } - return l; + return l; } template<> long PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) { - char* cstr = const_cast(s.c_str()); - if(*cstr == '\0') throw ParameterRejected("No argument given"); + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); - long l = strtol(cstr, &cstr, 10); - if(*cstr != '\0') throw ParameterRejected("Expected long"); + long l = strtol(cstr, &cstr, 10); + if(*cstr != '\0') throw ParameterRejected("Expected long"); - return l; + return l; } template<> double PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) { - char* cstr = const_cast(s.c_str()); - if(*cstr == '\0') throw ParameterRejected("No argument given"); + char* cstr = const_cast(s.c_str()); + if(*cstr == '\0') throw ParameterRejected("No argument given"); - double d = strtod(cstr, &cstr); - if(*cstr != '\0') throw ParameterRejected("Expected double"); + double d = strtod(cstr, &cstr); + if(*cstr != '\0') throw ParameterRejected("Expected double"); - return d; + return d; } template<> string PODParameter::validate(const string &s) throw(Parameter::ParameterRejected) { - return s; + return s; } diff --git a/dependencies/include/getoptPlusPlus/getoptpp.h b/dependencies/include/getoptPlusPlus/getoptpp.h index 23d0aeba..b0f825cf 100644 --- a/dependencies/include/getoptPlusPlus/getoptpp.h +++ b/dependencies/include/getoptPlusPlus/getoptpp.h @@ -203,7 +203,7 @@ protected: * iterator that technically allows for more complex grammar than what is * presently used. */ - virtual bool receive(ParserState& state) throw(ParameterRejected) = 0; + virtual int receive(ParserState& state) throw(ParameterRejected) = 0; friend class OptionsParser; @@ -250,20 +250,9 @@ protected: * receiveSwitch() or receiveArgument() accordingly. * * @param state The current argument being parsed. + * @return The number of parameters taken from the input */ - virtual bool receive(ParserState& state) throw(ParameterRejected); - - /** - * Called when a parameter does not have an argument, e.g. - * either -f or --foo - */ - virtual void receiveSwitch() throw (ParameterRejected) = 0; - - /** - * Called when a parameter does have an argument, .e.g - * -fbar or --foo=bar - */ - virtual void receiveArgument(const std::string& argument) throw (ParameterRejected) = 0; + virtual int receive(ParserState& state) throw(ParameterRejected) = 0; }; /** This class (used as a mixin) defines how a parameter @@ -344,15 +333,15 @@ private: /* Parameter that does not take an argument, and throws an exception * if an argument is given */ -class SwitchParameter : public CommonParameter { +template +class SwitchParameter : public CommonParameter { public: SwitchParameter(char shortOption, const char *longOption, const char* description); virtual ~SwitchParameter(); protected: - virtual void receiveSwitch() throw (Parameter::ParameterRejected); - virtual void receiveArgument(const std::string& argument) throw (Parameter::ParameterRejected); + virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); }; /** Plain-Old-Data parameter. Performs input validation. @@ -363,8 +352,8 @@ protected: * Specifically, you need to specialize validate(). */ -template -class PODParameter : public CommonParameter { +template +class PODParameter : public CommonParameter { public: PODParameter(char shortOption, const char *longOption, const char* description); @@ -383,14 +372,14 @@ public: std::string usageLine() const; protected: + virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); + /** Validation function for the data type. * * @throw ParameterRejected if the argument does not conform to this data type. * @return the value corresponding to the argument. */ - virtual T validate(const std::string& s) throw (ParameterRejected); - virtual void receiveArgument(const std::string &argument) throw(ParameterRejected); - virtual void receiveSwitch() throw (Parameter::ParameterRejected); + virtual T validate(const std::string& s) throw (Parameter::ParameterRejected); T value; }; diff --git a/dependencies/include/getoptPlusPlus/parameter.include.cc b/dependencies/include/getoptPlusPlus/parameter.include.cc index 4564d5ec..a1daf516 100644 --- a/dependencies/include/getoptPlusPlus/parameter.include.cc +++ b/dependencies/include/getoptPlusPlus/parameter.include.cc @@ -53,155 +53,125 @@ template std::string CommonParameter::usageLine() const { std::stringstream strstr; - strstr.width(10); if (hasShortOption()) { - strstr << std::left<< std::string("-") + shortOption(); + strstr << "-" << shortOption() << ", "; } else { - strstr << " "; + strstr << " "; } - strstr.width(20); - strstr << std::left << "--" + longOption(); + strstr.width(20); + strstr << std::left << "--" + longOption(); - return strstr.str(); + return strstr.str(); } - +/* + * + * Class SwitchParameter + * + * + */ template -bool CommonParameter::receive(ParserState& state) throw(Parameter::ParameterRejected) { +SwitchParameter::SwitchParameter(char shortOption, const char *longOption, + const char* description) : CommonParameter(shortOption, longOption, description) {} +template +SwitchParameter::~SwitchParameter() {} + +template +int SwitchParameter::receive(ParserState& state) throw(Parameter::ParameterRejected) { const std::string arg = state.get(); - try { - if(arg.at(0) != '-') return false; + if(arg.at(0) != '-') return false; - if(arg.at(1) == '-') { /* Long form parameter */ - try { - unsigned int eq = arg.find_first_of("="); + if ((arg.at(1) == '-' && arg.substr(2) == this->longOption()) || + (this->hasShortOption() && arg.at(1) == this->shortOption() && arg.length() == 2)) + { + this->set(); + return 1; + } - if(eq == std::string::npos) { - if(arg.substr(2) != longOption()) - return false; - - this->receiveSwitch(); - } else { - if(arg.substr(2, eq-2) != longOption()) - return false; - - this->receiveArgument(arg.substr(eq+1)); - } - return true; - } catch(Parameter::ExpectedArgument &ea) { - throw ExpectedArgument("--" + longOption() + ": expected an argument"); - } catch(Parameter::UnexpectedArgument &ua) { - throw UnexpectedArgument("--" + longOption() + ": did not expect an argument"); - } catch(Switchable::SwitchingError &e) { - throw ParameterRejected("--" + longOption() + ": parameter already set"); - } catch(Parameter::ParameterRejected &pr) { - - std::string what = pr.what(); - if(what.length()) - throw Parameter::ParameterRejected("--" + longOption() + ": " + what); - throw Parameter::ParameterRejected("--" + longOption() + " (unspecified error)"); - } - } - else if (hasShortOption()) - { - try { - if(arg.at(1) == shortOption()) { - /* Matched argument on the form -f or -fsomething */ - if(arg.length() == 2) { /* -f */ - this->receiveSwitch(); - - return true; - } else { /* -fsomething */ - this->receiveArgument(arg.substr(2)); - - return true; - } - } - } catch(Parameter::ExpectedArgument &ea) { - throw ExpectedArgument(std::string("-") + shortOption() + ": expected an argument"); - } catch(Parameter::UnexpectedArgument &ua) { - throw UnexpectedArgument(std::string("-") + shortOption() + ": did not expect an argument"); - } catch(Switchable::SwitchingError &e) { - throw ParameterRejected(std::string("-") + shortOption() + ": parameter already set"); - } - } - } catch(std::out_of_range& o) { - return false; - } - - return false; + return 0; } - - /* * PODParameter stuff * */ -template -PODParameter::PODParameter(char shortOption, const char *longOption, +template +PODParameter::PODParameter(char shortOption, const char *longOption, const char* description) : CommonParameter(shortOption, longOption, description) {} -template -PODParameter::~PODParameter() {} +template +PODParameter::~PODParameter() {} -template -PODParameter::operator T() const { return getValue(); } +template +PODParameter::operator T() const { return getValue(); } -template -void PODParameter::setDefault(T value) { +template +void PODParameter::setDefault(T value) { PresettableUniquelySwitchable::preset(); this->value = value; } -template -T PODParameter::getValue() const { - if(!isSet()) { - throw runtime_error( - std::string("Attempting to retreive the argument of parameter") + longOption() + " but it hasn't been set!"); +template +T PODParameter::getValue() const { + if(!this->isSet()) { + throw std::runtime_error( + std::string("Attempting to retreive the argument of parameter") + this->longOption() + " but it hasn't been set!"); } return value; } - -template -std::string PODParameter::usageLine() const { +template +std::string PODParameter::usageLine() const { std::stringstream strstr; - strstr.width(10); - if (hasShortOption()) + if (this->hasShortOption()) { - strstr << std::left << std::string("-") + shortOption() +"arg"; + strstr << "-" << this->shortOption() << ", "; } else { - strstr << ""; + strstr << " "; } strstr.width(20); - strstr << std::left << "--" + longOption() + "=arg"; + strstr << std::left << "--" + this->longOption() + " "; return strstr.str(); } -template -void PODParameter::receiveSwitch() throw (Parameter::ParameterRejected) { - throw Parameter::ExpectedArgument(); -} +template +int PODParameter::receive(ParserState& state) throw(Parameter::ParameterRejected) { -template -void PODParameter::receiveArgument(const std::string &argument) throw(Parameter::ParameterRejected) { - set(); - value = this->validate(argument); -} + const std::string arg = state.get(); + if(arg.at(0) != '-') return false; + + if((arg.at(1) == '-' && arg.substr(2) == this->longOption()) || + (this->hasShortOption() && arg.at(1) == this->shortOption() && arg.length() == 2)) + { + // retrieve the argument + std::string arg1 = state.peek(); + if (arg1.length() == 0) + { + throw Parameter::ExpectedArgument(arg + ": expected an argument"); + return 1; + } + + this->set(); + value = this->validate(arg1); + + return 2; + } + + return 0; +} #endif diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index a6eee382..8ed36533 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -1,19 +1,22 @@ cmake_minimum_required(VERSION 2.8) project(hyperion-remote) -find_package(Qt4 REQUIRED QtCore QtNetwork) +find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) # The following I do not undrstand completely... # libQtCore.so uses some hardcoded library path inside which are incorrect after copying the file RPi file system # Therefor, an extra path is needed on which to find the required libraries LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) -include_directories(${QT_INCLUDE_DIR}) +include_directories(${QT_INCLUDES}) -set(hyperion-remote_HEADERS) +set(hyperion-remote_HEADERS + specialoptions.h + connection.h) set(hyperion-remote_SOURCES - hyperion-remote.cpp) + hyperion-remote.cpp + connection.cpp) qt4_wrap_cpp(HYPERION_REMOTE_MOC_SOURCES ${hyperion-remote_HEADERS}) @@ -25,6 +28,7 @@ add_executable(hyperion-remote qt4_use_modules(hyperion-remote Core + Gui Network) target_link_libraries(hyperion-remote diff --git a/src/hyperion-remote/connection.cpp b/src/hyperion-remote/connection.cpp new file mode 100644 index 00000000..0b2d6970 --- /dev/null +++ b/src/hyperion-remote/connection.cpp @@ -0,0 +1,71 @@ +#include "connection.h" + +Connection::Connection(const std::string &address, bool printJson) +{ +} + +Connection::~Connection() +{ +} + +bool Connection::setColor(QColor color, int priority, int duration) +{ + std::cout << "Set color to " << color.red() << " " << color.green() << " " << color.blue() << std::endl; + return false; +} + +bool Connection::setImage(QImage image, int priority, int duration) +{ + std::cout << "Set image has size: " << image.width() << "x" << image.height() << std::endl; + return false; +} + +bool Connection::listPriorities() +{ + std::cout << "List priority channels" << std::endl; + return false; +} + +bool Connection::clear(int priority) +{ + std::cout << "Clear priority channel " << priority << std::endl; + return false; +} + +bool Connection::clearAll() +{ + std::cout << "Clear all priority channels" << std::endl; + return false; +} + +bool Connection::setThreshold(double red, double green, double blue) +{ + return false; +} + +bool Connection::setGamma(double red, double green, double blue) +{ + return false; +} + +bool Connection::setBlacklevel(double red, double green, double blue) +{ + return false; +} + +bool Connection::setWhitelevel(double red, double green, double blue) +{ + return false; +} + +bool Connection::sendMessage(const Json::Value &message) +{ + if (_printJson) + { + std::cout << "Command:" << std::endl; + std::cout << message << std::endl; + } + + return true; +} + diff --git a/src/hyperion-remote/connection.h b/src/hyperion-remote/connection.h new file mode 100644 index 00000000..5035e630 --- /dev/null +++ b/src/hyperion-remote/connection.h @@ -0,0 +1,31 @@ +#pragma once + +#include + +#include +#include + +#include + +class Connection +{ +public: + Connection(const std::string & address, bool printJson); + ~Connection(); + + bool setColor(QColor color, int priority, int duration); + bool setImage(QImage image, int priority, int duration); + bool listPriorities(); + bool clear(int priority); + bool clearAll(); + bool setThreshold(double red, double green, double blue); + bool setGamma(double red, double green, double blue); + bool setBlacklevel(double red, double green, double blue); + bool setWhitelevel(double red, double green, double blue); + +private: + bool sendMessage(const Json::Value & message); + +private: + bool _printJson; +}; diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index 2311ffef..df6e57ba 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -1,10 +1,25 @@ -#include +#include + #include #include +#include "specialoptions.h" +#include "connection.h" + + using namespace vlofgren; +int count(std::initializer_list values) +{ + int count = 0; + for (auto& value : values) { + if (value) + count++; + } + return count; +} + int main(int argc, const char * argv[]) { // some settings @@ -13,37 +28,96 @@ int main(int argc, const char * argv[]) OptionsParser optionParser("Simple application to send a command to hyperion using the Json interface"); ParameterSet & parameters = optionParser.getParameters(); - StringParameter & argAddress = parameters.add('a', "address" , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toAscii().constData()); - IntParameter & argPriority = parameters.add ('p', "priority" , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toAscii().constData()); - IntParameter & argDuration = parameters.add ('d', "duration" , "Specify how long the leds should be switched on in millseconds. Without this parameter, the leds will be switched on without end time."); - StringParameter & argColor = parameters.add('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)"); - StringParameter & argImage = parameters.add('i', "image" , "Set the leds to the colors according to the given image file"); - SwitchParameter & argList = parameters.add('l', "list" , "List all priority channels which are in use"); - SwitchParameter & argClear = parameters.add('x', "clear" , "Clear data for the priority channel provided by the -p option"); - SwitchParameter & argClearAll = parameters.add(0x0, "clear-all" , "Clear data for all priority channels"); - DoubleParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); - DoubleParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 values between 0.0 and 1.0)"); - DoubleParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); - DoubleParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 values which are normally between 0.0 and 1.0)"); - SwitchParameter & argPrint = parameters.add(0x0, "print" , "Print the json input and output messages on stdout"); - SwitchParameter & argHelp = parameters.add('h', "help" , "Show this help message and exit"); + StringParameter & argAddress = parameters.add ('a', "address" , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toAscii().constData()); + IntParameter & argPriority = parameters.add ('p', "priority" , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toAscii().constData()); + IntParameter & argDuration = parameters.add ('d', "duration" , "Specify how long the leds should be switched on in millseconds [default: infinity]"); + ColorParameter & argColor = parameters.add ('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)"); + ImageParameter & argImage = parameters.add ('i', "image" , "Set the leds to the colors according to the given image file"); + SwitchParameter<> & argList = parameters.add >('l', "list" , "List all priority channels which are in use"); + SwitchParameter<> & argClear = parameters.add >('x', "clear" , "Clear data for the priority channel provided by the -p option"); + SwitchParameter<> & argClearAll = parameters.add >(0x0, "clear-all" , "Clear data for all priority channels"); + TransformParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); + TransformParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 space seperated values between 0.0 and 1.0)"); + TransformParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); + TransformParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); + SwitchParameter<> & argPrint = parameters.add >(0x0, "print" , "Print the json input and output messages on stdout"); + SwitchParameter<> & argHelp = parameters.add >('h', "help" , "Show this help message and exit"); + + argAddress.setDefault(defaultServerAddress.toStdString()); + argPriority.setDefault(defaultPriority); + argDuration.setDefault(-1); + try { optionParser.parse(argc, argv); } catch (const std::runtime_error & e) { - qWarning() << e.what(); - optionParser.usage(); + std::cerr << e.what() << std::endl; return 1; } + // check if we need to display the usage if (argHelp.isSet()) { optionParser.usage(); return 0; } + // check if a color transform is set + bool colorTransform = argThreshold.isSet() || argGamma.isSet() || argBlacklevel.isSet() || argWhitelevel.isSet(); + + // check if exactly one command was given + int commandCount = count({argColor.isSet(), argImage.isSet(), argList.isSet(), argClear.isSet(), argClearAll.isSet(), colorTransform}); + if (commandCount != 1) + { + if (commandCount == 0) + { + std::cerr << "No command found. Provide one of the following options:" << std::endl; + } + else + { + std::cerr << "Multiple commands found. Provide one of the following options:" << std::endl; + } + std::cerr << " " << argColor.usageLine() << std::endl; + std::cerr << " " << argImage.usageLine() << std::endl; + std::cerr << " " << argList.usageLine() << std::endl; + std::cerr << " " << argClear.usageLine() << std::endl; + std::cerr << " " << argClearAll.usageLine() << std::endl; + std::cerr << "or one or more of the color transformations:" << std::endl; + std::cerr << " " << argThreshold.usageLine() << std::endl; + std::cerr << " " << argGamma.usageLine() << std::endl; + std::cerr << " " << argBlacklevel.usageLine() << std::endl; + std::cerr << " " << argWhitelevel.usageLine() << std::endl; + return 1; + } + + Connection connection(argAddress.getValue(), argPrint.isSet()); + + // now execute the given command + if (argColor.isSet()) + { + connection.setColor(argColor.getValue(), argPriority.getValue(), argDuration.getValue()); + } + else if (argImage.isSet()) + { + connection.setImage(argImage.getValue(), argPriority.getValue(), argDuration.getValue()); + } + else if (argList.isSet()) + { + connection.listPriorities(); + } + else if (argClear.isSet()) + { + connection.clear(argPriority.getValue()); + } + else if (argClearAll.isSet()) + { + connection.clearAll(); + } + else if (colorTransform) + { + } return 0; } diff --git a/src/hyperion-remote/specialoptions.h b/src/hyperion-remote/specialoptions.h new file mode 100644 index 00000000..96f4b304 --- /dev/null +++ b/src/hyperion-remote/specialoptions.h @@ -0,0 +1,102 @@ +#pragma once + +#include +#include + +#include + +struct ColorTransform +{ + double valueRed; + double valueGreen; + double valueBlue; +}; + +typedef vlofgren::PODParameter ColorParameter; +typedef vlofgren::PODParameter ImageParameter; +typedef vlofgren::PODParameter TransformParameter; + +namespace vlofgren { + template<> + QColor ColorParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + // Check if we can create the color by name + QColor color(s.c_str()); + if (color.isValid()) + { + return color; + } + + // check if we can create the color by hex RRGGBB value + if (s.length() == 6 && isxdigit(s[0]) && isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5])) + { + bool ok = true; + int rgb[3]; + for (int i = 0; i < 3 && ok; ++i) + { + QString colorComponent(s.substr(2*i, 2).c_str()); + rgb[i] = colorComponent.toInt(&ok, 16); + } + + // check if all components parsed succesfully + if (ok) + { + color.setRgb(rgb[0], rgb[1], rgb[2]); + return color; + } + } + + std::stringstream errorMessage; + errorMessage << "Invalid color. A color is specified by a six lettered RRGGBB hex value or one of the following names:"; + foreach (const QString & colorname, QColor::colorNames()) { + errorMessage << "\n " << colorname.toStdString(); + } + throw Parameter::ParameterRejected(errorMessage.str()); + + return color; + } + + template<> + QImage ImageParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + QImage image(s.c_str()); + + if (image.isNull()) + { + std::stringstream errorMessage; + errorMessage << "File " << s << " could not be opened as an image"; + throw Parameter::ParameterRejected(errorMessage.str()); + } + + return image; + } + + template<> + ColorTransform TransformParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + ColorTransform transform; + + // s should be split in 3 parts + // seperators are either a ',' or a space + QStringList components = QString(s.c_str()).split(" ", QString::SkipEmptyParts); + + if (components.size() == 3) + { + bool ok1, ok2, ok3; + transform.valueRed = components[0].toDouble(&ok1); + transform.valueGreen = components[1].toDouble(&ok2); + transform.valueBlue = components[2].toDouble(&ok3); + + if (ok1 && ok2 && ok3) + { + return transform; + } + } + + std::stringstream errorMessage; + errorMessage << "Argument " << s << " can not be parsed to 3 double values"; + throw Parameter::ParameterRejected(errorMessage.str()); + + return transform; + } +} From 463e7626b93059f559064181d649e064492f7dc4 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 13 Aug 2013 19:45:17 +0200 Subject: [PATCH 4/7] renamed files to be conform with the rest of the project --- CMakeLists.txt | 2 +- src/hyperion-remote/CMakeLists.txt | 15 ++++++--------- .../{colortransform.h => ColorTransformValues.h} | 2 +- .../{connection.cpp => Connection.cpp} | 4 ++-- .../{connection.h => Connection.h} | 4 ++-- .../{specialoptions.h => CustomParameter.h} | 8 ++++---- src/hyperion-remote/hyperion-remote.cpp | 12 ++++++------ 7 files changed, 22 insertions(+), 25 deletions(-) rename src/hyperion-remote/{colortransform.h => ColorTransformValues.h} (75%) rename src/hyperion-remote/{connection.cpp => Connection.cpp} (93%) rename src/hyperion-remote/{connection.h => Connection.h} (74%) rename src/hyperion-remote/{specialoptions.h => CustomParameter.h} (91%) diff --git a/CMakeLists.txt b/CMakeLists.txt index bed5086f..e5fe6dd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # define the minimum cmake version (as required by cmake) cmake_minimum_required(VERSION 2.8) -set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake) +#set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake) # Define the main-project name project(Hyperion) diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index 277598e4..d4141b86 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8) + project(hyperion-remote) find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) @@ -11,21 +12,17 @@ LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnuea include_directories(${QT_INCLUDES}) set(hyperion-remote_HEADERS - specialoptions.h - connection.h - colortransform.h) + CustomParameter.h + Connection.h + ColorTransformValues.h) set(hyperion-remote_SOURCES hyperion-remote.cpp - connection.cpp) - -qt4_wrap_cpp(HYPERION_REMOTE_MOC_SOURCES - ${hyperion-remote_HEADERS}) + Connection.cpp) add_executable(hyperion-remote ${hyperion-remote_HEADERS} - ${hyperion-remote_SOURCES} - ${HYPERION_REMOTE_MOC_SOURCES}) + ${hyperion-remote_SOURCES}) qt4_use_modules(hyperion-remote Core diff --git a/src/hyperion-remote/colortransform.h b/src/hyperion-remote/ColorTransformValues.h similarity index 75% rename from src/hyperion-remote/colortransform.h rename to src/hyperion-remote/ColorTransformValues.h index 06fb87f7..1649b191 100644 --- a/src/hyperion-remote/colortransform.h +++ b/src/hyperion-remote/ColorTransformValues.h @@ -1,6 +1,6 @@ #pragma once -struct ColorTransform +struct ColorTransformValues { double valueRed; double valueGreen; diff --git a/src/hyperion-remote/connection.cpp b/src/hyperion-remote/Connection.cpp similarity index 93% rename from src/hyperion-remote/connection.cpp rename to src/hyperion-remote/Connection.cpp index 7e8e8b01..342585b5 100644 --- a/src/hyperion-remote/connection.cpp +++ b/src/hyperion-remote/Connection.cpp @@ -1,6 +1,6 @@ #include -#include "connection.h" +#include "Connection.h" Connection::Connection(const std::string & a, bool printJson) : _printJson(printJson), @@ -63,7 +63,7 @@ bool Connection::clearAll() return false; } -bool Connection::setTransform(ColorTransform *threshold, ColorTransform *gamma, ColorTransform *blacklevel, ColorTransform *whitelevel) +bool Connection::setTransform(ColorTransformValues *threshold, ColorTransformValues *gamma, ColorTransformValues *blacklevel, ColorTransformValues *whitelevel) { std::cout << "Set color transforms" << std::endl; return false; diff --git a/src/hyperion-remote/connection.h b/src/hyperion-remote/Connection.h similarity index 74% rename from src/hyperion-remote/connection.h rename to src/hyperion-remote/Connection.h index 959e060b..51ca7493 100644 --- a/src/hyperion-remote/connection.h +++ b/src/hyperion-remote/Connection.h @@ -8,7 +8,7 @@ #include -#include "colortransform.h" +#include "ColorTransformValues.h" class Connection { @@ -21,7 +21,7 @@ public: bool listPriorities(); bool clear(int priority); bool clearAll(); - bool setTransform(ColorTransform * threshold, ColorTransform * gamma, ColorTransform * blacklevel, ColorTransform * whitelevel); + bool setTransform(ColorTransformValues * threshold, ColorTransformValues * gamma, ColorTransformValues * blacklevel, ColorTransformValues * whitelevel); private: bool sendMessage(const Json::Value & message); diff --git a/src/hyperion-remote/specialoptions.h b/src/hyperion-remote/CustomParameter.h similarity index 91% rename from src/hyperion-remote/specialoptions.h rename to src/hyperion-remote/CustomParameter.h index 8949bde4..199f4c85 100644 --- a/src/hyperion-remote/specialoptions.h +++ b/src/hyperion-remote/CustomParameter.h @@ -5,11 +5,11 @@ #include -#include "colortransform.h" +#include "ColorTransformValues.h" typedef vlofgren::PODParameter ColorParameter; typedef vlofgren::PODParameter ImageParameter; -typedef vlofgren::PODParameter TransformParameter; +typedef vlofgren::PODParameter TransformParameter; namespace vlofgren { template<> @@ -67,9 +67,9 @@ namespace vlofgren { } template<> - ColorTransform TransformParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + ColorTransformValues TransformParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) { - ColorTransform transform; + ColorTransformValues transform; // s should be split in 3 parts // seperators are either a ',' or a space diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index 9b5be248..6b60bac0 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -4,8 +4,8 @@ #include -#include "specialoptions.h" -#include "connection.h" +#include "CustomParameter.h" +#include "Connection.h" using namespace vlofgren; @@ -115,10 +115,10 @@ int main(int argc, char * argv[]) } else if (colorTransform) { - ColorTransform threshold = argThreshold.getValue(); - ColorTransform gamma = argGamma.getValue(); - ColorTransform blacklevel = argBlacklevel.getValue(); - ColorTransform whitelevel = argWhitelevel.getValue(); + ColorTransformValues threshold = argThreshold.getValue(); + ColorTransformValues gamma = argGamma.getValue(); + ColorTransformValues blacklevel = argBlacklevel.getValue(); + ColorTransformValues whitelevel = argWhitelevel.getValue(); connection.setTransform( argThreshold.isSet() ? &threshold : nullptr, From a04af1242cc843d939d846dc5571b1c4bf9fa000 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 13 Aug 2013 20:10:19 +0200 Subject: [PATCH 5/7] Clean up code Use tabs for indenting to make someone happy... --- src/hyperion-remote/CMakeLists.txt | 24 +-- src/hyperion-remote/ColorTransformValues.h | 7 +- src/hyperion-remote/Connection.cpp | 137 ++++++------- src/hyperion-remote/Connection.h | 40 ++-- src/hyperion-remote/CustomParameter.h | 143 +++++++------- src/hyperion-remote/hyperion-remote.cpp | 216 ++++++++++----------- 6 files changed, 297 insertions(+), 270 deletions(-) diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index d4141b86..a9291ba4 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -12,23 +12,23 @@ LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnuea include_directories(${QT_INCLUDES}) set(hyperion-remote_HEADERS - CustomParameter.h - Connection.h - ColorTransformValues.h) + CustomParameter.h + Connection.h + ColorTransformValues.h) set(hyperion-remote_SOURCES - hyperion-remote.cpp - Connection.cpp) + hyperion-remote.cpp + Connection.cpp) add_executable(hyperion-remote - ${hyperion-remote_HEADERS} - ${hyperion-remote_SOURCES}) + ${hyperion-remote_HEADERS} + ${hyperion-remote_SOURCES}) qt4_use_modules(hyperion-remote - Core - Gui - Network) + Core + Gui + Network) target_link_libraries(hyperion-remote - hyperion-utils - getoptPlusPlus) + hyperion-utils + getoptPlusPlus) diff --git a/src/hyperion-remote/ColorTransformValues.h b/src/hyperion-remote/ColorTransformValues.h index 1649b191..d36e2c91 100644 --- a/src/hyperion-remote/ColorTransformValues.h +++ b/src/hyperion-remote/ColorTransformValues.h @@ -1,8 +1,9 @@ #pragma once +/// Simple structure to contain the values of a color transformation struct ColorTransformValues { - double valueRed; - double valueGreen; - double valueBlue; + double valueRed; + double valueGreen; + double valueBlue; }; diff --git a/src/hyperion-remote/Connection.cpp b/src/hyperion-remote/Connection.cpp index 342585b5..1a0c7986 100644 --- a/src/hyperion-remote/Connection.cpp +++ b/src/hyperion-remote/Connection.cpp @@ -1,113 +1,116 @@ +// stl includes #include +// hyperion-remote includes #include "Connection.h" Connection::Connection(const std::string & a, bool printJson) : - _printJson(printJson), - _socket() + _printJson(printJson), + _socket() { - QString address(a.c_str()); - QStringList parts = address.split(":"); - if (parts.size() != 2) - { - throw std::runtime_error(QString("Wrong address: unable to parse address (%1)").arg(address).toStdString()); - } + QString address(a.c_str()); + QStringList parts = address.split(":"); + if (parts.size() != 2) + { + throw std::runtime_error(QString("Wrong address: unable to parse address (%1)").arg(address).toStdString()); + } - bool ok; - uint16_t port = parts[1].toUShort(&ok); - if (!ok) - { - throw std::runtime_error(QString("Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString()); - } + bool ok; + uint16_t port = parts[1].toUShort(&ok); + if (!ok) + { + throw std::runtime_error(QString("Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString()); + } - _socket.connectToHost(parts[0], port); - if (!_socket.waitForConnected()) - { - throw std::runtime_error("Unable to connect to host"); - } + _socket.connectToHost(parts[0], port); + if (!_socket.waitForConnected()) + { + throw std::runtime_error("Unable to connect to host"); + } } Connection::~Connection() { - _socket.close(); + _socket.close(); } bool Connection::setColor(QColor color, int priority, int duration) { - std::cout << "Set color to " << color.red() << " " << color.green() << " " << color.blue() << std::endl; - sendMessage("Set color message"); - return false; + std::cout << "Set color to " << color.red() << " " << color.green() << " " << color.blue() << std::endl; + sendMessage("Set color message"); + return false; } bool Connection::setImage(QImage image, int priority, int duration) { - std::cout << "Set image has size: " << image.width() << "x" << image.height() << std::endl; - return false; + std::cout << "Set image has size: " << image.width() << "x" << image.height() << std::endl; + return false; } bool Connection::listPriorities() { - std::cout << "List priority channels" << std::endl; - return false; + std::cout << "List priority channels" << std::endl; + return false; } bool Connection::clear(int priority) { - std::cout << "Clear priority channel " << priority << std::endl; - return false; + std::cout << "Clear priority channel " << priority << std::endl; + return false; } bool Connection::clearAll() { - std::cout << "Clear all priority channels" << std::endl; - return false; + std::cout << "Clear all priority channels" << std::endl; + return false; } bool Connection::setTransform(ColorTransformValues *threshold, ColorTransformValues *gamma, ColorTransformValues *blacklevel, ColorTransformValues *whitelevel) { - std::cout << "Set color transforms" << std::endl; - return false; + std::cout << "Set color transforms" << std::endl; + return false; } -bool Connection::sendMessage(const Json::Value & message) +Json::Value Connection::sendMessage(const Json::Value & message) { - // rpint if requested - if (_printJson) - { - std::cout << "Command: " << message << std::endl; - } + // print command if requested + if (_printJson) + { + std::cout << "Command: " << message << std::endl; + } - // serialize message - Json::FastWriter jsonWriter; - std::string serializedMessage = jsonWriter.write(message); + // serialize message + Json::FastWriter jsonWriter; + std::string serializedMessage = jsonWriter.write(message); - // write message - _socket.write(serializedMessage.c_str()); - if (!_socket.waitForBytesWritten()) - { - throw std::runtime_error("Error while writing data to host"); - } + // write message + _socket.write(serializedMessage.c_str()); + if (!_socket.waitForBytesWritten()) + { + throw std::runtime_error("Error while writing data to host"); + } - // receive reply - if (!_socket.waitForReadyRead()) - { - throw std::runtime_error("Error while reading data from host"); - } - char data[1024 * 100]; - uint64_t count = _socket.read(data, sizeof(data)); - std::string serializedReply(data, count); - Json::Reader jsonReader; - Json::Value reply; - if (!jsonReader.parse(serializedReply, reply)) - { - throw std::runtime_error("Error while parsing reply:" + serializedReply); - } + // receive reply + if (!_socket.waitForReadyRead()) + { + throw std::runtime_error("Error while reading data from host"); + } + char data[1024 * 100]; + uint64_t count = _socket.read(data, sizeof(data)); + std::string serializedReply(data, count); + Json::Reader jsonReader; + Json::Value reply; + if (!jsonReader.parse(serializedReply, reply)) + { + throw std::runtime_error("Error while parsing reply:" + serializedReply); + } - if (_printJson) - { - std::cout << "Reply:" << reply << std::endl; - } + // print reply if requested + if (_printJson) + { + std::cout << "Reply:" << reply << std::endl; + } - return true; + return reply; } diff --git a/src/hyperion-remote/Connection.h b/src/hyperion-remote/Connection.h index 51ca7493..43746634 100644 --- a/src/hyperion-remote/Connection.h +++ b/src/hyperion-remote/Connection.h @@ -1,33 +1,51 @@ #pragma once +// stl includes #include +// Qt includes #include #include #include +// jsoncpp includes #include +// hyperion-remote includes #include "ColorTransformValues.h" +/// Connection class to setup an connection to the hyperion server and execute commands class Connection { public: - Connection(const std::string & address, bool printJson); - ~Connection(); + Connection(const std::string & address, bool printJson); + ~Connection(); - bool setColor(QColor color, int priority, int duration); - bool setImage(QImage image, int priority, int duration); - bool listPriorities(); - bool clear(int priority); - bool clearAll(); - bool setTransform(ColorTransformValues * threshold, ColorTransformValues * gamma, ColorTransformValues * blacklevel, ColorTransformValues * whitelevel); + /// Set all leds to the specified color + bool setColor(QColor color, int priority, int duration); + + /// Set the leds according to the given image (assume the image is stretched to the display size) + bool setImage(QImage image, int priority, int duration); + + /// Retrieve a list of all occupied priority channels + bool listPriorities(); + + /// Clear the given priority channel + bool clear(int priority); + + /// Clear all priority channels + bool clearAll(); + + /// Set the color transform of the leds + /// Note that providing a NULL will leave the settings on the server unchanged + bool setTransform(ColorTransformValues * threshold, ColorTransformValues * gamma, ColorTransformValues * blacklevel, ColorTransformValues * whitelevel); private: - bool sendMessage(const Json::Value & message); + /// Send a json command message and receive its reply + Json::Value sendMessage(const Json::Value & message); private: - bool _printJson; + bool _printJson; - QTcpSocket _socket; + QTcpSocket _socket; }; diff --git a/src/hyperion-remote/CustomParameter.h b/src/hyperion-remote/CustomParameter.h index 199f4c85..1292e3a8 100644 --- a/src/hyperion-remote/CustomParameter.h +++ b/src/hyperion-remote/CustomParameter.h @@ -1,97 +1,102 @@ #pragma once +// Qt includes #include #include +// getoptPlusPLus includes #include +// hyperion-remote includes #include "ColorTransformValues.h" + typedef vlofgren::PODParameter ColorParameter; typedef vlofgren::PODParameter ImageParameter; typedef vlofgren::PODParameter TransformParameter; + namespace vlofgren { - template<> - QColor ColorParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) - { - // Check if we can create the color by name - QColor color(s.c_str()); - if (color.isValid()) - { - return color; - } + template<> + QColor ColorParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + // Check if we can create the color by name + QColor color(s.c_str()); + if (color.isValid()) + { + return color; + } - // check if we can create the color by hex RRGGBB value - if (s.length() == 6 && isxdigit(s[0]) && isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5])) - { - bool ok = true; - int rgb[3]; - for (int i = 0; i < 3 && ok; ++i) - { - QString colorComponent(s.substr(2*i, 2).c_str()); - rgb[i] = colorComponent.toInt(&ok, 16); - } + // check if we can create the color by hex RRGGBB value + if (s.length() == 6 && isxdigit(s[0]) && isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5])) + { + bool ok = true; + int rgb[3]; + for (int i = 0; i < 3 && ok; ++i) + { + QString colorComponent(s.substr(2*i, 2).c_str()); + rgb[i] = colorComponent.toInt(&ok, 16); + } - // check if all components parsed succesfully - if (ok) - { - color.setRgb(rgb[0], rgb[1], rgb[2]); - return color; - } - } + // check if all components parsed succesfully + if (ok) + { + color.setRgb(rgb[0], rgb[1], rgb[2]); + return color; + } + } - std::stringstream errorMessage; - errorMessage << "Invalid color. A color is specified by a six lettered RRGGBB hex value or one of the following names:"; - foreach (const QString & colorname, QColor::colorNames()) { - errorMessage << "\n " << colorname.toStdString(); - } - throw Parameter::ParameterRejected(errorMessage.str()); + std::stringstream errorMessage; + errorMessage << "Invalid color. A color is specified by a six lettered RRGGBB hex value or one of the following names:"; + foreach (const QString & colorname, QColor::colorNames()) { + errorMessage << "\n " << colorname.toStdString(); + } + throw Parameter::ParameterRejected(errorMessage.str()); - return color; - } + return color; + } - template<> - QImage ImageParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) - { - QImage image(s.c_str()); + template<> + QImage ImageParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + QImage image(s.c_str()); - if (image.isNull()) - { - std::stringstream errorMessage; - errorMessage << "File " << s << " could not be opened as an image"; - throw Parameter::ParameterRejected(errorMessage.str()); - } + if (image.isNull()) + { + std::stringstream errorMessage; + errorMessage << "File " << s << " could not be opened as an image"; + throw Parameter::ParameterRejected(errorMessage.str()); + } - return image; - } + return image; + } - template<> - ColorTransformValues TransformParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) - { - ColorTransformValues transform; + template<> + ColorTransformValues TransformParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) + { + ColorTransformValues transform; - // s should be split in 3 parts - // seperators are either a ',' or a space - QStringList components = QString(s.c_str()).split(" ", QString::SkipEmptyParts); + // s should be split in 3 parts + // seperators are either a ',' or a space + QStringList components = QString(s.c_str()).split(" ", QString::SkipEmptyParts); - if (components.size() == 3) - { - bool ok1, ok2, ok3; - transform.valueRed = components[0].toDouble(&ok1); - transform.valueGreen = components[1].toDouble(&ok2); - transform.valueBlue = components[2].toDouble(&ok3); + if (components.size() == 3) + { + bool ok1, ok2, ok3; + transform.valueRed = components[0].toDouble(&ok1); + transform.valueGreen = components[1].toDouble(&ok2); + transform.valueBlue = components[2].toDouble(&ok3); - if (ok1 && ok2 && ok3) - { - return transform; - } - } + if (ok1 && ok2 && ok3) + { + return transform; + } + } - std::stringstream errorMessage; - errorMessage << "Argument " << s << " can not be parsed to 3 double values"; - throw Parameter::ParameterRejected(errorMessage.str()); + std::stringstream errorMessage; + errorMessage << "Argument " << s << " can not be parsed to 3 double values"; + throw Parameter::ParameterRejected(errorMessage.str()); - return transform; - } + return transform; + } } diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index 6b60bac0..1585ff07 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -1,137 +1,137 @@ +// stl includes #include +// Qt includes #include +// getoptPlusPLus includes #include +// hyperion-remote include #include "CustomParameter.h" #include "Connection.h" - using namespace vlofgren; +/// Count the number of true values in a list of booleans int count(std::initializer_list values) { - int count = 0; - for (auto& value : values) { - if (value) - count++; - } - return count; + int count = 0; + for (bool value : values) { + if (value) + count++; + } + return count; } int main(int argc, char * argv[]) { - QCoreApplication app(argc, argv); + QCoreApplication app(argc, argv); - try - { - // some settings - QString defaultServerAddress = "localhost:19444"; - int defaultPriority = 100; + try + { + // some default settings + QString defaultServerAddress = "localhost:19444"; + int defaultPriority = 100; - OptionsParser optionParser("Simple application to send a command to hyperion using the Json interface"); - ParameterSet & parameters = optionParser.getParameters(); - StringParameter & argAddress = parameters.add ('a', "address" , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toAscii().constData()); - IntParameter & argPriority = parameters.add ('p', "priority" , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toAscii().constData()); - IntParameter & argDuration = parameters.add ('d', "duration" , "Specify how long the leds should be switched on in millseconds [default: infinity]"); - ColorParameter & argColor = parameters.add ('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)"); - ImageParameter & argImage = parameters.add ('i', "image" , "Set the leds to the colors according to the given image file"); - SwitchParameter<> & argList = parameters.add >('l', "list" , "List all priority channels which are in use"); - SwitchParameter<> & argClear = parameters.add >('x', "clear" , "Clear data for the priority channel provided by the -p option"); - SwitchParameter<> & argClearAll = parameters.add >(0x0, "clear-all" , "Clear data for all priority channels"); - TransformParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); - TransformParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 space seperated values between 0.0 and 1.0)"); - TransformParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); - TransformParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); - SwitchParameter<> & argPrint = parameters.add >(0x0, "print" , "Print the json input and output messages on stdout"); - SwitchParameter<> & argHelp = parameters.add >('h', "help" , "Show this help message and exit"); + // create the option parser and initialize all parameters + OptionsParser optionParser("Simple application to send a command to hyperion using the Json interface"); + ParameterSet & parameters = optionParser.getParameters(); + StringParameter & argAddress = parameters.add ('a', "address" , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toAscii().constData()); + IntParameter & argPriority = parameters.add ('p', "priority" , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toAscii().constData()); + IntParameter & argDuration = parameters.add ('d', "duration" , "Specify how long the leds should be switched on in millseconds [default: infinity]"); + ColorParameter & argColor = parameters.add ('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)"); + ImageParameter & argImage = parameters.add ('i', "image" , "Set the leds to the colors according to the given image file"); + SwitchParameter<> & argList = parameters.add >('l', "list" , "List all priority channels which are in use"); + SwitchParameter<> & argClear = parameters.add >('x', "clear" , "Clear data for the priority channel provided by the -p option"); + SwitchParameter<> & argClearAll = parameters.add >(0x0, "clear-all" , "Clear data for all priority channels"); + TransformParameter & argGamma = parameters.add('g', "gamma" , "Set the gamma of the leds (requires 3 values)"); + TransformParameter & argThreshold = parameters.add('t', "threshold" , "Set the threshold of the leds (requires 3 space seperated values between 0.0 and 1.0)"); + TransformParameter & argBlacklevel = parameters.add('b', "blacklevel", "Set the blacklevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); + TransformParameter & argWhitelevel = parameters.add('w', "whitelevel", "Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); + SwitchParameter<> & argPrint = parameters.add >(0x0, "print" , "Print the json input and output messages on stdout"); + SwitchParameter<> & argHelp = parameters.add >('h', "help" , "Show this help message and exit"); - argAddress.setDefault(defaultServerAddress.toStdString()); - argPriority.setDefault(defaultPriority); - argDuration.setDefault(-1); + // set the default values + argAddress.setDefault(defaultServerAddress.toStdString()); + argPriority.setDefault(defaultPriority); + argDuration.setDefault(-1); - // parse the options - optionParser.parse(argc, const_cast(argv)); + // parse all options + optionParser.parse(argc, const_cast(argv)); - // check if we need to display the usage - if (argHelp.isSet()) - { - optionParser.usage(); - return 0; - } + // check if we need to display the usage. exit if we do. + if (argHelp.isSet()) + { + optionParser.usage(); + return 0; + } - // check if a color transform is set - bool colorTransform = argThreshold.isSet() || argGamma.isSet() || argBlacklevel.isSet() || argWhitelevel.isSet(); + // check if at least one of the available color transforms is set + bool colorTransform = argThreshold.isSet() || argGamma.isSet() || argBlacklevel.isSet() || argWhitelevel.isSet(); - // check if exactly one command was given - int commandCount = count({argColor.isSet(), argImage.isSet(), argList.isSet(), argClear.isSet(), argClearAll.isSet(), colorTransform}); - if (commandCount != 1) - { - if (commandCount == 0) - { - std::cerr << "No command found. Provide one of the following options:" << std::endl; - } - else - { - std::cerr << "Multiple commands found. Provide one of the following options:" << std::endl; - } - std::cerr << " " << argColor.usageLine() << std::endl; - std::cerr << " " << argImage.usageLine() << std::endl; - std::cerr << " " << argList.usageLine() << std::endl; - std::cerr << " " << argClear.usageLine() << std::endl; - std::cerr << " " << argClearAll.usageLine() << std::endl; - std::cerr << "or one or more of the color transformations:" << std::endl; - std::cerr << " " << argThreshold.usageLine() << std::endl; - std::cerr << " " << argGamma.usageLine() << std::endl; - std::cerr << " " << argBlacklevel.usageLine() << std::endl; - std::cerr << " " << argWhitelevel.usageLine() << std::endl; - return 1; - } + // check that exactly one command was given + int commandCount = count({argColor.isSet(), argImage.isSet(), argList.isSet(), argClear.isSet(), argClearAll.isSet(), colorTransform}); + if (commandCount != 1) + { + std::cerr << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:" << std::endl; + std::cerr << " " << argColor.usageLine() << std::endl; + std::cerr << " " << argImage.usageLine() << std::endl; + std::cerr << " " << argList.usageLine() << std::endl; + std::cerr << " " << argClear.usageLine() << std::endl; + std::cerr << " " << argClearAll.usageLine() << std::endl; + std::cerr << "or one or more of the available color transformations:" << std::endl; + std::cerr << " " << argThreshold.usageLine() << std::endl; + std::cerr << " " << argGamma.usageLine() << std::endl; + std::cerr << " " << argBlacklevel.usageLine() << std::endl; + std::cerr << " " << argWhitelevel.usageLine() << std::endl; + return 1; + } - // create the connection - Connection connection(argAddress.getValue(), argPrint.isSet()); + // create the connection to the hyperion server + Connection connection(argAddress.getValue(), argPrint.isSet()); - // now execute the given command - if (argColor.isSet()) - { - connection.setColor(argColor.getValue(), argPriority.getValue(), argDuration.getValue()); - } - else if (argImage.isSet()) - { - connection.setImage(argImage.getValue(), argPriority.getValue(), argDuration.getValue()); - } - else if (argList.isSet()) - { - connection.listPriorities(); - } - else if (argClear.isSet()) - { - connection.clear(argPriority.getValue()); - } - else if (argClearAll.isSet()) - { - connection.clearAll(); - } - else if (colorTransform) - { - ColorTransformValues threshold = argThreshold.getValue(); - ColorTransformValues gamma = argGamma.getValue(); - ColorTransformValues blacklevel = argBlacklevel.getValue(); - ColorTransformValues whitelevel = argWhitelevel.getValue(); + // now execute the given command + if (argColor.isSet()) + { + connection.setColor(argColor.getValue(), argPriority.getValue(), argDuration.getValue()); + } + else if (argImage.isSet()) + { + connection.setImage(argImage.getValue(), argPriority.getValue(), argDuration.getValue()); + } + else if (argList.isSet()) + { + connection.listPriorities(); + } + else if (argClear.isSet()) + { + connection.clear(argPriority.getValue()); + } + else if (argClearAll.isSet()) + { + connection.clearAll(); + } + else if (colorTransform) + { + ColorTransformValues threshold = argThreshold.getValue(); + ColorTransformValues gamma = argGamma.getValue(); + ColorTransformValues blacklevel = argBlacklevel.getValue(); + ColorTransformValues whitelevel = argWhitelevel.getValue(); - connection.setTransform( - argThreshold.isSet() ? &threshold : nullptr, - argGamma.isSet() ? &gamma : nullptr, - argBlacklevel.isSet() ? &blacklevel : nullptr, - argWhitelevel.isSet() ? &whitelevel : nullptr); - } - } - catch (const std::runtime_error & e) - { - std::cerr << e.what() << std::endl; - return 1; - } + connection.setTransform( + argThreshold.isSet() ? &threshold : nullptr, + argGamma.isSet() ? &gamma : nullptr, + argBlacklevel.isSet() ? &blacklevel : nullptr, + argWhitelevel.isSet() ? &whitelevel : nullptr); + } + } + catch (const std::runtime_error & e) + { + // An error occured. Display error and quit + std::cerr << e.what() << std::endl; + return 1; + } - return 0; + return 0; } From baba35c99888d585c77ad39ed97e0142dbeee87d Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 13 Aug 2013 22:35:50 +0200 Subject: [PATCH 6/7] Added sending the image command --- src/hyperion-remote/Connection.cpp | 78 ++++++++++++++++++++++++++++-- src/hyperion-remote/Connection.h | 2 + 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/src/hyperion-remote/Connection.cpp b/src/hyperion-remote/Connection.cpp index 1a0c7986..8580aa68 100644 --- a/src/hyperion-remote/Connection.cpp +++ b/src/hyperion-remote/Connection.cpp @@ -27,6 +27,8 @@ Connection::Connection(const std::string & a, bool printJson) : { throw std::runtime_error("Unable to connect to host"); } + + std::cout << "Connected to " << a << std::endl; } Connection::~Connection() @@ -37,16 +39,61 @@ Connection::~Connection() bool Connection::setColor(QColor color, int priority, int duration) { std::cout << "Set color to " << color.red() << " " << color.green() << " " << color.blue() << std::endl; - sendMessage("Set color message"); - return false; + + // create command + Json::Value command; + command["command"] = "color"; + command["priority"] = priority; + Json::Value & rgbValue = command["color"]; + rgbValue[0] = color.red(); + rgbValue[1] = color.green(); + rgbValue[2] = color.blue(); + if (duration > 0) + { + command["duration"] = duration; + } + + // send command message + Json::Value reply = sendMessage(command); + + // parse reply message + return parseReply(reply); } bool Connection::setImage(QImage image, int priority, int duration) { std::cout << "Set image has size: " << image.width() << "x" << image.height() << std::endl; - return false; + + // ensure the image has RGB888 format + image = image.convertToFormat(QImage::Format_RGB888); + QByteArray binaryImage; + binaryImage.reserve(image.width() * image.height() * 3); + for (int i = 0; i < image.height(); ++i) + { + binaryImage.append(reinterpret_cast(image.constScanLine(i)), image.width() * 3); + } + const QByteArray base64Image = binaryImage.toBase64(); + + // create command + Json::Value command; + command["command"] = "image"; + command["priority"] = priority; + command["width"] = image.width(); + command["height"] = image.height(); + command["data"] = std::string(base64Image.data(), base64Image.size()); + if (duration > 0) + { + command["duration"] = duration; + } + + // send command message + Json::Value reply = sendMessage(command); + + // parse reply message + return parseReply(reply); } + bool Connection::listPriorities() { std::cout << "List priority channels" << std::endl; @@ -102,7 +149,7 @@ Json::Value Connection::sendMessage(const Json::Value & message) Json::Value reply; if (!jsonReader.parse(serializedReply, reply)) { - throw std::runtime_error("Error while parsing reply:" + serializedReply); + throw std::runtime_error("Error while parsing reply: invalid json"); } // print reply if requested @@ -114,3 +161,26 @@ Json::Value Connection::sendMessage(const Json::Value & message) return reply; } +bool Connection::parseReply(const Json::Value &reply) +{ + bool success = false; + std::string reason = "No error info"; + + try + { + success = reply.get("success", false).asBool(); + if (!success) + reason = reply.get("error", reason).asString(); + } + catch (const std::runtime_error &) + { + // Some json paring error: ignore and set parsing error + } + + if (!success) + { + throw std::runtime_error("Error while paring reply: " + reason); + } + + return success; +} diff --git a/src/hyperion-remote/Connection.h b/src/hyperion-remote/Connection.h index 43746634..93de4318 100644 --- a/src/hyperion-remote/Connection.h +++ b/src/hyperion-remote/Connection.h @@ -44,6 +44,8 @@ private: /// Send a json command message and receive its reply Json::Value sendMessage(const Json::Value & message); + bool parseReply(const Json::Value & reply); + private: bool _printJson; From 8e8e63011fd4a393d4136badde1d59a3a7fc6cff Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 13 Aug 2013 22:43:36 +0200 Subject: [PATCH 7/7] Added some more modification documentation --- .../include/getoptPlusPlus/getoptpp.h | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/dependencies/include/getoptPlusPlus/getoptpp.h b/dependencies/include/getoptPlusPlus/getoptpp.h index b0f825cf..bd98081b 100644 --- a/dependencies/include/getoptPlusPlus/getoptpp.h +++ b/dependencies/include/getoptPlusPlus/getoptpp.h @@ -19,7 +19,8 @@ * * - Removed using namespace std from header * - Changed Parameter container type from std::set to std::list to presume order - * + * - Changed arguments of Parameters to be a seperated arguments on the command line + * - Make the choice of receiving arguments or not in subclasses of CommonParameter */ #include @@ -50,7 +51,7 @@ public: Parameter& operator[](char c) const; /** Find a parameter by long option form. */ - Parameter& operator[](const std::string &s) const; + Parameter& operator[](const std::string &s) const; /** Factory method that adds a new parameter of * type T to the set. @@ -72,7 +73,7 @@ public: ~ParameterSet(); protected: friend class OptionsParser; - std::list parameters; + std::list parameters; private: ParameterSet(const ParameterSet& ps); @@ -94,7 +95,7 @@ public: ParameterSet& getParameters(); /** Parse command line arguments */ - void parse(int argc, const char* argv[]) throw(std::runtime_error); + void parse(int argc, const char* argv[]) throw(std::runtime_error); /** Generate a usage screen */ void usage() const; @@ -102,16 +103,16 @@ public: /** Return the name of the program, as * given by argv[0] */ - const std::string& programName() const; + const std::string& programName() const; /** Return a vector of each non-parameter */ - const std::vector& getFiles() const; + const std::vector& getFiles() const; protected: - std::string argv0; - std::string fprogramDesc; + std::string argv0; + std::string fprogramDesc; ParameterSet parameters; - std::vector files; + std::vector files; friend class ParserState; }; @@ -123,18 +124,18 @@ protected: class ParserState { public: - const std::string peek() const; - const std::string get() const; + const std::string peek() const; + const std::string get() const; void advance(); bool end() const; protected: - ParserState(OptionsParser &opts, std::vector& args); + ParserState(OptionsParser &opts, std::vector& args); private: friend class OptionsParser; OptionsParser &opts; - const std::vector &arguments; - std::vector::const_iterator iterator; + const std::vector &arguments; + std::vector::const_iterator iterator; }; /** @@ -148,27 +149,27 @@ public: /** Generic exception thrown when a parameter is malformed */ - class ParameterRejected : public std::runtime_error { + class ParameterRejected : public std::runtime_error { public: - ParameterRejected(const std::string& s) : std::runtime_error(s) {} + ParameterRejected(const std::string& s) : std::runtime_error(s) {} ParameterRejected() : runtime_error("") {} }; /** Exception thrown when a parameter did not expect an argument */ class UnexpectedArgument : public ParameterRejected { public: - UnexpectedArgument(const std::string &s) : ParameterRejected(s) {} + UnexpectedArgument(const std::string &s) : ParameterRejected(s) {} UnexpectedArgument() {} }; /** Exception thrown when a parameter expected an argument */ class ExpectedArgument : public ParameterRejected { public: - ExpectedArgument(const std::string &s) : ParameterRejected(s) {} + ExpectedArgument(const std::string &s) : ParameterRejected(s) {} ExpectedArgument() {} }; - Parameter(char shortOption, const std::string & longOption, const std::string & description); + Parameter(char shortOption, const std::string & longOption, const std::string & description); virtual ~Parameter(); @@ -176,16 +177,16 @@ public: virtual bool isSet() const = 0; /** This parameter's line in OptionsParser::usage() */ - virtual std::string usageLine() const = 0; + virtual std::string usageLine() const = 0; /** Description of the parameter (rightmost field in OptionsParser::usage()) */ - const std::string& description() const; + const std::string& description() const; /** The long name of this parameter (e.g. "--option"), without the dash. */ - const std::string& longOption() const; + const std::string& longOption() const; - /** Check if this parameters has a short option */ - bool hasShortOption() const; + /** Check if this parameters has a short option */ + bool hasShortOption() const; /** The short name of this parameter (e.g. "-o"), without the dash. */ char shortOption() const; @@ -203,13 +204,13 @@ protected: * iterator that technically allows for more complex grammar than what is * presently used. */ - virtual int receive(ParserState& state) throw(ParameterRejected) = 0; + virtual int receive(ParserState& state) throw(ParameterRejected) = 0; friend class OptionsParser; char fshortOption; - const std::string flongOption; - const std::string fdescription; + const std::string flongOption; + const std::string fdescription; private: }; @@ -243,16 +244,16 @@ public: const char* description); virtual ~CommonParameter(); - virtual std::string usageLine() const; + virtual std::string usageLine() const; protected: /** Parse the argument given by state, and dispatch either * receiveSwitch() or receiveArgument() accordingly. * * @param state The current argument being parsed. - * @return The number of parameters taken from the input + * @return The number of parameters taken from the input */ - virtual int receive(ParserState& state) throw(ParameterRejected) = 0; + virtual int receive(ParserState& state) throw(ParameterRejected) = 0; }; /** This class (used as a mixin) defines how a parameter @@ -341,7 +342,7 @@ public: virtual ~SwitchParameter(); protected: - virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); + virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); }; /** Plain-Old-Data parameter. Performs input validation. @@ -372,14 +373,14 @@ public: std::string usageLine() const; protected: - virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); + virtual int receive(ParserState& state) throw(Parameter::ParameterRejected); /** Validation function for the data type. * * @throw ParameterRejected if the argument does not conform to this data type. * @return the value corresponding to the argument. */ - virtual T validate(const std::string& s) throw (Parameter::ParameterRejected); + virtual T validate(const std::string& s) throw (Parameter::ParameterRejected); T value; };