本文整理汇总了C++中DataPtr::length方法的典型用法代码示例。如果您正苦于以下问题:C++ DataPtr::length方法的具体用法?C++ DataPtr::length怎么用?C++ DataPtr::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataPtr
的用法示例。
在下文中一共展示了DataPtr::length方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decodeTypedElements
inline void decodeTypedElements( BinaryPortable *, T *, DataPtr &data, T *t, int nCount)
{
if (data.length() != sizeof(T)*nCount)
{
RCF_THROW(RCF::Exception(RCF::SfError_DataFormat))(data.length())(nCount)(typeid(T).name());
}
T *buffer = reinterpret_cast<T *>(data.get());
RCF::networkToMachineOrder(buffer, sizeof(T), nCount);
memcpy(t, buffer, nCount*sizeof(T));
}
示例2: EncodingBinaryPortable_toObjectImpl
void EncodingBinaryPortable_toObjectImpl(
DataPtr & data,
T * t,
int nCount)
{
if (data.length() != sizeof(T)*nCount)
{
RCF::Exception e(RCF::_SfError_DataFormat());
RCF_THROW(e)(data.length())(nCount)(typeid(T).name());
}
T *buffer = reinterpret_cast<T *>(data.get());
RCF::networkToMachineOrder(buffer, sizeof(T), nCount);
memcpy(t, buffer, nCount*sizeof(T));
}
示例3: EncodingBinaryNative_toObjectImpl
void EncodingBinaryNative_toObjectImpl(
DataPtr & data,
T * t,
int nCount)
{
RCF_ASSERT_EQ( data.length() , sizeof(T)*nCount);
memcpy(t, data.get(), sizeof(T)*nCount);
}
示例4: EncodingText_toObjectImpl
void EncodingText_toObjectImpl(
DataPtr & data,
T * t,
int nCount)
{
if (data.length() == 0)
{
RCF::Exception e(RCF::_SfError_DataFormat());
RCF_THROW(e);
}
RCF::MemIstream istr(data.get(), data.length());
istr >> t[0];
for (int i=1; i<nCount; i++)
{
char ch;
istr.get(ch);
RCF_ASSERT_EQ( ch , chSeparator );
istr >> t[i];
}
}
示例5: countTypedElements
inline UInt32 countTypedElements( Text *, T *, DataPtr &data)
{
// Count number of internally occurring separators in the data, and then add 1
UInt32 count = 0;
for (UInt32 i=1; i<data.length()-1; i++)
{
if (data.get()[i] == Byte8(chSeparator))
{
count++;
}
}
return count+1;
}
示例6: EncodingText_getCountImpl
UInt32 EncodingText_getCountImpl(DataPtr & data, T *)
{
// Return 1 + number of separator characters.
UInt32 count = 0;
for (UInt32 i=1; i<data.length()-1; i++)
{
if (data.get()[i] == Byte8(chSeparator))
{
count++;
}
}
return count+1;
}
示例7: put
void OStream::put(const DataPtr &value)
{
write_byte( (Byte8) Data );
write(value.get(), value.length());
}
示例8: EncodingBinaryPortable_getCountImpl
UInt32 EncodingBinaryPortable_getCountImpl(DataPtr & data, T *)
{
RCF_ASSERT(data.length() % sizeof(T) == 0);
return data.length() / sizeof(T);
}