00001 // +-------------------------------------------------------------------------+ 00002 // | I__n__t__e__L__i__b 0.6.10 development | 00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. | 00004 // | | 00005 // | This is free software. The library part is available under | 00006 // | GNU LESSER GENERAL PUBLIC LICENSE v.2.1. | 00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt, or at http://www.gnu.org | 00008 // | Please see also docs/readme.txt and visit http://www.intelib.org | 00009 // | | 00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! | 00011 // +-------------------------------------------------------------------------+ 00012 00013 00014 00015 00024 #ifndef INTELIB_SQUEUE_HPP_SENTRY 00025 #define INTELIB_SQUEUE_HPP_SENTRY 00026 00027 #include "sexpress.hpp" 00028 #include "iexcept.hpp" 00029 00030 00032 00050 class SQueue : public SReference { 00051 SExpressionCons *last; 00052 public: 00053 00055 SQueue(); 00056 00058 00061 SQueue(const SReference &ref); 00062 00064 ~SQueue() { /* the parent will do all the job */ } 00065 00067 void InsertFirst(const SReference& item); 00069 void Append(const SReference& item); 00071 bool RemoveFirst(); 00073 bool IsEmpty() const { return IsEmptyList(); } 00074 00076 template <class Tp> SQueue& operator|(const Tp &t) 00077 { Append(SReference(t)); return *this; } 00078 00080 template <class Tp> SQueue& operator,(const Tp &t) 00081 { Append(SReference(t)); return *this; } 00082 00084 SExpressionCons *GetPtr() const 00085 { return static_cast<SExpressionCons*>(SReference::GetPtr()); } 00086 00087 private: 00088 SQueue(const SQueue &) {} // no copying! 00089 void operator=(const SQueue &) {} // no assigning! 00090 }; 00091 00092 #endif // sentry