summaryrefslogtreecommitdiff
path: root/TAO/tao/DynamicInterface/ExceptionList.h
blob: 9ec372f2b31be247d22154817c69748780a42fcf (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
138
139
140
141
142
143
144
145
146
147
148
149
150
// This may look like C, but it's really -*- C++ -*-
//
// $Id$

// ============================================================================
//
// = LIBRARY
//    DynamicInterface
//
// = FILENAME
//    ExceptionList.h
//
// = DESCRIPTION
//    This file defines the ExceptionList datatype used in
//    dynamic invocations.
//
// = AUTHOR
//     Copyright 1994-1995 by Sun Microsystems Inc.
//
// ============================================================================

#ifndef TAO_CORBA_EXCEPTIONLIST_H
#define TAO_CORBA_EXCEPTIONLIST_H
#include "ace/pre.h"

#include "dynamicinterface_export.h"
#include "tao/corbafwd.h"
#include "ace/Unbounded_Queue.h"
#include "ace/Atomic_Op.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class CORBA_ExceptionList;
typedef CORBA_ExceptionList *CORBA_ExceptionList_ptr;

class TAO_DynamicInterface_Export CORBA_ExceptionList
{
  // = TITLE
  //    ExceptionList definition taken from CORBA v2.2 Feb 1998.
  //
  // = DESCRIPTION
  //    Maintains a list of TypeCodes for Exceptions.
public:
  // = Intialization and termination methods.

  CORBA_ExceptionList (void);
  // Constructor.

  CORBA_ExceptionList (CORBA::ULong len,
                       CORBA::TypeCode_ptr *tc_list);
  // Constructor - initialize given a length and an array of
  // TypeCodes.

  ~CORBA_ExceptionList (void);
  // Destructor.

  CORBA::ULong count (void);
  // Return the number of elements.

  CORBA_ExceptionList_ptr _duplicate (void);
  // Increase the reference count.

  static CORBA_ExceptionList_ptr _duplicate (CORBA_ExceptionList *);
  // Increase the reference count in the spec defined manner.

  void _destroy (void);

  static CORBA_ExceptionList_ptr _nil (void);

  void add (CORBA::TypeCode_ptr tc);
  // Add a TypeCode to the list.

  void add_consume (CORBA::TypeCode_ptr tc);
  // Add and consume a TypeCode to the list.

  CORBA::TypeCode_ptr item (CORBA::ULong slot
                            TAO_ENV_ARG_DECL_WITH_DEFAULTS);
  // Return the typecode at slot i. Raises the "Bounds" exception.

  void remove (CORBA::ULong slot
               TAO_ENV_ARG_DECL_WITH_DEFAULTS);
  // Remove the typecode at slot i. Raises the "Bounds" exception.

  void  _incr_refcnt (void);
  void  _decr_refcnt (void);
  // Increment and decrement ref counts.

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

private:
  // = Not allowed.
  CORBA_ExceptionList (const CORBA_ExceptionList &);
  CORBA_ExceptionList &operator= (const CORBA_ExceptionList &);

  ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
  // Reference counter.

  ACE_Unbounded_Queue<CORBA::TypeCode_ptr> tc_list_;
  // Internal list of typecodes.
};

class TAO_DynamicInterface_Export CORBA_ExceptionList_var
{
  // = TITLE
  //    CORBA_ExceptionList_var
  //
  // = DESCRIPTION
  //    Lifecycle management helper class for ExceptionList objects.
public:
  CORBA_ExceptionList_var (void);
  // Default constructor.

  CORBA_ExceptionList_var (CORBA_ExceptionList_ptr);

  CORBA_ExceptionList_var (const CORBA_ExceptionList_var &);
  // Copy constructor.

  ~CORBA_ExceptionList_var (void);
  // Destructor.

  CORBA_ExceptionList_var &operator= (CORBA_ExceptionList_ptr);
  CORBA_ExceptionList_var &operator= (const CORBA_ExceptionList_var &);
  CORBA_ExceptionList_ptr operator-> (void) const;

  operator const CORBA_ExceptionList_ptr &() const;
  operator CORBA_ExceptionList_ptr &();

  // in, inout, out, _retn.
  CORBA_ExceptionList_ptr in (void) const;
  CORBA_ExceptionList_ptr &inout (void);
  CORBA_ExceptionList_ptr &out (void);
  CORBA_ExceptionList_ptr _retn (void);
  CORBA_ExceptionList_ptr ptr (void) const;

private:
  CORBA_ExceptionList_ptr ptr_;
};

#if defined (__ACE_INLINE__)
# include "ExceptionList.inl"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /* TAO_CORBA_EXCEPTIONLIST_H */