Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShBasicBlock.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 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 SHBASICBLOCK_HPP
00021 #define SHBASICBLOCK_HPP
00022 
00023 #include <list>
00024 #include "ShBlock.hpp"
00025 #include "ShStatement.hpp"
00026 
00027 namespace SH {
00028 
00035 class 
00036 SH_DLLEXPORT
00037 ShBasicBlock : public ShBlock {
00038 public:
00039   typedef std::list<ShStatement> ShStmtList;
00040   typedef ShStmtList::iterator iterator;
00041   typedef ShStmtList::const_iterator const_iterator;
00042   typedef ShStmtList::reverse_iterator reverse_iterator;
00043   typedef ShStmtList::const_reverse_iterator const_reverse_iterator;
00044 
00045   ~ShBasicBlock();
00046 
00047   void print(std::ostream& out, int indent) const;
00048   void graphvizDump(std::ostream& out) const;
00049 
00052   void addStatement(const ShStatement& stmt);
00053 
00056   void prependStatement(const ShStatement& stmt);
00057 
00058   /* List ops 
00059    * @{ */
00060   bool empty() { return m_statements.empty(); }
00061 
00062   const_iterator begin() const { return m_statements.begin(); }
00063   const_iterator end() const { return m_statements.end(); }
00064   iterator begin() { return m_statements.begin(); }
00065   iterator end() { return m_statements.end(); } 
00066 
00067   const_reverse_iterator rbegin() const { return m_statements.rbegin(); }
00068   const_reverse_iterator rend() const { return m_statements.rend(); }
00069   reverse_iterator rbegin() { return m_statements.rbegin(); }
00070   reverse_iterator rend() { return m_statements.rend(); } 
00071 
00072   iterator erase(iterator I) { return m_statements.erase(I); }
00073 
00074   // Place all the elements of l before the iterator I and removes them
00075   // from l
00076   void splice(iterator I, ShStmtList &l) { m_statements.splice(I, l); }
00077 
00078   // Places all the elements starting from lI in l before the iterator I and
00079   // removes them from l
00080   void splice(iterator I, ShStmtList &l, iterator lI) {
00081     m_statements.splice(I, l, lI, l.end());
00082   }
00083   
00084   ShStmtList m_statements;
00085 //private:
00086 };
00087 
00088 typedef ShPointer<ShBasicBlock> ShBasicBlockPtr;
00089 typedef ShPointer<const ShBasicBlock> ShBasicBlockCPtr;
00090 
00091 }
00092 
00093 #endif

Generated on Thu Jul 28 17:33:01 2005 for Sh by  doxygen 1.4.3-20050530