OTB  10.0.0
Orfeo Toolbox
otbParserX.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 #include "OTBMathParserXExport.h"
47 
48 namespace otb
49 {
50 
51 class ParserXImpl;
52 
53 
63 class OTBMathParserX_EXPORT ParserX : public itk::LightObject
64 {
65 public:
67  typedef ParserX Self;
68  typedef itk::LightObject Superclass;
69  typedef itk::SmartPointer<Self> Pointer;
70  typedef itk::SmartPointer<const Self> ConstPointer;
71 
73  itkNewMacro(Self);
74 
76  itkTypeMacro(ParserX, itk::LightObject);
77 
80  typedef mup::Value ValueType;
81  typedef mup::IValue IValueType;
82 
84  virtual void SetExpr(const std::string& Expression);
85 
88 
90  const IValueType& EvalRef();
91 
93  void DefineVar(const std::string& sName, ValueType* fVar);
94 
96  // void DefineConst(const std::string &sName, ValueType *fVar);
97 
99  void ClearVar();
100 
102  const std::string& GetExpr() const;
103 
105  const mup::var_maptype& GetVar() const;
106 
108  const mup::var_maptype& GetExprVar() const;
109 
111  bool CheckExpr();
112 
113 protected:
115  ~ParserX() override;
116  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
117 
118 
119 private:
120  ParserX(const Self&) = delete;
121  void operator=(const Self&) = delete;
122 
123  typedef itk::SmartPointer<ParserXImpl> ParserXImplPtr;
125 }; // end class
126 
127 } // end namespace otb
128 
129 #endif
Definition of the standard floating point parser. Standard implementation of the mathematical express...
Definition: otbParserX.h:64
virtual void SetExpr(const std::string &Expression)
void DefineVar(const std::string &sName, ValueType *fVar)
bool CheckExpr()
void operator=(const Self &)=delete
itk::LightObject Superclass
Definition: otbParserX.h:68
~ParserX() override
const mup::var_maptype & GetVar() const
itk::SmartPointer< Self > Pointer
Definition: otbParserX.h:69
const mup::var_maptype & GetExprVar() const
void PrintSelf(std::ostream &os, itk::Indent indent) const override
mup::Value ValueType
Definition: otbParserX.h:80
mup::IValue IValueType
Definition: otbParserX.h:81
ParserXImplPtr m_InternalParserX
Definition: otbParserX.h:124
ValueType Eval()
ParserX(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
Definition: otbParserX.h:70
void ClearVar()
ParserX Self
Definition: otbParserX.h:67
const std::string & GetExpr() const
ParserX ParserXType
Definition: otbParserX.h:76
const IValueType & EvalRef()
itk::SmartPointer< ParserXImpl > ParserXImplPtr
Definition: otbParserX.h:123
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.