3 //=============================================================================
7 * Header file for CORBA Context class.
9 * @author Jeff Parsons <parsons@cs.wustl.edu>
11 //=============================================================================
16 #include /**/ "ace/pre.h"
18 #include "tao/DynamicInterface/dynamicinterface_export.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/DynamicInterface/DII_CORBA_methods.h"
25 #include "tao/AnyTypeCode/AnyTypeCode_methods.h"
27 #include "tao/Pseudo_VarOut_T.h"
28 #include "tao/orbconf.h"
29 #include "tao/Basic_Types.h"
30 #include "tao/ORB_Constants.h"
31 #include "tao/default_environment.h"
33 #include "ace/Unbounded_Queue.h"
36 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
43 typedef NVList
*NVList_ptr
;
46 typedef Context
* Context_ptr
;
49 typedef ContextList
* ContextList_ptr
;
51 typedef TAO_Pseudo_Var_T
<Context
> Context_var
;
52 typedef TAO_Pseudo_Out_T
<Context
> Context_out
;
54 typedef TAO_Pseudo_Var_T
<ContextList
> ContextList_var
;
55 typedef TAO_Pseudo_Out_T
<ContextList
> ContextList_out
;
60 * @brief CORBA::Context
62 * TAO's minimal implementation of the Context interface. Since
63 * Contexts are inherently un-typesafe, there use is deprecated and
64 * the feature may eventaully disappear from CORBA. It is
65 * implemented only to make the arg list of
66 * CORBA::Object::_create_request() compliant. The only (pointer)
67 * value that should be passed is 0.
69 class TAO_DynamicInterface_Export Context
73 ~Context () = default;
75 // = Pseudo-object methods
76 static Context
*_duplicate (Context
*);
77 static Context
*_nil ();
79 // = Reference counting.
80 CORBA::ULong
_incr_refcount ();
81 CORBA::ULong
_decr_refcount ();
83 // = All the spec-required functions below will just throw a
84 // CORBA::NO_IMPLEMENT exception and do nothing else.
86 const char *context_name () const;
88 CORBA::Context_ptr
parent () const;
90 void create_child (const char *child_ctx_name
,
91 CORBA::Context_out child_ctx
);
93 void set_one_value (const char *propname
, const CORBA::Any
&propvalue
);
95 void set_values (CORBA::NVList_ptr values
);
97 void delete_values (const char *propname
);
99 void get_values (const char *start_scope
,
100 CORBA::Flags op_flags
,
102 CORBA::NVList_ptr
&values
);
104 // Useful for template programming.
105 typedef CORBA::Context_ptr _ptr_type
;
106 typedef CORBA::Context_var _var_type
;
107 typedef CORBA::Context_out _out_type
;
110 /// Reference counter.
111 std::atomic
<uint32_t> refcount_
{ 1 };
117 * @brief ContextList definition taken from CORBA v2.3a Dec 1998
119 * Maintains a list of strings for Contexts.
121 class TAO_DynamicInterface_Export ContextList
125 ContextList () = default;
127 /// Constructor - initialize given a length and an array of
129 ContextList (CORBA::ULong len
, char **ctx_list
);
134 /// Return the number of elements.
135 CORBA::ULong
count ();
137 /// Increment the reference count.
138 ContextList_ptr
_duplicate ();
140 /// Increment the reference count.
141 static ContextList_ptr
_duplicate (ContextList
*);
143 /// Decrement the reference count and delete if it is 0.
146 /// Return null pointer of this type.
147 static ContextList_ptr
_nil ();
149 /// Add a string to the list.
150 void add (char *ctx
);
152 /// Add and consume a string to the list.
153 void add_consume (char *ctx
);
155 /// Return the typecode at slot i. Raises the "Bounds" exception.
156 char *item (CORBA::ULong slot
);
158 /// Remove the typecode at slot i. Raises the "Bounds" exception.
159 void remove (CORBA::ULong slot
);
161 /// Increment and decrement ref counts.
162 void _incr_refcount ();
163 void _decr_refcount ();
165 // Useful for template programming.
166 typedef CORBA::ContextList_ptr _ptr_type
;
167 typedef CORBA::ContextList_var _var_type
;
168 typedef CORBA::ContextList_out _out_type
;
171 ContextList (const ContextList
&) = delete;
172 ContextList
&operator= (const ContextList
&) = delete;
174 /// Reference counter.
175 std::atomic
<uint32_t> refcount_
;
177 /// Internal list of typecodes.
178 ACE_Unbounded_Queue
<char *> ctx_list_
;
180 } // End CORBA namespace.
182 TAO_END_VERSIONED_NAMESPACE_DECL
184 #if defined (__ACE_INLINE__)
185 # include "tao/DynamicInterface/Context.inl"
186 #endif /* __ACE_INLINE__ */
188 #include /**/ "ace/post.h"
190 #endif /* TAO_CONTEXT_H */