ShBlock.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2006 Serious Hack Inc.
00004 // 
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHBLOCK_HPP
00021 #define SHBLOCK_HPP
00022 
00023 #include <vector>
00024 #include <iosfwd>
00025 #include "ShDllExport.hpp"
00026 #include "ShRefCount.hpp"
00027 #include "ShStatement.hpp"
00028 
00029 namespace SH {
00030 
00034 class
00035 SH_DLLEXPORT ShBlock : public ShRefCountable {
00036 public:
00037   virtual ~ShBlock();
00038 
00040   virtual void print(std::ostream& out, int indent) const = 0;
00041 };
00042 
00043 typedef ShPointer<ShBlock> ShBlockPtr;
00044 typedef ShPointer<const ShBlock> ShBlockCPtr;
00045 
00048 class
00049 SH_DLLEXPORT ShBlockList : public ShRefCountable {
00050 public:
00051   ShBlockList(bool isArgument = false);
00052 
00054   bool isArgument();
00055 
00057   void addStatement(const ShStatement& statement);
00059   void addBlock(const ShBlockPtr& statement);
00060 
00062   ShBlockPtr getFront() const;
00063   
00065   ShBlockPtr removeFront();
00066 
00068   bool empty() const;
00069 
00071   friend SH_DLLEXPORT std::ostream& operator<<(std::ostream& out, const ShBlockList& blockList);
00072 
00074   std::ostream& print(std::ostream& out, int indentation) const;
00075 
00076 private:
00077   bool m_isArgument;
00078   std::vector<ShBlockPtr> m_blocks;
00079 };
00080 
00081 typedef ShPointer<ShBlockList> ShBlockListPtr;
00082 typedef ShPointer<const ShBlockList> ShBlockListCPtr;
00083 
00084 }
00085 
00086 #endif

Generated on Thu Feb 16 14:51:31 2006 for Sh by  doxygen 1.4.6