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


C++ ObjectHandle类代码示例

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


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

示例1: invoke

	Variant invoke(const ObjectHandle& object, const IDefinitionManager& definitionManager,
		const ReflectedMethodParameters& parameters) override
	{
		auto pointer = reflectedCast<ClassType>(object.data(), object.type(), definitionManager);
		TF_ASSERT(pointer != nullptr);
		return invokeMember( pointer, method_, definitionManager, parameters, std::index_sequence_for<Args...>{} );
	}
开发者ID:wgsyd,项目名称:wgtf,代码行数:7,代码来源:reflection_method_utilities.hpp

示例2: DREFGOBJ

SysStatus
SysVMessagesClient::getCallBackOH(ObjectHandle& oh, void*& blockKey)
{
    ProcessID pid;
    SysStatus rc;

    pid = DREFGOBJ(TheProcessRef)->getPID();
    if (pid != callBackOH.pid()) {
	/* either we've never initialized or
	 * this is a fork child and we need
	 * a new call back oh.
	 */
	ProcessID serverPID;
	ObjectHandle serverOH;
	StubSysVMessages::__Get__metaoh(serverOH);
	passertMsg(!serverOH.invalid(), "No SysVMessages server\n");
	serverPID=serverOH.pid();
	/*
	 * make oh to this object for async callback
	 */
	rc = giveAccessByServer(callBackOH, serverPID);
	passertMsg(_SUCCESS(rc), "giveAccessByServer failed %ld\n", rc);
    }
    oh = callBackOH;
    blockKey = (void*)obj;
    return 0;
}
开发者ID:BillTheBest,项目名称:k42,代码行数:27,代码来源:SysVMessagesClient.C

示例3: switch

/*static*/ SysStatus
FileLinuxPacket::CreateInternal(FileLinuxRef& newSocket, ObjectHandle stubOH,
				uval clientType, uval oflags, sval domain,
			        sval type, sval protocol)
{
    SysStatus rc;
    FileLinuxPacket *newp = NULL;

    ObjectHandle dummy;

    switch (type) {
    case SOCK_DGRAM:
    case SOCK_RAW:
	switch (domain) {
	case AF_NETLINK:
	case AF_INET:
	    newp = new FileLinuxPacket(domain, type, protocol);
	    break;
	case AF_UNIX:
	    newp = (FileLinuxPacket*) new FileLinuxPacketUnix(domain, type,
                                                        protocol);
	    break;
	default:
	    tassertMsg(0, "fixme.  Add the domain (%ld) here as well.\n",
	                 domain);
	    break;
	}
	break;
    default:
	tassertMsg(0, "fixme.  Add the type (%ld) here as well.\n", type);
	break;
    }

    // using dummy tells init not to make a stubHolder
    dummy.init();
    newp->init(dummy, NULL);

    newp->local = newp->remote = 0;
    newp->localLen = newp->remoteLen = 0;

    newp->sps.setOH(stubOH);

    switch (clientType) {
    case TransStreamServer::TRANS_VIRT:
	newp->stubHolder = new TransVirtStream(stubOH);
	break;
    case TransStreamServer::TRANS_PPC:
	newp->stubHolder = new TransPPCStream(stubOH);
	break;
    default:
	err_printf("Unknown socket client type: %ld\n", clientType);
    }

    newSocket = (FileLinuxRef)newp->getRef();

    // register object for callback by server
    rc = newp->registerCallback();
    tassert(_SUCCESS(rc), err_printf("do cleanup code\n"));
    return 0;
}
开发者ID:BillTheBest,项目名称:k42,代码行数:60,代码来源:FileLinuxPacket.C

示例4: mexFunction

void mexFunction(int nlhs, mxArray *plhs[],
    int nrhs, const mxArray *prhs[]) {
	double *i_oesgp_object;

	i_oesgp_object =  mxGetPr(prhs[0]);
    
    VectorXd prediction;
    VectorXd prediction_variance;
    
    ObjectHandle<OESGP>* handle = 
            ObjectHandle<OESGP>::from_mex_handle(prhs[0]);
	handle->get_object().predict(prediction, prediction_variance);
    
    
    if (nlhs >= 1) {
        plhs[0] = mxCreateDoubleMatrix(prediction.rows(), 1, mxREAL);
        double *output = mxGetPr(plhs[0]);
        for (unsigned int i=0; i<prediction.rows(); i++) {
            output[i] = prediction[i];
        }
    } 
    
    if (nlhs >= 2) {
        plhs[1] = mxCreateDoubleMatrix(prediction_variance.rows(), 1, mxREAL);
        double *output = mxGetPr(plhs[1]);
        for (unsigned int i=0; i<prediction_variance.rows(); i++) {
            output[i] = prediction_variance[i];
        }        
    } 
}
开发者ID:farhanrahman,项目名称:nice,代码行数:30,代码来源:predictOESGP.cpp

