OTB  9.0.0
Orfeo Toolbox
otbParserX.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbParserX_h
22 #define otbParserX_h
23 
24 #include "itkLightObject.h"
25 #include "itkObjectFactory.h"
26 
27 #if defined(__clang__)
28 #pragma clang diagnostic push
29 #pragma clang diagnostic ignored "-Wc++11-extensions"
30 
31 #if defined(__apple_build_version__)
32 /* Apple's 3.6.0 based clang doesn't support -Winconsistent-missing-override */
33 #if __apple_build_version__ >= 7000053
34 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
35 #endif
36 #elif __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)
37 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
38 #endif
39 
40 #include "mpParser.h"
41 #pragma clang diagnostic pop
42 
43 #else
44 #include "mpParser.h"
45 #endif
46 
47 namespace otb
48 {
49 
50 class ParserXImpl;
51 
52 
62 class ITK_EXPORT ParserX : public itk::LightObject
63 {
64 public:
66  typedef ParserX Self;
67  typedef itk::LightObject Superclass;
68  typedef itk::SmartPointer<Self> Pointer;
69  typedef itk::SmartPointer<const Self> ConstPointer;
70 
72  itkNewMacro(Self);
73 
75  itkTypeMacro(ParserX, itk::LightObject);
76 
78  typedef ParserX ParserXType;
79  typedef mup::Value ValueType;
80  typedef mup::IValue IValueType;
81 
83  virtual void SetExpr(const std::string& Expression);
84 
86  ValueType Eval();
87 
89  const IValueType& EvalRef();
90 
92  void DefineVar(const std::string& sName, ValueType* fVar);
93 
95  // void DefineConst(const std::string &sName, ValueType *fVar);
96 
98  void ClearVar();
99 
101  const std::string& GetExpr() const;
102 
104  const mup::var_maptype& GetVar() const;
105 
107  const mup::var_maptype& GetExprVar() const;
108 
110  bool CheckExpr();
111 
112 protected:
113  ParserX();
114  ~ParserX() override;
115  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
116 
117 
118 private:
119  ParserX(const Self&) = delete;
120  void operator=(const Self&) = delete;
121 
122  typedef itk::SmartPointer<ParserXImpl> ParserXImplPtr;
124 }; // end class
125 
126 } // end namespace otb
127 
128 #endif
otb::ParserX::ParserXImplPtr
itk::SmartPointer< ParserXImpl > ParserXImplPtr
Definition: otbParserX.h:122
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ParserX::Self
ParserX Self
Definition: otbParserX.h:66
otb::ParserX::ValueType
mup::Value ValueType
Definition: otbParserX.h:79
otb::ParserX::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbParserX.h:69
otb::ParserX::IValueType
mup::IValue IValueType
Definition: otbParserX.h:80
otb::ParserX::ParserXType
ParserX ParserXType
Definition: otbParserX.h:75
otb::ParserX::Superclass
itk::LightObject Superclass
Definition: otbParserX.h:67
otb::ParserX::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbParserX.h:68
otb::ParserX::m_InternalParserX
ParserXImplPtr m_InternalParserX
Definition: otbParserX.h:123
otb::ParserX
Definition of the standard floating point parser. Standard implementation of the mathematical express...
Definition: otbParserX.h:62