More tests update
[ACE_TAO.git] / TAO / tests / Sequence_Iterators / mock_reference.hpp
blob31ed319199c2048ed464bc777d3e88373a36a0e3
1 #ifndef guard_mock_reference_hpp
2 #define guard_mock_reference_hpp
3 /**
4 * @file
6 * @brief Mock an object reference so we can test the sequences in
7 * isolation.
9 * @author Carlos O'Ryan
11 #include "ace/config-all.h"
13 #include "tao/Basic_Types.h"
15 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 // Forward declare the class a CORBA::release function for it. That
17 // avoids having to introduce CORBA::Object into the tests.
18 // Ideally the T_var and T_out types should accept mock objects
19 // too, but that is too much to bite in the current iteration.
20 class mock_reference;
21 namespace CORBA
23 void release(mock_reference*);
26 class mock_stream;
28 TAO_END_VERSIONED_NAMESPACE_DECL
30 #include "tao/Objref_VarOut_T.h"
32 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
34 typedef mock_reference *mock_reference_ptr;
35 typedef TAO_Objref_Var_T<mock_reference> mock_reference_var;
36 typedef TAO_Objref_Out_T<mock_reference> mock_reference_out;
38 /**
39 * @class mock_reference
41 * @brief Implement a concrete class with the right interface for an
42 * object reference.
44 class mock_reference
46 public:
47 virtual ~mock_reference();
49 typedef mock_reference_var _var_type;
50 typedef mock_reference_out _out_type;
52 static mock_reference * allocate(int id);
53 static mock_reference * _nil();
55 static mock_reference * _duplicate(mock_reference * rhs);
56 static void _tao_release(mock_reference * rhs);
58 inline bool operator==(mock_reference const & rhs) const
60 return id_ == rhs.id_;
63 inline bool operator!=(mock_reference const & rhs) const
65 return !(*this == rhs);
68 inline int id() const
70 return id_;
73 private:
74 mock_reference ();
76 inline mock_reference(int id)
77 : id_(id)
80 private:
81 int id_;
84 CORBA::Boolean operator<< (TAO_OutputCDR &, const mock_reference *);
85 CORBA::Boolean operator>> (TAO_InputCDR &, mock_reference *&);
87 namespace TAO
89 template<>
90 struct Objref_Traits< mock_reference>
92 static mock_reference_ptr duplicate (mock_reference_ptr);
93 static void release (mock_reference_ptr);
94 static mock_reference_ptr nil (void);
95 static CORBA::Boolean marshal (const mock_reference_ptr p, TAO_OutputCDR & cdr);
99 TAO_END_VERSIONED_NAMESPACE_DECL
100 #endif // guard_mock_reference_hpp