示例5: main

int
main()
{
    NativeProcess();

    SysStatus rc;
    ObjectHandle oh;

    UsrTstRef ref = UsrTst::Create();

    rc = DREF(ref)->giveAccessByServer(oh, _KERNEL_PID);
    tassert(_SUCCESS(rc), err_printf("woops\n"));
    printf("testDisabledIPC: calling kernel with oh %lx %lx\n",
	   oh.commID(), oh.xhandle());
    Scheduler::Disable();
    ALLOW_PRIMITIVE_PPC();
    DREFGOBJ(TheProcessRef)->testUserIPC(oh);
    UN_ALLOW_PRIMITIVE_PPC();
    Scheduler::Enable();
    printf("testDisabledIPC: done calling kernel\n");
    for (uval i = 0; i < 20; i++) {
	printf("testDisabledIPC: sleeping (%ld)\n", i);
	Scheduler::DelayMicrosecs(5000);
    }
    printf("testDisabledIPC: terminating\n");
    return 0;
}
开发者ID:jimix,项目名称:k42,代码行数:27,代码来源:testDisabledIPC.C

示例6: RECEIVE

RECEIVE(DROP, id, msg, reliable)
{
	ObjectHandle item = Object::construct((string) msg[1]);
	if (!item) return;
	item->unserialize(msg[1]);
	game.world->temporary.push_back(item);
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:7,代码来源:netcode.cpp

示例7: ReflectedMethodParameterWrapper

	ReflectedMethodParameterWrapper( const Variant& variant, const IDefinitionManager & definitionManager )
	{
		ObjectHandle handle;
		value = variant.tryCast<ObjectHandle>( handle )
			? *reflectedCast< Type >(handle.data(), handle.type(), definitionManager )
			: variant.cast<Type>();
	}
开发者ID:bw-github,项目名称:wgtf,代码行数:7,代码来源:reflection_method_utilities.hpp

示例8: assert

//==============================================================================
ObjectHandle SetReflectedPropertyCommand::execute(
	const ObjectHandle & arguments ) const
{
	ReflectedPropertyCommandArgument * commandArgs =
		arguments.getBase< ReflectedPropertyCommandArgument >();
	auto objManager = definitionManager_.getObjectManager();
	assert( objManager != nullptr );
	ObjectHandle object = objManager->getObject( commandArgs->getContextId() );
	if (!object.isValid())
	{
		return CommandErrorCode::INVALID_ARGUMENTS;
	}
	PropertyAccessor property = object.getDefinition( definitionManager_ )->bindProperty( 
		commandArgs->getPropertyPath(), object );
	if (property.isValid() == false)
	{
		//Can't set
		return CommandErrorCode::INVALID_ARGUMENTS;
	}
	const Variant & data = commandArgs->getPropertyValue();
	bool br = property.setValue( data );
	if (!br)
	{
		return CommandErrorCode::INVALID_VALUE;
	}

	// Do not return the object
	// CommandInstance will hold a reference to the return value
	// and the CommandInstance is stored in the undo/redo history forever
	// This is due to a circular reference in CommandManagerImpl::pushFrame
	return nullptr;
}
开发者ID:bw-github,项目名称:wgtf,代码行数:33,代码来源:set_reflectedproperty_command.cpp

示例9: newModel

    OSPModel MPIDistributedDevice::newModel()
    {
      auto *instance = new DistributedModel;
      ObjectHandle handle;
      handle.assign(instance);

      return (OSPModel)(int64)handle;
    }
开发者ID:ingowald,项目名称:OSPRay,代码行数:8,代码来源:MPIDistributedDevice.cpp

示例10: DREF

// create a server file object to represent this block file
/* virtual */ SysStatus
FileSystemK42RamFS::createServerFileBlock(ServerFileRef &fref, FSFile *fsFile)
{
    ObjectHandle oh;
    SysStatus rc = DREF(tref)->getKptoh(oh);
    tassertMsg(_SUCCESS(rc) && oh.valid(), "?");
    return ServerFileBlockK42RamFS::Create(fref, fsFile, oh);
}
开发者ID:BillTheBest,项目名称:k42,代码行数:9,代码来源:FileSystemK42RamFS.C

示例11: createDistributedObject

    inline API_TYPE createDistributedObject(const char *type)
    {
      auto *instance = OSPRAY_TYPE::createInstance(type);

      ObjectHandle handle;
      handle.assign(instance);

      return (API_TYPE)(int64)handle;
    }
开发者ID:ingowald,项目名称:OSPRay,代码行数:9,代码来源:MPIDistributedDevice.cpp

示例12: DistributedFrameBuffer

 OSPFrameBuffer
 MPIDistributedDevice::frameBufferCreate(const vec2i &size,
                                         const OSPFrameBufferFormat mode,
                                         const uint32 channels)
 {
   ObjectHandle handle;
   auto *instance = new DistributedFrameBuffer(size, handle, mode, channels,
                                               true);
   handle.assign(instance);
   return (OSPFrameBuffer)(int64)handle;
 }
开发者ID:ingowald,项目名称:OSPRay,代码行数:11,代码来源:MPIDistributedDevice.cpp

示例13: fprintf

int MemoryManager::garbageCollect()
{
    register int j;
    int c=1,f=0;

    if(noGC)
        return 0;

    if (debugging) 
        fprintf(stderr,"\ngarbage collecting ... \n");

    for(TObjectTableIterator x = objectTable.begin(), xend = objectTable.end(); x != xend; ++x)
        x->referenceCount = 0;
    objectTable[0].referenceCount = 1;
    /* visit symbols and firstProcess to toggle their referenceCount */

    visit(symbols);

    /* Visit any explicitly held references from the use of ObjectHandle */
    ObjectHandle* explicitRef = ObjectHandle::getListHead();
    while(explicitRef)
    {
        visit(*explicitRef);
        explicitRef = explicitRef->next();
    }

    /* add new garbage to objectFreeList 
    * toggle referenceCount 
    * count the objects
    */

    for (j=objectTable.size()-1; j>0; j--) 
    {
        if (objectTable[j].referenceCount == 0) 
        {
            if(destroyObject(j))
                f++;
        } 
        else
        {
            if (0!=(objectTable[j].referenceCount = -objectTable[j].referenceCount))
                c++;
        }
    }

    if (debugging)
    {
        fprintf(stderr," %d references.\n",ObjectHandle::numTotalHandles());
        fprintf(stderr," %d objects - %d freed.\n",c,f);
    }

    return f;
}
开发者ID:pgregory,项目名称:tumbleweed,代码行数:53,代码来源:objmemory.cpp

示例14: ReflectedMethodParameterWrapper

	ReflectedMethodParameterWrapper(const Variant& variant, const IDefinitionManager& definitionManager)
	{
		if (variant.canCast<ObjectHandle>())
		{
			ObjectHandle handle = variant.cast<ObjectHandle>();
			pointer_ = reflectedCast<Type>(handle.data(), handle.type(), definitionManager);
		}
		else
		{
			pointer_ = &const_cast<Variant&>(variant).cast<Type&>();
		}
	}
开发者ID:wgsyd,项目名称:wgtf,代码行数:12,代码来源:reflection_method_utilities.hpp

示例15: _SERROR

/* static */ SysStatus
RegionReplicated::_CreateFixedLenExtDyn(uval& regionVaddr, uval regionSize,
					uval alignmentreq, ObjectHandle frOH,
					uval fileOffset, uval accessreq,
					XHandle target, ObjectHandle tsOH,
					RegionType::Type regionType,
					__CALLER_PID callerPID)
{
    RegionRef ref;
    ProcessRef pref=0;
    SysStatus rc;
    FCMRef fcmRef;
    TypeID type;
    ObjRef objRef;
    FRRef frRef;

    rc = RegionDefault::PrefFromTarget(target, callerPID, pref);
    _IF_FAILURE_RET(rc);

    rc = XHandleTrans::XHToInternal(frOH.xhandle(), callerPID,
				    MetaObj::attach, objRef, type);
    tassertWrn(_SUCCESS(rc), "RegionReplicated failed XHToInternal\n");
    _IF_FAILURE_RET(rc);

    // verify that type is of FRComp - we'd really like just FR
// FIXMEXX talk to Orran, the brilliant, charming, ..
    if (!MetaFR::isBaseOf(type)) {
	tassertWrn(0, "object handle <%lx,%lx> not of correct type\n",
		   frOH.commID(), frOH.xhandle());
	return _SERROR(1542, 0, EINVAL);
    }

    //FIXME check xobj to make sure it matches our processID

    frRef = (FRRef)objRef;

    rc = RegionReplicated::CreateFixedLen(
	ref, pref, regionVaddr,
	regionSize, alignmentreq, frRef, fileOffset,
	(AccessMode::mode)accessreq);

    // FIXME: Kludge for enabling dyn-switch
#if 0
    CObjRoot *partitionedFCMRoot = 0;
    rc = FCMPartitionedTrivial::Create(partitionedFCMRoot, fcmRef, regionSize,
				       /* number of cache lines per rep */ 256,
				       /* associativity of each line */    4);
    tassert(_SUCCESS(rc), err_printf("Replicated Trivial fcm create\n"));

    PMRef pmRef;
    rc = DREF(pref)->getPM(pmRef);
    tassert(_SUCCESS(rc), ;);
开发者ID:BillTheBest,项目名称:k42,代码行数:52,代码来源:RegionReplicated.C


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