Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
ToolDescription.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2013.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: $
32 // $Authors: Chris Bielow, Mathias Walzer $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H
36 #define OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H
37 
41 #include <OpenMS/CONCEPT/Types.h>
44 
45 
46 
47 namespace OpenMS
48 {
49 
50  namespace Internal
51  {
56  struct FileMapping
57  {
58  String location; // a regex/macro mix; to be expanded by tool;
59  String target; // TOPP parameter that determines the desired name
60  // thus: move location -> target
61 
63  {
64  if (this == &rhs) return *this;
65 
66  location = rhs.location;
67  target = rhs.target;
68  return *this;
69  }
70 
71  };
72 
77  struct MappingParam
78  {
79  std::map<Int, String> mapping;
80  std::vector<FileMapping> pre_moves;
81  std::vector<FileMapping> post_moves;
82 
84  {
85  if (this == &rhs) return *this;
86 
87  mapping = rhs.mapping;
88  pre_moves = rhs.pre_moves;
89  post_moves = rhs.post_moves;
90  return *this;
91  }
92 
93  };
94 
102  struct OPENMS_DLLAPI ToolDescriptionInternal
103  {
107  StringList types; // -types of the tool (if any, e.g. ['centroided','wavelet'])
108 
109  // default C'Tor
111 
112  // C'Tor with arguments
113  ToolDescriptionInternal(const bool p_is_internal, const String & p_name, const String & p_category, const StringList & p_types);
114 
115  // short C'Tor
116  ToolDescriptionInternal(const String & p_name, const StringList & p_types);
117 
118  ToolDescriptionInternal & operator=(const ToolDescriptionInternal & rhs);
119 
120  bool operator==(const ToolDescriptionInternal & rhs) const;
121 
122  bool operator<(const ToolDescriptionInternal & rhs) const;
123  };
124 
125  struct OPENMS_DLLAPI ToolExternalDetails
126  {
132  String path; //< filename to external tool
133  String working_directory; //< folder where the command will be executed from
136  };
137 
141  struct OPENMS_DLLAPI ToolDescription :
143  {
144  // additional details for external tools (one entry for each 'type')
145  std::vector<ToolExternalDetails> external_details;
146 
147  // default CTor
148  ToolDescription();
149 
150  // C'Tor for internal TOPP tools
151  ToolDescription(const String & p_name, const String & p_category, const StringList & p_types = StringList());
152 
153  void addExternalType(const String & type, const ToolExternalDetails & details);
154 
155  void append(const ToolDescription & other);
156 
157  ToolDescription & operator=(const ToolDescription & rhs);
158  };
159 
160  } // namespace Internal
161 
162 } // namespace OPENMS
163 
164 #endif // OPENMS_DATASTRUCTURES_TOOLDESCRIPTION_H
std::vector< FileMapping > pre_moves
Definition: ToolDescription.h:80
A more convenient string class.
Definition: String.h:56
Definition: ToolDescription.h:125
MappingParam tr_table
Definition: ToolDescription.h:134
String path
Definition: ToolDescription.h:132
Filename mappings for all input/output files.
Definition: ToolDescription.h:77
String text_startup
Definition: ToolDescription.h:127
Definition: ToolDescription.h:141
String target
Definition: ToolDescription.h:59
String text_finish
Definition: ToolDescription.h:129
String category
Definition: ToolDescription.h:130
Maps input/output files to filenames for the external program.
Definition: ToolDescription.h:56
String category
Definition: ToolDescription.h:106
FileMapping & operator=(const FileMapping &rhs)
Definition: ToolDescription.h:62
ToolDescription Class.
Definition: ToolDescription.h:102
String location
Definition: ToolDescription.h:58
String working_directory
Definition: ToolDescription.h:133
StringList types
Definition: ToolDescription.h:107
std::map< Int, String > mapping
Definition: ToolDescription.h:79
String name
Definition: ToolDescription.h:105
std::vector< ToolExternalDetails > external_details
Definition: ToolDescription.h:145
Management and storage of parameters / INI files.
Definition: Param.h:69
String list.
Definition: StringList.h:56
Param param
Definition: ToolDescription.h:135
MappingParam & operator=(const MappingParam &rhs)
Definition: ToolDescription.h:83
String text_fail
Definition: ToolDescription.h:128
String commandline
Definition: ToolDescription.h:131
bool is_internal
Definition: ToolDescription.h:104
std::vector< FileMapping > post_moves
Definition: ToolDescription.h:81

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:22 using doxygen 1.8.5