本文整理汇总了C++中atom::get_enc方法的典型用法代码示例。如果您正苦于以下问题:C++ atom::get_enc方法的具体用法?C++ atom::get_enc怎么用?C++ atom::get_enc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atom
的用法示例。
在下文中一共展示了atom::get_enc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
// Verify data encoding
void check(atom test, atom::type_t type, atom::enc_t enc, size_t size)
{
atom::type_t type_found;
atom::enc_t enc_found;
byte_vector test_bytes = test.encode_vector();
atom copy;
// Dump
printf("Atom: ");
test.print();
// What's in the atom?
type_found = test.get_type();
printf("\nData Type: %s\n", atom_type_to_string(type_found));
if (type != type_found)
{
printf("*** Failed (expected %s) ***\n", atom_type_to_string(type));
exit(1);
}
// How is it encoded?
enc_found = test.get_enc();
printf("Encoding: %s\n", atom_enc_to_string(enc_found));
if (enc != enc_found)
{
printf("*** Failed (expected %s) ***\n", atom_enc_to_string(enc));
exit(1);
}
// Debug
dump(test_bytes);
// Check total size
if (test.get_header_size() + size != test_bytes.size())
{
printf("*** Failed (expected %u bytes) ***\n",
(unsigned int)(test.get_header_size() + size));
exit(1);
}
// Reconstruct atom
printf("Testing reconstructed copy ...\n");
copy.decode_vector(test_bytes);
if (test != copy)
{
printf("*** Failed (decoded object differs) ***\n");
exit(1);
}
// Bump the counter
test_count++;
}