本文整理汇总了C++中REALM_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ REALM_ASSERT函数的具体用法?C++ REALM_ASSERT怎么用?C++ REALM_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REALM_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: REALM_ASSERT
inline std::size_t LinkView::size() const noexcept
{
REALM_ASSERT(is_attached());
if (!m_row_indexes.is_attached())
return 0;
return m_row_indexes.size();
}
示例2: REALM_ASSERT
inline bool InterprocessMutex::is_valid() noexcept
{
#ifdef REALM_ROBUST_MUTEX_EMULATION
return true;
#else
REALM_ASSERT(m_shared_part);
return m_shared_part->is_valid();
#endif
}
示例3: REALM_ASSERT
inline void StringColumn::insert(std::size_t row_ndx, StringData value)
{
REALM_ASSERT(!(value.is_null() && !m_nullable));
std::size_t size = this->size();
REALM_ASSERT_3(row_ndx, <=, size);
std::size_t num_rows = 1;
bool is_append = row_ndx == size;
do_insert(row_ndx, value, num_rows, is_append); // Throws
}
示例4: REALM_ASSERT
void SyncFileActionMetadata::remove()
{
REALM_ASSERT(m_realm);
m_realm->verify_thread();
m_realm->begin_transaction();
TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_fileActionMetadata);
table->move_last_over(m_row.get_index());
m_realm->commit_transaction();
m_realm = nullptr;
}
示例5: set_null
void set_null(size_t index) override
{
REALM_ASSERT(m_nullable);
if (!m_array->is_inner_bptree_node()) {
static_cast<BasicArray<T>*>(m_array.get())->set(index, null::get_null_float<T>()); // Throws
return;
}
SetLeafElem set_leaf_elem(m_array->get_alloc(), null::get_null_float<T>());
m_array->update_bptree_elem(index, set_leaf_elem); // Throws
}
示例6: REALM_ASSERT_DEBUG
// Implementing pure virtual method of ColumnBase.
inline void StringColumn::insert_rows(size_t row_ndx, size_t num_rows_to_insert,
size_t prior_num_rows)
{
REALM_ASSERT_DEBUG(prior_num_rows == size());
REALM_ASSERT(row_ndx <= prior_num_rows);
StringData value = m_nullable ? realm::null() : StringData("");
bool is_append = (row_ndx == prior_num_rows);
do_insert(row_ndx, value, num_rows_to_insert, is_append); // Throws
}
示例7: if
// Old database files will not have the m_nulls array, so we need code paths for
// backwards compatibility for these cases. We can test if m_nulls exists by looking
// at number of references in this ArrayBinary.
inline bool ArrayBinary::legacy_array_type() const noexcept
{
if (Array::size() == 3)
return false; // New database file
else if (Array::size() == 2)
return true; // Old database file
else
REALM_ASSERT(false); // Should never happen
return false;
}
示例8: mutex_lock
inline void InterprocessMutex::lock()
{
#ifdef REALM_ROBUST_MUTEX_EMULATION
std::unique_lock<Mutex> mutex_lock(m_lock_info->m_local_mutex);
m_lock_info->m_file.lock_exclusive();
mutex_lock.release();
#else
REALM_ASSERT(m_shared_part);
m_shared_part->lock([]() {});
#endif
}
示例9: REALM_ASSERT
inline void Spec::set_column_attr(size_t column_ndx, ColumnAttr attr)
{
REALM_ASSERT(column_ndx < get_column_count());
// At this point we only allow one attr at a time
// so setting it will overwrite existing. In the future
// we will allow combinations.
m_attr.set(column_ndx, attr);
update_has_strong_link_columns();
}
示例10: REALM_ASSERT
inline void BinaryColumn::update_from_parent(size_t old_baseline) noexcept
{
if (root_is_leaf()) {
bool is_big = m_array->get_context_flag();
if (!is_big) {
// Small blobs root leaf
REALM_ASSERT(dynamic_cast<ArrayBinary*>(m_array.get()));
ArrayBinary* leaf = static_cast<ArrayBinary*>(m_array.get());
leaf->update_from_parent(old_baseline);
return;
}
// Big blobs root leaf
REALM_ASSERT(dynamic_cast<ArrayBigBlobs*>(m_array.get()));
ArrayBigBlobs* leaf = static_cast<ArrayBigBlobs*>(m_array.get());
leaf->update_from_parent(old_baseline);
return;
}
// Non-leaf root
m_array->update_from_parent(old_baseline);
}
示例11: while
inline size_t Utf8x16<Char16, Traits16>::find_utf8_buf_size(const Char16*& in_begin,
const Char16* const in_end)
{
size_t num_out = 0;
const Char16* in = in_begin;
while (in != in_end) {
REALM_ASSERT(&in[0] >= in_begin && &in[0] < in_end);
uint_fast16_t v = uint_fast16_t(Traits16::to_int_type(in[0]));
if (REALM_LIKELY(v < 0x80)) {
if (REALM_UNLIKELY(int_add_with_overflow_detect(num_out, 1)))
break; // Avoid overflow
in += 1;
}
else if (REALM_LIKELY(v < 0x800)) {
if (REALM_UNLIKELY(int_add_with_overflow_detect(num_out, 2)))
break; // Avoid overflow
in += 1;
}
else if (REALM_LIKELY(v < 0xD800 || 0xE000 <= v)) {
if (REALM_UNLIKELY(int_add_with_overflow_detect(num_out, 3)))
break; // Avoid overflow
in += 1;
}
else {
if (REALM_UNLIKELY(in + 1 == in_end)) {
break; // Incomplete surrogate pair
}
if (REALM_UNLIKELY(int_add_with_overflow_detect(num_out, 4)))
break; // Avoid overflow
in += 2;
}
}
REALM_ASSERT(in >= in_begin && in <= in_end);
in_begin = in;
return num_out;
}
示例12: init
void init(RowIndexes* row_indexes)
{
m_columns.clear();
m_string_enum_columns.clear();
m_columns.resize(m_column_indexes.size(), 0);
m_string_enum_columns.resize(m_column_indexes.size(), 0);
for (size_t i = 0; i < m_column_indexes.size(); i++) {
const ColumnBase& cb = row_indexes->get_column_base(m_column_indexes[i]);
const ColumnTemplateBase* ctb = dynamic_cast<const ColumnTemplateBase*>(&cb);
REALM_ASSERT(ctb);
if (const StringEnumColumn* cse = dynamic_cast<const StringEnumColumn*>(&cb))
m_string_enum_columns[i] = cse;
else
m_columns[i] = ctb;
}
}
示例13: REALM_ASSERT
MemRef BasicArray<T>::slice(size_t offset, size_t size, Allocator& target_alloc) const
{
REALM_ASSERT(is_attached());
// FIXME: This can be optimized as a single contiguous copy
// operation.
BasicArray slice(target_alloc);
_impl::ShallowArrayDestroyGuard dg(&slice);
slice.create(); // Throws
size_t begin = offset;
size_t end = offset + size;
for (size_t i = begin; i != end; ++i) {
T value = get(i);
slice.add(value); // Throws
}
dg.release();
return slice.get_mem();
}
示例14: verify_attached
ValueType Object::get_property_value_impl(ContextType& ctx, const Property &property)
{
verify_attached();
size_t column = property.table_column;
if (is_nullable(property.type) && m_row.is_null(column)) {
return ctx.null_value();
}
if (is_array(property.type) && property.type != PropertyType::LinkingObjects) {
REALM_ASSERT(property.type == PropertyType::Object);
return ctx.box(List(m_realm, m_row.get_linklist(column)));
}
switch (property.type & ~PropertyType::Flags) {
case PropertyType::Bool: return ctx.box(m_row.get_bool(column));
case PropertyType::Int: return ctx.box(m_row.get_int(column));
case PropertyType::Float: return ctx.box(m_row.get_float(column));
case PropertyType::Double: return ctx.box(m_row.get_double(column));
case PropertyType::String: return ctx.box(m_row.get_string(column));
case PropertyType::Data: return ctx.box(m_row.get_binary(column));
case PropertyType::Date: return ctx.box(m_row.get_timestamp(column));
case PropertyType::Any: return ctx.box(m_row.get_mixed(column));
case PropertyType::Object: {
auto linkObjectSchema = m_realm->schema().find(property.object_type);
TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), property.object_type);
return ctx.box(Object(m_realm, *linkObjectSchema, table->get(m_row.get_link(column))));
}
case PropertyType::LinkingObjects: {
auto target_object_schema = m_realm->schema().find(property.object_type);
auto link_property = target_object_schema->property_for_name(property.link_origin_property_name);
TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), target_object_schema->name);
auto tv = m_row.get_table()->get_backlink_view(m_row.get_index(), table.get(), link_property->table_column);
return ctx.box(Results(m_realm, std::move(tv)));
}
default: REALM_UNREACHABLE();
}
}
示例15: REALM_ASSERT
inline bool Descriptor::operator==(const Descriptor& d) const noexcept
{
REALM_ASSERT(is_attached());
REALM_ASSERT(d.is_attached());
return *m_spec == *d.m_spec;
}