Free Electron
EvaluatorI.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 __evaluator_EvaluatorI_h__
8 #define __evaluator_EvaluatorI_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 class Variables : public Counted
16 {
17  public:
18  t_stdvector< Record > m_varray;
19 
20  unsigned int size(void) { return m_varray.size(); }
21  Record &operator [] (unsigned int a_i)
22  { return m_varray[a_i]; }
23  void resize(unsigned int a_size)
24  { m_varray.resize(a_size); }
25 
26  void copy(Variables &a_other)
27  {
28  m_varray.resize(a_other.size());
29  for(unsigned int i = 0; i < size(); i++)
30  {
31  (*this)[i] = a_other[i];
32  }
33  }
34 };
35 
36 typedef Variables t_variables;
37 
38 /// Functional Mini Language evaluator
39 ///
40 /// see @ref evaluate_evaluate
41 class FE_DL_EXPORT EvaluatorI : virtual public Component, public CastableAs<EvaluatorI>
42 {
43  public:
44 virtual void bind(sp<RecordGroup> a_rg) = 0;
45 
46  /// manage
47 virtual void compile(const t_stdstring &a_buffer) = 0;
48 virtual void evaluate(void) = 0;
49 
50 virtual void addFunction(const t_stdstring &a_function,
51  const t_stdstring &a_component) = 0;
52 virtual sp<FunctionI> createFunction(const t_stdstring &a_function) = 0;
53 
54  /// access variables (input and output)
55 virtual unsigned int index(const t_stdstring &a_name) = 0;
56 virtual const Record &variable(unsigned int a_index) = 0;
57 virtual const sp< Aggregate > &aggregate(unsigned int a_index) = 0;
58 virtual void assignVariable(unsigned int a_index,
59  Record a_record,
60  sp< Aggregate > a_aggregate) = 0;
61 virtual t_variables &variables(void) = 0;
62 
63 virtual Record create(const t_stdstring &a_name,
64  sp< AccessorSet > a_spSA) = 0;
65 };
66 
67 } /* namespace ext */
68 } /* namespace fe */
69 
70 #endif
71 
kernel
Definition: namespace.dox:3
Functional Mini Language evaluator.
Definition: EvaluatorI.h:41
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Base for all interfacable components.
Definition: Component.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192