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

ShStream.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 Serious Hack Inc.
00004 // 
00005 // This software is provided 'as-is', without any express or implied
00006 // warranty. In no event will the authors be held liable for any damages
00007 // arising from the use of this software.
00008 // 
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it
00011 // freely, subject to the following restrictions:
00012 // 
00013 // 1. The origin of this software must not be misrepresented; you must
00014 // not claim that you wrote the original software. If you use this
00015 // software in a product, an acknowledgment in the product documentation
00016 // would be appreciated but is not required.
00017 // 
00018 // 2. Altered source versions must be plainly marked as such, and must
00019 // not be misrepresented as being the original software.
00020 // 
00021 // 3. This notice may not be removed or altered from any source
00022 // distribution.
00024 #ifndef SHSTREAM_HPP
00025 #define SHSTREAM_HPP
00026 
00027 #include <list>
00028 #include "ShDllExport.hpp"
00029 #include "ShChannel.hpp"
00030 #include "ShChannelNode.hpp"
00031 
00032 namespace SH {
00033 
00039 class
00040 SH_DLLEXPORT ShStream {
00041 public:
00042   typedef std::list<ShChannelNodePtr> NodeList;
00043   typedef NodeList::iterator iterator;
00044   typedef NodeList::const_iterator const_iterator;
00045 
00046   ShStream();
00047   ShStream(const ShChannelNodePtr& node);
00048   
00049   template<typename T>
00050   ShStream(const ShChannel<T>& channel);
00051 
00052   const_iterator begin() const;
00053   const_iterator end() const;
00054   iterator begin();
00055   iterator end();
00056   int size() const;
00057 
00058   template<typename T>
00059   void append(const ShChannel<T>& channel);
00060   template<typename T>
00061   void prepend(const ShChannel<T>& channel);
00062 
00063   void append(const ShChannelNodePtr& node);
00064   void prepend(const ShChannelNodePtr& node);
00065   // Execute fully bound stream program and place results in stream.
00066   ShStream& operator=(const ShProgram& program);
00067   
00068 private:
00069   NodeList m_nodes;
00070 };
00071 
00075 template<typename T1, typename T2>
00076 ShStream combine(const ShChannel<T1>& left, const ShChannel<T2>& right);
00077 
00082 template<typename T2>
00083 ShStream combine(const ShStream& left, const ShChannel<T2>& right);
00084 
00089 template<typename T1>
00090 ShStream combine(const ShChannel<T1>& left, const ShStream& right);
00091 
00092 SH_DLLEXPORT
00093 ShStream combine(const ShStream& left, const ShStream& right);
00094 
00097 template<typename T1, typename T2>
00098 ShStream operator&(const ShChannel<T1>& left, const ShChannel<T2>& right);
00099 
00102 template<typename T2>
00103 ShStream operator&(const ShStream& left, const ShChannel<T2>& right);
00104 
00107 template<typename T1>
00108 ShStream operator&(const ShChannel<T1>& left, const ShStream& right);
00109 
00112 SH_DLLEXPORT
00113 ShStream operator&(const ShStream& left, const ShStream& right);
00114 
00119 SH_DLLEXPORT
00120 ShProgram connect(const ShStream& stream, const ShProgram& program);
00121 
00124 SH_DLLEXPORT
00125 ShProgram operator<<(const ShProgram& program, const ShStream& stream);
00126 
00127 
00128 }
00129 
00130 #include "ShStreamImpl.hpp"
00131 
00132 #endif

Generated on Thu Apr 21 17:32:49 2005 for Sh by  doxygen 1.4.2