summaryrefslogtreecommitdiff
path: root/TAO/tao/Context.h
blob: 8058abf82b931c8248947d8945483578a0025e96 (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
// This may look like C, but it's really -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    Context.h
//
// = DESCRIPTION
//    Header file for CORBA Context class.
//
// = AUTHOR
//     Jeff Parsons <parsons@cs.wustl.edu>
//
// ============================================================================

#ifndef TAO_CONTEXT_H
#define TAO_CONTEXT_H

#include "tao/corbafwd.h"

class TAO_Export CORBA_Context
{
  // = TITLE
  //   CORBA_Context
  //
  // = DESCRIPTION
  //   TAO's minimal implementation of the Context interface.
  //   Since Contexts are inherently un-typesafe, there use
  //   is deprecated and the feature may eventaully disappear
  //   from CORBA. It is implemented only to make the arg list
  //   of CORBA_Object::_create_request() compliant. The only
  //   (pointer) value that should be passed is 0.
  //
public:
  // Default ctor and dtor.
  CORBA_Context (void);
  ~CORBA_Context (void);

  // Pseudo object methods
  static CORBA_Context* _duplicate (CORBA_Context*);
  static CORBA_Context* _nil (void);

  // = Reference counting.
  CORBA::ULong _incr_refcnt (void);
  CORBA::ULong _decr_refcnt (void);

#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8
  typedef CORBA_Context_ptr _ptr_type;
  typedef CORBA_Context_var _var_type;
#endif /* __GNUC__ */
  // Useful for template programming.

private:
  CORBA::ULong refcount_;
  // reference counting

  ACE_SYNCH_MUTEX refcount_lock_;
  // protect the reference count
};

typedef CORBA_Context* CORBA_Context_ptr;

class TAO_Export CORBA_Context_var
{
  // = TITLE
  //   The T_var class for Context
  //
  // = DESCRIPTION
  //   As any other pseudo object Context must have a T_var class,
  //   the interface an semantics are specified in the CORBA spec.
  //
  // = NOTE
  //   We use CORBA_Context_ptr as the _ptr type instead of
  //   CORBA::Context_ptr, this is an attempt to reduced the cyclic
  //   dependencies in TAO.
  //
public:
  CORBA_Context_var (void);
  CORBA_Context_var (CORBA_Context_ptr);
  CORBA_Context_var (const CORBA_Context_var &);
  ~CORBA_Context_var (void);

  CORBA_Context_var &operator= (CORBA_Context_ptr);
  CORBA_Context_var &operator= (const CORBA_Context_var &);
  CORBA_Context_ptr operator-> (void) const;

  operator const CORBA_Context_ptr &() const;
  operator CORBA_Context_ptr &();
  // in, inout, out, _retn
  CORBA_Context_ptr in (void) const;
  CORBA_Context_ptr &inout (void);
  CORBA_Context_ptr &out (void);
  CORBA_Context_ptr _retn (void);
  CORBA_Context_ptr ptr (void) const;

private:
  CORBA_Context_ptr ptr_;
};

class TAO_Export CORBA_Context_out
{
  // = TITLE
  //   The T_out class for Context
  //
  // = DESCRIPTION
  //   As any other pseudo object Context must have a T_out class,
  //   the interface an semantics are specified in the CORBA spec.
  //
  // = NOTE
  //   We use CORBA_Context_ptr as the _ptr type instead of
  //   CORBA::Context_ptr, this is an attempt to reduced the cyclic
  //   dependencies in TAO.
  //
public:
  CORBA_Context_out (CORBA_Context_ptr &);
  CORBA_Context_out (CORBA_Context_var &);
  CORBA_Context_out (CORBA_Context_out &);
  CORBA_Context_out &operator= (CORBA_Context_out &);
  CORBA_Context_out &operator= (const CORBA_Context_var &);
  CORBA_Context_out &operator= (CORBA_Context_ptr);
  operator CORBA_Context_ptr &();
  CORBA_Context_ptr &ptr (void);
  CORBA_Context_ptr operator-> (void);

private:
  CORBA_Context_ptr &ptr_;
};

#if defined (__ACE_INLINE__)
# include "tao/Context.i"
#endif /* __ACE_INLINE__ */

#endif /* TAO_CONTEXT_H */