Om
program_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_ProgramOperation_
16 
18 
19 #else
20 
21 // MARK: - Om::Language::Operation::ProgramOperation
22 
23  #define Template_ \
24  template <typename ThisProgram>
25 
26  #define Type_ \
27  Om::Language::Operation::ProgramOperation<ThisProgram>
28 
29 // MARK: public (static)
30 
31 Template_
32 inline char const * Type_::GetName() {
33  return ThisProgram::GetName();
34 }
35 
36 Template_
37 template <typename TheProgramOperation>
38 inline void Type_::GiveElements(
39  TheProgramOperation &,
40  Consumer & theConsumer
41 ) {
42  theConsumer.TakeElement(
43  DefaultIncompleteOperation<
44  ProgramOperation<ThisProgram>
45  >::GetOperator()
46  );
47 }
48 
49 // MARK: public (non-static)
50 
51 Template_
52 inline bool Type_::ParseQuotedElements(
53  Evaluation & theEvaluation,
54  Reader & theReader
55 ) {
56  ThisProgram theProgram;
57  theProgram.ParseElements(theReader);
58  theEvaluation.TakeQuotedProducer(theProgram);
59  return true;
60 }
61 
62 Template_
63 template <typename TheOperand>
64 inline bool Type_::TakeOperand(
65  Evaluation & theEvaluation,
66  TheOperand & theOperand
67 ) {
68  assert(
69  !theOperand.IsEmpty()
70  );
71  return this->TakeQuotedProducer(
72  theEvaluation,
73  *theOperand.GetProgram()
74  );
75 }
76 
77 Template_
78 template <typename TheProducer>
79 inline bool Type_::TakeQuotedProducer(
80  Evaluation & theEvaluation,
81  TheProducer & theProducer
82 ) {
83  ThisProgram theProgram;
84  theProgram.TakeElements(theProducer);
85  theEvaluation.TakeQuotedProducer(theProgram);
86  return true;
87 }
88 
89  #undef Type_
90  #undef Template_
91 
92 #endif
Om header file.