blob: d0583ca6843e3bda76d2066fd52fb34513dfe1dd (
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
|
#ifndef guard_mock_reference_hpp
#define guard_mock_reference_hpp
/**
* @file
*
* @brief Mock an object reference so we can test the sequences in
* isolation.
*
* $Id$
*
* @author Carlos O'Ryan
*/
#include "ace/config-all.h"
#include "testing_counters.hpp"
// Forward declare the class a CORBA::release function for it. That
// avoids having to introduce CORBA::Object into the tests.
// Ideally the T_var and T_out types should accept mock objects
// too, but that is too much to bite in the current iteration.
class mock_reference;
namespace CORBA
{
void release(mock_reference*);
}
#include "tao/Pseudo_VarOut_T.h"
/**
* @class
*
* @brief Implement a concrete class with the right interface for an
* object reference.
*/
class mock_reference
{
public:
virtual ~mock_reference();
typedef TAO_Pseudo_Var_T<mock_reference> _var_type;
typedef TAO_Pseudo_Out_T<mock_reference,_var_type> _out_type;
static mock_reference * allocate(int id);
static mock_reference * _nil();
static call_counter duplicate_calls;
static mock_reference * _duplicate(mock_reference * rhs);
static call_counter release_calls;
static void _tao_release(mock_reference * rhs);
inline bool operator==(mock_reference const & rhs) const
{
return id_ == rhs.id_;
}
inline bool operator!=(mock_reference const & rhs) const
{
return !(*this == rhs);
}
inline int id() const
{
return id_;
}
private:
inline mock_reference(int id)
: id_(id)
{}
private:
int id_;
};
typedef mock_reference * mock_reference_ptr;
typedef mock_reference::_var_type mock_reference_var;
typedef mock_reference::_out_type mock_reference_out;
#endif // guard_mock_reference_hpp
|