OTB  6.7.0
Orfeo Toolbox
otbParser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbParser_h
22 #define otbParser_h
23 
24 #include "itkLightObject.h"
25 #include "itkObjectFactory.h"
26 
27 #include "otb_muparser.h"
28 
29 namespace otb
30 {
31 
32 class ParserImpl;
33 
34 
44 class ITK_EXPORT Parser : public itk::LightObject
45 {
46 public:
48  typedef Parser Self;
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(Parser, itk::LightObject);
58 
60  typedef Parser ParserType;
61  typedef double ValueType;
62 
64  typedef std::map<std::string, int> FunctionMapType;
65 
67  virtual void SetExpr(const std::string & Expression);
68 
70  ValueType Eval();
71 
73  void DefineVar(const std::string &sName, ValueType *fVar);
74 
76  void ClearVar();
77 
79  const std::string& GetExpr() const;
80 
82  const std::map<std::string, Parser::ValueType*>& GetVar() const;
83 
85  FunctionMapType GetFunList() const;
86 
88  bool CheckExpr();
89 
90 protected:
91  Parser();
92  ~Parser() override;
93  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
94 
95 
96 private:
97  Parser(const Self &) = delete;
98  void operator =(const Self &) = delete;
99 
102 }; // end class
103 
104 }//end namespace otb
105 
106 #endif
Definition of the standard floating point parser. Standard implementation of the mathematical express...
Definition: otbParser.h:44
Parser Self
Definition: otbParser.h:48
itk::SmartPointer< ParserImpl > ParserImplPtr
Definition: otbParser.h:100
ParserImplPtr m_InternalParser
Definition: otbParser.h:101
std::map< std::string, int > FunctionMapType
Definition: otbParser.h:64
itk::LightObject Superclass
Definition: otbParser.h:49
itk::SmartPointer< const Self > ConstPointer
Definition: otbParser.h:51
itk::SmartPointer< Self > Pointer
Definition: otbParser.h:50
double ValueType
Definition: otbParser.h:61
Parser ParserType
Definition: otbParser.h:57