00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SHSTREAMLISTIMPL_HPP
00021 #define SHSTREAMLISTIMPL_HPP
00022
00023 #include "ShStream.hpp"
00024 #include "ShChannel.hpp"
00025
00026 namespace SH {
00027
00028 template<typename T>
00029 ShStream::ShStream(const ShChannel<T>& channel)
00030 {
00031 m_nodes.push_back(channel.node());
00032 }
00033
00034 template<typename T>
00035 void ShStream::append(const ShChannel<T>& channel)
00036 {
00037 m_nodes.push_back(channel.node());
00038 }
00039
00040 template<typename T>
00041 void ShStream::prepend(const ShChannel<T>& channel)
00042 {
00043 m_nodes.push_front(channel.node());
00044 }
00045
00046
00047 template<typename T1, typename T2>
00048 ShStream combine(const ShChannel<T1>& left, const ShChannel<T2>& right)
00049 {
00050 ShStream stream(left);
00051 stream.append(right);
00052 return stream;
00053 }
00054
00055 template<typename T2>
00056 ShStream combine(const ShStream& left, const ShChannel<T2>& right)
00057 {
00058 ShStream stream = left;
00059 stream.append(right);
00060 return stream;
00061 }
00062
00063 template<typename T1>
00064 ShStream combine(const ShChannel<T1>& left, const ShStream& right)
00065 {
00066 ShStream stream = right;
00067 stream.prepend(left);
00068 return stream;
00069 }
00070
00071
00072 template<typename T1, typename T2>
00073 ShStream operator&(const ShChannel<T1>& left, const ShChannel<T2>& right)
00074 {
00075 return combine(left, right);
00076 }
00077
00078 template<typename T2>
00079 ShStream operator&(const ShStream& left, const ShChannel<T2>& right)
00080 {
00081 return combine(left, right);
00082 }
00083
00084 template<typename T1>
00085 ShStream operator&(const ShChannel<T1>& left, const ShStream& right)
00086 {
00087 return combine(left, right);
00088 }
00089
00090 }
00091 #endif