本文整理汇总了C++中d_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ d_assert函数的具体用法?C++ d_assert怎么用?C++ d_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了d_assert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clear_buffers
void
solver_type::
ensure_buffer_size
( solve_1d_functor_type
const & calc_1d_functor
, size_type x_size
, size_type y_size
)
// The 1d functors know how big a buffer they need.
{
// Make sure the buffers are big enough to handle the solve.
// And shrink them or release them if they are too big.
if ( not_early_exit( ) ) {
size_type const now_buf_size = buf_a_.size( );
size_type const min_buf_size = calc_1d_functor.get_min_buf_count( x_size, y_size);
if ( (min_buf_size > now_buf_size) ||
(min_buf_size < (now_buf_size / 2)) )
{
if ( min_buf_size == 0 ) {
clear_buffers( );
} else {
buf_a_.resize( min_buf_size); buf_iter_a_ = buf_a_.begin( );
buf_b_.resize( min_buf_size); buf_iter_b_ = buf_b_.begin( );
}
}
d_assert( buf_a_.size( ) >= min_buf_size);
d_assert( buf_b_.size( ) >= min_buf_size);
}
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:29,代码来源:heat_solver.cpp
示例2: d_assert
const char * DBConnector::GetString(int i)
{
d_assert (mysql_row != NULL);
d_assert (i < (int)mysql_num_fields(mysql_result));
return mysql_row[i];
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:7,代码来源:DBConnector.cpp
示例3: d_assert
void
double_slide_holder::
set_values
( value_type val
, value_type min
, value_type max
, value_type ss // -1 means use existing value
, value_type ps // -1 means use existing value
)
{
d_assert( ! is_setting( ));
// We generate our own signals instead of relying on the inner object.
while_setting_value_wrapper_type wrapper( this, false);
d_assert( is_setting( ));
// Remember the old values.
value_type const old_val = get_value( );
value_type const old_min = get_min_value( );
value_type const old_max = get_max_value( );
value_type const old_ss = get_single_step( );
value_type const old_ps = get_page_step( );
// Must do this before the conversions that follow.
setup_conversions( min, max);
// Send the values to the inner holder.
p_inner_holder_->
set_values
( convert_outer_to_inner( val)
, convert_outer_to_inner( min)
, convert_outer_to_inner( max)
, convert_outer_to_inner_distance( ss)
, convert_outer_to_inner_distance( ps)
);
// Find the new values. These may be slightly different due to rounding etc.
value_type const new_val = get_value( );
value_type const new_min = get_min_value( );
value_type const new_max = get_max_value( );
value_type const new_ss = get_single_step( );
value_type const new_ps = get_page_step( );
// Emit the value signals.
if ( (new_ss != old_ss) || (new_ps != old_ps) ) {
emit has_changed__steps( new_ss, new_ps);
wrapper.request_signal( );
}
if ( (new_min != old_min) || (new_max != old_max) ) {
emit has_changed__range( new_min, new_max);
wrapper.request_signal( );
}
if ( new_val != old_val ) {
emit has_changed( new_val);
wrapper.request_signal( );
}
// The wrapper dtor will signal has_changed( ) if appropriate.
wrapper.done_with_no_throws( );
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:60,代码来源:pack_holder.cpp
示例4: GetCurLayer
void TerrainLayerDlg::_notifyEditLayer(Event * _sender)
{
if (mLayerInfoDlg->GetLayer() == NULL) // is add
return ;
Terrain * tn = Environment::Instance()->GetTerrain();
int layerId = GetCurLayer();
d_assert (layerId != -1);
Terrain::Layer layer;
layer.detail = mLayerInfoDlg->GetDiffuseMap();
layer.normal = mLayerInfoDlg->GetNormalMap();
layer.specular = mLayerInfoDlg->GetSpecularMap();
layer.scale = mLayerInfoDlg->GetUVScale();
layer.material = -1;
tn->SetLayer(layerId, layer);
size_t isel = mLayerList->getIndexSelected();
d_assert (isel != MyGUI::ITEM_NONE);
mLayerList->setItemNameAt(isel, layer.detail.c_wstr());
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:27,代码来源:TerrainLayerDlg.cpp
示例5: l
void memory_session::begin()
{
scoped_lock l(mutex);
d_assert(unfrozen_threads_count != UNINITIALIZED, "Memory session begin() while uninitialized");
const bool currently_frozen = (unfrozen_threads_count == 0);
// is zero only on first begin() of current thread with this session
if (!frozen.get())
{
frozen.reset(new bool(currently_frozen));
if (unfrozen_threads_count > 0)
++unfrozen_threads_count;
// session right after init() is unfrozen
else if (unfrozen_threads_count == NOTSTARTED)
unfrozen_threads_count = 1;
}
else
{
d_assert(unfrozen_threads_count >= 0, "unfrozen_threads_count == " << unfrozen_threads_count);
*frozen.get() = currently_frozen;
if (!currently_frozen)
++unfrozen_threads_count;
}
default_sub_session->begin();
}
开发者ID:dopiera,项目名称:coherent,代码行数:29,代码来源:session.cpp
示例6: attach
void
int_range_steps_holder::
attach( QSpinBox * p_spinb)
{
d_assert( p_spinb);
// Move the values.
d_assert( is_valid( ));
//if ( init_value_from_holder ) {
move_values_to( p_spinb);
//} else {
// set_values_from( p_spinb);
//}
d_assert( is_valid( ));
// Put the widget on the list.
d_assert( ! attached_widgets_.contains( p_spinb));
attached_widgets_.push_front( p_spinb);
d_verify( connect(
p_spinb, SIGNAL( destroyed( QObject *)),
this, SLOT( before_dtor( QObject *))
));
// Watch for a signal from the UI.
d_verify( connect( p_spinb, SIGNAL( valueChanged( int)), this, SLOT( set_value( int))));
// We also need to relay changes here back to the UI objects. We could do it by intercepting
// these signals from this object:
// has_changed( int)
// has_changed__range( int, int)
// has_changed__steps( int, int)
// But since the ctrl classes don't have the slots to support this, so instead we loop thru
// our list of attached widgets and set these values explicitly. See move_values_to(..) and
// set_values(..).
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:35,代码来源:int_holder.cpp
示例7: convert_log_pack_to_ui
/* static */
int
pack_range_steps_holder::
convert_log_pack_to_ui( double d_log_pack)
//
// Used when you want to map a double value to a log-scale integer.
// Double must be > 0. Doubles map to integers as follows:
//
// log_pack ui == 1000 * std::log( log_pack)
// ======= ================
// 0.0001 -> -9210
// 0.001 -> -6908
// 0.01 -> -4605
// 0.1 -> -2303
// 1.0 -> 0
// 10.0 -> +2303
// 100.0 -> +4605
// 1000.0 -> +6908
// 10000.0 -> +9210
{
// ln( 10000) is slightly more than +9.21
// ln( .0001) is slightly less than -9.21
d_assert( (0.0001 <= d_log_pack) && (d_log_pack <= 10000.0)); // is_valid_log_pack
// std::log(..) is natural log. std::log10(..) is log-base-10.
double const d_linear_pack = std::log( d_log_pack);
int const i_ui = convert_linear_pack_to_ui( d_linear_pack);
d_assert( (-10000 <= i_ui) && (i_ui <= 10000)); // is_valid_ui_for_log_pack
return i_ui;
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:29,代码来源:pack_holder.cpp
示例8: d_assert
GizmoBar::GizmoBar()
{
mLayout = MGUI::Layout::Load("GizmoBar.layout", NULL);
mLayout->SetVisible(false);
mWidget_Move = mLayout->GetChild("Move"); d_assert (mWidget_Move);
mWidget_Rotate = mLayout->GetChild("Rotate"); d_assert (mWidget_Rotate);
mWidget_Scale = mLayout->GetChild("Scale"); d_assert (mWidget_Scale);
mWidget_Move->SetAlpha(1.0f);
mWidget_Rotate->SetAlpha(0.5f);
mWidget_Scale->SetAlpha(0.5f);
mWidget_Move->E_MouseClick += new cListener1<GizmoBar, const MGUI::MouseEvent *>(this, &GizmoBar::OnMove);
mWidget_Rotate->E_MouseClick += new cListener1<GizmoBar, const MGUI::MouseEvent *>(this, &GizmoBar::OnRotate);
mWidget_Scale->E_MouseClick += new cListener1<GizmoBar, const MGUI::MouseEvent *>(this, &GizmoBar::OnScale);
mEditBox_X = (MGUI::EditBox *)mLayout->GetChild("x");
mEditBox_Y = (MGUI::EditBox *)mLayout->GetChild("y");
mEditBox_Z = (MGUI::EditBox *)mLayout->GetChild("z");
mEditBox_X->E_KeyLostFocus += new cListener1<GizmoBar, const MGUI::FocusEvent *>(this, &GizmoBar::OnTextChanged);
mEditBox_Y->E_KeyLostFocus += new cListener1<GizmoBar, const MGUI::FocusEvent *>(this, &GizmoBar::OnTextChanged);
mEditBox_Z->E_KeyLostFocus += new cListener1<GizmoBar, const MGUI::FocusEvent *>(this, &GizmoBar::OnTextChanged);
Editor::Instance()->E_NodeSelect += new cListener0<GizmoBar>(this, &GizmoBar::OnNodeSelect);
Editor::Instance()->E_NodePositionChanged += new cListener0<GizmoBar>(this, &GizmoBar::OnPositionChanged);
Editor::Instance()->E_NodeRotationChanged += new cListener0<GizmoBar>(this, &GizmoBar::OnRotationChanged);
Editor::Instance()->E_NodeScaleChanged += new cListener0<GizmoBar>(this, &GizmoBar::OnScaleChanged);
}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:30,代码来源:GizmoBar.cpp
示例9: d_assert
void MGUI_RenderSystem::initialise()
{
d_assert (!mIsInitialise);
MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());
mVertexFormat = MyGUI::VertexColourType::ColourARGB;
memset(&mInfo, 0, sizeof(mInfo));
setViewSize(Engine::Instance()->GetDeviceProperty()->Width,
Engine::Instance()->GetDeviceProperty()->Height);
mUpdate = false;
mShaderLib = ShaderLibManager::Instance()->LoadShaderLib("Shaders\\MGUI.ShaderLib", "Shaders\\MGUI.ShaderLib");
d_assert (mShaderLib);
mDefaultTech = mShaderLib->GetTechnique("MGUI_Default");
d_assert (mDefaultTech);
mVertexDecl = VideoBufferManager::Instance()->CreateVertexDeclaration();
mVertexDecl->AddElement(0, 0, DT_FLOAT3, DU_POSITION, 0);
mVertexDecl->AddElement(0, 12, DT_COLOR, DU_COLOR, 0);
mVertexDecl->AddElement(0, 16, DT_FLOAT2, DU_TEXCOORD, 0);
mVertexDecl->Init();
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
mIsInitialise = true;
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:30,代码来源:MGUI_RenderSystem.cpp
示例10: d_assert
void
worker_thread_type::
start_run__from_master_thread
( input_params_type const & input_params
, sheet_type const & src_sheet
, sheet_type & trg_sheet
, sheet_type & extra_sheet
)
// Start running the worker thread.
// The worker thread will signal when it is done.
{
// This is called from the master thread.
d_assert( currentThread( ) != this);
// This is only called if we are not running.
d_assert( 0 == p_src_sheet_ );
d_assert( 0 == p_trg_sheet_ );
d_assert( 0 == p_extra_sheet_);
// Setup the params for the solver.
input_params_ = input_params ;
p_src_sheet_ = & src_sheet ;
p_trg_sheet_ = & trg_sheet ;
p_extra_sheet_ = & extra_sheet ;
// This signal should be picked up by the worker thread.
emit start__master_to_worker( );
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:28,代码来源:heat_solver.cpp
示例11: sizeof
void Water::Load(const char * source)
{
DataStreamPtr stream = ResourceManager::Instance()->OpenResource(source);
if (stream == NULL)
return ;
int Magic, Version;
stream->Read(&Magic, sizeof(int));
stream->Read(&Version, sizeof(int));
d_assert (Magic == K_Magic);
d_assert (Version == 0);
if (Version == 0)
{
int sizeX, sizeZ;
stream->Read(&sizeX, sizeof(int));
stream->Read(&sizeZ, sizeof(int));
d_assert (sizeX == mSizeX && sizeZ == mSizeZ);
stream->Read(&mHeight, sizeof(float));
stream->Read(mData, sizeX * sizeZ);
}
_initBlock();
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:32,代码来源:MWWater.cpp
示例12: free_small_chunk_alloc
std::pair<byte*, size_t> memory_sub_session::add_merge_remove_free_small_chunk(byte* p, size_t bytes)
{
std::pair<byte*, std::pair<size_t, int> > chunk_alloc = free_small_chunk_alloc(p);
size_t remainder_size = bytes;
byte* remainder_pointer = p;
if (!free_small_chunks.empty())
{
// adding and merging free space
std::map<byte*, size_t>::iterator next = free_small_chunks.upper_bound(remainder_pointer);
if (next != free_small_chunks.begin())
{
std::map<byte*, size_t>::iterator previous = next;
--previous;
if (previous->first >= chunk_alloc.first)
{
d_assert(remainder_pointer > previous->first);
const size_t diff = remainder_pointer - previous->first;
d_assert(diff >= previous->second);
if (diff == previous->second)
{
remainder_pointer = previous->first;
remainder_size += previous->second;
free_small_chunks_inv.erase(std::make_pair(previous->second, previous->first));
free_small_chunks.erase(previous);
parent->ram_allocated_bytes -= free_small_chunk_size;
parent->total_allocated_bytes -= free_small_chunk_size;
next = free_small_chunks.upper_bound(remainder_pointer);
}
}
}
if (next != free_small_chunks.end() && remainder_size != chunk_alloc.second.first)
{
d_assert(next->first > remainder_pointer);
const size_t diff = next->first - remainder_pointer;
if (diff == remainder_size)
{
remainder_size += next->second;
free_small_chunks_inv.erase(std::make_pair(next->second, next->first));
free_small_chunks.erase(next);
parent->ram_allocated_bytes -= free_small_chunk_size;
parent->total_allocated_bytes -= free_small_chunk_size;
}
}
}
return std::make_pair(remainder_pointer, remainder_size);
}
开发者ID:dopiera,项目名称:coherent,代码行数:59,代码来源:sub_session.cpp
示例13: convert_linear_pack_to_ui
/* static */
int
pack_range_steps_holder::
convert_linear_pack_to_ui( int i_linear_pack)
{
d_assert( is_valid_linear_pack( i_linear_pack));
int const i_ui = i_linear_pack * i_linear_to_ui_expand_factor;
d_assert( is_valid_ui( i_ui));
return i_ui;
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:10,代码来源:pack_holder.cpp
示例14: d_assert
void memory_sub_session::remove_small_alloc(byte* p)
{
std::set<std::pair<byte*, size_t> >::const_iterator i = small_allocs.upper_bound(std::make_pair(p, 0));
d_assert(i != small_allocs.end());
d_assert(i->first == p);
small_allocs.erase(i);
parent->ram_allocated_bytes -= small_alloc_size;
parent->total_allocated_bytes -= small_alloc_size;
}
开发者ID:dopiera,项目名称:coherent,代码行数:10,代码来源:sub_session.cpp
示例15: SetupTextBox
void SetupTextBox(MGUI::Layout * layout, const uchar_t * caption, const String & parentName)
{
d_assert (layout != NULL);
MGUI::Widget * parentWidget = layout->GetChild(parentName.c_str());
d_assert (parentWidget != NULL);
MGUI::TextBox * textBox = new MGUI::TextBox(NULL, parentWidget);
textBox->SetAlign(MGUI::eAlign::LEFT | MGUI::eAlign::V_CENTER);
textBox->SetCaption(caption);
}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:11,代码来源:Demo04_Lighting.cpp
示例16: convert_ui_to_log_pack
/* static */
double
pack_range_steps_holder::
convert_ui_to_log_pack( int i_ui)
{
d_assert( (-10000 <= i_ui) && (i_ui <= 10000)); // is_valid_ui_for_log_pack
// std::exp(..) calcs the "natural" exponential.
double const d_linear_pack = convert_ui_to_linear_pack( i_ui);
double const d_log_pack = std::exp( d_linear_pack);
d_assert( (0.0001 <= d_log_pack) && (d_log_pack <= 10000.0)); // is_valid_log_pack
return d_log_pack;
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:12,代码来源:pack_holder.cpp
示例17: intercept__has_changed__steps
/* slot (protected) */
void
double_slide_holder::
intercept__has_changed__steps( inner_value_type /* inner_ss */, inner_value_type /* inner_ps */)
{
// We should be the only ones setting these inner values.
d_assert( is_setting( ));
// Confirm that everything looks right.
d_assert( is_valid( ));
// Our setter will emit this signal later.
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:13,代码来源:pack_holder.cpp
示例18: convert_ui_to_linear_pack
/* static */
double
pack_range_steps_holder::
convert_ui_to_linear_pack( int i_ui)
//
// Changes an integer to a double 1000 times smaller.
// Used when you need a big integer for a UI widget, but you store a small double.
{
d_assert( is_valid_ui( i_ui));
double const d_linear_pack = static_cast< double >( i_ui) * d_ui_to_linear_squeeze_factor;
d_assert( is_valid_linear_pack( d_linear_pack));
return d_linear_pack;
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:13,代码来源:pack_holder.cpp
示例19: d_define_method
d_define_method(illuminable_bitmap, set_light_mask)(struct s_object *self, struct s_object *drawable_mask, enum e_illuminable_bitmap_sides side) {
d_using(illuminable_bitmap);
double mask_width, mask_height, image_width, image_height;
if (illuminable_bitmap_attributes->drawable_mask[side])
d_delete(illuminable_bitmap_attributes->drawable_mask[side]);
illuminable_bitmap_attributes->drawable_mask[side] = d_retain(drawable_mask);
d_call(illuminable_bitmap_attributes->drawable_mask[side], m_drawable_set_blend, e_drawable_blend_add);
d_call(illuminable_bitmap_attributes->drawable_mask[side], m_drawable_get_dimension, &mask_width, &mask_height);
d_call(self, m_drawable_get_dimension, &image_width, &image_height);
d_assert((image_width == mask_width));
d_assert((image_height == mask_height));
return self;
}
开发者ID:nardinan,项目名称:miranda,代码行数:13,代码来源:illuminable_bitmap.obj.c
示例20: detach
void
int_range_steps_holder::
detach( QAbstractSlider * p_slider)
{
d_assert( p_slider);
d_assert( is_valid( ));
d_assert( attached_widgets_.contains( p_slider));
d_verify( disconnect( p_slider, SIGNAL( valueChanged( int)), this, SLOT( set_value( int))));
d_verify( disconnect( p_slider, SIGNAL( destroyed( QObject *)), this, SLOT( before_dtor( QObject *))));
d_verify( 1 == attached_widgets_.removeAll( p_slider));
d_assert( ! attached_widgets_.contains( p_slider));
d_assert( is_valid( ));
}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:15,代码来源:int_holder.cpp
注:本文中的d_assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论