aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/hybrid/cdr/ostream.hxx
blob: f4f3ee6f3227e127a4c22f59fc96c65cb8f48636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// file      : xsde/cxx/hybrid/cdr/ostream.hxx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSDE_CXX_HYBRID_CDR_OSTREAM_HXX
#define XSDE_CXX_HYBRID_CDR_OSTREAM_HXX

#include <xsde/cxx/config.hxx>

#include <stddef.h>  // size_t

#ifdef XSDE_STL
#  include <string>
#endif

#include <ace/CDR_Stream.h>

#include <xsde/cxx/buffer.hxx>
#include <xsde/cxx/date-time.hxx>

#ifdef XSDE_STL
#  include <xsde/cxx/qname-stl.hxx>
#  include <xsde/cxx/string-sequence-stl.hxx>
#else
#  include <xsde/cxx/qname.hxx>
#  include <xsde/cxx/string-sequence.hxx>
#endif

#include <xsde/cxx/hybrid/any-type.hxx>
#include <xsde/cxx/hybrid/sequence.hxx>

#ifdef XSDE_EXCEPTIONS
#  include <xsde/cxx/hybrid/cdr/exceptions.hxx>
#endif

namespace xsde
{
  namespace cxx
  {
    namespace hybrid
    {
      class ocdrstream
      {
      public:
        explicit
        ocdrstream (ACE_OutputCDR& cdr);

        ACE_OutputCDR&
        impl ();

      public:
        struct as_size
        {
          explicit as_size (size_t s) : s_ (s) {}
          size_t s_;
        };

      public:
#ifdef XSDE_EXCEPTIONS

        void operator<< (bool);
        void operator<< (signed char);
        void operator<< (unsigned char);
        void operator<< (short);
        void operator<< (unsigned short);
        void operator<< (int);
        void operator<< (unsigned int);
        void operator<< (long);
        void operator<< (unsigned long);

#ifdef XSDE_LONGLONG
        void operator<< (long long);
        void operator<< (unsigned long long);
#endif
        void operator<< (as_size);
        void operator<< (float);
        void operator<< (double);

#ifdef XSDE_STL
        void operator<< (const std::string&);
#else
        void operator<< (const char*);
#endif
        void operator<< (const buffer&);

#else // XSDE_EXCEPTIONS

        bool operator<< (bool);
        bool operator<< (signed char);
        bool operator<< (unsigned char);
        bool operator<< (short);
        bool operator<< (unsigned short);
        bool operator<< (int);
        bool operator<< (unsigned int);
        bool operator<< (long);
        bool operator<< (unsigned long);

#ifdef XSDE_LONGLONG
        bool operator<< (long long);
        bool operator<< (unsigned long long);
#endif
        bool operator<< (as_size);
        bool operator<< (float);
        bool operator<< (double);

#ifdef XSDE_STL
        bool operator<< (const std::string&);
#else
        bool operator<< (const char*);
#endif
        bool operator<< (const buffer&);

#endif // XSDE_EXCEPTIONS

      private:
        ocdrstream (const ocdrstream&);
        ocdrstream& operator= (const ocdrstream&);

      private:
        ACE_OutputCDR& cdr_;
      };

#ifdef XSDE_EXCEPTIONS
      void operator<< (ocdrstream&, const any_type&);
      void operator<< (ocdrstream&, const qname&);
      void operator<< (ocdrstream&, const string_sequence&);
      void operator<< (ocdrstream&, const time_zone&);
      void operator<< (ocdrstream&, const date&);
      void operator<< (ocdrstream&, const date_time&);
      void operator<< (ocdrstream&, const duration&);
      void operator<< (ocdrstream&, const gday&);
      void operator<< (ocdrstream&, const gmonth&);
      void operator<< (ocdrstream&, const gmonth_day&);
      void operator<< (ocdrstream&, const gyear&);
      void operator<< (ocdrstream&, const gyear_month&);
      void operator<< (ocdrstream&, const time&);
#else
      bool operator<< (ocdrstream&, const any_type&);
      bool operator<< (ocdrstream&, const qname&);
      bool operator<< (ocdrstream&, const string_sequence&);
      bool operator<< (ocdrstream&, const time_zone&);
      bool operator<< (ocdrstream&, const date&);
      bool operator<< (ocdrstream&, const date_time&);
      bool operator<< (ocdrstream&, const duration&);
      bool operator<< (ocdrstream&, const gday&);
      bool operator<< (ocdrstream&, const gmonth&);
      bool operator<< (ocdrstream&, const gmonth_day&);
      bool operator<< (ocdrstream&, const gyear&);
      bool operator<< (ocdrstream&, const gyear_month&);
      bool operator<< (ocdrstream&, const time&);
#endif

#ifdef XSDE_EXCEPTIONS
      template <typename T>
      void operator<< (ocdrstream&, const pod_sequence<T>&);

      template <typename T>
      void operator<< (ocdrstream&, const fix_sequence<T>&);

      template <typename T>
      void operator<< (ocdrstream&, const var_sequence<T>&);
#else
      template <typename T>
      bool operator<< (ocdrstream&, const pod_sequence<T>&);

      template <typename T>
      bool operator<< (ocdrstream&, const fix_sequence<T>&);

      template <typename T>
      bool operator<< (ocdrstream&, const var_sequence<T>&);
#endif
    }
  }
}

#include <xsde/cxx/hybrid/cdr/ostream.ixx>
#include <xsde/cxx/hybrid/cdr/ostream.txx>

#endif  // XSDE_CXX_HYBRID_CDR_OSTREAM_HXX