Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / DynamicInterface / Context.cpp
blob9a2aa9888c731884201a48fedf93e439d1e619b8
1 #include "tao/DynamicInterface/Context.h"
2 #include "tao/AnyTypeCode/TypeCode.h"
3 #include "tao/CORBA_String.h"
4 #include "tao/SystemException.h"
5 #include "ace/Guard_T.h"
7 #if !defined (__ACE_INLINE__)
8 # include "tao/DynamicInterface/Context.inl"
9 #endif /* ! __ACE_INLINE__ */
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 CORBA::ULong
14 CORBA::Context::_incr_refcount ()
16 return ++refcount_;
19 CORBA::ULong
20 CORBA::Context::_decr_refcount ()
22 CORBA::ULong const new_count = --this->refcount_;
24 if (new_count == 0)
25 delete this;
27 return new_count;
30 const char *
31 CORBA::Context::context_name () const
33 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
36 CORBA::Context_ptr
37 CORBA::Context::parent () const
39 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
42 void
43 CORBA::Context::create_child (const char * /* child_ctx_name */,
44 CORBA::Context_out /* child_ctx */)
46 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
49 void
50 CORBA::Context::set_one_value (const char * /* propname */,
51 const CORBA::Any & /* propvalue */)
53 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
56 void
57 CORBA::Context::set_values (CORBA::NVList_ptr)
59 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
62 void
63 CORBA::Context::delete_values (const char * /* propname */)
65 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
68 void
69 CORBA::Context::get_values (const char * /* start_scope */,
70 CORBA::Flags /* op_flags */,
71 const char * /* pattern */,
72 CORBA::NVList_ptr & /* values */)
74 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
77 CORBA::ContextList::ContextList (CORBA::ULong len, char* *ctx_list)
78 : refcount_ (1)
80 for (CORBA::ULong i=0; i < len; i++)
82 this->add (ctx_list [i]);
86 CORBA::ContextList::~ContextList ()
88 for (CORBA::ULong i = 0; i < this->count (); ++i)
90 char **ctx = 0;
92 if (this->ctx_list_.get (ctx, i) == -1)
94 return;
97 CORBA::string_free (*ctx);
101 void
102 CORBA::ContextList::add (char *ctx)
104 this->ctx_list_.enqueue_tail (CORBA::string_dup (ctx));
107 void
108 CORBA::ContextList::add_consume (char *ctx)
110 this->ctx_list_.enqueue_tail (ctx);
113 char *
114 CORBA::ContextList::item (CORBA::ULong slot)
116 char **ctx = 0;
118 if (this->ctx_list_.get (ctx, slot) == -1)
120 throw ::CORBA::TypeCode::Bounds ();
122 else
124 return CORBA::string_dup (*ctx);
128 void
129 CORBA::ContextList::remove (CORBA::ULong)
131 throw ::CORBA::NO_IMPLEMENT ();
134 CORBA::ContextList_ptr
135 CORBA::ContextList::_duplicate ()
137 ++this->refcount_;
138 return this;
141 void
142 CORBA::ContextList::_destroy ()
144 CORBA::ULong const current = --this->refcount_;
146 if (current == 0)
148 delete this;
152 void
153 CORBA::ContextList::_incr_refcount ()
155 ++this->refcount_;
158 void
159 CORBA::ContextList::_decr_refcount ()
161 --this->refcount_;
163 if (this->refcount_ != 0)
165 delete this;
169 TAO_END_VERSIONED_NAMESPACE_DECL