本文整理汇总了C++中IsObj函数的典型用法代码示例。如果您正苦于以下问题:C++ IsObj函数的具体用法?C++ IsObj怎么用?C++ IsObj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsObj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: lengthAfterObjectKey
//
// This computes obj_C = obj_Z - obj_A from obj_K
//
unsigned long lengthAfterObjectKey( Ref * obj_K ) {
// Keys fall into the following categories: FunctionKey, SimpleKey, Pointer to Keys
Ref key = *obj_K;
if ( IsSimpleKey( key ) ) {
switch ( LayoutOfSimpleKey( key ) ) {
//switch ( KindOfSimpleKey( key ) ) {
case RECORD_LAYOUT: {
//case MAP_KIND:
//case PAIR_KIND:
//case RECORD_KIND: {
assert( LayoutOfSimpleKey( key ) == RECORD_LAYOUT );
assert( KindOfSimpleKey( key ) == PAIR_KIND || KindOfSimpleKey( key ) == MAP_KIND || KindOfSimpleKey( key ) == RECORD_KIND );
return sizeAfterKeyOfRecordLayout( obj_K );
break;
}
case VECTOR_LAYOUT: {
//case VECTOR_KIND: {
assert( LayoutOfSimpleKey( key ) == VECTOR_LAYOUT );
assert( KindOfSimpleKey( key ) == VECTOR_KIND );
return sizeAfterKeyOfVectorLayout( obj_K );
break;
}
case MIXED_LAYOUT: {
assert( LayoutOfSimpleKey( key ) == MIXED_LAYOUT );
return sizeAfterKeyOfMixedLayout( obj_K );
break;
}
case STRING_LAYOUT: {
//case STRING_KIND: {
assert( LayoutOfSimpleKey( key ) == STRING_LAYOUT );
assert( KindOfSimpleKey( key ) == STRING_KIND );
return sizeAfterKeyOfStringLayout( obj_K );
break;
}
case WRECORD_LAYOUT: {
assert( LayoutOfSimpleKey( key ) == WRECORD_LAYOUT );
return sizeAfterKeyOfWRecordLayout( obj_K );
break;
}
default:
throw UnreachableError();
}
} else if ( IsFunctionKey( key ) ) {
return sizeAfterKeyOfFn( obj_K );
} else if ( IsObj( key ) ) {
return sizeAfterKeyOfInstance( obj_K );
} else {
throw Ginger::Mishap( "Cannot take length of this" );
}
}
开发者ID:Spicery,项目名称:ginger,代码行数:53,代码来源:misclayout.cpp
示例17: PriorityQueuePop
void PriorityQueuePop(VMGlobals *g, PyrObject *queueobj, PyrSlot *result)
{
PyrSlot *schedqSlot = queueobj->slots;
if (IsObj(schedqSlot)) {
PyrObject *schedq = slotRawObject(schedqSlot);
double time;
if (!getheap(g, schedq, &time, result)) {
SetNil(result);
}
} else {
SetNil(result);
}
}
开发者ID:bagong,项目名称:supercollider,代码行数:14,代码来源:PyrListPrim.cpp
示例18: PriorityQueueTop
void PriorityQueueTop(PyrObject *queueobj, PyrSlot *result)
{
PyrSlot *schedqSlot = queueobj->slots;
if (IsObj(schedqSlot)) {
PyrObject *schedq = slotRawObject(schedqSlot);
if (schedq->size > 1) {
slotCopy(result,&schedq->slots[1]);
} else {
SetNil(result);
}
} else {
SetNil(result);
}
}
开发者ID:bagong,项目名称:supercollider,代码行数:15,代码来源:PyrListPrim.cpp
示例19: ObjectPool_im_gDisposeObject
imeth objrtn ObjectPool_im_gDisposeObject(object self, object obj)
{ ObjectPool_iv_t *iv = GetIVs(ObjectPool, self);
object pobj = gNewWithPtr(Pointer, obj);
object val = gFindValue(iv->iObjects, pobj);
if (val) {
if (IsObj(obj)) {
long v1 = gObjectSerialNumber(obj);
long v2 = gLongValue(gValue(val));
if (v1 == v2)
gShortValue(gKey(val)) ? gDeepDispose(obj) : gDispose(obj);
}
gDeepDisposeObj(iv->iObjects, pobj);
}
gDispose(pobj);
return NULL;
}
开发者ID:blakemcbride,项目名称:Dynace,代码行数:16,代码来源:ObjectPool.c
示例20: findObjectKey
//
// This computes obj_K from obj_A.
//
Ref * findObjectKey( Ref * obj_A ) {
// Cases are that 'obj_A' is pointing at
// 1. FnLengthKey.
// 2. NonKey* Key series
if ( IsFnLength( *obj_A ) ) {
// We are at the start of a function.
// It has a fixed offset to the key.
return obj_A + OFFSET_FROM_FN_LENGTH_TO_KEY;
} else {
for ( int n = 0; n < MAX_OFFSET_FROM_START_TO_KEY; n++ ) {
//
// Note that this function is called on objects that have been
// forwarded but not yet scanned by the GC. So the test for the
// key has to be capable of coping with a forwarded key. This
// test is stupider and restricts values in front of the key to
// simple values.
//
// A smarter test is
// 1. Are you a simple key? Job done. A: yes
// 2. Are you an object? Define K = *you
// 2a. Is *K the keykey? If so job done. A: yes
// 2b. Is *K forwarded? Define F = *K
// 2c. Is *F the keykey? If so A: yes
// 3. Otherwise done A: no
//
/* I think the code would look like this.
if ( IsSimpleKey( *obj_A ) ) return obj_A;
if ( IsObj( *obj_A ) ) {
if ( *RefToPtr4( *obj_A ) == sysClassKey ) return obj_A;
}
if ( IsFwd( *obj_A ) ) {
Ref K = *FwdToPtr4( *obj_A );
if ( IsObj( K ) ) {
if ( *RefToPtr4( K ) == sysClassKey ) return obj_A;
}
}
*/
Ref * x = obj_A + n;
Ref k = *x;
if ( IsSimpleKey( k ) || IsObj( k ) || IsFwd( k ) ) {
return x;
}
}
throw UnreachableError();
}
}
开发者ID:Spicery,项目名称:ginger,代码行数:49,代码来源:misclayout.cpp
注:本文中的IsObj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论