valuebase.cpp

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 552 行 · 第 1/2 页

CPP
552
字号
  }
  else
  {
     CORBA::String_var repo_id_stream;

     // It would be more efficient not to copy the string %!)
     if (strm.read_string (repo_id_stream.inout ()) == 0)
     {
        return 0;
     }

     factory = orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
  }

  if (factory == 0) // %! except.!
    {
      ACE_DEBUG ((LM_ERROR,
                  ACE_TEXT ("(%N:%l) OBV factory is null !!!\n")));
      return 0;
    }

  return retval;
}

CORBA::Boolean
CORBA::ValueBase::_tao_unmarshal_post (TAO_InputCDR &)
{
  CORBA::Boolean retval = 1;

  // (... called from T::_tao_unmarshal)
  // 7. if (chunking) check the last blocksize tag for correct value.  +++
  //    And if we're gonna to truncate, skip all the state of the more
  //    derived classes. (But it might need to be accessed again,
  //    if there are embedded objects which are referenced later
  //    in this CDR encoding stream.)

  // 8. if (chunking) there must be some end tag. Let the CDR stream deal
  //    with this (and decrease the nesting level of valuetypes).
  //    Also the CDR stream must check for eventually outstanding end tags
  //    at the end of the stream which have to cause a marshal
  //    exception there.

  return retval;
}


// ================== Typecode initializations ==================
static const CORBA::Long _oc_CORBA_ValueBase[] =
  {
    TAO_ENCAP_BYTE_ORDER, // byte order
    32,
    ACE_NTOHL (0x49444c3a),
    ACE_NTOHL (0x6f6d672e),
    ACE_NTOHL (0x6f72672f),
    ACE_NTOHL (0x434f5242),
    ACE_NTOHL (0x412f5661),
    ACE_NTOHL (0x6c756542),
    ACE_NTOHL (0x6173653a),
    ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CORBA/ValueBase:1.0
    10,
    ACE_NTOHL (0x56616c75),
    ACE_NTOHL (0x65426173),
    ACE_NTOHL (0x65000000),  // name = ValueBase
    0, // value modifier
    CORBA::tk_null, // no stateful base valuetype
    0, // member count
  };


static const CORBA::Long _oc_CORBA_Visibility[] =
  {
    TAO_ENCAP_BYTE_ORDER, // byte order
    33,
    ACE_NTOHL (0x49444c3a),
    ACE_NTOHL (0x6f6d672e),
    ACE_NTOHL (0x6f72672f),
    ACE_NTOHL (0x434f5242),
    ACE_NTOHL (0x412f5669),
    ACE_NTOHL (0x73696269),
    ACE_NTOHL (0x6c697479),
    ACE_NTOHL (0x3a312e30),
    ACE_NTOHL (0x0),  // repository ID = IDL:omg.org/CORBA/Visibility:1.0
    11,
    ACE_NTOHL (0x56697369),
    ACE_NTOHL (0x62696c69),
    ACE_NTOHL (0x74790000),  // name = Visibility
    CORBA::tk_short,
  };


static const CORBA::Long _oc_CORBA_ValueModifier[] =
  {
    TAO_ENCAP_BYTE_ORDER, // byte order
    36,
    ACE_NTOHL (0x49444c3a),
    ACE_NTOHL (0x6f6d672e),
    ACE_NTOHL (0x6f72672f),
    ACE_NTOHL (0x434f5242),
    ACE_NTOHL (0x412f5661),
    ACE_NTOHL (0x6c75654d),
    ACE_NTOHL (0x6f646966),
    ACE_NTOHL (0x6965723a),
    ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CORBA/ValueModifier:1.0
    14,
    ACE_NTOHL (0x56616c75),
    ACE_NTOHL (0x654d6f64),
    ACE_NTOHL (0x69666965),
    ACE_NTOHL (0x72000000),  // name = ValueModifier
    CORBA::tk_short,
  };

namespace CORBA
{
  static TypeCode _tao_valuetype_tk_val_tmp (CORBA::tk_value,
                   sizeof (_oc_CORBA_ValueBase),
                   (char *) &_oc_CORBA_ValueBase,
                   0,
                   sizeof (CORBA::ValueBase));


  TypeCode_ptr _tc_ValueBase = &_tao_valuetype_tk_val_tmp;

