summaryrefslogtreecommitdiff
path: root/TAO/IIOP/tests/Thruput_test/ttcpC.h
blob: e163dc7ff750bfd5cb18ac0b39463d4f3394b67f (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/**************************************************************************
This file has been hand-crafted to work with the ORB API of TAO
***************************************************************************/

#ifndef TTCP_SEQUENCE_C_H
#define TTCP_SEQUENCE_C_H

#include <stdlib.h>
#include <string.h>

#include "corba/orb.h"
#include "corba/stub.h"
#include "debug.h"

// mapping for PerfStruct
struct PerfStruct{
  CORBA_Short s;
  CORBA_Char  c;
  CORBA_Long  l;
  CORBA_Octet o;
  CORBA_Double d;
  CORBA_Octet pad[8];


  typedef CORBA_Octet pad_slice;
  typedef pad_slice *pad_slice_ptr;

  static inline pad_slice *pad_alloc() {
    return new CORBA_Octet[8];
  }

  static inline void pad_free(pad_slice *data) {
    if (data) delete[] data;
  }

};
extern CORBA_TypeCode_ptr _tc_PerfStruct;

class ttcp_sequence;
typedef ttcp_sequence *ttcp_sequence_ptr;
typedef ttcp_sequence_ptr ttcp_sequenceRef;

class ttcp_sequence: public virtual CORBA_Object
{
public:
  static ttcp_sequence_ptr _duplicate(ttcp_sequence_ptr obj);
  static ttcp_sequence_ptr _narrow(CORBA_Object_ptr obj);
  static ttcp_sequence_ptr _nil();


  class ShortSeq
  {
  public:
    ShortSeq();
    ShortSeq(CORBA_ULong max);
    ShortSeq(CORBA_ULong max,
	     CORBA_ULong length,
	     CORBA_Short *value,
	     CORBA_Boolean release = CORBA_B_FALSE
	     );
    //    ShortSeq(const ShortSeq&);
    ~ShortSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    CORBA_Short &operator[](CORBA_ULong index);
    const CORBA_Short &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    CORBA_Short *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_ShortSeq;

  class LongSeq
  {
  public:
    LongSeq();
    LongSeq(CORBA_ULong max);
    LongSeq(CORBA_ULong max,
	    CORBA_ULong length,
	    CORBA_Long *value,
	    CORBA_Boolean release = CORBA_B_FALSE
	    );
    //    LongSeq(const LongSeq&);
    ~LongSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    CORBA_Long &operator[](CORBA_ULong index);
    const CORBA_Long &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    CORBA_Long *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_LongSeq;

  class DoubleSeq
  {
  public:
    DoubleSeq();
    DoubleSeq(CORBA_ULong max);
    DoubleSeq(CORBA_ULong max,
	      CORBA_ULong length,
	      CORBA_Double *value,
	      CORBA_Boolean release = CORBA_B_FALSE
	      );
    //    DoubleSeq(const DoubleSeq&);
    ~DoubleSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    CORBA_Double &operator[](CORBA_ULong index);
    const CORBA_Double &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    CORBA_Double *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_DoubleSeq;

  class CharSeq
  {
  public:
    CharSeq();
    CharSeq(CORBA_ULong max);
    CharSeq(CORBA_ULong max,
	    CORBA_ULong length,
	    CORBA_Char *value,
	    CORBA_Boolean release = CORBA_B_FALSE
	    );
    //    CharSeq(const CharSeq&);
    ~CharSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    CORBA_Char &operator[](CORBA_ULong index);
    const CORBA_Char &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    CORBA_Char *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_CharSeq;

  class OctetSeq
  {
  public:
    OctetSeq();
    OctetSeq(CORBA_ULong max);
    OctetSeq(CORBA_ULong max,
	     CORBA_ULong length,
	     CORBA_Octet *value,
	     CORBA_Boolean release = CORBA_B_FALSE
	     );
    //    OctetSeq(const OctetSeq&);
    ~OctetSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    CORBA_Octet &operator[](CORBA_ULong index);
    const CORBA_Octet &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    CORBA_Octet *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_OctetSeq;

  class StructSeq
  {
  public:
    StructSeq();
    StructSeq(CORBA_ULong max);
    StructSeq(CORBA_ULong max,
	      CORBA_ULong length,
	      PerfStruct *value,
	      CORBA_Boolean release = CORBA_B_FALSE
	      );
    //    StructSeq(const StructSeq&);
    ~StructSeq();
    CORBA_ULong maximum() const;
    void length(CORBA_ULong);
    CORBA_ULong length() const;
    PerfStruct &operator[](CORBA_ULong index);
    const PerfStruct &operator[](CORBA_ULong index) const;
  private:
    CORBA_ULong _maximum;
    CORBA_ULong _length;
    PerfStruct *_buffer;
    CORBA_Boolean _release;
  };
  static CORBA_TypeCode_ptr _tc_StructSeq;


  // now the methods
  virtual void sendShortSeq(const ShortSeq& ttcp_seq, CORBA_Environment &);
  virtual void sendLongSeq(const LongSeq& ttcp_seq, CORBA_Environment &);
  virtual void sendDoubleSeq(const DoubleSeq& ttcp_seq, CORBA_Environment &);
  virtual void sendOctetSeq(const OctetSeq& ttcp_seq, CORBA_Environment &);
  virtual void sendCharSeq(const CharSeq& ttcp_seq, CORBA_Environment &);
  virtual void sendStructSeq(const StructSeq& ttcp_seq, CORBA_Environment &);

  virtual void start_timer(CORBA_Environment &);
  virtual void stop_timer(CORBA_Environment &);

protected:
  ttcp_sequence() {}
  ttcp_sequence(STUB_Object *refdata);
  virtual ~ttcp_sequence() {}

private:
  ttcp_sequence(const ttcp_sequence &) {}
  void operator=(const ttcp_sequence &) {}
};

#endif