当前位置: 首页>>代码示例>>C++>>正文


C++ EncodingImpl类代码示例

本文整理汇总了C++中EncodingImpl的典型用法代码示例。如果您正苦于以下问题:C++ EncodingImpl类的具体用法?C++ EncodingImpl怎么用?C++ EncodingImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EncodingImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Error

size_t
Exclude::wireEncode(EncodingImpl<TAG>& encoder) const
{
  if (m_exclude.empty()) {
    throw Error("Exclude filter cannot be empty");
  }

  size_t totalLength = 0;

  // Exclude ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
  // Any     ::= ANY-TYPE TLV-LENGTH(=0)

  for (const auto& item : m_exclude) {
    if (item.second) {
      totalLength += prependEmptyBlock(encoder, tlv::Any);
    }
    if (!item.first.empty() || !item.second) {
      totalLength += item.first.wireEncode(encoder);
    }
  }

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::Exclude);
  return totalLength;
}
开发者ID:Estoque86,项目名称:Comparison_New_Simulators,代码行数:25,代码来源:exclude.cpp

示例2: prependNonNegativeIntegerBlock

size_t
Route::wireEncode(EncodingImpl<T>& block) const
{
  size_t totalLength = 0;

  // Absence of an ExpirationPeriod signifies non-expiration
  if (!m_hasInfiniteExpirationPeriod) {
    totalLength += prependNonNegativeIntegerBlock(block,
                                                  ndn::tlv::nfd::ExpirationPeriod,
                                                  m_expirationPeriod.count());
  }

  totalLength += prependNonNegativeIntegerBlock(block,
                                                ndn::tlv::nfd::Flags,
                                                m_flags);

  totalLength += prependNonNegativeIntegerBlock(block,
                                                ndn::tlv::nfd::Cost,
                                                m_cost);

  totalLength += prependNonNegativeIntegerBlock(block,
                                                ndn::tlv::nfd::Origin,
                                                m_origin);

  totalLength += prependNonNegativeIntegerBlock(block,
                                                ndn::tlv::nfd::FaceId,
                                                m_faceId);

  totalLength += block.prependVarNumber(totalLength);
  totalLength += block.prependVarNumber(ndn::tlv::nfd::Route);

  return totalLength;
}
开发者ID:WeiqiJust,项目名称:NDN-total,代码行数:33,代码来源:nfd-rib-entry.cpp

示例3: prependEmptyBlock

size_t
Exclude::wireEncode(EncodingImpl<TAG>& encoder) const
{
  if (m_entries.empty()) {
    BOOST_THROW_EXCEPTION(Error("cannot encode empty Exclude selector"));
  }

  size_t totalLength = 0;

  // Exclude ::= EXCLUDE-TYPE TLV-LENGTH Any? (GenericNameComponent (Any)?)+
  // Any     ::= ANY-TYPE TLV-LENGTH(=0)

  for (const Entry& entry : m_entries) {
    if (entry.second) {
      totalLength += prependEmptyBlock(encoder, tlv::Any);
    }
    if (!entry.first.isNegInf) {
      totalLength += entry.first.component.wireEncode(encoder);
    }
  }

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::Exclude);
  return totalLength;
}
开发者ID:cawka,项目名称:ndn-cxx,代码行数:25,代码来源:exclude.cpp

示例4: wireEncode

 size_t
 wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::RX,
                                                 m_rx);
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::TX,
                                                 m_tx);
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::FaceId,
                                                 m_faceId);
   
   totalLength += encoder.prependByteArrayBlock(ndn::statusCollector::tlv::LinkIp,
                                        reinterpret_cast<const uint8_t*>(m_linkIp.c_str()), m_linkIp.size());
   
   totalLength += encoder.prependByteArrayBlock(ndn::statusCollector::tlv::CurrentTime,
                                        reinterpret_cast<const uint8_t*>(m_timestamp.c_str()), m_timestamp.size());
   
   
   totalLength += encoder.prependVarNumber(totalLength);
   totalLength += encoder.prependVarNumber(statusCollector::tlv::FaceStatus);
   return totalLength;
 }
开发者ID:WU-ARL,项目名称:ndnTestbedDataCollector,代码行数:28,代码来源:ndnTestbedDataCollector.hpp

示例5: prependNonNegativeIntegerBlock