  static TypeCode _tao_valuetype_tk_vis_tmp (CORBA::tk_alias,
                   sizeof (_oc_CORBA_Visibility),
                   (char *) &_oc_CORBA_Visibility,
                   0,
                   sizeof (CORBA::Visibility));

  TypeCode_ptr _tc_Visibility =
  &_tao_valuetype_tk_vis_tmp;

  static TypeCode _tao_valuetype_tk_vm_tmp (CORBA::tk_alias,
                   sizeof (_oc_CORBA_ValueModifier),
                   (char *) &_oc_CORBA_ValueModifier,
                   0,
                   sizeof (CORBA::ValueModifier));

  TypeCode_ptr _tc_ValueModifier =
  &_tao_valuetype_tk_vm_tmp;
}

// member functions for CORBA::DefaultValueRefCountBase ============

// destructor
CORBA::DefaultValueRefCountBase::~DefaultValueRefCountBase (void)
{
}

void
CORBA::DefaultValueRefCountBase::_add_ref (void)
{
  this->_tao_add_ref ();
}

void
CORBA::DefaultValueRefCountBase::_remove_ref (void)
{
  this->_tao_remove_ref ();
}

CORBA::ULong
CORBA::DefaultValueRefCountBase::_refcount_value (void)
{
  return this->_tao_refcount_value ();
}

// ===========================================================

CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase (void)
  : _tao_reference_count_ (1)
{
}


void
CORBA::DefaultValueRefCountBase::_tao_add_ref (void)
{
  ACE_GUARD (TAO_SYNCH_MUTEX,
             guard,
             this->_tao_reference_count_lock_);

  ++this->_tao_reference_count_;
}

void
CORBA::DefaultValueRefCountBase::_tao_remove_ref (void)
{
  {
    ACE_GUARD (TAO_SYNCH_MUTEX,
               guard,
               this->_tao_reference_count_lock_);

    --this->_tao_reference_count_;

    if (this->_tao_reference_count_ != 0)
      {
        return;
      }
  }

  // The guard has been already given up, but this is no problem
  // cause we have held the last reference, and this one we don't give
  // away anymore, we do:
  delete this;
}

CORBA::ULong
CORBA::DefaultValueRefCountBase::_tao_refcount_value (void)
{
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
                    guard,
                    this->_tao_reference_count_lock_,
                    0);

  return _tao_reference_count_;
}

// ===========================================================

// Some constants.

const CORBA::ULong TAO_OBV_GIOP_Flags::Value_tag_base    = 0x7fffff00L;
const CORBA::ULong TAO_OBV_GIOP_Flags::Value_tag_sigbits = 0xffffff00L;
const CORBA::ULong TAO_OBV_GIOP_Flags::Codebase_url      = 1;
const CORBA::ULong TAO_OBV_GIOP_Flags::Type_info_sigbits = 0x00000006L;
const CORBA::ULong TAO_OBV_GIOP_Flags::Type_info_none    = 0;
const CORBA::ULong TAO_OBV_GIOP_Flags::Type_info_single  = 2;
const CORBA::ULong TAO_OBV_GIOP_Flags::Type_info_list    = 6;

// ===========================================================

CORBA::Boolean
operator<< (TAO_OutputCDR &strm,
            const CORBA::ValueBase *_tao_valuetype)
{
  return CORBA::ValueBase::_tao_marshal (
             strm,
             ACE_const_cast (CORBA::ValueBase *,
                             _tao_valuetype),
             (ptrdiff_t) &CORBA::ValueBase::_downcast
           );
}

CORBA::Boolean
operator>> (TAO_InputCDR &strm,
            CORBA::ValueBase *&_tao_valuetype)
{
  return CORBA::ValueBase::_tao_unmarshal (strm,
                                           _tao_valuetype);
}

// =============== Template Specializations =====================
namespace TAO
{
  void
  Value_Traits<CORBA::ValueBase>::tao_add_ref (
      CORBA::ValueBase *p)
  {
    CORBA::add_ref (p);
  }

  void
  Value_Traits<CORBA::ValueBase>::tao_remove_ref (
      CORBA::ValueBase * p)
  {
    CORBA::remove_ref (p);
  }

  void
  Value_Traits<CORBA::ValueBase>::tao_release (
      CORBA::ValueBase * p)
  {
    CORBA::remove_ref (p);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?