您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DL_ASSERT函数代码示例

51自学网 2021-06-01 20:22:21
  C++
这篇教程C++ DL_ASSERT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DL_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ DL_ASSERT函数的具体用法?C++ DL_ASSERT怎么用?C++ DL_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DL_ASSERT函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DL_ASSERT

void LevelFactory::LoadLevelListFromXML(const std::string& aXMLPath){	myLevelPaths.clear();	XMLReader reader;	reader.OpenDocument(aXMLPath);	std::string levelPath = "";	int ID = 0;	int lastID = ID - 1;	tinyxml2::XMLElement* levelElement = reader.FindFirstChild("level");	for (; levelElement != nullptr; levelElement = reader.FindNextElement(levelElement))	{		lastID = ID;				reader.ForceReadAttribute(levelElement, "ID", ID);		reader.ForceReadAttribute(levelElement, "path", levelPath);		myLevelPaths[ID] = levelPath;		if (ID - 1 != lastID)		{			DL_ASSERT("[LevelFactory] Wrong ID-number in levelList.xml! The numbers should be counting up, in order.");		}		if (myCurrentID >= 10)		{			DL_ASSERT("[LevelFactory] Can't handle level ID with two digits.");		}	}	reader.CloseDocument();}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:29,


示例2: DL_ASSERT

void Prism::Sprite::ResizeTexture(ID3D11Texture2D* aSrcTexture){	myTexture->Release();	myShaderView->Release();	D3D11_TEXTURE2D_DESC desc;	aSrcTexture->GetDesc(&desc);	desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;	HRESULT hr = Engine::GetInstance()->GetDevice()->CreateTexture2D(&desc, NULL, &myTexture);	if (FAILED(hr))	{		DL_ASSERT("Failed to CreateTexture2D");	}	Engine::GetInstance()->SetDebugName(myTexture, "Sprite::myTexture");	hr = Engine::GetInstance()->GetDevice()->CreateShaderResourceView(myTexture, NULL, &myShaderView);	if (FAILED(hr))	{		DL_ASSERT("Failed to CopyFromD3DTexture");	}	Engine::GetInstance()->SetDebugName(myShaderView, "Sprite::myShaderView");	CopyFromD3DTexture(aSrcTexture);	mySurfaces.DeleteAll();	InitSurface("DiffuseTexture", myShaderView);}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:28,


示例3: DL_DEBUG

void XMLWriter::SetAttribute(XMLElement aElement, const std::string& aAttributeName, const bool aValue){	if (myHasCreatedDoc == false)	{		DL_DEBUG("[XMLWriter]: Tried to [InsertElement] before Creating an document");		DL_ASSERT("[XMLWriter]: Failed to SaveDocument");	}	if (aElement == nullptr)	{		if (aValue == true)		{			DL_DEBUG("[XMLWriter]: Tried to [SetAttribute] to a Element that dint exist. Attribute: %s, Value: %s", aAttributeName.c_str(), "true");		}		else		{			DL_DEBUG("[XMLWriter]: Tried to [SetAttribute] to a Element that dint exist. Attribute: %s, Value: %s", aAttributeName.c_str(), "false");		}		DL_ASSERT("[XMLWriter]: Failed to SetAttribute");	}	aElement->SetAttribute(aAttributeName.c_str(), aValue);	myHasUnsavedChanges = true;}
开发者ID:wardh,项目名称:ZeldaClone,代码行数:27,


