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


C++ IObject类代码示例

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


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

示例1: test

void test() {
  IServiceManager* servmgr;
  IStaticServiceHandler* handler;
  IMonikerService* monikers;
  IObject* test;
  IObject* obj;

  servmgr = XPLC::getServiceManager();
  ASSERT(servmgr != 0, "could not obtain service manager");

  obj = servmgr->getObject(XPLC::staticServiceHandler);
  ASSERT(obj != 0, "could not obtain static service handler");

  handler = mutate<IStaticServiceHandler>(obj);
  ASSERT(handler != 0, "static service handler does not have the IStaticServiceHandler interface");

  test = new TestObject;
  ASSERT(test != 0, "could not create TestObject");
  test->addRef();

  handler->addObject(TestObject_CID, test);
  VERIFY(servmgr->getObject(TestObject_CID) == test, "adding the test object did not work");
  VERIFY(test->release() == 2, "incorrect refcount on test object");

  obj = servmgr->getObject(XPLC::monikers);
  ASSERT(obj != 0, "could not obtain moniker component");
  
  monikers = mutate<IMonikerService>(obj);
  ASSERT(monikers != 0, "moniker service does not have the IMoniker interface");
  monikers->registerObject("moniker", XPLC::monikers);
  monikers->registerObject("testobject", TestObject_CID);

  obj = monikers->resolve("testobject");
  ASSERT(obj != 0, "resolving the test object returned nothing");
  ASSERT(obj == test, "the testobject moniker resolved to something else than the test object");
  VERIFY(obj->release() == 2, "refcount is wrong on the test object");

  obj = monikers->resolve("moniker:testobject");
  ASSERT(obj != 0, "resolving the test object indirectly returned nothing");
  ASSERT(obj == test, "the testobject moniker indirectly resolved to something else than the test object");
  VERIFY(obj->release() == 2, "refcount is wrong on the test object");

  obj = monikers->resolve("moniker:");
  VERIFY(obj == 0, "resolving an empty sub-moniker returned something");

  VERIFY(monikers->release() == 1, "incorrect refcount on moniker service");

  VERIFY(handler->release() == 2, "incorrect refcount on static service handler");

  servmgr->shutdown();
  VERIFY(servmgr->release() == 0, "service manager has non-zero refcount after shutdown/release");

  VERIFY(test->release() == 0, "refcount is wrong on the test object");
}
开发者ID:BackupTheBerlios,项目名称:xplc-svn,代码行数:54,代码来源:test.cpp

示例2: Visit

