go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkParameterFileParser.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkParameterFileParser_h
20 #define __itkParameterFileParser_h
21 
22 #include "itkObject.h"
23 #include "itkObjectFactory.h"
24 #include "itkMacro.h"
25 
26 #include <map>
27 #include <string>
28 #include <vector>
29 #include <fstream>
30 
31 namespace itk
32 {
33 
80 class ParameterFileParser : public Object
81 {
82 public:
83 
86  typedef Object Superclass;
88  typedef SmartPointer< const Self > ConstPointer;
89 
91  itkNewMacro( Self );
92 
94  itkTypeMacro( ParameterFileParser, Object );
95 
97  typedef std::vector< std::string > ParameterValuesType;
98  typedef std::map<
99  std::string,
100  ParameterValuesType > ParameterMapType;
101 
103  itkSetStringMacro( ParameterFileName );
104  itkGetStringMacro( ParameterFileName );
105 
107  virtual const ParameterMapType & GetParameterMap( void ) const;
108 
110  void ReadParameterFile( void );
111 
115  std::string ReturnParameterFileAsString( void );
116 
117 protected:
118 
120  virtual ~ParameterFileParser();
121 
122 private:
123 
124  ParameterFileParser( const Self & ); // purposely not implemented
125  void operator=( const Self & ); // purposely not implemented
126 
133  void BasicFileChecking( void ) const;
134 
140  bool CheckLine( const std::string & line, std::string & lineOut ) const;
141 
143  void GetParameterFromLine( const std::string & fullLine,
144  const std::string & line );
145 
147  void SplitLine( const std::string & fullLine, const std::string & line,
148  std::vector< std::string > & splittedLine ) const;
149 
153  void ThrowException( const std::string & line, const std::string & hint ) const;
154 
156  std::string m_ParameterFileName;
157  std::ifstream m_ParameterFile;
158  ParameterMapType m_ParameterMap;
159 
160 };
161 
162 } // end of namespace itk
163 
164 #endif // end __itkParameterFileParser_h
std::map< std::string, ParameterValuesType > ParameterMapType
std::string ReturnParameterFileAsString(void)
void BasicFileChecking(void) const
bool CheckLine(const std::string &line, std::string &lineOut) const
void GetParameterFromLine(const std::string &fullLine, const std::string &line)
Implements functionality to read a parameter file.
void ThrowException(const std::string &line, const std::string &hint) const
void operator=(const Self &)
std::vector< std::string > ParameterValuesType
virtual const ParameterMapType & GetParameterMap(void) const
SmartPointer< Self > Pointer
void SplitLine(const std::string &fullLine, const std::string &line, std::vector< std::string > &splittedLine) const
SmartPointer< const Self > ConstPointer


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo