aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/hybrid/cdr/ostream.txx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsde/xsde/cxx/hybrid/cdr/ostream.txx')
-rw-r--r--libxsde/xsde/cxx/hybrid/cdr/ostream.txx110
1 files changed, 110 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/hybrid/cdr/ostream.txx b/libxsde/xsde/cxx/hybrid/cdr/ostream.txx
new file mode 100644
index 0000000..1dd40df
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/ostream.txx
@@ -0,0 +1,110 @@
+// file : xsde/cxx/hybrid/cdr/ostream.txx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+
+#ifdef XSDE_EXCEPTIONS
+
+ template <typename T>
+ void
+ operator<< (ocdrstream& s, const pod_seq<T>& x)
+ {
+ s << ocdrstream::as_size (x.size ());
+
+ for (typename pod_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+ }
+
+ template <typename T>
+ void
+ operator<< (ocdrstream& s, const fix_seq<T>& x)
+ {
+ s << ocdrstream::as_size (x.size ());
+
+ for (typename fix_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+ }
+
+ template <typename T>
+ void
+ operator<< (ocdrstream& s, const var_seq<T>& x)
+ {
+ s << ocdrstream::as_size (x.size ());
+
+ for (typename var_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+ }
+
+#else // XSDE_EXCEPTIONS
+
+ template <typename T>
+ bool
+ operator<< (ocdrstream& s, const pod_seq<T>& x)
+ {
+ if (!(s << ocdrstream::as_size (x.size ())))
+ return false;
+
+ for (typename pod_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ if (!(s << *i))
+ return false;
+ }
+
+ return true;
+ }
+
+ template <typename T>
+ bool
+ operator<< (ocdrstream& s, const fix_seq<T>& x)
+ {
+ if (!(s << ocdrstream::as_size (x.size ())))
+ return false;
+
+ for (typename fix_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ if (!(s << *i))
+ return false;
+ }
+
+ return true;
+ }
+
+ template <typename T>
+ bool
+ operator<< (ocdrstream& s, const var_seq<T>& x)
+ {
+ if (!(s << ocdrstream::as_size (x.size ())))
+ return false;
+
+ for (typename var_seq<T>::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ if (!(s << *i))
+ return false;
+ }
+
+ return true;
+ }
+
+#endif // XSDE_EXCEPTIONS
+ }
+ }
+}