Go to the documentation of this file.00001 #ifndef ORO_TYPESTREAMSELECTOR_HPP_
00002 #define ORO_TYPESTREAMSELECTOR_HPP_
00003
00004 #include <ostream>
00005 #include <istream>
00006
00007
00008 namespace RTT
00009 {
00010 namespace types {
00011 template<typename T, bool b_value>
00012 struct TypeStreamSelector;
00013 template<typename T>
00014 struct TypeStreamSelector<T,true>
00015 {
00016 static std::ostream& write(std::ostream& os, T const& t)
00017 {
00018 #ifdef OS_HAVE_STREAMS
00019 os << t;
00020 #endif
00021 return os;
00022 }
00023 static std::istream& read(std::istream& os, T& t)
00024 {
00025 #ifdef OS_HAVE_STREAMS
00026 os >> t;
00027 #endif
00028 return os;
00029 }
00030 };
00031 template<typename T>
00032 struct TypeStreamSelector<T,false>
00033 {
00034 static std::ostream& write(std::ostream& os, T)
00035 {
00036 return os;
00037 }
00038 static std::istream& read(std::istream& os, T& )
00039 {
00040 return os;
00041 }
00042 };
00043 }
00044 }
00045
00046 #endif