示例4: ZeroMemory

	void LineRenderer::DrawLines(CU::GrowingArray<CU::RenderCommandLine, unsigned int>& someLines)	{		if (someLines.Size() > 0)		{			D3D11_MAPPED_SUBRESOURCE resource;			ZeroMemory(&resource, sizeof(resource));			myEngine->GetContext()->Map(myLineDummyBuffer.myVertexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);			memcpy(resource.pData, reinterpret_cast<void*>(&(someLines[0].myFirstPoint.x)), someLines.Size() * sizeof(float) * 8);			myEngine->GetContext()->Unmap(myLineDummyBuffer.myVertexBuffer.Get(), 0);			myEngine->GetContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);			myEngine->GetContext()->IASetVertexBuffers(0, 1, &myLineDummyBuffer.myVertexBuffer, &myLineDummyBuffer.myStride, &myLineDummyBuffer.myByteOffset);			myEngine->GetContext()->IASetInputLayout(myLineInputLayout.Get());			COMObjectPointer<ID3DX11EffectPass> pass = myLineTechnique->GetPassByIndex(0);			if (pass->IsValid() == false)			{				DL_ASSERT("Pass invalid");			}			HRESULT passResult = pass->Apply(NULL, myEngine->GetContext().Get());			if (FAILED(passResult))			{				DL_ASSERT("Pass failed.");			}			myEngine->GetContext()->Draw(someLines.Size() * 2, 0);		}	}
开发者ID:ebithril,项目名称:ModelViewer,代码行数:29,


示例5: DL_ASSERT

bool XMLReader::ForceReadAttribute(const XMLElement aElementToReadFrom, const std::string& aAttributeToRead, bool* aTargetVariable) const{	if (myHasOpenedDoc == false)		DL_ASSERT("[XMLReader]: Tried to [ReadAttribute(bool)] before Opening the document");	if (aElementToReadFrom->QueryBoolAttribute(aAttributeToRead.c_str(), aTargetVariable) == tinyxml2::XML_NO_ERROR)		return true;	DL_DEBUG("Failed to read Attribute: [ %s ], from Element: [ %s ], in Document: [ %s ]", aAttributeToRead.c_str(), aElementToReadFrom->Name(), myFilePath.c_str());	DL_ASSERT("Failed to [ForceReadAttribute(bool)], check DebugLog for more info");	return false;}
开发者ID:wardh,项目名称:ZeldaClone,代码行数:12,


示例6: mySize

Prism::Sprite::Sprite(ID3D11Texture2D* aTexture, const CU::Vector2<float>& aSpriteSize	, const CU::Vector2<float>& aHotSpot)	: mySize(aSpriteSize)	, myHotspot(aHotSpot)	, myTexture(nullptr)	, myShaderView(nullptr){	myFileName = "Inited from ID3D11Texture";	myEffect = Engine::GetInstance()->GetEffectContainer()->GetEffect("Data/Resource/Shader/S_effect_sprite.fx");	myEffect->AddListener(this);	D3D11_INPUT_ELEMENT_DESC vertexDesc[] =	{		{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },		{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },	};	D3D11_TEXTURE2D_DESC desc;	aTexture->GetDesc(&desc);	desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;	HRESULT hr = Engine::GetInstance()->GetDevice()->CreateTexture2D(&desc, NULL, &myTexture);	if (FAILED(hr))	{		DL_ASSERT("Failed to CreateTexture2D");	}	Engine::GetInstance()->SetDebugName(myTexture, "Sprite::myTexture");	hr = Engine::GetInstance()->GetDevice()->CreateShaderResourceView(myTexture, NULL, &myShaderView);	if (FAILED(hr))	{		DL_ASSERT("Failed to CopyFromD3DTexture");	}	Engine::GetInstance()->SetDebugName(myShaderView, "Sprite::myShaderView");		CopyFromD3DTexture(aTexture);	InitInputLayout(vertexDesc, ARRAYSIZE(vertexDesc), "Sprite::InputLayout");	InitVertexBuffer(sizeof(VertexPosUV), D3D11_USAGE_IMMUTABLE, 0);	InitSurface("DiffuseTexture", myShaderView);	InitIndexBuffer();	InitBlendState("Sprite::BlendState");	ZeroMemory(myInitData, sizeof(myInitData));	CreateVertices();}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:49,


示例7: dl_internal_convert_no_header

