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


C++ ObjectFactory类代码示例

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


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

示例1: lua_getref

Object* ObjectManager::createInstance(lua_State* L, const String& className, const String& name)
{
	int luaReference = ScriptManager::getSingleton().getLuaClass(className);
	if (luaReference == 0) 
	{
		throw new Ogre::Exception(0, "Lua class '" + className + "' not found", __FILE__);
	}
	
	// põe a classe da pilha
	lua_getref(L, luaReference);
	int idx = lua_gettop(L);

	const String type(LuaHelper::getTableStringField(L, idx, "type"));

	ObjectFactory* factory = this->getObjectFactory(type);
	if (factory == NULL)
	{
		throw new Ogre::Exception(0, "no factory registered for type '" + type + "'", __FILE__);
	}

	Object* obj = factory->createInstance(L, luaReference, name);
	obj->setClassName(className);

	// register the object
	objects[name] = obj;

	return obj;
}
开发者ID:Clever-Boy,项目名称:fusionge,代码行数:28,代码来源:ObjectManager.cpp

示例2: init

void SuifEnv::init() {
  ObjectFactory* of = new SuifEnvObjectFactory;
  set_object_factory( of );
  of -> init( this );

  AggregateMetaClass*
        suifObjectMC = of->create_object_meta_class(
                                 SuifObject::get_class_name(),
                                 sizeof( SuifObject ),
                                 SuifObject::constructorFunction,
            (AggregateMetaClass*)of->lookupMetaClass( Object::get_class_name() ) );

  PointerMetaClass* pointerToSuifObjectR = of->get_pointer_meta_class( suifObjectMC, false );

  suifObjectMC -> add_field_description( "parent", pointerToSuifObjectR, OFFSETOF( SuifObject, parent ) );

  // Brick::init_meta_class(this);

  input_sub_system = new InputSubSystemDefaultImplementation( this );
  output_subsystem = new OutputSubSystemDefaultImplementation( this );
  cloneSubSystem = new CloneSubSystemDefaultImplementation( this );
  _dll_subsystem = new DLLSubSystem( this );
  _module_subsystem = new ModuleSubSystem( this );
  _error_subsystem = new ErrorSubSystem( this );
  _print_subsystem = new PrintSubSystem( this );
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:26,代码来源:suif_env.cpp

示例3: assert

    GeometryShader::GeometryShader(const CompiledShaderByteCode& compiledShader, const StreamOutputInitializers& soInitializers)
    {
        if (compiledShader.GetStage() != ShaderStage::Null) {
            assert(compiledShader.GetStage() == ShaderStage::Geometry);

            auto byteCode = compiledShader.GetByteCode();

            intrusive_ptr<ID3D::GeometryShader> underlying;
            if (soInitializers._outputBufferCount == 0) {

                underlying = ObjectFactory().CreateGeometryShader(byteCode.first, byteCode.second);

            } else {

                assert(soInitializers._outputBufferCount <= D3D11_SO_BUFFER_SLOT_COUNT);
                D3D11_SO_DECLARATION_ENTRY nativeDeclaration[D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT];
                auto delcCount = BuildNativeDeclaration(nativeDeclaration, dimof(nativeDeclaration), soInitializers);

                ObjectFactory objFactory;
                auto featureLevel = objFactory.GetUnderlying()->GetFeatureLevel();
                underlying = objFactory.CreateGeometryShaderWithStreamOutput( 
                    byteCode.first, byteCode.second,
                    nativeDeclaration, delcCount,
                    soInitializers._outputBufferStrides, soInitializers._outputBufferCount,
                        //      Note --     "NO_RASTERIZED_STREAM" is only supported on feature level 11. For other feature levels
                        //                  we must disable the rasterization step some other way
                    (featureLevel>=D3D_FEATURE_LEVEL_11_0)?D3D11_SO_NO_RASTERIZED_STREAM:0);

            }

            _underlying = std::move(underlying);
        }
    }
开发者ID:Clever-Boy,项目名称:XLE,代码行数:33,代码来源:Shader.cpp

示例4: v

void Display::displayRequirements(CmdParser c)
{
	try
	{
		Verbose v(true);
		Verbose::show("******** REQUIREMENT 4 ********");
		Verbose::show("Refer to files Message.h and Message.cpp\n");
		Verbose::show("******** REQUIREMENT 6 ********");
		Verbose::show("Refer to files Communiation.h and Communication.cpp\n");
		Verbose::show("******** REQUIREMENT 8 ********");
		Verbose::show("Refer to files Executive.h, Display.h, Display.cpp and Executive.cpp\n");
		Verbose::show("******** DEMONSTRATING REQUIREMENT 3, 5 & 7 ********\n");
		ObjectFactory of;
		IRecvr *recv = of.createRecvr(stoi(c.getSelfPortNo()));
		ISendr *sender = of.createSendr();
		IMessage *msg = of.createMessage();
		Peer *peer_ = new Peer(sender,recv,msg);
		peer_->start();
		std::cout.flush();
		Verbose::show("\n\n  Press Enter to Exit.");
		std::cin.get();
		peer_->stop();
		
	}
	catch (exception ex)
	{
		string s = ex.what();
		Verbose::show("Exception thrown: "+s);
	}
	


}
开发者ID:akhilpanchal,项目名称:RemoteCodeManagement,代码行数:33,代码来源:Display.cpp

示例5: DoInstall

EnergySourceContainer
EnergySourceHelper::Install (NodeContainer c) const
{
  EnergySourceContainer container;
  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
    {
      Ptr<EnergySource> src = DoInstall (*i);
      container.Add (src);
      /*
       * Check if EnergySourceContainer is already aggregated to target node. If
       * not, create a new EnergySourceContainer and aggregate it to node.
       */
      Ptr<EnergySourceContainer> EnergySourceContrainerOnNode =
        (*i)->GetObject<EnergySourceContainer> ();
      if (EnergySourceContrainerOnNode == NULL)
        {
          ObjectFactory fac;
          fac.SetTypeId ("ns3::EnergySourceContainer");
          EnergySourceContrainerOnNode = fac.Create<EnergySourceContainer> ();
          EnergySourceContrainerOnNode->Add (src);
          (*i)->AggregateObject (EnergySourceContrainerOnNode);
        }
      else
        {
          EnergySourceContrainerOnNode->Add (src);  // append new EnergySource
        }
    }
  return container;
}
开发者ID:shuiziliuBUPT,项目名称:HelloWorld,代码行数:29,代码来源:energy-model-helper.cpp

示例6: while

bool ObjectManager::frameEnded(const Ogre::FrameEvent& evt)
{
	// Step the world and then synchronise the scene nodes with it, 
	// we could get this to do this automatically, but we 
	// can't be sure of what order the frame listeners will fire in
	if (mStepper->step(evt.timeSinceLastFrame))
    {
		std::vector<Object*>::iterator eraseIter = eraseQueue.begin();
		while (eraseIter != eraseQueue.end())
		{
			ObjectFactory* factory = this->getObjectFactory((*eraseIter)->getTypeName());
			assert(factory != NULL);
			factory->destroyInstance(*eraseIter);			
			eraseIter++;
		}		
		eraseQueue.clear();

		mWorld->synchronise(); 

		std::map<std::string, Object*>::iterator iter = objects.begin();
		while (iter != objects.end())
		{			
			if (iter->second != NULL)
			{
				iter->second->update(evt.timeSinceLastFrame);
			}
			iter++;
		}
    }

	return true;
}
开发者ID:Clever-Boy,项目名称:fusionge,代码行数:32,代码来源:ObjectManager.cpp

示例7: TestObjectSerialization3

void TestObjectSerialization3()
{
	ObjectFactory<Serializable> factory;

	//factory.Register("ObjectA", new ObjectCreator<ObjectA, Serializable>());
	factory.Register("ObjectD", new ObjectCreator<ObjectD, Serializable>());


	ObjectD d = ObjectD();
	d.Set(6, 7, 8, "ObjectD baby");
	d.AccessA().Set(1, 2, 3, "ObjectA baby");
	
	BinaryFileStream stream;

	stream.StartWrite("test3.txt");
	d.Save(stream);
	stream.SerializeQueue();
	stream.Close();

	std::vector<Serializable *> load;

	stream.StartRead("test3.txt", factory);
	ObjectD * loaded = stream.GetNext<ObjectD*>();

	stream.Close();
	loaded->Print();
	delete loaded;
}
开发者ID:Akranar,项目名称:daguerreo,代码行数:28,代码来源:TEST_Serialization_TestCases.cpp

示例8: freePlugIn

 void freePlugIn(ExecutableAgent* pPlugin)
 {
    ObjectFactory* pFact = Service<ApplicationServices>()->getObjectFactory();
    if (pFact != NULL)
    {
       pFact->destroyObject(pPlugin, TypeConverter::toString<ExecutableAgent>());
    }
 }
开发者ID:Siddharthk,项目名称:opticks,代码行数:8,代码来源:SimpleExecution.cpp

示例9: freeWizard

 void freeWizard(WizardObject* pWizard)
 {
    ObjectFactory* pFact = Service<ApplicationServices>()->getObjectFactory();
    if (pFact != NULL)
    {
       pFact->destroyObject(pWizard, TypeConverter::toString<WizardObject>());
    }
 }
开发者ID:Siddharthk,项目名称:opticks,代码行数:8,代码来源:SimpleExecution.cpp

示例10: ctkAbstractLibraryFactoryTest1

//-----------------------------------------------------------------------------
int ctkAbstractLibraryFactoryTest1(int argc, char * argv [] )
{
  QApplication app(argc, argv);

  ObjectFactory factory;
  factory.registerItems();

  return EXIT_SUCCESS;
}
开发者ID:bpayne,项目名称:CTK,代码行数:10,代码来源:ctkAbstractLibraryFactoryTest1.cpp

示例11: CreateObjectFactory

ObjectFactory * CreateObjectFactory()
{
    ObjectFactory * factory = new ObjectFactory();
	factory->RegisterObject(new WallObject());
	factory->RegisterObject(new HeatObject());
	factory->RegisterObject(new WindowObject());
	factory->RegisterObject(new Probe());
	factory->RegisterObject(new StoneWallObject());
    return factory;
}
开发者ID:Pamilator,项目名称:CellularAutomata,代码行数:10,代码来源:main.cpp

示例12: Uninitialize

void Uninitialize()
{
    ObjectFactory *instance = ObjectFactory::getInstance();

    if (instance == NULL)
    {
        VMF_EXCEPTION(InternalErrorException, "Can't get Object factory instance");
    }

    std::shared_ptr<IDataSourceFactory> emptyDataSourceFactoryPtr;
    instance->setDataSourceFactory(emptyDataSourceFactoryPtr);
}
开发者ID:savuor,项目名称:vmf,代码行数:12,代码来源:object_factory.cpp

示例13: TestObjectSerialization

void TestObjectSerialization()
{
	ObjectFactory<Serializable> factory;

	factory.Register("ObjectA", new ObjectCreator<ObjectA, Serializable>());
	factory.Register("ObjectB", new ObjectCreator<ObjectB, Serializable>());
	factory.Register("ObjectC", new ObjectCreator<ObjectC, Serializable>());
	factory.Register("STLVectorObjectIO", new ObjectCreator<STLVectorObjectIO<ObjectA>, Serializable>());


	ObjectA a = ObjectA();
	a.Set(1, 2, 3, "ObjectA baby");

	ObjectB b = ObjectB();
	b.Set(6, 7, 8, "ObjectB baby");
	

	ObjectC c = ObjectC();
	c.Set(3, 4, 5, "ObjectC baby");

	b.data4 = &c;
	c.data4 = &b;

	BinaryFileStream stream;

	stream.StartWrite("test.txt");
	a.Save(stream);
	b.Save(stream);
	//c.Save(stream, true);
	stream.SerializeQueue();
	stream.Close();

	std::vector<Serializable *> load;

	stream.StartRead("test.txt", factory);
	//stream.LoadObjects(factory);

	ObjectA * loaded_a = stream.GetNext<ObjectA*>();
	ObjectB * loaded_b = stream.GetNext<ObjectB*>();
	ObjectC * loaded_c = stream.GetNext<ObjectC*>();

	stream.Close();

	loaded_a->Print();
	loaded_b->Print();
	loaded_c->Print();

	delete loaded_a;
	delete loaded_b;
	delete loaded_c;
}
开发者ID:Akranar,项目名称:daguerreo,代码行数:51,代码来源:TEST_Serialization_TestCases.cpp

示例14: Initialize

void Initialize(std::shared_ptr<IDataSourceFactory> &dataSourceFactory)
{
    if (!dataSourceFactory)
    {
        VMF_EXCEPTION(IncorrectParamException, "Unable to initialize by empty DataSourceFactory instance");
    }

    ObjectFactory *instance = ObjectFactory::getInstance();

    if (instance == NULL)
    {
        VMF_EXCEPTION(InternalErrorException, "Can't get Object factory instance");
    }

    instance->setDataSourceFactory(dataSourceFactory);
}
开发者ID:savuor,项目名称:vmf,代码行数:16,代码来源:object_factory.cpp

示例15: CancelEventHandler

WPFCppCliDemo::WPFCppCliDemo()
{
  // set up channel
  ObjectFactory* pObjFact = new ObjectFactory;
  pSendr_ = pObjFact->createSendr();
  pRecvr_ = pObjFact->createRecvr();
  pChann_ = pObjFact->createMockChannel(pSendr_, pRecvr_);
  pChann_->start();
  delete pObjFact;
  // client's receive thread
  recvThread = gcnew Thread(gcnew ThreadStart(this, &WPFCppCliDemo::getMessage));
  recvThread->Start();
  // set event handlers
  this->Loaded += 
    gcnew System::Windows::RoutedEventHandler(this, &WPFCppCliDemo::OnLoaded);
  this->Closing += 
    gcnew CancelEventHandler(this, &WPFCppCliDemo::Unloading);
  hSendButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::sendMessage);
  hClearButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::clear);
  hFolderBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::browseForFolder);
  hConnectButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::connect);
  hUploadBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::uploadBrowseFolder);
  hUploadFileButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::uploadFile);
  hDownloadBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::downloadBrowseFolder);
  hDownloadFileButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::downloadFile);
  hTextSearchButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::textSearch);

  // set Window properties
  this->Title = "WPF C++/CLI Demo";
  this->Width = 800;
  this->Height = 600;
  // attach dock panel to Window
  this->Content = hDockPanel;
  hDockPanel->Children->Add(hStatusBar);
  hDockPanel->SetDock(hStatusBar, Dock::Bottom);
  hDockPanel->Children->Add(hGrid);

  // setup Window controls and views
  setUpTabControl();
  setUpStatusBar();
  setUpSendMessageView();
  setUpConnectionView();
  setUpFileUploadView();
  setUpFileDownloadView();
  setUpTextSearchView();
  setUpFileSearchView();
}
开发者ID:CodeWizrd,项目名称:Remote-Code-Mgmt-Facility,代码行数:47,代码来源:Window.cpp


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