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

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

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

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

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

示例1: GAnimElement

// default constructor with ownerGAnimTRSNode2D::GAnimTRSNode2D(const GElement* Owner) : GAnimElement(Owner) {	// gPivotPosition is automatically set to (0, 0)	gPivotRotation = 0;	gPivotScale.Set(1, 1);	gFather = NULL;	gCustomData = NULL;	// add TRS properties	GBool alreadyExists;	GUInt32 index;	GProperty *tmpProp = AddProperty("transform", G_PROPERTY_CLASSID, GKeyValue(), alreadyExists, index);	if (tmpProp) {		G_ASSERT(alreadyExists == G_FALSE);		// default value for "x" and "y" sub-properties will be set automatically to 0		tmpProp->AddProperty("position", G_TWOHERMITEPROPERTY1D_CLASSID, GKeyValue(), alreadyExists, index);		G_ASSERT(alreadyExists == G_FALSE);		tmpProp->AddProperty("rotation", G_HERMITEPROPERTY1D_CLASSID, GKeyValue((GReal)0), alreadyExists, index);		G_ASSERT(alreadyExists == G_FALSE);		// we must impose a default value of 1 to "x" and "y" sub-properties		GProperty *p = tmpProp->AddProperty("scale", G_TWOHERMITEPROPERTY1D_CLASSID, GKeyValue(), alreadyExists, index);		G_ASSERT(alreadyExists == G_FALSE);		p->Property("x")->SetDefaultValue(GKeyValue((GReal)1));		p->Property("y")->SetDefaultValue(GKeyValue((GReal)1));	}}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:28,


示例2: Property

