1 #ifndef guard_mock_reference_hpp
2 #define guard_mock_reference_hpp
6 * @brief Mock an object reference so we can test the sequences in
9 * @author Carlos O'Ryan
11 #include "ace/config-all.h"
13 #include "testing_counters.hpp"
15 #include "tao/Basic_Types.h"
17 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 // Forward declare the class a CORBA::release function for it. That
19 // avoids having to introduce CORBA::Object into the tests.
20 // Ideally the T_var and T_out types should accept mock objects
21 // too, but that is too much to bite in the current iteration.
25 void release(mock_reference
*);
30 TAO_END_VERSIONED_NAMESPACE_DECL
32 #include "tao/Objref_VarOut_T.h"
34 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
36 typedef mock_reference
*mock_reference_ptr
;
37 typedef TAO_Objref_Var_T
<mock_reference
> mock_reference_var
;
38 typedef TAO_Objref_Out_T
<mock_reference
> mock_reference_out
;
41 * @class mock_reference
43 * @brief Implement a concrete class with the right interface for an
49 virtual ~mock_reference();
51 typedef mock_reference_var _var_type
;
52 typedef mock_reference_out _out_type
;
54 static mock_reference
* allocate(int id
);
55 static mock_reference
* _nil();
57 static call_counter duplicate_calls
;
58 static mock_reference
* _duplicate(mock_reference
* rhs
);
59 static call_counter release_calls
;
60 static void _tao_release(mock_reference
* rhs
);
61 static call_counter serialize_calls
;
62 static call_counter deserialize_calls
;
63 static call_counter marshal_calls
;
65 inline bool operator==(mock_reference
const & rhs
) const
67 return id_
== rhs
.id_
;
70 inline bool operator!=(mock_reference
const & rhs
) const
72 return !(*this == rhs
);
83 inline mock_reference(int id
)
91 CORBA::Boolean
operator<< (TAO_OutputCDR
&, const mock_reference
*);
92 CORBA::Boolean
operator>> (TAO_InputCDR
&, mock_reference
*&);
97 struct Objref_Traits
< mock_reference
>
99 static mock_reference_ptr
duplicate (mock_reference_ptr
);
100 static void release (mock_reference_ptr
);
101 static mock_reference_ptr
nil (void);
102 static CORBA::Boolean
marshal (const mock_reference_ptr p
, TAO_OutputCDR
& cdr
);
106 TAO_END_VERSIONED_NAMESPACE_DECL
107 #endif // guard_mock_reference_hpp