size_t
FaceEventNotification::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::Flags, m_flags);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::LinkType, m_linkType);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FacePersistency, m_facePersistency);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceScope, m_faceScope);
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceId, m_faceId);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceEventKind, m_kind);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::nfd::FaceEventNotification);
  return totalLength;
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:26,代码来源:face-event-notification.cpp

示例6: Error

size_t
Exclude::wireEncode(EncodingImpl<T>& block) const
{
  if (m_exclude.empty()) {
    throw Error("Exclude filter cannot be empty");
  }

  size_t totalLength = 0;

  // Exclude ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
  // Any     ::= ANY-TYPE TLV-LENGTH(=0)

  for (Exclude::const_iterator i = m_exclude.begin(); i != m_exclude.end(); i++)
    {
      if (i->second)
        {
          totalLength += prependBooleanBlock(block, tlv::Any);
        }
      if (!i->first.empty())
        {
          totalLength += i->first.wireEncode(block);
        }
    }

  totalLength += block.prependVarNumber(totalLength);
  totalLength += block.prependVarNumber(tlv::Exclude);
  return totalLength;
}
开发者ID:WeiqiJust,项目名称:NDN-total,代码行数:28,代码来源:exclude.cpp

示例7: switch

size_t
KeyLocator::wireEncode(EncodingImpl<TAG>& encoder) const
{
  // KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
  // KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+

  size_t totalLength = 0;

  switch (m_type) {
  case KeyLocator_None:
    break;
  case KeyLocator_Name:
    totalLength += m_name.wireEncode(encoder);
    break;
  case KeyLocator_KeyDigest:
    totalLength += encoder.prependBlock(m_keyDigest);
    break;
  default:
    NDN_THROW(Error("Unsupported KeyLocator type " + to_string(m_type)));
  }

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::KeyLocator);
  return totalLength;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:25,代码来源:key-locator.cpp

示例8: Error

size_t
DefaultParam::wireEncode(EncodingImpl<T>& block) const
{
  size_t totalLength = 0;

  switch (m_originType) {
  case TYPE_ID:
  case TYPE_KEY:
  case TYPE_CERT:
    {
      totalLength += m_originName.wireEncode(block);
      break;
    }
  case TYPE_USER:
    break;
  default:
    throw Error("DefaultParam::wireEncode: unsupported PibType: " +
                boost::lexical_cast<std::string>(m_originType));
  }

  totalLength += prependNonNegativeIntegerBlock(block, tlv::pib::Type, m_originType);
  totalLength += prependNonNegativeIntegerBlock(block, tlv::pib::Type, m_targetType);
  totalLength += block.prependVarNumber(totalLength);
  totalLength += block.prependVarNumber(tlv::pib::DefaultParam);

  return totalLength;
}
开发者ID:CSUL,项目名称:ndn-tools,代码行数:27,代码来源:default-param.cpp

示例9: prependNonNegativeIntegerBlock

