PDI 0.4.1

Data exchange made easy

expression.h
1 /*******************************************************************************
2  * Copyright (C) 2015-2019 Commissariat a l'energie atomique et aux energies alternatives (CEA)
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of CEA nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  ******************************************************************************/
24 
25 #ifndef PDI_EXPRESSION_H_
26 #define PDI_EXPRESSION_H_
27 
28 #include <memory>
29 
30 #include <pdi/pdi_fwd.h>
31 #include <pdi/ref_any.h>
32 
33 namespace PDI {
34 
35 class PDI_EXPORT Expression
36 {
37  struct PDI_NO_EXPORT Impl;
38 
39  friend struct Impl;
40 
41  std::unique_ptr<Impl> m_impl;
42 
43  Expression(std::unique_ptr<Impl>);
44 
45 public:
50  Expression();
51 
56  Expression(const Expression& expr);
57 
62  Expression(Expression&& expr);
63 
85  Expression(const char* expr);
86 
108  Expression(const std::string& expr);
109 
114  Expression(long expr);
115 
118  ~Expression();
119 
125  Expression& operator=(const Expression& expr);
126 
132  Expression& operator=(Expression&& expr);
133 
138  operator bool () const;
139 
144  long to_long(Context& ctx) const;
145 
150  std::string to_string(Context& ctx) const;
151 
156  Ref to_ref(Context& ctx) const;
157 
158 };
159 
160 } // namespace PDI
161 
162 #endif // PDI_EXPRESSION_H_
Definition: context.h:44
std::string to_string(PC_tree_t tree)
Returns the string content of a scalar node.
Definition: expression.h:35
A dynamically typed reference to data with automatic memory management and read/write locking semanti...
Definition: pdi_fwd.h:77
long to_long(PC_tree_t tree)
Returns the int value of a scalar node.
Definition: array_datatype.h:31