NVList_Adapter_Impl.cpp

Go to the documentation of this file.
00001 // @(#) $Id: NVList_Adapter_Impl.cpp 76995 2007-02-11 12:51:42Z johnnyw $
00002 
00003 #include "tao/AnyTypeCode/NVList_Adapter_Impl.h"
00004 
00005 ACE_RCSID (AnyTypeCode,
00006            NVList_Adapter_Impl,
00007            "$Id: NVList_Adapter_Impl.cpp 76995 2007-02-11 12:51:42Z johnnyw $")
00008 
00009 #include "tao/AnyTypeCode/NVList.h"
00010 #include "tao/SystemException.h"
00011 #include "ace/CORBA_macros.h"
00012 
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014 
00015 void
00016 TAO_NVList_Adapter_Impl::create_list (
00017       CORBA::Long count,
00018       CORBA::NVList_ptr &new_list)
00019 {
00020   ACE_ASSERT (CORBA::ULong (count) <= UINT_MAX);
00021   // Create an empty list
00022   ACE_NEW_THROW_EX (new_list,
00023                     CORBA::NVList,
00024                     CORBA::NO_MEMORY (
00025                       CORBA::SystemException::_tao_minor_code (
00026                         0,
00027                         ENOMEM),
00028                       CORBA::COMPLETED_NO));
00029 
00030   // If count is greater than 0, create a list of NamedValues.
00031   if (count != 0)
00032     {
00033       new_list->max_ = (CORBA::ULong) count;
00034 
00035       for (CORBA::Long i = 0; i < count; ++i)
00036         {
00037           CORBA::NamedValue_ptr nv = 0;
00038           ACE_NEW_THROW_EX (nv,
00039                             CORBA::NamedValue,
00040                             CORBA::NO_MEMORY (
00041                               CORBA::SystemException::_tao_minor_code (
00042                                 0,
00043                                 ENOMEM),
00044                               CORBA::COMPLETED_NO));
00045 
00046           new_list->values_.enqueue_tail (nv);
00047         }
00048     }
00049 }
00050 
00051 void
00052 TAO_NVList_Adapter_Impl::create_named_value (
00053       CORBA::NamedValue_ptr &nv
00054       )
00055 {
00056   ACE_NEW_THROW_EX (nv,
00057                     CORBA::NamedValue,
00058                     CORBA::NO_MEMORY (
00059                       CORBA::SystemException::_tao_minor_code (
00060                         0,
00061                         ENOMEM),
00062                       CORBA::COMPLETED_NO));
00063 }
00064 
00065 int
00066 TAO_NVList_Adapter_Impl::Initializer (void)
00067 {
00068   return ACE_Service_Config::process_directive (ace_svc_desc_TAO_NVList_Adapter_Impl);
00069 }
00070 
00071 TAO_END_VERSIONED_NAMESPACE_DECL
00072 
00073 ACE_STATIC_SVC_DEFINE (TAO_NVList_Adapter_Impl,
00074                        ACE_TEXT ("TAO_NVList_Adapter"),
00075                        ACE_SVC_OBJ_T,
00076                        &ACE_SVC_NAME (TAO_NVList_Adapter_Impl),
00077                        ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00078                        0)
00079 ACE_FACTORY_DEFINE (TAO_AnyTypeCode, TAO_NVList_Adapter_Impl)

Generated on Sun Jan 27 13:21:06 2008 for TAO_AnyTypeCode by doxygen 1.3.6