当前位置: 首页>>代码示例>>C++>>正文


C++ IsObj函数代码示例

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


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

示例1: PriorityQueueAdd

void PriorityQueueAdd(struct VMGlobals *g, PyrObject* queueobj, PyrSlot* item, double time)
{
	PyrObject *schedq, *newschedq;
	int size, maxsize;

	PyrSlot *schedqSlot = queueobj->slots;
	if (!IsObj(schedqSlot)) {
		size = 32;
		schedq = newPyrArray(g->gc, size, 0, true);
		schedq->size = 1;
		SetInt(schedq->slots + 0, 0); // stability count
		SetObject(schedqSlot, schedq);
		g->gc->GCWriteNew(queueobj, schedq); // we know schedq is white so we can use GCWriteNew
	} else {
		schedq = slotRawObject(schedqSlot);
		maxsize = ARRAYMAXINDEXSIZE(schedq);
		size = schedq->size;
		if (size+3 > maxsize) {

			newschedq = newPyrArray(g->gc, maxsize*2, 0, true);
			newschedq->size = size;

			slotCopy(newschedq->slots, schedq->slots, size);
			assert(IsInt(newschedq->slots));

			SetObject(schedqSlot, newschedq);
			g->gc->GCWriteNew(queueobj, newschedq); // we know newschedq is white so we can use GCWriteNew

			schedq = newschedq;
		}
	}

	addheap(g, schedq, time, item);
}
开发者ID:bagong,项目名称:supercollider,代码行数:34,代码来源:PyrListPrim.cpp

示例2: PriorityQueueAdd

void PriorityQueueAdd(struct VMGlobals *g, PyrObject* queueobj, PyrSlot* item, double time)
{
	PyrObject *schedq, *newschedq;
	int size, maxsize;

	PyrSlot *schedqSlot = queueobj->slots;
	if (!IsObj(schedqSlot)) {
		size = 16;
		schedq = newPyrArray(g->gc, size, 0, true);
		SetObject(schedqSlot, schedq);
		g->gc->GCWrite(queueobj, schedq);
	} else {
		schedq = schedqSlot->uo;
		maxsize = ARRAYMAXINDEXSIZE(schedq);
		size = schedq->size;
		if (size+2 > maxsize) {
			PyrSlot *pslot, *qslot;

			newschedq = newPyrArray(g->gc, maxsize*2, 0, true);
			newschedq->size = size;

			pslot = schedq->slots - 1;
			qslot = newschedq->slots - 1;
			for (int i=0; i<size; ++i) slotCopy(++qslot, ++pslot);

			SetObject(schedqSlot, newschedq);
			g->gc->GCWrite(queueobj, newschedq);

			schedq = newschedq;
		}
	}

	addheap(g, schedq, time, item);
}
开发者ID:scztt,项目名称:sc-debug,代码行数:34,代码来源:PyrListPrim.cpp

示例3: EAssert