size_t
Interest::wireEncode(EncodingImpl<TAG>& block) const
{
  size_t totalLength = 0;

  // Interest ::= INTEREST-TYPE TLV-LENGTH
  //                Name
  //                Selectors?
  //                Nonce
  //                Scope?
  //                InterestLifetime?
  //                Link?
  //                SelectedDelegation?

  // (reverse encoding)
  if (hasLink()) {
    if (hasSelectedDelegation()) {
      totalLength += prependNonNegativeIntegerBlock(block,
                                                    tlv::SelectedDelegation,
                                                    m_selectedDelegationIndex);
    }
    totalLength += prependBlock(block, m_link);
  }
  else {
    BOOST_ASSERT(!hasSelectedDelegation());
  }

  // InterestLifetime
  if (getInterestLifetime() >= time::milliseconds::zero() &&
      getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
    {
      totalLength += prependNonNegativeIntegerBlock(block,
                                                    tlv::InterestLifetime,
                                                    getInterestLifetime().count());
    }

  // Scope
  if (getScope() >= 0)
    {
      totalLength += prependNonNegativeIntegerBlock(block, tlv::Scope, getScope());
    }

  // Nonce
  getNonce(); // to ensure that Nonce is properly set
  totalLength += block.prependBlock(m_nonce);

  // Selectors
  if (hasSelectors())
    {
      totalLength += getSelectors().wireEncode(block);
    }

  // Name
  totalLength += getName().wireEncode(block);

  totalLength += block.prependVarNumber(totalLength);
  totalLength += block.prependVarNumber(tlv::Interest);
  return totalLength;
}
开发者ID:vusirikala,项目名称:ndn-cxx,代码行数:59,代码来源:interest.cpp

示例10: prependNonNegativeIntegerBlock

size_t
Interest::encode03(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  // Encode as NDN Packet Format v0.3
  // Interest ::= INTEREST-TYPE TLV-LENGTH
  //                Name
  //                CanBePrefix?
  //                MustBeFresh?
  //                ForwardingHint?
  //                Nonce?
  //                InterestLifetime?
  //                HopLimit?
  //                ApplicationParameters?

  // (reverse encoding)

  // ApplicationParameters
  if (hasApplicationParameters()) {
    totalLength += encoder.prependBlock(getApplicationParameters());
  }

  // HopLimit: not yet supported

  // InterestLifetime
  if (getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::InterestLifetime,
                                                  static_cast<uint64_t>(getInterestLifetime().count()));
  }

  // Nonce
  uint32_t nonce = getNonce(); // if nonce was unset, getNonce generates a random nonce
  totalLength += encoder.prependByteArrayBlock(tlv::Nonce, reinterpret_cast<uint8_t*>(&nonce), sizeof(nonce));

  // ForwardingHint
  if (!getForwardingHint().empty()) {
    totalLength += getForwardingHint().wireEncode(encoder);
  }

  // MustBeFresh
  if (getMustBeFresh()) {
    totalLength += prependEmptyBlock(encoder, tlv::MustBeFresh);
  }

  // CanBePrefix
  if (getCanBePrefix()) {
    totalLength += prependEmptyBlock(encoder, tlv::CanBePrefix);
  }

  // Name
  totalLength += getName().wireEncode(encoder);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::Interest);
  return totalLength;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:57,代码来源:interest.cpp

示例11: prependNonNegativeIntegerBlock

size_t
NackHeader::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t length = 0;
  length += prependNonNegativeIntegerBlock(encoder, tlv::NackReason,
                                           static_cast<uint32_t>(m_reason));
  length += encoder.prependVarNumber(length);
  length += encoder.prependVarNumber(tlv::Nack);
  return length;
}
开发者ID:2nd-ndn-hackathon,项目名称:ndn-cxx-logging,代码行数:10,代码来源:nack-header.cpp

示例12:

size_t
Component::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;
  if (value_size() > 0)
    totalLength += encoder.prependByteArray(value(), value_size());
  totalLength += encoder.prependVarNumber(value_size());
  totalLength += encoder.prependVarNumber(type());
  return totalLength;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:10,代码来源:name-component.cpp

示例13: prependNestedBlock

size_t
StrategyChoice::wireEncode(EncodingImpl<TAG>& encoder) const
{
    size_t totalLength = 0;

    totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
    totalLength += m_name.wireEncode(encoder);

    totalLength += encoder.prependVarNumber(totalLength);
    totalLength += encoder.prependVarNumber(tlv::nfd::StrategyChoice);
    return totalLength;
}
开发者ID:Estoque86,项目名称:Comparison_New_Simulators,代码行数:12,代码来源:nfd-strategy-choice.cpp

示例14: prependNestedBlock

inline size_t
prependNestedBlock(EncodingImpl<TAG>& encoder, uint32_t type, const U& value)
{
  BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<U>));

  size_t valueLength = value.wireEncode(encoder);
  size_t totalLength = valueLength;
  totalLength += encoder.prependVarNumber(valueLength);
  totalLength += encoder.prependVarNumber(type);

  return totalLength;
}
开发者ID:AaronTien,项目名称:ndn-cxx,代码行数:12,代码来源:block-helpers.hpp

示例15: prependStringBlock

size_t
ValidityPeriod::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  totalLength += prependStringBlock(encoder, tlv::NotAfter, time::toIsoString(m_notAfter));
  totalLength += prependStringBlock(encoder, tlv::NotBefore, time::toIsoString(m_notBefore));

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::ValidityPeriod);
  return totalLength;
}
开发者ID:2nd-ndn-hackathon,项目名称:ndn-cxx-logging,代码行数:12,代码来源:validity-period.cpp


注:本文中的EncodingImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。