15 #ifndef Om_Language_Form_
32 inline bool Type_::BackGiveTerm(Consumer & theConsumer) {
34 this->thisOperandDeque.empty()
37 !this->thisOperator.IsEmpty()
39 this->thisOperator.GiveElements(theConsumer);
41 this->thisOperator.IsEmpty()
45 this->thisOperandDeque.back().GiveElements(theConsumer);
46 this->thisOperandDeque.pop_back();
47 return this->IsEmpty();
50 inline bool Type_::BackPopTerm() {
52 this->thisOperandDeque.empty()
55 !this->thisOperator.IsEmpty()
57 Operator().Swap(this->thisOperator);
60 this->thisOperandDeque.pop_back();
61 return this->IsEmpty();
64 template <
typename TheOperand>
65 inline void Type_::BackTakeOperand(TheOperand & theOperand) {
66 this->thisOperandDeque.push_back(
69 this->thisOperandDeque.back().Take(theOperand);
72 template <
typename TheProducer>
73 inline void Type_::BackTakeQuotedProducer(TheProducer & theProducer) {
74 this->thisOperandDeque.push_back(
77 this->thisOperandDeque.back().SetProgram(
78 theProducer.GiveProgram()
82 inline bool Type_::FrontGiveTerm(Consumer & theConsumer) {
84 this->thisOperator.IsEmpty()
87 !this->thisOperandDeque.empty()
89 this->thisOperandDeque.front().GiveElements(theConsumer);
90 this->thisOperandDeque.pop_front();
92 this->thisOperator.GiveElements(theConsumer);
94 this->thisOperator.IsEmpty()
97 return this->thisOperandDeque.empty();
100 inline bool Type_::FrontPopTerm() {
102 this->thisOperator.IsEmpty()
105 !this->thisOperandDeque.empty()
107 this->thisOperandDeque.pop_front();
109 Operator().Swap(this->thisOperator);
111 this->thisOperator.IsEmpty()
114 return this->thisOperandDeque.empty();
117 template <
typename TheOperand>
118 inline void Type_::FrontTakeOperand(TheOperand & theOperand) {
119 this->thisOperandDeque.push_front(
122 this->thisOperandDeque.front().Take(theOperand);
125 template <
typename TheProducer>
126 inline void Type_::FrontTakeQuotedProducer(TheProducer & theProducer) {
127 this->thisOperandDeque.push_front(
130 this->thisOperandDeque.front().SetProgram(
131 theProducer.GiveProgram()
136 return this->thisOperator;
139 inline void Type_::GiveElements(Consumer & theConsumer) {
140 this->GiveElements<OperandDeque::iterator>(
144 this->thisOperandDeque.clear();
147 inline void Type_::GiveElements(Consumer & theConsumer)
const {
148 this->GiveElements<OperandDeque::const_iterator>(
154 inline bool Type_::IsEmpty()
const {
156 this->thisOperator.IsEmpty() &&
157 this->thisOperandDeque.empty()
161 inline void Type_::Swap(Form & theForm) {
162 this->thisOperator.Swap(theForm.thisOperator);
163 this->thisOperandDeque.swap(theForm.thisOperandDeque);
166 template <
typename TheOperator>
167 inline void Type_::TakeOperator(TheOperator & theOperator) {
169 !theOperator.IsEmpty()
171 this->thisOperator.Take(theOperator);
177 typename TheOperandIterator,
180 inline void Type_::GiveElements(
182 Consumer & theConsumer
188 !theForm.thisOperator.IsEmpty()
190 theConsumer.TakeElement(theForm.thisOperator);
192 TheOperandIterator
const theEnd = theForm.thisOperandDeque.end();
194 TheOperandIterator theCurrent = theForm.thisOperandDeque.begin();
195 theEnd != theCurrent;
198 theConsumer.TakeElement(*theCurrent);
207 Om::Language::Form::ElementRange
211 inline Type_::ElementRange(Form
const & theForm):
213 theForm.thisOperandDeque.begin()
216 theForm.thisOperandDeque.end()
218 thisElement(&theForm.thisOperator) {
220 theForm.thisOperator.IsEmpty()
222 assert(this->thisOperandEnd != this->thisOperandIterator);
223 this->thisElement = &*this->thisOperandIterator++;
227 inline bool Type_::operator !()
const {
228 return !this->thisElement;
232 assert(this->thisElement);
233 return *this->thisElement;
236 inline bool Type_::Equals(ElementRange
const & theElementRange)
const {
237 return this->thisElement == theElementRange.thisElement;
240 inline void Type_::End() {
241 this->thisElement = 0;
244 inline void Type_::Pop() {
245 assert(this->thisElement);
246 this->thisElement = (
247 this->thisOperandEnd == this->thisOperandIterator ?
249 &*this->thisOperandIterator++
256 Type_
const & theFirst,
257 Type_
const & theSecond
259 return theFirst.Equals(theSecond);
263 Type_
const & theFirst,
264 Type_
const & theSecond
266 return !theFirst.Equals(theSecond);
274 Om::Language::Form::OperandRange
278 inline Type_<Om::Language::Operand>::OperandRange(Form & theForm):
279 Om::Source::CollectionFrontSource<
281 OperandDeque::iterator
282 >(theForm.thisOperandDeque) {}
284 inline Type_<Om::Language::Operand const>::OperandRange(Form
const & theForm):
285 Om::Source::CollectionFrontSource<
287 OperandDeque::const_iterator
288 >(theForm.thisOperandDeque) {}
299 theFirst.
Swap(theSecond);
A Program that contains a single elemental item (or none, when IsEmpty() returns true).
The Operator implementation.
bool operator!=(DefaultAtom< TheImplementation > const &, DefaultAtom< TheImplementation > const &)
bool operator==(DefaultAtom< TheImplementation > const &, DefaultAtom< TheImplementation > const &)
void swap(Om::Language::Expression &, Om::Language::Expression &)