// extend/update the object with values from Val
// this and Val should be an Object and not an array or something else
void TJsonVal::MergeObj(const PJsonVal& Val) {
	EAssert(Val->IsObj() && IsObj());
	for (int N = 0; N < Val->GetObjKeys(); N++) {
		const TStr Key = Val->GetObjKey(N);
		AddToObj(Key, Val->GetObjKey(Key));
	}
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:9,代码来源:json.cpp

示例4: prConnectSharedMem

int prConnectSharedMem(VMGlobals *g, int numArgsPushed)
{
#if !defined(SC_IPHONE)
	PyrSlot *a = g->sp - 1;
	PyrSlot *b = g->sp;

	assert(IsObj(a));

	PyrObject * self = slotRawObject(a);
	int portNumber = slotRawInt(b);

	int ptrIndex       = 0;
	int finalizerIndex = 1;

	try {
		server_shared_memory_client * client = new server_shared_memory_client(portNumber);
		SetPtr(self->slots + ptrIndex, client);

		InstallFinalizer(g, self, finalizerIndex, disconnectSharedMem);

		postfl("Shared memory server interface initialized\n");
	} catch (std::exception & e) {
		postfl("Cannot connect to shared memory: %s\n", e.what());
		return errFailed;
	}
#else
	postfl("Warning: Shared memory server interface disabled on iphone\n");
#endif
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:30,代码来源:OSCData.cpp

示例5: SanityClearObj

bool PyrGC::SanityClearObj(PyrObject *objA, int level)
{
	if (!(objA->IsMarked())) return true;
	if (objA->IsPermanent()) return true;
	objA->ClearMark(); // unmark it

	if (objA->obj_format <= obj_slot) {
		// scan it
		int size = objA->size;
		if (size > 0) {
			PyrSlot *slot = objA->slots;
			for (int j=size; j--; ++slot) {
				PyrObject *objB = NULL;
				if (IsObj(slot) && slotRawObject(slot)) {
					objB = slotRawObject(slot);
				}
				if (objB) {
					/*if (level > 40) {
						fprintf(stderr, "40 levels deep!\n");
						dumpBadObject(objA);
						//dumpObject((PyrObject*)objB);  //newPyrFrame
						return errFailed;
					}*/
					bool err = SanityClearObj(objB, level+1);
					if (!err) return false;
				}
			}
		}
	}
	return true;
}
开发者ID:ASauer,项目名称:supercollider,代码行数:31,代码来源:GC.cpp

示例6: prSetControlBusValue

int prSetControlBusValue(VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp - 2;
	PyrSlot *b = g->sp - 1;
	PyrSlot *c = g->sp;

	assert(IsObj(a));
	PyrObject * self = slotRawObject(a);
	int ptrIndex       = 0;
	PyrSlot * ptrSlot = self->slots + ptrIndex;
	if (NotPtr(ptrSlot))
		return errFailed;

	if (!IsInt(b))
		return errFailed;

	int busIndex = slotRawInt(b);

	if (NotPtr(ptrSlot))
		return errFailed;

	float value;
	int error = slotFloatVal(c, &value);
	if (error != errNone)
		return error;

	server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot);

	client->get_control_busses()[busIndex] = value;
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:31,代码来源:OSCData.cpp

示例7: prDisconnectSharedMem

int prDisconnectSharedMem(VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp;

	assert(IsObj(a));
	PyrObject * self = slotRawObject(a);
	return disconnectSharedMem(g, self);
}
开发者ID:robertol80,项目名称:supercollider,代码行数:8,代码来源:OSCData.cpp

示例8: sysVectorAppend

Ref * sysVectorAppend( Ref * pc, class MachineClass * vm ) {

	//	Variables here would be unaffected by a GC.
	unsigned long N;
	unsigned long lhs_n;
	unsigned long rhs_n;

	if ( vm->count != 2 ) throw Ginger::Mishap( "Wrong number of arguments in vectorAppend" );

	{
	
		//	May need to GC so leave on the stack.
		Ref rhs = vm->fastPeek();
		Ref lhs = vm->fastPeek( 1 );
		
		if ( !IsObj( lhs ) || !IsObj( rhs ) ) throw Ginger::Mishap( "Invalid arguments in vectorAppend" );
		
		Ref * lhs_K = RefToPtr4( lhs );
		Ref * rhs_K = RefToPtr4( rhs );
		Ref lhs_key = *lhs_K;
		Ref rhs_key = *rhs_K;
		
		if ( lhs_key != rhs_key || !IsSimpleKey( lhs_key ) || KindOfSimpleKey( lhs_key ) != VECTOR_KIND ) throw Ginger::Mishap( "Invalid arguments in vectorAppend" );
	
		lhs_n = sizeAfterKeyOfVectorLayout( lhs_K );
		rhs_n = sizeAfterKeyOfVectorLayout( rhs_K );
		N = lhs_n + rhs_n;
	
	}
	
	XfrClass xfr( vm->heap().preflight( pc, N + 2 ) );

	//	No risk of GC so safe to pop.
	Ref * rhs_K = RefToPtr4( vm->fastPop() );
	Ref * lhs_K = RefToPtr4( vm->fastPop() );

	xfr.xfrRef( ULongToSmall( N ) );
	xfr.setOrigin();
	xfr.xfrRef( *lhs_K );
	xfr.xfrCopy( lhs_K + 1, lhs_n );
	xfr.xfrCopy( rhs_K + 1, rhs_n );

	vm->fastPush( xfr.makeRef() );
	return pc;

}
开发者ID:gjhiggins,项目名称:ginger,代码行数:46,代码来源:sysvector.cpp

示例9: PriorityQueueClear

void PriorityQueueClear(PyrObject *queueobj)
{
	PyrSlot *schedqSlot = queueobj->slots;

	if (IsObj(schedqSlot)) {
		PyrObject *schedq = schedqSlot->uo;
		schedq->size = 0;
	}
}
开发者ID:scztt,项目名称:sc-debug,代码行数:9,代码来源:PyrListPrim.cpp

示例10: PriorityQueueClear

void PriorityQueueClear(PyrObject *queueobj)
{
	PyrSlot *schedqSlot = queueobj->slots;

	if (IsObj(schedqSlot)) {
		PyrObject *schedq = slotRawObject(schedqSlot);
		SetInt(schedq->slots, 0); // stability count
		schedq->size = 1;
	}
}
开发者ID:bagong,项目名称:supercollider,代码行数:10,代码来源:PyrListPrim.cpp

示例11: PriorityQueuePostpone

void PriorityQueuePostpone(PyrObject* queueobj, double time)
{
	PyrSlot *schedqSlot = queueobj->slots;

	if (IsObj(schedqSlot)) {
		PyrObject *schedq = slotRawObject(schedqSlot);
		PyrSlot* slots = schedq->slots;
		for (int i=1; i < schedq->size; i+=3) {
			SetRaw(&slots[i], slotRawFloat(&slots[i]) + time);
		}
	}
}
开发者ID:bagong,项目名称:supercollider,代码行数:12,代码来源:PyrListPrim.cpp

示例12: PriorityQueuePostpone

void PriorityQueuePostpone(PyrObject* queueobj, double time)
{
	PyrSlot *schedqSlot = queueobj->slots;

	if (IsObj(schedqSlot)) {
		PyrObject *schedq = schedqSlot->uo;
		PyrSlot* slots = schedq->slots;
		for (int i=0; i < schedq->size; i+=2) {
			slots[i].uf += time;
		}
	}
}
开发者ID:scztt,项目名称:sc-debug,代码行数:12,代码来源:PyrListPrim.cpp

示例13: PriorityQueueEmpty

bool PriorityQueueEmpty(PyrObject *queueobj)
{
	PyrSlot *schedqSlot = queueobj->slots;

	if (IsObj(schedqSlot)) {
		PyrObject *schedq = slotRawObject(schedqSlot);
		if (schedq->size > 1) {
			return false;
		}
	}
	return true;
}
开发者ID:bagong,项目名称:supercollider,代码行数:12,代码来源:PyrListPrim.cpp

示例14: Finalize

void PyrGC::Finalize(PyrObject *finalizer)
{
	if (!IsPtr(finalizer->slots+0)) return;
	if (!IsObj(finalizer->slots+1)) return;

	ObjFuncPtr func = (ObjFuncPtr)finalizer->slots[0].ui;
	PyrObject *obj = finalizer->slots[1].uo;
	//post("FINALIZE %s %p\n", obj->classptr->name.us->name, obj);
	(func)(mVMGlobals, obj);

	SetNil(obj->slots+0);
	SetNil(obj->slots+1);
}
开发者ID:scztt,项目名称:sc-debug,代码行数:13,代码来源:GC.cpp

示例15: Finalize

void PyrGC::Finalize(PyrObject *finalizer)
{
	if (!IsPtr(finalizer->slots+0)) return;
	if (!IsObj(finalizer->slots+1)) return;

	ObjFuncPtr func = (ObjFuncPtr)slotRawPtr(&finalizer->slots[0]);
	PyrObject *obj = slotRawObject(&finalizer->slots[1]);
	//post("FINALIZE %s %p\n", slotRawSymbol(&obj->classptr->name)->name, obj);
	(func)(mVMGlobals, obj);

	SetNil(obj->slots+0);
	SetNil(obj->slots+1);
}
开发者ID:ASauer,项目名称:supercollider,代码行数:13,代码来源:GC.cpp


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