ShRecord.hpp

Go to the documentation of this file.
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 SHRECORD_HPP
00021 #define SHRECORD_HPP
00022 
00023 #include <list>
00024 #include "ShDllExport.hpp"
00025 #include "ShVariable.hpp"
00026 
00030 namespace SH {
00031 
00037 class
00038 SH_DLLEXPORT ShRecord {
00039 public:
00040   typedef std::list<ShVariable> VarList; 
00041   typedef VarList::iterator iterator;
00042   typedef VarList::const_iterator const_iterator;
00043 
00044   ShRecord();
00045   ShRecord(const ShVariable &var);
00046   
00047   const_iterator begin() const;
00048   const_iterator end() const;
00049   iterator begin();
00050   iterator end();
00051   size_t size() const;
00052 
00053   void append(const ShVariable& variable);
00054   void prepend(const ShVariable& variable);
00055 
00056   void append(const ShRecord& rec);
00057   void prepend(const ShRecord& rec);
00058 
00059   // Assigns one record to another.
00060   // In retained mode, this inserts assignment statements into the current
00061   // ShProgram.  
00062   ShRecord& operator=(const ShRecord &other);
00063 
00064   // Execute fully bound record program and place results in record.
00065   ShRecord& operator=(const ShProgram& program);
00066 
00067   // Converts a ShRecord containing only uniforms into a stream
00068   // (Must be unswizzled uniforms (and not constants), as this uses the variable's
00069   // variant arrays directly as the channel memory
00070   //
00071   // If you change any of the values here, you must call 
00072   // update_all on the nodes
00073   //ShStream toStream();
00074   
00075 private:
00076   VarList m_vars;
00077 };
00078 
00082 SH_DLLEXPORT
00083 ShRecord combine(const ShVariable &left, const ShVariable &right);
00084 
00089 SH_DLLEXPORT
00090 ShRecord combine(const ShRecord& left, const ShVariable& right);
00091 
00096 SH_DLLEXPORT
00097 ShRecord combine(const ShVariable& left, const ShRecord& right);
00098 
00099 SH_DLLEXPORT
00100 ShRecord combine(const ShRecord& left, const ShRecord& right);
00101 
00104 SH_DLLEXPORT
00105 ShRecord operator&(const ShVariable& left, const ShVariable& right);
00106 
00109 SH_DLLEXPORT
00110 ShRecord operator&(const ShRecord& left, const ShVariable& right);
00111 
00114 SH_DLLEXPORT
00115 ShRecord operator&(const ShVariable& left, const ShRecord& right);
00116 
00119 SH_DLLEXPORT
00120 ShRecord operator&(const ShRecord& left, const ShRecord& right);
00121 
00126 SH_DLLEXPORT
00127 ShProgram connect(const ShRecord& rec, const ShProgram& program);
00128 
00131 SH_DLLEXPORT
00132 ShProgram operator<<(const ShProgram& program, const ShRecord& rec);
00133 
00138 SH_DLLEXPORT
00139 ShProgram connect(const ShProgram& program, const ShRecord& rec);
00140 
00143 SH_DLLEXPORT
00144 ShProgram operator<<(const ShRecord& rec, const ShProgram& program);
00145 
00146 }
00147 
00148 #endif

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