Go to the documentation of this file.00001 #include "tao/DynamicInterface/Context.h"
00002
00003 ACE_RCSID (DynamicInterface,
00004 Context,
00005 "$Id: Context.cpp 76995 2007-02-11 12:51:42Z johnnyw $")
00006
00007 #include "tao/AnyTypeCode/TypeCode.h"
00008 #include "tao/CORBA_String.h"
00009 #include "tao/SystemException.h"
00010
00011 #include "ace/Guard_T.h"
00012
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/DynamicInterface/Context.inl"
00015 #endif
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 CORBA::Context::Context (void)
00020 : refcount_ (1)
00021 {
00022 }
00023
00024 CORBA::Context::~Context (void)
00025 {
00026 }
00027
00028 CORBA::ULong
00029 CORBA::Context::_incr_refcnt (void)
00030 {
00031 return ++refcount_;
00032 }
00033
00034 CORBA::ULong
00035 CORBA::Context::_decr_refcnt (void)
00036 {
00037 CORBA::ULong const new_count = --this->refcount_;
00038
00039 if (new_count == 0)
00040 delete this;
00041
00042 return new_count;
00043 }
00044
00045 const char *
00046 CORBA::Context::context_name (void) const
00047 {
00048 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00049 }
00050
00051 CORBA::Context_ptr
00052 CORBA::Context::parent (void) const
00053 {
00054 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00055 }
00056
00057 void
00058 CORBA::Context::create_child (const char * ,
00059 CORBA::Context_out )
00060 {
00061 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00062 }
00063
00064 void
00065 CORBA::Context::set_one_value (const char * ,
00066 const CORBA::Any & )
00067 {
00068 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00069 }
00070
00071 void
00072 CORBA::Context::set_values (CORBA::NVList_ptr)
00073 {
00074 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00075 }
00076
00077 void
00078 CORBA::Context::delete_values (const char * )
00079 {
00080 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00081 }
00082
00083 void
00084 CORBA::Context::get_values (const char * ,
00085 CORBA::Flags ,
00086 const char * ,
00087 CORBA::NVList_ptr & )
00088 {
00089 throw ::CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
00090 }
00091
00092 CORBA::ContextList::ContextList (CORBA::ULong len, char* *ctx_list)
00093 : ref_count_ (1)
00094 {
00095 for (CORBA::ULong i=0; i < len; i++)
00096 {
00097 this->add (ctx_list [i]);
00098 }
00099 }
00100
00101 CORBA::ContextList::~ContextList (void)
00102 {
00103 for (CORBA::ULong i = 0; i < this->count (); ++i)
00104 {
00105 char **ctx = 0;
00106
00107 if (this->ctx_list_.get (ctx, i) == -1)
00108 {
00109 return;
00110 }
00111
00112 CORBA::string_free (*ctx);
00113 }
00114 }
00115
00116 void
00117 CORBA::ContextList::add (char *ctx)
00118 {
00119 this->ctx_list_.enqueue_tail (CORBA::string_dup (ctx));
00120 }
00121
00122 void
00123 CORBA::ContextList::add_consume (char *ctx)
00124 {
00125 this->ctx_list_.enqueue_tail (ctx);
00126 }
00127
00128 char *
00129 CORBA::ContextList::item (CORBA::ULong slot)
00130 {
00131 char **ctx = 0;
00132
00133 if (this->ctx_list_.get (ctx, slot) == -1)
00134 {
00135 throw ::CORBA::TypeCode::Bounds ();
00136 }
00137 else
00138 {
00139 return CORBA::string_dup (*ctx);
00140 }
00141 }
00142
00143 void
00144 CORBA::ContextList::remove (CORBA::ULong)
00145 {
00146 throw ::CORBA::NO_IMPLEMENT ();
00147 }
00148
00149 CORBA::ContextList_ptr
00150 CORBA::ContextList::_duplicate (void)
00151 {
00152 ++this->ref_count_;
00153 return this;
00154 }
00155
00156 void
00157 CORBA::ContextList::_destroy (void)
00158 {
00159 CORBA::ULong const current = --this->ref_count_;
00160
00161 if (current == 0)
00162 {
00163 delete this;
00164 }
00165 }
00166
00167 void
00168 CORBA::ContextList::_incr_refcnt (void)
00169 {
00170 ++this->ref_count_;
00171 }
00172
00173 void
00174 CORBA::ContextList::_decr_refcnt (void)
00175 {
00176 --this->ref_count_;
00177
00178 if (this->ref_count_ != 0)
00179 {
00180 delete this;
00181 }
00182 }
00183
00184 TAO_END_VERSIONED_NAMESPACE_DECL