本文整理汇总了C++中ObObj::get_bool方法的典型用法代码示例。如果您正苦于以下问题:C++ ObObj::get_bool方法的具体用法?C++ ObObj::get_bool怎么用?C++ ObObj::get_bool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObObj
的用法示例。
在下文中一共展示了ObObj::get_bool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: free
TEST(ObObj,Serialize_bool)
{
ObObj t;
t.set_bool(true);
int64_t len = t.get_serialize_size();
ASSERT_EQ(len,2);
char *buf = (char *)malloc(len);
int64_t pos = 0;
ASSERT_EQ(t.serialize(buf,len,pos),OB_SUCCESS);
ASSERT_EQ(pos,len);
ObObj f;
pos = 0;
ASSERT_EQ(f.deserialize(buf,len,pos),OB_SUCCESS);
ASSERT_EQ(pos,len);
bool r = false;
bool l = false;
ASSERT_EQ(f.get_type(),t.get_type());
f.get_bool(r);
t.get_bool(l);
ASSERT_EQ(r,l);
free(buf);
}
示例2: deserialize_basic_param
//.........这里部分代码省略.........
// result cached
if (OB_SUCCESS == ret)
{
ret = obj.deserialize(buf, data_len, pos);
if (OB_SUCCESS == ret)
{
ret = obj.get_int(int_value);
if (OB_SUCCESS == ret)
{
//is read consistency
set_is_result_cached(int_value > 0);
}
else
{
TBSYS_LOG(WARN, "fail to get int. obj type=%d", obj.get_type());
}
}
else
{
TBSYS_LOG(WARN, "fail to deserialize obj. ret=%d", ret);
}
}
// data_version
if (OB_SUCCESS == ret)
{
ret = obj.deserialize(buf, data_len, pos);
if (OB_SUCCESS == ret)
{
ret = obj.get_int(int_value);
if (OB_SUCCESS == ret)
{
// data version
set_data_version(int_value);
}
else
{
TBSYS_LOG(WARN, "fail to get int. obj type=%d", obj.get_type());
}
}
else
{
TBSYS_LOG(WARN, "fail to deserialize obj. ret=%d", ret);
}
}
// table id
if (OB_SUCCESS == ret)
{
ret = obj.deserialize(buf, data_len, pos);
if (OB_SUCCESS == ret)
{
ret = obj.get_int(int_value);
if (OB_SUCCESS == ret)
{
table_id_ = int_value;
}
else
{
TBSYS_LOG(WARN, "fail to get int. obj type=%d", obj.get_type());
}
}
else
{
TBSYS_LOG(WARN, "fail to deserialize obj. ret=%d", ret);
}
}
// renamed table id
if (OB_SUCCESS == ret)
{
ret = obj.deserialize(buf, data_len, pos);
if (OB_SUCCESS == ret)
{
ret = obj.get_int(int_value);
if (OB_SUCCESS == ret)
{
renamed_table_id_ = int_value;
}
else
{
TBSYS_LOG(WARN, "fail to get int. obj type=%d", obj.get_type());
}
}
else
{
TBSYS_LOG(WARN, "fail to deserialize obj. ret=%d", ret);
}
}
if (OB_SUCCESS == ret)
{
if (OB_SUCCESS != (ret = obj.deserialize(buf, data_len, pos)))
{
TBSYS_LOG(WARN, "fail to deserialize obj:ret[%d]", ret);
}
else if (OB_SUCCESS != (ret = obj.get_bool(only_static_data_)))
{
TBSYS_LOG(WARN, "fail to get bool:ret[%d]", ret);
}
}
return ret;
}