blob: c2cb67e1f49b66235f1bf2cf8dc98a6fededed75 (
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
|
// $Id$
#ifndef EVENT_H_
#define EVENT_H_
#include "EventS.h"
#include <iostream>
#include "tao/Valuetype/ValueFactory.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
class MyEvent_i
: public virtual OBV_MyEvent
, public virtual CORBA::DefaultValueRefCountBase
{
public:
MyEvent_i(const char* n, CORBA::Long k)
{
name(n);
kind(k);
}
virtual ::CORBA::ValueBase *_copy_value (void)
{
::CORBA::ValueBase *ret_val = 0;
ACE_NEW_THROW_EX (
ret_val,
MyEvent_i (
name (),
kind ()
),
::CORBA::NO_MEMORY ()
);
return ret_val;
}
virtual void dump ()
{
CORBA::LongSeq& pl = payload();
ACE_DEBUG((LM_DEBUG, "\nPayload contents.\n"));
for (CORBA::ULong i = 0; i < pl.length(); ++i)
{
ACE_DEBUG((LM_DEBUG, "%d = %d\n", i, pl[i]));
}
ACE_DEBUG((LM_DEBUG, "\n"));
}
virtual CORBA::Long size ()
{
return payload().length();
}
virtual void add_long (CORBA::Long n)
{
CORBA::LongSeq& pl = payload();
CORBA::ULong idx = pl.length();
pl.length(idx + 1);
pl[idx] = n;
}
};
class MyEventFactory
: public virtual CORBA::ValueFactoryBase
{
public:
virtual CORBA::ValueBase * create_for_unmarshal ()
{
// It doesn't matter what values we construct it with
// because they will be overwritten with the demarshaled values.
return new MyEvent_i("", -1);
}
};
#endif /* EVENT_H_ */
|