GError GAnimTRSNode2D::SetScale(const GTimeValue TimePos, const GVectBase<GReal, 2>& RelScale) {	GError err;	GProperty *tmpProp = Property("transform");	// this can be the case of a curve not created through a kernel	if (!tmpProp) {		err = G_MISSING_KERNEL;	}	else {		// extract position track		GProperty *scaleProp = tmpProp->Property("scale");		G_ASSERT(scaleProp);		GKeyValue tmpValue;		tmpValue.SetTimePosition(TimePos);		// set "x" property		tmpProp = scaleProp->Property("x");		G_ASSERT(tmpProp != NULL);		tmpValue.SetValue(RelScale[G_X]);		err = tmpProp->SetValue(tmpValue, TimePos, G_ABSOLUTE_VALUE);		if (err != G_NO_ERROR)			return err;		// set "y" property		tmpProp = scaleProp->Property("y");		G_ASSERT(tmpProp != NULL);		tmpValue.SetValue(RelScale[G_Y]);		err = tmpProp->SetValue(tmpValue, TimePos, G_ABSOLUTE_VALUE);	}	return err;}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:32,


示例3: G_ASSERT

// clone propertiesGError GAnimElement::CloneProperties(const GAnimElement& Source) {	const GProperty *srcProp;	GProperty *tmpProp;	GBool alreadyExists;	GUInt32 i;	GError err;	G_ASSERT(this != &Source);	GDynArray<GProperty *>::const_iterator it = Source.gProperties.begin();		// clone every property	for (; it != Source.gProperties.end(); ++it) {		srcProp = *it;		G_ASSERT(srcProp != NULL);		tmpProp = AddProperty(srcProp->Name(), srcProp->ClassID(), GKeyValue(), alreadyExists, i);		if (tmpProp) {			// lets do copy			err = tmpProp->CopyFrom(*srcProp);			if (err != G_NO_ERROR)				RemoveProperty(i);		}		else			G_ASSERT(tmpProp != NULL);	}	return G_NO_ERROR;}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:30,


示例4: G_ASSERT

void Label::setAttachPoint(int p_attachPoint){	G_ASSERT(!((p_attachPoint & AP_LEFT) && (p_attachPoint & AP_RIGHT)) && "bad value");	G_ASSERT(!((p_attachPoint & AP_TOP) && (p_attachPoint & AP_BOTTOM)) && "bad value");	m_attachPoint = p_attachPoint;}
开发者ID:bercik,项目名称:gear,代码行数:7,


示例5: G_ASSERT

void ShaderImpl::begin(CL_GraphicContext &p_gc){	G_ASSERT(m_initialized);	G_ASSERT(!m_began);	// new texture	m_drawRect = m_parent->getDrawRect(m_boundRect);	m_texture = CL_Texture(p_gc, m_drawRect.get_width(), m_drawRect.get_height());	// attach frame buffer	m_frameBuffer.attach_color_buffer(0, m_texture);	p_gc.set_frame_buffer(m_frameBuffer);	// clear to transparent	p_gc.clear(CL_Colorf::transparent);	// set proper matrix	p_gc.push_modelview();	// get scaling in count	const CL_Mat4f &matrix = p_gc.get_modelview();	const float scaleX = matrix[0];	const float scaleY = matrix[5];	p_gc.mult_translate(-m_drawRect.left / scaleX, -m_drawRect.top / scaleY);	m_began = true;}
开发者ID:genail,项目名称:gear,代码行数:28,


示例6: GLDisableShaders

void GOpenGLBoard::GrabFrameBuffer(const GAABox2& LogicBox, GLGrabbedRect& Shot) {	GLDisableShaders();	GReal left, right, bottom, top;	Projection(left, right, bottom, top);	if (LogicBox.Min()[G_X] > left)		left = LogicBox.Min()[G_X];	if (LogicBox.Max()[G_X] < right)		right = LogicBox.Max()[G_X];	if (LogicBox.Min()[G_Y] > bottom)		bottom = LogicBox.Min()[G_Y];	if (LogicBox.Max()[G_Y] < top)		top = LogicBox.Max()[G_Y];	GAABox2 tmpBox(GPoint2(left, bottom), GPoint2(right, top));	GPoint<GInt32, 2> p0 = LogicalToPhysicalInt(tmpBox.Min());	GPoint<GInt32, 2> p1 = LogicalToPhysicalInt(tmpBox.Max());	p0[G_X] -= 1;	p0[G_Y] -= 1;	p1[G_X] += 1;	p1[G_Y] += 1;	GGenericAABox<GInt32, 2> intBox(p0, p1);	GUInt32 width = (GUInt32)GMath::Abs(p1[G_X] - p0[G_X]);	GUInt32 height = (GUInt32)GMath::Abs(p1[G_Y] - p0[G_Y]);	glPixelStorei(GL_PACK_ALIGNMENT, 1);	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);	UpdateGrabBuffer(width, height, Shot);	G_ASSERT(Shot.TexName > 0);	G_ASSERT(Shot.TexWidth > 0 && Shot.TexHeight > 0);	G_ASSERT(Shot.TexWidth >= width && Shot.TexHeight >= height);	SELECT_AND_DISABLE_TUNIT(1)	SELECT_AND_DISABLE_TUNIT(0)	glEnable(Shot.Target);	glBindTexture(Shot.Target, Shot.TexName);	glCopyTexSubImage2D(Shot.Target, 0, 0, 0, (GLint)intBox.Min()[G_X], (GLint)intBox.Min()[G_Y], (GLsizei)width, (GLsizei)height);	Shot.Width = width;	Shot.Height = height;	Shot.IsEmpty = G_FALSE;	Shot.gNotExpandedLogicBox = tmpBox;	GPoint2 q0 = PhysicalToLogical(p0);	GPoint2 q1 = PhysicalToLogical(p1);	Shot.gExpandedLogicBox.SetMinMax(q0, q1);	SELECT_AND_DISABLE_TUNIT(0)	glPixelStorei(GL_PACK_ALIGNMENT, 4);	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:58,


示例7: Q_ASSERT_X

 /**  * @brief Realization::clear  */ void Realization::clear() {     Entity::SharedClass head = std::dynamic_pointer_cast<Entity::Class>(G_ASSERT(headClass()));     Q_ASSERT_X(head, "Realization::clear", "head class not found or not Class");     for (auto method : m_Methods) {         head->removeMethods(method->name());         G_ASSERT(tailClass())->removeMethods(method->name());     } }
开发者ID:vt4a2h,项目名称:uml-tool,代码行数:12,


示例8: G_ASSERT

void RaceScene::initializeOnline(const CL_String &p_hostname, int p_port){	G_ASSERT(p_hostname.length() > 0);	G_ASSERT(p_port > 0 && p_port <= 0xFFFF);	if (!m_initialized) {		m_logic = new Race::OnlineRaceLogic(p_hostname, p_port);		initCommon();	}}
开发者ID:bercik,项目名称:gear,代码行数:11,


示例9: hm_watch_finalize

/* * Event source function - destructor of the source, called  *  before the source object destroyed. we decrease the reference *  count of ioc channel since the source object owes the count *  of it.*/static voidhm_watch_finalize(GSource *source){    HmWatch *watch;    G_ASSERT(source != NULL);    g_atomic_int_add(&total_watch_count, -1);    watch = (HmWatch*)source;    hm_debug(        "Net IO '%p' finalized. total %d left.",        NET_IO(watch), g_atomic_int_get(&total_watch_count)    );    if (watch->funcs && watch->funcs->finalize)    {        (*watch->funcs->finalize)(watch);    }    hm_watch_destroy_private(watch->priv_data);    watch->priv_data = NULL;    if (watch->conn)    /* we need to flush the rest of data!!! */    {        hm_connection_close(watch->conn);    }    if (watch->buffer)    {        hm_net_buf_free(watch->buffer);    }    g_mutex_free(watch->lock);}
开发者ID:dulton,项目名称:hm-platform,代码行数:41,


示例10: m_initialized

OnlineRaceLogic::OnlineRaceLogic(const CL_String &p_host, int p_port) :	m_initialized(false),	m_host(p_host),	m_port(p_port),	m_client(&Game::getInstance().getNetworkConnection()),	m_localPlayer(Game::getInstance().getPlayer()),	m_voteRunning(false){	G_ASSERT(p_port > 0 && p_port <= 0xFFFF);	m_client->setServerAddr(m_host);	m_client->setServerPort(m_port);	// connect signal and slots from player's car	Car &car = m_localPlayer.getCar();	m_slots.connect(car.sig_inputChanged(), this, &OnlineRaceLogic::onInputChange);	// connect signals and slots from client	m_slots.connect(m_client->sig_connected(),         this, &OnlineRaceLogic::onConnected);	m_slots.connect(m_client->sig_disconnected(),      this, &OnlineRaceLogic::onDisconnected);	m_slots.connect(m_client->sig_goodbyeReceived(),   this, &OnlineRaceLogic::onGoodbye);	m_slots.connect(m_client->sig_playerJoined(),      this, &OnlineRaceLogic::onPlayerJoined);	m_slots.connect(m_client->sig_playerLeaved(),      this, &OnlineRaceLogic::onPlayerLeaved);	m_slots.connect(m_client->sig_gameStateReceived(), this, &OnlineRaceLogic::onGameState);	m_slots.connect(m_client->sig_carStateReceived(),  this, &OnlineRaceLogic::onCarState);	m_slots.connect(m_client->sig_raceStartReceived(), this, &OnlineRaceLogic::onRaceStart);	m_slots.connect(m_client->sig_voteStarted(),       this, &OnlineRaceLogic::onVoteStarted);	m_slots.connect(m_client->sig_voteEnded(),         this, &OnlineRaceLogic::onVoteEnded);	m_slots.connect(m_client->sig_voteTickReceived(),  this, &OnlineRaceLogic::onVoteTick);}
开发者ID:bercik,项目名称:gear,代码行数:31,


示例11: getPlayer

void OnlineRaceLogic::onPlayerLeaved(const CL_String &p_name){	// get the player	Player &player = getPlayer(p_name);	// remove from level	getLevel().removeCar(&player.getCar());	// remove from game	removePlayer(player);	TPlayerList::iterator itor;	bool found = false;	for (itor = m_remotePlayers.begin(); itor != m_remotePlayers.end(); ++itor) {		if (reinterpret_cast<unsigned> (itor->get()) == reinterpret_cast<unsigned> (&player)) {			m_remotePlayers.erase(itor);			found = true;			break;		}	}	G_ASSERT(found);	display(cl_format("Player %1 leaved", p_name));}
开发者ID:bercik,项目名称:gear,代码行数:26,


示例12: nmp_io_new

__export NmpIO *nmp_io_new(NmpConnection *conn, NmpPacketProto *proto, 	NmpIOFuncs *funcs, gsize size){	NmpIO *io;	G_ASSERT(conn != NULL && proto != NULL && funcs != NULL);	if (nmp_connection_is_blocked(conn))	{		nmp_warning(			"Net create io on blocked connection '%p'.",			conn		);		return NULL;			}	io = (NmpIO*)nmp_watch_create(		conn, &nmp_io_watch_funcs, size);	if (!io)	{		nmp_warning(			"Net create watch failed."		);		return NULL;	}	nmp_io_initialize(io, 0);	io->proto = proto;	io->funcs = funcs;	return io;}
开发者ID:dulton,项目名称:nampu,代码行数:33,


示例13: hm_watch_unref

__export voidhm_watch_unref(HmWatch *watch){    G_ASSERT(watch != NULL);    g_source_unref((GSource*)watch);}
开发者ID:dulton,项目名称:hm-platform,代码行数:7,


示例14: nmp_sysmsg_default_priv_des

static voidnmp_sysmsg_default_priv_des(gpointer priv, gsize size){    G_ASSERT(priv != NULL);    nmp_mem_kfree(priv, size);}
开发者ID:dulton,项目名称:nampu,代码行数:7,


示例15: nmp_sysmsg_set_userdata

gintnmp_sysmsg_set_userdata(NmpSysMsg *msg, gpointer data, gsize size){	gpointer p;	G_ASSERT(NMP_IS_SYSMSG(msg));	if (data && size)	{		p = nmp_mem_kalloc(size);		if (!p)		{			return -ENOMEM;		}		if (msg->user_data)		{			nmp_mem_kfree(msg->user_data, msg->user_size);		}		msg->user_data = p;		msg->user_size = size;		memcpy(msg->user_data, data, size);		return 0;	}	return -EINVAL;}
开发者ID:dulton,项目名称:nampu,代码行数:27,


示例16: hm_net_kill_io

__export ginthm_net_kill_io(HmNet *net, HmNetIO *net_io){    G_ASSERT(net != NULL && net_io != NULL);    return _hm_net_kill_io(net, net_io, 0, 0);}
开发者ID:dulton,项目名称:hm-platform,代码行数:7,


示例17: G_ASSERT

//------------------------------------------------------------GError QGLWidgetTest::LoadAndTesselateGlyphs(const GString& FileName, const GReal Deviation) {	if (!FileUtils::FileExists(StrUtils::ToAscii(FileName)))		return G_FILE_NOT_FOUND;	// create the font	GFont2D *font = (GFont2D *)gKernel->CreateNew(G_FONT2D_CLASSID);	if (!font)		return G_MEMORY_ERROR;	// load the font, normalizing points into [0;1]x[0;1] range (scale=0 option)	GError err = font->Load(StrUtils::ToAscii(FileName), "scale=0");	if (err != G_NO_ERROR)		return err;	// flatten and tessellate every character	GInt32 i, j = font->CharsCount();	for (i = 0; i < j; ++i) {		const GFontChar2D *fontChar = font->CharByIndex(i);		G_ASSERT(fontChar != NULL);		if (!fontChar->IsComposite()) {			GTesselatedGlyph *tessGlyph = new(std::nothrow) GTesselatedGlyph(fontChar, Deviation);			if (tessGlyph) {				gTesselatedGlyphs.push_back(tessGlyph);			}		}	}	// delete font from memory and return	delete font;	return G_NO_ERROR;}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:30,


示例18: nmp_mod_mds_setup

gintnmp_mod_mds_setup(NmpAppMod *am_self){	gint err;	NmpModAccess *ma_self;	NmpModMds *self;	struct sockaddr_in sin;	G_ASSERT(am_self != NULL);	self = (NmpModMds*)am_self;	ma_self = (NmpModAccess*)am_self;	bzero(&sin, sizeof(sin));	sin.sin_family = AF_INET;	sin.sin_port = htons(JPFCMS_MDU_PORT);	sin.sin_addr.s_addr = INADDR_ANY;	nmp_mod_acc_init_net(ma_self, &nmp_packet_proto, &nmp_xml_proto);	self->listen_io = nmp_mod_acc_create_listen_io(		ma_self, (struct sockaddr*)&sin, &err	);	if (!self->listen_io)	{		nmp_error("<NmpModPu> create listen io failed!");		return err;	}	nmp_net_set_heavy_io_load(self->listen_io);	nmp_app_mod_set_name(am_self, "MOD-MDU");	nmp_mod_mds_register_msg_handler(self);	return 0;}
开发者ID:dulton,项目名称:nampu,代码行数:34,


示例19: hm_listen_watch_create

/* * Create a event source object for connection. The object  * will be added to "Event Context" for polling. */ __export HmWatch *hm_listen_watch_create(HmConnection *conn, HmWatchFuncs *funcs, gint size){    GSource *source;    HmWatch *watch;    G_ASSERT(conn != NULL && funcs != NULL && size >= sizeof(HmWatch));    source = g_source_new(&hm_watch_funcs, size);    watch = (HmWatch*)source;    watch->buffer = NULL;    watch->lock = g_mutex_new();    watch->conn = conn;    watch->funcs = funcs;    watch->r_fd.fd = hm_connection_get_fd(conn);    watch->r_fd.events = READ_COND;    watch->r_fd.revents = 0;    hm_watch_init_time(watch);    watch->w_pending = 0;    watch->killed = 0;    watch->heavy_io_load = hm_connection_is_heavy(conn);    watch->block_size = hm_connection_get_buffer_size(conn);    hm_watch_set_callback(watch, hm_watch_listen_dispatch, NULL);    g_source_add_poll(source, &watch->r_fd);    g_atomic_int_add(&total_watch_count, 1);    return watch;}
开发者ID:dulton,项目名称:hm-platform,代码行数:37,


示例20: hm_watch_attach

__export voidhm_watch_attach(HmWatch *watch, GMainContext *context){    G_ASSERT(watch != NULL);    g_source_attach((GSource*)watch, context);}
开发者ID:dulton,项目名称:hm-platform,代码行数:7,


示例21: nmp_sysmsg_init

static voidnmp_sysmsg_init(NmpSysMsg *self){    G_ASSERT(self != NULL);    INIT_MSGID(self->msg_id);    self->flags = FLG_SYSMSG_FORWARD;    self->packet_layer.seq = 0;    self->from_io = NULL;    self->dst = BUSSLOT_POS_MAX;    self->src = BUSSLOT_POS_MAX;    self->orig = BUSSLOT_POS_MAX;    self->priv = nmp_new0(NmpSysMsgPriv, 1);    BUG_ON(!self->priv);    /* glib says never */	self->user_data = NULL;	self->user_size = 0;    g_atomic_int_add(&total_sysmsg_count, 1);	{	//@{debug}		static guint print_tag = 0;		if (++print_tag % 1000 == 0)		{ 		    nmp_print(		        "===== NOW TOTAL SYSMSG OJBECTS: %d =====",		        g_atomic_int_get(&total_sysmsg_count)		    );		}	}}
开发者ID:dulton,项目名称:nampu,代码行数:32,


示例22: nmp_mod_mds_new_mds

gintnmp_mod_mds_new_mds(NmpModMds *self, NmpNetIO *io, const gchar *id,	NmpID *conflict){	NmpGuestBase *mds;	gint ret;	G_ASSERT(self != NULL && io != NULL);	mds = nmp_mods_guest_new(sizeof(NmpMds), id, nmp_mod_mds_destroy, self);	if (G_UNLIKELY(!mds))		return -E_NOMEM;	nmp_mod_mds_struct_init((NmpMds*)mds);	nmp_mods_guest_attach_io(mds, io);	ret = nmp_mods_container_add_guest(self->container,		mds, conflict);	if (G_UNLIKELY(ret))	{		nmp_print(			"<NmpModMds> mds:%s register failed, err:%d", id, ret		);	}	nmp_mods_guest_unref(mds);	return ret;}
开发者ID:dulton,项目名称:nampu,代码行数:26,



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


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