Free Electron
old/moa/Function.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __moa_Function_h__
8 #define __moa_Function_h__
9 
10 #include "solve/solve.h"
11 #include "evaluate/evaluate.h"
12 #include "evaluate/Function.h"
13 
14 #define FE_GS_EVAL_GLOBAL_VAR FALSE
15 
16 namespace fe
17 {
18 namespace ext
19 {
20 
21 #if FE_GS_EVAL_GLOBAL_VAR
22 extern std::map< std::string, t_moa_real > gs_eval_global_var;
23 #endif
24 
25 class FE_DL_EXPORT GetGlobalVar :
26  virtual public FunctionI,
27  public Initialize<GetGlobalVar>
28 {
29  public:
30  GetGlobalVar(void) {}
31  ~GetGlobalVar(void);
32  void initialize(void);
33 virtual void eval(Record &a_return,
34  t_stdvector<WeakRecord> &a_argv);
35 virtual bool compile(sp<RecordGroup> a_rg, Record &a_return,
36  t_stdvector<WeakRecord> &a_argv,
37  t_stdstring &a_msg);
38  private:
39 virtual sp<Aggregate> &returnType(void) { return m_aggregate; }
40  sp<AsVariable> m_asVariable;
41  sp<Aggregate> m_aggregate;
42  bool m_valid;
43  t_moa_real *m_p_real;
44 };
45 
46 
47 /// @brief FunctionI to access real value attributes in src/data
48 class FE_DL_EXPORT GetRealFromRecord :
49  virtual public FunctionI,
50  public Initialize<GetRealFromRecord>
51 {
52  public:
53  GetRealFromRecord(void) {}
54  ~GetRealFromRecord(void);
55  void initialize(void);
56 virtual void eval(Record &a_return,
57  t_stdvector<WeakRecord> &a_argv);
58 virtual bool compile(sp<RecordGroup> a_rg, Record &a_return,
59  t_stdvector<WeakRecord> &a_argv,
60  t_stdstring &a_msg);
61  private:
62 virtual sp<Aggregate> &returnType(void) { return m_aggregate; }
63  sp<AsVariable> m_asVariable;
64  sp<Aggregate> m_aggregate;
65  Accessor<t_moa_real> m_a_real;
66  Accessor<t_moa_v2> m_a_v2;
67  Accessor<t_moa_v3> m_a_v3;
68  Record m_record;
69  unsigned int m_index;
70  unsigned int m_type;
71  bool m_valid;
72  sp<RecordGroup> m_rg;
73  sp<Scope> m_spScope;
74 };
75 
76 /// @brief FunctionI to get real value attributes in src/data
77 class FE_DL_EXPORT CanonicalRealGet :
78  virtual public FunctionI,
79  public Initialize<CanonicalRealGet>
80 {
81  public:
82  CanonicalRealGet(void) {}
83  ~CanonicalRealGet(void);
84  void initialize(void);
85 virtual void eval(Record &a_return,
86  t_stdvector<WeakRecord> &a_argv);
87 virtual bool compile(sp<RecordGroup> a_rg, Record &a_return,
88  t_stdvector<WeakRecord> &a_argv,
89  t_stdstring &a_msg);
90  private:
91 virtual sp<Aggregate> &returnType(void) { return m_aggregate; }
92  sp<AsVariable> m_asVariable;
93  sp<Aggregate> m_aggregate;
94  RealAccessor m_a_real;
95  Record m_record;
96  sp<RecordGroup> m_rg;
97  sp<Scope> m_spScope;
98  CanonicalStd m_canonical;
99  unsigned int m_mode;
100  String m_arg0;
101  String m_arg1;
102  AsString m_asString;
103 };
104 
105 /// @brief FunctionI to set real value attributes in src/data
106 class FE_DL_EXPORT CanonicalRealSet :
107  virtual public FunctionI,
108  public Initialize<CanonicalRealSet>
109 {
110  public:
111  CanonicalRealSet(void) {}
112  ~CanonicalRealSet(void);
113  void initialize(void);
114 virtual void eval(Record &a_return,
115  t_stdvector<WeakRecord> &a_argv);
116 virtual bool compile(sp<RecordGroup> a_rg, Record &a_return,
117  t_stdvector<WeakRecord> &a_argv,
118  t_stdstring &a_msg);
119  private:
120 virtual sp<Aggregate> &returnType(void) { return m_aggregate; }
121  sp<AsVariable> m_asVariable;
122  sp<Aggregate> m_aggregate;
123  RealAccessor m_a_real;
124  Record m_record;
125  sp<RecordGroup> m_rg;
126  sp<Scope> m_spScope;
127  CanonicalStd m_canonical;
128  String m_arg0;
129  String m_arg1;
130  AsString m_asString;
131 };
132 
133 /// @brief Concatenate strings
134 class FE_DL_EXPORT Concatenate :
135  virtual public FunctionI,
136  public Initialize<Concatenate>
137 {
138  public:
139  Concatenate(void) {}
140  ~Concatenate(void);
141  void initialize(void);
142 virtual void eval(Record &a_return,
143  t_stdvector<WeakRecord> &a_argv);
144 virtual bool compile(sp<RecordGroup> a_rg, Record &a_return,
145  t_stdvector<WeakRecord> &a_argv,
146  t_stdstring &a_msg);
147  private:
148 virtual sp<Aggregate> &returnType(void)
149  { return m_stringAggregate; }
150  bool m_valid;
151  sp<RecordGroup> m_rg;
152  sp<Scope> m_spScope;
153  sp< AsString > m_asString;
154  sp< Aggregate > m_stringAggregate;
155 };
156 
157 /// @brief
158 class FE_DL_EXPORT EvaluatorStd :
159  virtual public Evaluator,
160  public Initialize<EvaluatorStd>
161 {
162  public:
163  EvaluatorStd(void) {}
164 virtual ~EvaluatorStd(void);
165  void initialize(void);
166 virtual void bind(sp<RecordGroup> a_rg);
167 };
168 
169 } /* namespace ext */
170 } /* namespace fe */
171 
172 #endif /* __moa_Function_h__ */
FunctionI to get real value attributes in src/data.
Definition: old/moa/Function.h:77
FunctionI to set real value attributes in src/data.
Definition: old/moa/Function.h:106
Interface to add functions to an Evaluator.
Definition: FunctionI.h:80
kernel
Definition: namespace.dox:3
Concatenate strings.
Definition: old/moa/Function.h:134
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
FunctionI to access real value attributes in src/data.
Definition: old/moa/Function.h:48