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

ShBasicBlock.cpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory
00004 // Project administrator: Michael D. McCool
00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa,
00006 //          Michael D. McCool
00007 // 
00008 // This software is provided 'as-is', without any express or implied
00009 // warranty. In no event will the authors be held liable for any damages
00010 // arising from the use of this software.
00011 // 
00012 // Permission is granted to anyone to use this software for any purpose,
00013 // including commercial applications, and to alter it and redistribute it
00014 // freely, subject to the following restrictions:
00015 // 
00016 // 1. The origin of this software must not be misrepresented; you must
00017 // not claim that you wrote the original software. If you use this
00018 // software in a product, an acknowledgment in the product documentation
00019 // would be appreciated but is not required.
00020 // 
00021 // 2. Altered source versions must be plainly marked as such, and must
00022 // not be misrepresented as being the original software.
00023 // 
00024 // 3. This notice may not be removed or altered from any source
00025 // distribution.
00027 #include "ShBasicBlock.hpp"
00028 #include <iostream>
00029 #include "ShUtility.hpp"
00030 
00031 namespace SH {
00032 
00033 ShBasicBlock::~ShBasicBlock()
00034 {
00035 }
00036 
00037 void ShBasicBlock::print(std::ostream& out, int indent) const
00038 {
00039   using std::endl;
00040   
00041   shPrintIndent(out, indent);
00042   out << "{" << endl;
00043   for (ShStmtList::const_iterator I = m_statements.begin();
00044        I != m_statements.end(); ++I) {
00045     shPrintIndent(out, indent + 2);
00046     out << *I << endl;
00047   }
00048   shPrintIndent(out, indent);
00049   out << "}" << endl;
00050 }
00051 
00052 void ShBasicBlock::graphvizDump(std::ostream& out) const
00053 {
00054   for (ShStmtList::const_iterator I = m_statements.begin();
00055        I != m_statements.end(); ++I) {
00056     out << *I << "\\n";
00057   }
00058 }
00059 
00060 void ShBasicBlock::addStatement(const ShStatement& stmt)
00061 {
00062   m_statements.push_back(stmt);
00063 }
00064 
00065 void ShBasicBlock::prependStatement(const ShStatement& stmt)
00066 {
00067   m_statements.push_front(stmt);
00068 }
00069 
00070 ShBasicBlock::ShStmtList::const_iterator ShBasicBlock::begin() const
00071 {
00072   return m_statements.begin();
00073 }
00074 
00075 ShBasicBlock::ShStmtList::const_iterator ShBasicBlock::end() const
00076 {
00077   return m_statements.end();
00078 }
00079 
00080 ShBasicBlock::ShStmtList::iterator ShBasicBlock::begin()
00081 {
00082   return m_statements.begin();
00083 }
00084 
00085 ShBasicBlock::ShStmtList::iterator ShBasicBlock::end()
00086 {
00087   return m_statements.end();
00088 }
00089 
00090 
00091 }

Generated on Mon Jan 24 18:36:30 2005 for Sh by  doxygen 1.4.1