bool CVisitNodeDWORD::Visit(IComponent *component, bool bVisitEnter)
{
	IObject *theObject;
	IHashString *objName;

	theObject = dynamic_cast<IObject *>(component);

	// if the object is invalid
	if (!theObject)
	{
		// log error
		return false;
	}

	// get the name of the object
	objName = theObject->GetName();

	// add name to set
	m_DWORDSet->Add(objName);

	return true;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:22,代码来源:VisitNodeDWORD.cpp

示例3: PumpHandler

DWORD CObjectCubeMapManager::PumpHandler(DWORD size, void *data, IHashString *name, 
									 IHashString *compType, MSGFUNCTION msgFunction)
{
	MODELTOCUBETEXTUREMAP::iterator startIter;
	MODELTOCUBETEXTUREMAP::iterator endIter;

	DWORD retval = MSG_NOT_HANDLED;
		
	// specific object
	if (name != NULL)
	{
		startIter = m_ModelCubeTexturesMap.lower_bound(name->GetUniqueID());
		endIter = m_ModelCubeTexturesMap.upper_bound(name->GetUniqueID());
	}
	
	// pump through everything if no name is specified
	else
	{
		startIter = m_ModelCubeTexturesMap.begin();
		endIter = m_ModelCubeTexturesMap.end();
	}

	for (; startIter != endIter; startIter++)
	{
		IObject *object = startIter->second;

		if ((compType == NULL) || (object->IsKindOf(compType)))
		{
			retval = (object->*msgFunction)(size, data);

			if (retval == MSG_HANDLED_STOP)
			{
				return retval;
			}
		}
	}
	return retval;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:38,代码来源:ObjectCubeMapManager.cpp

示例4: getBounds

//-*****************************************************************************
Box3d getBounds( IObject iObj )
{
    Box3d bnds;
    bnds.makeEmpty();

    M44d xf = getFinalMatrix( iObj );

    if ( IPolyMesh::matches( iObj.getMetaData() ) )
    {
        IPolyMesh mesh( iObj, kWrapExisting );
        IPolyMeshSchema ms = mesh.getSchema();
        V3fArraySamplePtr positions = ms.getValue().getPositions();
        size_t numPoints = positions->size();

        for ( size_t i = 0 ; i < numPoints ; ++i )
        {
            bnds.extendBy( (*positions)[i] );
        }
    }
    else if ( ISubD::matches( iObj.getMetaData() ) )
    {
        ISubD mesh( iObj, kWrapExisting );
        ISubDSchema ms = mesh.getSchema();
        V3fArraySamplePtr positions = ms.getValue().getPositions();
        size_t numPoints = positions->size();

        for ( size_t i = 0 ; i < numPoints ; ++i )
        {
            bnds.extendBy( (*positions)[i] );
        }
    }

    bnds.extendBy( Imath::transform( bnds, xf ) );

    g_bounds.extendBy( bnds );

    return bnds;
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:39,代码来源:AbcBoundsEcho.cpp

示例5: scopingTest

void scopingTest(bool useOgawa)
{
    {
        OObject top;
        {
            OArchive archive;
            if (useOgawa)
            {
                archive = CreateArchiveWithInfo(
                    Alembic::AbcCoreOgawa::WriteArchive(),
                    "archiveScopeTest.abc",
                    "Alembic test", "", MetaData() );
            }
            else
            {
                archive = CreateArchiveWithInfo(
                    Alembic::AbcCoreHDF5::WriteArchive(),
                    "archiveScopeTest.abc",
                    "Alembic test", "", MetaData() );
            }
            top = archive.getTop();
        }
        OObject childA( top, "a");
        OObject childB( top, "b");
        ODoubleProperty prop(top.getProperties(), "prop", 0);
        TESTING_ASSERT(prop.getObject().getArchive().getName() ==
            "archiveScopeTest.abc");
    }

    {
        IObject top;
        {
            AbcF::IFactory factory;
            AbcF::IFactory::CoreType coreType;
            IArchive archive = factory.getArchive("archiveScopeTest.abc",
                                                  coreType);

           TESTING_ASSERT( (useOgawa && coreType == AbcF::IFactory::kOgawa) ||
                           (!useOgawa && coreType == AbcF::IFactory::kHDF5) );

            top = archive.getTop();

            double start, end;
            GetArchiveStartAndEndTime( archive, start, end );
            TESTING_ASSERT( start == DBL_MAX && end == -DBL_MAX );
        }
        TESTING_ASSERT(top.getNumChildren() == 2 );
        TESTING_ASSERT(top.getChildHeader("a") != NULL);
        TESTING_ASSERT(top.getChildHeader("b") != NULL);
        TESTING_ASSERT( ! top.getParent().valid() );
        TESTING_ASSERT( top.getArchive().getName() ==
            "archiveScopeTest.abc");
        IScalarProperty prop(top.getProperties(), "prop");
        TESTING_ASSERT(prop.valid());
        TESTING_ASSERT(prop.getObject().getArchive().getName() ==
            "archiveScopeTest.abc");
    }
}
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:58,代码来源:ArchiveTest.cpp

示例6: _Impl_CheckClsId

ELAPI _Impl_CheckClsId(
    /* [in] */ PInterface serverObj,
    /* [in] */ const ClassID* classiD,
    /* [out] */ PInterface* outServerObj)
{
    IObject* object;
    char str[80];
    ClassID clsid;
    clsid.mUunm = str;

    object = (IObject*)serverObj->Probe(EIID_IObject);
    if (NULL == object) return E_INVALID_ARGUMENT;

    object->GetClassID(&clsid);
    while (*(EMuid *)&clsid != *(EMuid *)classiD) {
        object = (IObject*)object->Probe(EIID_SUPER_OBJECT);
        if (NULL == object) return E_INVALID_ARGUMENT;

        object->GetClassID(&clsid);
    }
    *outServerObj = object;  // don't AddRef, Caller don't Release either.
    return NOERROR;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:23,代码来源:cbapi.cpp

示例7: visitObject

//-*****************************************************************************
void visitObject( IObject iObj,
                  std::string iIndent )
{
    // Object has a name, a full name, some meta data,
    // and then it has a compound property full of properties.
    std::string path = iObj.getFullName();

    if ( path != "/" )
    {
        std::cout << "Object " << "name=" << path << std::endl;
    }

    // Get the properties.
    ICompoundProperty props = iObj.getProperties();
    visitProperties( props, iIndent );

    // now the child objects
    for ( size_t i = 0 ; i < iObj.getNumChildren() ; i++ )
    {
        visitObject( IObject( iObj, iObj.getChildHeader( i ).getName() ),
                     iIndent );
    }
}
开发者ID:ahmidou,项目名称:aphid,代码行数:24,代码来源:main.cpp

示例8: objectBindDrawIndexedRecursive

    virtual VkBool32 objectBindDrawIndexedRecursive(const IObject& object, const ICommandBuffersSP& cmdBuffer, const SmartPointerVector<IGraphicsPipelineSP>& allGraphicsPipelines, const uint32_t bufferIndex) const
    {
    	if (viewFrustum)
    	{
    		if (viewFrustum->isVisible(object.getRootNode()->getBoundingSphere()))
    		{
    			return VK_TRUE;
    		}

    		return VK_FALSE;
    	}

    	return VK_TRUE;
    }
开发者ID:Asmodean-,项目名称:Vulkan,代码行数:14,代码来源:cull.hpp

示例9: getErrorHandler

//-*****************************************************************************
void ICompoundProperty::init ( const IObject & iObject,
                               const Argument &iArg0,
                               const Argument &iArg1 )
{
    getErrorHandler().setPolicy(
        GetErrorHandlerPolicy( iObject, iArg0, iArg1 ) );

    ALEMBIC_ABC_SAFE_CALL_BEGIN(
        "ICompoundProperty::init( IObject )" );

    m_property = iObject.getProperties().getPtr();

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:15,代码来源:ICompoundProperty.cpp

示例10: ReadObject

	void DataNode::GetValueRaw(IObject& object) const
	{

		struct helper
		{
			static void ReadObject(void* object, const ObjectType& type, const DataNode& node)
			{
				for (auto baseType : type.GetBaseTypes())
				{
					const ObjectType* baseObjectType = dynamic_cast<const ObjectType*>(baseType.type);
					if (!baseObjectType)
						continue;

					void* baseObject = (*baseType.dynamicCastUpFunc)(object);
					ReadObject(baseObject, *baseObjectType, node);
				}

				for (auto field : type.GetFields())
				{
					auto srlzAttribute = field->GetAttribute<SerializableAttribute>();
					if (srlzAttribute)
					{
						auto fldNode = node.GetNode(field->GetName());
						if (fldNode)
							field->DeserializeFromObject(object, *fldNode);
					}
				}
			}
		};

		const ObjectType& type = dynamic_cast<const ObjectType&>(object.GetType());
		void* objectPtr = type.DynamicCastFromIObject(const_cast<IObject*>(&object));
		helper::ReadObject(objectPtr, type, *this);

		if (object.GetType().IsBasedOn(TypeOf(ISerializable)))
			((ISerializable&)object).OnDeserialized(*this);
	}
开发者ID:zenkovich,项目名称:o2,代码行数:37,代码来源:DataNode.cpp

示例11: VERIFY_MESSAGE_SIZE

DWORD CCoordinateToolManager::OnDeleteObject(DWORD size, void *param)
{
	// This message has its priority raised so that it gets called before the
  	// parent entity's delete object. We MUST to remove coordinate tool
  	// for entity, before its deletion. Otherwise physics will crash.
  	// Is there any better solution, except to catch all DeleteObject messages?
  
  	VERIFY_MESSAGE_SIZE(sizeof(DELETEOBJECTPARAMS), size);
  	DELETEOBJECTPARAMS* dop = (DELETEOBJECTPARAMS*)param;
  
  	IObject * object = FindByParent(dop->name);
  	if (object != NULL)
  	{
  		// Remove coordinate tool for this parent object.
  		DELETEOBJECTPARAMS dop;
  		dop.name = object->GetName();
  		static DWORD msgHash_DeleteObject = CHashString(_T("DeleteObject")).GetUniqueID();
  		m_ToolBox->SendMessage(msgHash_DeleteObject, sizeof(DELETEOBJECTPARAMS), &dop);

		m_CoordinateToolName = NULL;
  	}

	return MSG_HANDLED_PROCEED;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:24,代码来源:CoordinateToolManager.cpp

示例12: readFlatHierarchy

void readFlatHierarchy(const std::string &archiveName)
{
    // Open an existing archive for reading. Indicate that we want
    //   Alembic to throw exceptions on errors.
    AbcF::IFactory factory;
    factory.setPolicy(  ErrorHandler::kThrowPolicy );
    AbcF::IFactory::CoreType coreType;
    IArchive archive = factory.getArchive(archiveName, coreType);
    IObject archiveTop = archive.getTop();

    // Determine the number of (top level) children the archive has
    const int numChildren = archiveTop.getNumChildren();
    ABCA_ASSERT( numChildren == 10,
                 "Expected 10 children, found " << numChildren );

    std::cout << "The archive has " << numChildren << " children:"
              << std::endl;

    // Iterate through them, print out their names
    for (int ii=0; ii<numChildren; ii++)
    {
        IObject child( archiveTop,
                       archiveTop.getChildHeader(ii).getName() );
        std::cout << "  " << child.getName();

        const unsigned int children = child.getNumChildren();
        std::cout << " has " << children << " children"
                  << std::endl;

        ABCA_ASSERT( children == 0,
                     "Expected no children, found " << children );

    }

    // Done - the archive closes itself
}
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:36,代码来源:ObjectTests.cpp

示例13: pruneTest

//-*****************************************************************************
void pruneTest()
{
    std::string fileName = "objectPrune1.abc";
    std::string fileName2 = "objectPrune2.abc";
    {
        OArchive archive( Alembic::AbcCoreOgawa::WriteArchive(), fileName );
        OObject child( archive.getTop(), "child" );
        OObject childCool( child, "cool" );
        OObject childGuy( child, "guy" );

        OObject childA( archive.getTop(), "childA" );
        OObject childAA( childA, "A" );

        OObject childB( archive.getTop(), "childB" );
        OObject childBB( childB, "B" );
    }

    {
        MetaData md;
        Alembic::AbcCoreLayer::SetPrune( md, true );

        OArchive archive( Alembic::AbcCoreOgawa::WriteArchive(), fileName2 );
        OObject child( archive.getTop(), "child" );
        OObject childGuy( child, "guy", md );

        OObject childA( archive.getTop(), "childA" );
        OObject childAA( childA, "A", md );
        OObject childAB( childA, "B", md );

        OObject childB( archive.getTop(), "childB", md );
    }

    {
        std::vector< std::string > files;
        files.push_back( fileName );
        files.push_back( fileName2 );

        Alembic::AbcCoreFactory::IFactory factory;
        IArchive archive = factory.getArchive( files );

        // child, childA, childB
        TESTING_ASSERT( archive.getTop().getNumChildren() == 2 );

        IObject child = archive.getTop().getChild("child");
        TESTING_ASSERT( child.getNumChildren() == 1 );
        TESTING_ASSERT( child.getChild("cool").valid() );
        TESTING_ASSERT( child.getChild("cool").getNumChildren() == 0 );

        IObject childA = archive.getTop().getChild("childA");
        TESTING_ASSERT( childA.getNumChildren() == 0 );
    }
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:53,代码来源:ObjectTests.cpp

示例14: bounded

/**
 * Return a random point in a generic shape limited by a bounding box.
 * @param object an object in which the point is generated
 * @param rng a random number generator
 * @param box a box restricting the point's volume
 * @param maxAttempts number of attempts to find a suitable point
 * @return a point or none if maxAttempts was exceeded
 */
boost::optional<Kernel::V3D> bounded(const IObject &object,
                                     Kernel::PseudoRandomNumberGenerator &rng,
                                     const BoundingBox &box,
                                     size_t maxAttempts) {
  boost::optional<Kernel::V3D> point{boost::none};
  if (box.isNull()) {
    throw std::invalid_argument(
        "Invalid bounding box. Cannot generate random point.");
  }
  for (size_t attempts{0}; attempts < maxAttempts; ++attempts) {
    const double r1 = rng.nextValue();
    const double r2 = rng.nextValue();
    const double r3 = rng.nextValue();
    auto pt = box.generatePointInside(r1, r2, r3);
    if (object.isValid(pt)) {
      point = pt;
      break;
    }
  };
  return point;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:RandomPoint.cpp

示例15: setupWithObject

void IGeom::setupWithObject(IObject object)
{
	size_t numChildren = object.getNumChildren();
	
	for (size_t i = 0; i < numChildren; ++i)
	{
		const ObjectHeader &ohead = object.getChildHeader(i);

		ofPtr<IGeom> dptr;
		if (Alembic::AbcGeom::IPolyMesh::matches(ohead))
		{
			Alembic::AbcGeom::IPolyMesh pmesh(object, ohead.getName());
			if (pmesh)
			{
				dptr.reset(new ofxAlembic::IPolyMesh(pmesh));
			}
		}
		else if (Alembic::AbcGeom::IPoints::matches(ohead))
		{
			Alembic::AbcGeom::IPoints points(object, ohead.getName());
			if (points)
			{
				dptr.reset(new ofxAlembic::IPoints(points));
			}
		}
		else if (Alembic::AbcGeom::ICurves::matches(ohead))
		{
			Alembic::AbcGeom::ICurves curves(object, ohead.getName());
			if (curves)
			{
				dptr.reset(new ofxAlembic::ICurves(curves));
			}
		}
		else if (Alembic::AbcGeom::INuPatch::matches(ohead))
		{
			ofLogError("ofxAlembic") << "INuPatch not implemented";
			assert(false);

//			Alembic::AbcGeom::INuPatch nuPatch(object, ohead.getName());
//			if ( nuPatch )
//			{
//				dptr.reset( new INuPatchDrw( nuPatch ) );
//			}
		}
		else if (Alembic::AbcGeom::IXform::matches(ohead))
		{
			Alembic::AbcGeom::IXform xform(object, ohead.getName());
			if (xform)
			{
				dptr.reset(new ofxAlembic::IXform(xform));
			}
		}
		else if (Alembic::AbcGeom::ISubD::matches(ohead))
		{
			ofLogError("ofxAlembic") << "ISubD not implemented";
			assert(false);

//			Alembic::AbcGeom::ISubD subd(object, ohead.getName());
//			if ( subd )
//			{
//				dptr.reset( new ISubDDrw( subd ) );
//			}
		}
		else if (Alembic::AbcGeom::ICamera::matches(ohead))
		{
			Alembic::AbcGeom::ICamera camera(object, ohead.getName());
			if (camera)
			{
				dptr.reset(new ofxAlembic::ICamera(camera));
			}
		}
		else
		{
			ofLogError("ofxAlembic") << "unknown object type: " << ohead.getFullName();
		}

		if (dptr && dptr->valid())
		{
			dptr->index = m_children.size();
			m_children.push_back(dptr);
			m_minTime = std::min(m_minTime, dptr->m_minTime);
			m_maxTime = std::max(m_maxTime, dptr->m_maxTime);
		}
	}
}
开发者ID:perfume-dev,项目名称:ofxAlembic,代码行数:85,代码来源:ofxAlembicReader.cpp


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