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 This file is part of the elastix software.
4 
5 Copyright (c) University Medical Center Utrecht. All rights reserved.
6 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7 details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __itkParameterFileParser_h
15 #define __itkParameterFileParser_h
16 
17 #include "itkObject.h"
18 #include "itkObjectFactory.h"
19 #include "itkMacro.h"
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 #include <fstream>
25 
26 
27 namespace itk
28 {
29 
76 class ParameterFileParser : public Object
77 {
78 public:
79 
82  typedef Object Superclass;
83  typedef SmartPointer< Self > Pointer;
84  typedef SmartPointer< const Self > ConstPointer;
85 
87  itkNewMacro( Self );
88 
90  itkTypeMacro( ParameterFileParser, Object );
91 
93  typedef std::vector< std::string > ParameterValuesType;
94  typedef std::map<
95  std::string,
97 
99  itkSetStringMacro( ParameterFileName );
100  itkGetStringMacro( ParameterFileName );
101 
103  virtual const ParameterMapType & GetParameterMap( void ) const;
104 
106  void ReadParameterFile( void );
107 
111  std::string ReturnParameterFileAsString( void );
112 
113 protected:
115  virtual ~ParameterFileParser();
116 
117 private:
118  ParameterFileParser(const Self&); //purposely not implemented
119  void operator=(const Self&); //purposely not implemented
120 
127  void BasicFileChecking( void ) const;
128 
134  bool CheckLine( const std::string & line, std::string & lineOut ) const;
135 
137  void GetParameterFromLine( const std::string & fullLine,
138  const std::string & line );
139 
141  void SplitLine( const std::string & fullLine, const std::string & line,
142  std::vector<std::string> & splittedLine ) const;
143 
147  void ThrowException( const std::string & line, const std::string & hint ) const;
148 
150  std::string m_ParameterFileName;
151  std::ifstream m_ParameterFile;
153 
154 }; // end class ParameterFileParser
155 
156 } // end of namespace itk
157 
158 #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 05-01-2014 for elastix by doxygen 1.8.5 elastix logo