Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

ToolDescription.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: $
00032 // $Authors: Chris Bielow, Mathias Walzer $
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H
00036 #define OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H
00037 
00038 #include <OpenMS/DATASTRUCTURES/String.h>
00039 #include <OpenMS/DATASTRUCTURES/StringList.h>
00040 #include <OpenMS/DATASTRUCTURES/Param.h>
00041 #include <OpenMS/CONCEPT/Types.h>
00042 #include <OpenMS/CONCEPT/Exception.h>
00043 #include <OpenMS/CONCEPT/LogStream.h>
00044 
00045 
00046 
00047 namespace OpenMS
00048 {
00049 
00050   namespace Internal
00051   {
00056     struct FileMapping
00057     {
00058       String location; // a regex/macro mix; to be expanded by tool;
00059       String target;   // TOPP parameter that determines the desired name
00060       // thus: move location -> target
00061 
00062       FileMapping & operator=(const FileMapping & rhs)
00063       {
00064         if (this == &rhs) return *this;
00065 
00066         location = rhs.location;
00067         target = rhs.target;
00068         return *this;
00069       }
00070 
00071     };
00072 
00077     struct MappingParam
00078     {
00079       std::map<Int, String> mapping;
00080       std::vector<FileMapping> pre_moves;
00081       std::vector<FileMapping> post_moves;
00082 
00083       MappingParam & operator=(const MappingParam & rhs)
00084       {
00085         if (this == &rhs) return *this;
00086 
00087         mapping = rhs.mapping;
00088         pre_moves = rhs.pre_moves;
00089         post_moves = rhs.post_moves;
00090         return *this;
00091       }
00092 
00093     };
00094 
00102     struct OPENMS_DLLAPI ToolDescriptionInternal
00103     {
00104       bool is_internal;
00105       String name;
00106       String category;
00107       StringList types; // -types of the tool (if any, e.g. ['centroided','wavelet'])
00108 
00109       // default C'Tor
00110       ToolDescriptionInternal();
00111 
00112       // C'Tor with arguments
00113       ToolDescriptionInternal(const bool p_is_internal, const String & p_name, const String & p_category, const StringList & p_types);
00114 
00115       // short C'Tor
00116       ToolDescriptionInternal(const String & p_name, const StringList & p_types);
00117 
00118       ToolDescriptionInternal & operator=(const ToolDescriptionInternal & rhs);
00119 
00120       bool operator==(const ToolDescriptionInternal & rhs) const;
00121 
00122       bool operator<(const ToolDescriptionInternal & rhs) const;
00123     };
00124 
00125     struct OPENMS_DLLAPI ToolExternalDetails
00126     {
00127       String text_startup;
00128       String text_fail;
00129       String text_finish;
00130       String category;
00131       String commandline;
00132       String path; //< filename to external tool
00133       String working_directory; //< folder where the command will be executed from
00134       MappingParam tr_table;
00135       Param param;
00136     };
00137 
00141     struct OPENMS_DLLAPI ToolDescription :
00142       ToolDescriptionInternal
00143     {
00144       // additional details for external tools (one entry for each 'type')
00145       std::vector<ToolExternalDetails> external_details;
00146 
00147       // default CTor
00148       ToolDescription();
00149 
00150       // C'Tor for internal TOPP tools
00151       ToolDescription(const String & p_name, const String & p_category, const StringList & p_types = StringList());
00152 
00153       void addExternalType(const String & type, const ToolExternalDetails & details);
00154 
00155       void append(const ToolDescription & other);
00156 
00157       ToolDescription & operator=(const ToolDescription & rhs);
00158     };
00159 
00160   } // namespace Internal
00161 
00162 } // namespace OPENMS
00163 
00164 #endif // OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:45 using doxygen 1.7.1