⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pg_properties_encoder.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
/* -*- C++ -*- */
//=============================================================================
/**
 *  @file    PG_Properties_Encoder.cpp
 *
 *  PG_Properties_Encoder.cpp,v 1.2 2003/12/22 01:44:38 wilson_d Exp
 *
 *  This file implements classes to help manage the Properties
 *  defined in the Portable Object Group.
 *
 *  @author Dale Wilson <wilson_d@ociweb.com>
 */
//=============================================================================
#include "ace/pre.h"
#include "PG_Properties_Encoder.h"

//////////
// Properties_Encoder
TAO_PG::Properties_Encoder::Properties_Encoder ()
{
}

TAO_PG::Properties_Encoder::~Properties_Encoder ()
{
}


void TAO_PG::Properties_Encoder::add (
  const char * name,
  const PortableGroup::Value & value)
{
  NamedValue nv(name, value);
  values_.push_back(nv);
}

void TAO_PG::Properties_Encoder::encode (
  PortableGroup::Properties * property_set) const
{
  ACE_ASSERT (property_set != 0);
  size_t count = values_.size();
  property_set->length(count);
  for( size_t nItem = 0; nItem < count; ++nItem )
  {
    const NamedValue & nv = values_[nItem];
    PortableGroup::Property & property = (*property_set)[nItem];
    PortableGroup::Name & nsName = property.nam;
    PortableGroup::Value & anyValue = property.val;
    // assign the value
    anyValue = (nv.second());

    // assign the name
    // @@: This restricts the name to a single level with no "kind"
    // @@: remove this restriction (?)
    nsName.length(1);
    CosNaming::NameComponent & nc = nsName[0];

    nc.id = CORBA::string_dup (nv.first().c_str());
    // nc.kind defaults to empty.  Leave it that way (for now)
  }
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
  template class ACE_Pair< ACE_CString, PortableGroup::Value>;
  template class ACE_Vector< TAO_PG::Properties_Encoder::NamedValue, 10 >;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
# pragma instantiate ACE_Pair< ACE_CString, PortableGroup::Value>
# pragma instantiate ACE_Vector< TAO_PG::Properties_Encoder::NamedValue, 10 >
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

⌨️ 快捷键说明

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