dl_error_t dl_internal_convert_no_header( dl_ctx_t       dl_ctx,                                          unsigned char* packed_instance, unsigned char* packed_instance_base,                                          unsigned char* out_instance,    size_t         out_instance_size,                                          size_t*        needed_size,                                          dl_endian_t    src_endian,      dl_endian_t    out_endian,                                          dl_ptr_size_t  src_ptr_size,    dl_ptr_size_t  out_ptr_size,                                          const SDLType* root_type,       size_t         base_offset ){	dl_binary_writer writer;	dl_binary_writer_init( &writer, out_instance, out_instance_size, out_instance == 0x0, src_endian, out_endian, out_ptr_size );	SConvertContext ConvCtx( src_endian, out_endian, src_ptr_size, out_ptr_size );	ConvCtx.m_lInstances.Add(SInstance(packed_instance, root_type, 0x0, dl_type_t(DL_TYPE_ATOM_POD | DL_TYPE_STORAGE_STRUCT)));	dl_error_t err = dl_internal_convert_collect_instances(dl_ctx, root_type, packed_instance, packed_instance_base, ConvCtx);	// TODO: we need to sort the instances here after their offset!	SInstance* insts = ConvCtx.m_lInstances.GetBasePtr();	std::sort( insts, insts + ConvCtx.m_lInstances.Len(), dl_internal_sort_pred );	for(unsigned int i = 0; i < ConvCtx.m_lInstances.Len(); ++i)	{		err = dl_internal_convert_write_instance( dl_ctx, ConvCtx.m_lInstances[i], &ConvCtx.m_lInstances[i].m_OffsetAfterPatch, ConvCtx, &writer );		if(err != DL_ERROR_OK) 			return err;	}	if(out_instance != 0x0) // no need to patch data if we are only calculating size	{		for(unsigned int i = 0; i < ConvCtx.m_lPatchOffset.Len(); ++i)		{			SConvertContext::PatchPos& PP = ConvCtx.m_lPatchOffset[i];			// find new offset			pint NewOffset = pint(-1);			for(unsigned int j = 0; j < ConvCtx.m_lInstances.Len(); ++j )			{				pint OldOffset = ConvCtx.m_lInstances[j].m_pAddress - packed_instance_base;				if(OldOffset == PP.m_OldOffset)				{					NewOffset = ConvCtx.m_lInstances[j].m_OffsetAfterPatch;					break;				}			}			DL_ASSERT(NewOffset != pint(-1) && "We should have found the instance!");			dl_binary_writer_seek_set( &writer, PP.m_Pos );			dl_binary_writer_write_ptr( &writer, NewOffset + base_offset );		}	}	dl_binary_writer_seek_end( &writer );	*needed_size = (unsigned int)dl_binary_writer_tell( &writer );	return err;}
开发者ID:matricks,项目名称:datalibrary,代码行数:60,


示例8: DLInternalReadPtrData

static pint DLInternalReadPtrData( const uint8*  _pPtrData,								   dl_endian_t   _SourceEndian,								   dl_ptr_size_t _PtrSize ){	switch(_PtrSize)	{		case DL_PTR_SIZE_32BIT:		{			uint32 Offset = *(uint32*)_pPtrData;			if(_SourceEndian != DL_ENDIAN_HOST)				return (pint)dl_swap_endian_uint32( Offset );			else				return (pint)Offset;		}		break;		case DL_PTR_SIZE_64BIT:		{			uint64 Offset = *(uint64*)_pPtrData;			if(_SourceEndian != DL_ENDIAN_HOST)				return (pint)dl_swap_endian_uint64( Offset );			else				return (pint)Offset;		}		break;		default:			DL_ASSERT(false && "Invalid ptr-size");	}	return 0;}
开发者ID:matricks,项目名称:datalibrary,代码行数:32,


示例9: DL_ASSERT

	Worker::~Worker()	{		if (myThread != nullptr)		{			DL_ASSERT("Worker not destroyed.");		}	}
开发者ID:wardh,项目名称:ZeldaClone,代码行数:7,


示例10: dlthread_get_shmem

void * dlthread_get_shmem(    size_t nbytes,    dlthread_comm_t const comm_idx){  size_t myid;  void * ptr;  comm_t * comm;  if (comm_idx != DLTHREAD_COMM_SINGLE) {    myid = dlthread_get_id(comm_idx);    comm = my_comms+comm_idx;    DL_ASSERT(comm->buffer != NULL,"Null buffer on communicator %zu/n", /        (size_t)comm_idx);    if (myid == 0) {      ptr = malloc(nbytes);       ((void**)comm->buffer)[0] = ptr;    }    dlthread_barrier(comm_idx);    ptr = ((void**)comm->buffer)[0];    dlthread_barrier(comm_idx);  } else {    ptr = malloc(nbytes);  }  return ptr;}
开发者ID:GeospatialDaryl,项目名称:Metis_from_KarypisLab,代码行数:33,


示例11: if

std::string EntityFactory::ConvertToPowerUpInGameName(ePowerUpType aPowerUpType){	if (aPowerUpType == ePowerUpType::HEALTHKIT)	{		return "Health kit";	}	else if (aPowerUpType == ePowerUpType::SHIELDBOOST)	{		return "Shield boost";	}	else if (aPowerUpType == ePowerUpType::FIRERATEBOOST)	{		return "Firerate";	}	else if (aPowerUpType == ePowerUpType::WEAPON_UPGRADE)	{		return "Upgrade";	}	else if (aPowerUpType == ePowerUpType::EMP)	{		return "EMP";	}	else if (aPowerUpType == ePowerUpType::HOMING)	{		return "Homing";	}	else if (aPowerUpType == ePowerUpType::INVULNERABLITY)	{		return "Invulnerability";	}	DL_ASSERT("[EntityFactory] Wrong powerup enum in ConvertToPowerUpInGameName.");	return "";}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:34,


示例12: DL_DEBUG

void XMLReader::DebugFirstChild(const std::string& aChildName) const{	if (myDoc->FirstChildElement(aChildName.c_str()) == nullptr)	{		DL_DEBUG("Failed to [ForceFindFirstChild]. Parent: [ Document ], Child: [ %s ], File: [ %s ]", aChildName.c_str(), myFilePath.c_str());		DL_ASSERT("Failed to [ForceFindFirstChild], check DebugLog for more info");	}}
开发者ID:wardh,项目名称:ZeldaClone,代码行数:8,


示例13: par_eseprefine

vtx_t par_eseprefine(    ctrl_t * const ctrl,    graph_t * const graph,    esinfo_t * const esinfo){  vtx_t nmoves;  wgt_t maxpwgt[2];  wgt_t * const pwgts = graph->pwgts;  DL_ASSERT(check_esinfo(esinfo,graph,(pid_t const **)graph->where), /      "Bad esinfo before refinement");  DL_ASSERT(check_esbnd(esinfo->bnd,graph),"Bad boundary before refinement");  maxpwgt[0] = graph->tvwgt * ctrl->tpwgts[0] * ctrl->ubfactor;  maxpwgt[1] = graph->tvwgt * ctrl->tpwgts[1] * ctrl->ubfactor;  if (graph->nedges < SERIAL_FM_FACTOR*sqrt(graph->dist.nthreads)) {    nmoves = __eseprefine_FM1S(ctrl,graph,ctrl->nrefpass,esinfo,maxpwgt);  } else {    switch (ctrl->rtype) {      case MTMETIS_RTYPE_FM:        nmoves = __eseprefine_FM1S(ctrl,graph,ctrl->nrefpass,esinfo,maxpwgt);        break;      case MTMETIS_RTYPE_GREEDY:        nmoves = __par_eseprefine_GREEDY(ctrl,graph,ctrl->nrefpass,esinfo, /            maxpwgt);        break;      default:        dl_error("Unknown refinement type for edge separators '%d'/n", /            ctrl->rtype);    }  }  DL_ASSERT_EQUALS(graph->mincut,par_graph_cut(graph, /        (pid_t const **)graph->where),"%"PF_WGT_T);  DL_ASSERT_EQUALS(wgt_lsum(graph->pwgts,2),graph->tvwgt,"%"PF_TWGT_T);  DL_ASSERT(check_esbnd(esinfo->bnd,graph),"Bad boundary before refinement");  par_vprintf(ctrl->verbosity,MTMETIS_VERBOSITY_HIGH,"%zu) [%"PF_VTX_T" %" /      PF_ADJ_T"] {%"PF_WGT_T":%"PF_WGT_T" %"PF_WGT_T" # %"PF_WGT_T":%" /      PF_WGT_T" %"PF_VTX_T"}/n",graph->level,graph->nvtxs,graph->nedges, /      pwgts[0],pwgts[1],graph->mincut,maxpwgt[0],maxpwgt[1],nmoves);  return nmoves;}
开发者ID:GeospatialDaryl,项目名称:Metis_from_KarypisLab,代码行数:46,


示例14: dl_internal_ptr_size

static pint dl_internal_ptr_size(dl_ptr_size_t size_enum){	switch(size_enum)	{		case DL_PTR_SIZE_32BIT: return 4;		case DL_PTR_SIZE_64BIT: return 8;		default: DL_ASSERT("unknown ptr size!"); return 0;	}}
开发者ID:matricks,项目名称:datalibrary,代码行数:9,


示例15: DL_ASSERT

WeaponDataType WeaponFactory::GetWeapon(const std::string& aWeaponName){	auto it = myWeaponsTypes.find(aWeaponName);	if (myWeaponsTypes.find(aWeaponName) == myWeaponsTypes.end())	{		std::string errorMessage = "[WeaponFactory]: Could not find the weapon " + aWeaponName + ".";		DL_ASSERT(errorMessage.c_str());	}	return it->second;}
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:10,


示例16: __par_update_neighbor

static inline wgt_t __par_update_neighbor(    pid_t const side,    vtx_t const v,    adj_t const ewgt,    pid_t const * const where,    esnbrinfo_t * const nbrinfo,    vtx_iset_t * const bnd,    vw_pq_t * const q){  wgt_t cut, gain;  pid_t const other = side ^ 0x01;  /* update connectivity */  nbrinfo[v].con[side] += ewgt;  nbrinfo[v].con[other] -= ewgt;  /* remove or add to boundary */  if (where[v] == side) {    cut = -ewgt;    if (nbrinfo[v].con[other] == 0) {      vtx_iset_remove(v,bnd);    }  } else {    cut = ewgt;    if (!vtx_iset_contains(v,bnd)) {      vtx_iset_add(v,bnd);      /* add to queue */      if (q) {        gain = nbrinfo[v].con[side] - /            nbrinfo[v].con[other];        vw_pq_push(gain,v,q);      }    } else {      if (q) {        gain = nbrinfo[v].con[side] - /            nbrinfo[v].con[other];        if (vw_pq_contains(v,q)) {          gain = nbrinfo[v].con[side] - /              nbrinfo[v].con[other];          vw_pq_update(gain,v,q);        } else {          vw_pq_push(gain,v,q);        }      }    }  }  DL_ASSERT(nbrinfo[v].con[other] >= 0,"Negative con %"PF_WGT_T":%"PF_WGT_T /      " ewgt = %"PF_WGT_T" for %"PF_TID_T":%"PF_VTX_T"/n",nbrinfo[v].con[0], /      nbrinfo[v].con[1],ewgt,(tid_t)dlthread_get_id(DLTHREAD_COMM_ROOT),v);  return cut;}
开发者ID:GeospatialDaryl,项目名称:Metis_from_KarypisLab,代码行数:54,



注:本文中的DL_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DMA_BIT_MASK函数代码示例
C++ DLOG函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。