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


C++ DataManager类代码示例

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


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

示例1: DataManager

void TopicModel::saveTopicData(QString qname, int k) {

    DataManager *datamanager = new DataManager();

    sleep(1);

    connect(datamanager, SIGNAL(saveTick(int)), this, SIGNAL(saveTick(int)));

    emit changeStatus("Saving");

    /*************************************/
    // Save parameters
    /*************************************/

    datamanager->saveInt(qname, "M", "M", M);

    /*************************************/
    // Save Theta
    /*************************************/

    if(k == 0) {
        datamanager->saveArray(qname, "Theta", "feature", "probability", Theta0);
    } else {
        datamanager->saveArray(qname, "Theta", "feature", "probability", Theta[k-1]);
    }

    emit changeStatus("Ready");
    disconnect(datamanager, SIGNAL(loadTick(int)), this, SIGNAL(loadTick(int)));
    delete datamanager;
}
开发者ID:tornadory,项目名称:VideoAnalysis-1,代码行数:30,代码来源:TopicModel.cpp

示例2: set_time

bool set_time(int id)
{
	if(id < 0)
		return false;
	DataManager* data = DataManager::instanceOf();
	for(int i = 0; i < 3; ++i)
	{
		string tmp;
		int hour, min, sec;
		cout << "podaj dokladny czas" << endl;
		
		cout << "teraz podaj: godzine" << endl;
		hour = get_from_stdin();

		cout << "podaj: minute" << endl;
		min = get_from_stdin();
		
		cout << "podaj: sekunde" << endl;
		sec = get_from_stdin();
		try{
		if( data->getList().find(id)->setTime(hour,min,sec) )
		{
			return true;
		}
		}
		catch(invalid_argument e)
		{
			cerr << "bledny czas" << endl;
		}
			
	}
	return false;
}
开发者ID:damikl,项目名称:ZaawanCpp,代码行数:33,代码来源:cmdinterface.cpp

示例3: set_date

bool set_date(int id)
{
	if(id < 0)
		return false;
	DataManager* data = DataManager::instanceOf();
	for(int i = 0; i < 3; ++i)
	{
		string tmp;
		int day, month, year;
		cout << "podaj date" << endl;
		cout << "teraz podaj: dzien" << endl;
		day = get_from_stdin();
	
		cout << "podaj: miesiac" << endl;
		month = get_from_stdin();
		
		cout << "podaj: rok" << endl;
		year = get_from_stdin();
		try{
			if( data->getList().find(id)->setDate(day,month,year) )
			{
				return true;
			}
		}
		catch(invalid_argument e)
		{
			cerr << "bledna data" << endl;
		}

	}
	return false;
}
开发者ID:damikl,项目名称:ZaawanCpp,代码行数:32,代码来源:cmdinterface.cpp

示例4:

MovableProducer::MovableProducer(DataManager &dm, const gamedata::unit_movable *um)
	:
	ObjectProducer(dm, um),
	unit_data(*um),
	on_move{dm.get_sound(this->unit_data.move_sound)},
	on_attack{dm.get_sound(this->unit_data.move_sound)},
	projectile{dm.get_type(this->unit_data.projectile_unit_id)} {

	// extra graphics if available
	// villagers have invalid attack and walk graphics
	// it seems these come from the command data instead
	auto walk = dm.get_unit_texture(this->unit_data.walking_graphics0);
	if (!walk) {

		// use standing instead
		walk = this->graphics[graphic_type::standing];
	}
	this->graphics[graphic_type::walking] = walk;

	// reuse as carry graphic if not already set
	if (this->graphics.count(graphic_type::carrying) == 0) {
		this->graphics[graphic_type::carrying] = walk;
	}

	auto attack = dm.get_unit_texture(this->unit_data.attack_graphic);
	if (attack && attack->is_valid()) {
		this->graphics[graphic_type::attack] = attack;
	}

	// extra abilities
	this->type_abilities.emplace_back(std::make_shared<MoveAbility>(this->on_move));
	this->type_abilities.emplace_back(std::make_shared<AttackAbility>(this->on_attack));
}
开发者ID:MrBeardy,项目名称:openage,代码行数:33,代码来源:producer.cpp

示例5: handleDSActivation

bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    std::vector<unsigned int> const & dims = dm->getDimensions();
    unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
    float scrollPos = sb->getScrollPosition();
    dm->activate(dim);
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->enable();
    CEGUI::WindowEventArgs w(sb);
    sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
    // Set the global scrollbar to the right position.
    sb->setScrollPosition(scrollPos);
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->show();
  }
  // TODO handle else-error
  return true;
}
开发者ID:Nvveen,项目名称:Revolution,代码行数:27,代码来源:GUIManager.cpp

示例6: Init

void RootUI::Init()
{


	CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
	Root = wmgr.loadLayoutFromFile("ui.layout");
	CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(Root);


	Controller * ctrl = static_cast<Controller*>(GetManager()->Get("Controller"));
	DataManager * dm = static_cast<DataManager*>(GetManager()->Get("DataManager"));



	ResourceLoader * res = static_cast<ResourceLoader*>(dm->Get("Resources"));



	root_settings = new RootSettings(res, Root);
	top_root = new TopRoot(dm, Root);




}
开发者ID:aaether14,项目名称:3D-Adventures,代码行数:25,代码来源:ui_root.cpp

示例7: Enable

void TerrainWrapper::Enable()
{




	Controller * ctrl = static_cast<Controller*>(GetManager()->Get("Controller"));
	DataManager * dm = static_cast<DataManager*>(GetManager()->Get("DataManager"));



	Techniques * tech = static_cast<Techniques*>(dm->Get("Techniques"));
	ResourceLoader * res = static_cast<ResourceLoader*>(dm->Get("Resources"));
	Environment * env = static_cast<Environment*>(res->Get("Environment"));
	Camera * camera = static_cast<Camera*>(ctrl->Get("Camera"));
	View * view = camera->GetView();
	ViewInfo * info = camera->GetInfo();



	Shader::Enable();
	Shader::Set("myTextureSampler", 0);
	Shader::Set("myTextureSampler2", 1);
	Shader::Set("myTextureSampler3", 2);
	Shader::Set("shadow_map", 3);
	TerrainShader::SendTextureAttributes(terra->GetTextureAttributes(), 4);


	/**
	Raising to power for gamma correction
	*/
	getLight()->SetFog(glm::pow(env->fog_color, glm::vec3(2.2)), env->fog_density);
	getLight()->SetDirectionalLight(env->terrain_bright*
		glm::pow(env->sun_color, glm::vec3(2.2)),
		env->sun_dir,
		env->terrain_ambient,
		env->terrain_diffuse);





	Set("LightMatrix", Math::GetBiasMatrix()*
		tech->GetShadow()->GetDirectionalShadow(env, info, view));



	tech->GetShadow()->GetShadowMap()->BindTexture(0, GL_TEXTURE3);
	tech->GetShadow()->GetShadowMap()->ResetTextureState();




	ManagePlayerCollision(ctrl, false);



}
开发者ID:aaether14,项目名称:3D-Adventures,代码行数:58,代码来源:terrain_wrapper.cpp

示例8: GetItemStatusChange

//ゲットしたアイテムの状態をNEWに
void TreasureEffect::GetItemStatusChange(void){
	DataManager *data = &DataManager::GetInstance();

	if(data->m_MogllStatus.treasureStatus != -1 && data->m_MogllStatus.treasureStatus < 60){
		data->m_SaveData.itemStatus[data->m_MogllStatus.treasureStatus] = DataManager::ITEM_NEW;
		data->SaveData();
	}

}
开发者ID:rurudo,项目名称:moguru,代码行数:10,代码来源:TreasureEffect.cpp

示例9: LoadVolumes

void ColocalizationDlg::LoadVolumes()
{
	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame) return;

	DataManager* mgr = vr_frame->GetDataManager();
    if (!mgr) return;

	m_vol_a = mgr->GetVolumeData(m_calc_a_text->GetValue());
	m_vol_b = mgr->GetVolumeData(m_calc_b_text->GetValue());
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:11,代码来源:ColocalizationDlg.cpp

示例10: GetNextItem

void DataListCtrl::EndEdit(bool update)
{
	if (!m_rename_text->IsShown())
		return;

	if (update)
	{
		wxString new_name = m_rename_text->GetValue();

		long item = GetNextItem(-1,
			wxLIST_NEXT_ALL,
			wxLIST_STATE_SELECTED);
		VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
		DataManager* mgr = vr_frame?vr_frame->GetDataManager():0;

		if (item != -1 && mgr)
		{
			wxString name = GetText(item, 1);

			if (new_name != name)
			{
				wxString new_name2 = new_name;
				for (int i=1; mgr->CheckNames(new_name2); i++)
					new_name2 = new_name+wxString::Format("_%d", i);


				if (GetItemText(item) == "Volume")
				{
					VolumeData* vd = mgr->GetVolumeData(name);
					if (vd)
						vd->SetName(new_name2);
				}
				else if (GetItemText(item) == "Mesh")
				{
					MeshData* md = mgr->GetMeshData(name);
					if (md)
						md->SetName(new_name2);
				}
				else if (GetItemText(item) == "Annotations")
				{
					Annotations* ann = mgr->GetAnnotations(name);
					if (ann)
						ann->SetName(new_name2);
				}

				//update ui
				SetText(item, 1, new_name2);
				vr_frame->UpdateTree();
			}
		}
	}

   m_rename_text->Hide();
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:54,代码来源:ListPanel.cpp

示例11: Render

void TerrainWrapper::Render()
{




	Controller * ctrl = static_cast<Controller*>(GetManager()->Get("Controller"));
	DataManager * dm = static_cast<DataManager*>(GetManager()->Get("DataManager"));


	Techniques * tech = static_cast<Techniques*>(dm->Get("Techniques"));
	ResourceLoader * res = static_cast<ResourceLoader*>(dm->Get("Resources"));
	Environment * env = static_cast<Environment*>(res->Get("Environment"));
	Camera * camera = static_cast<Camera*>(ctrl->Get("Camera"));
	View * view = camera->GetView();
	ViewInfo * info = camera->GetInfo();





	if (tech->GetSSAO()->OnGeometryPass())
	{


		tech->GetSSAO()->SetGeometryPassUniforms(view->getCamera(),
			view->getViewMatrix());


	}
	else if (tech->GetShadow()->OnShadowPass())
	{

		tech->GetShadow()->UniformMVP(tech->GetShadow()->GetDirectionalShadow(env, info, view));


	}
	else
	{


		Space(glm::mat4(1.0), view);


	}



	terra->Render(camera->GetFrustum(), false);




}
开发者ID:aaether14,项目名称:3D-Adventures,代码行数:54,代码来源:terrain_wrapper.cpp

示例12: main

int main(int argc, char** argv)
{
	SoundTest app;

	// Read config file name from command line or use default one.
	const char* cfgName = "soundTest.cfg";
	if(argc == 2) cfgName = argv[1];

	Config* cfg = new Config(cfgName);

	DataManager* dm = DataManager::getInstance();
	// Add a default filesystem data source using current work dir.
	dm->addSource(new FilesystemDataSource("./"));
	dm->addSource(new FilesystemDataSource(OMICRON_DATA_PATH));

	ServiceManager* sm = new ServiceManager();
	sm->setupAndStart(cfg);

	float delay = -0.01f; // Seconds to delay sending events (<= 0 disables delay)
#ifdef _DEBUG
	bool printOutput = true;
#else
	bool printOutput = false;
#endif

	while(true)
	{
		sm->poll();

		// Get events
		int av = sm->getAvailableEvents();
		if(av != 0)
		{
			// TODO: Instead of copying the event list, we can lock the main one.
			Event evts[OMICRON_MAX_EVENTS];
			sm->getEvents(evts, OMICRON_MAX_EVENTS);
			for( int evtNum = 0; evtNum < av; evtNum++)
			{
				app.handleEvent(evts[evtNum]);
			}
			app.update();
			//if( printOutput )
			//	printf("------------------------------------------------------------------------------\n");
		}
	}

	sm->stop();
	delete sm;
	delete cfg;
	delete dm;
	
	return 0;
}
开发者ID:OKaluza,项目名称:omicron,代码行数:53,代码来源:soundtest.cpp

示例13: main

// DEPRECATED, gnuplot.cpp will be removed soon
int main(void)
{
  DataManager dm;
  std::shared_ptr<
      std::set<std::shared_ptr<Track> >
    > result = dm.computeTracks();

  std::cout << "Tracks:" << std::endl;
  for (auto t : *result)
  {
    std::cout << "Track: " << t->getLongitude() <<","<<t->getLatitude() << std::endl;
  }

  return 0;
}
开发者ID:bandarichen,项目名称:track0matic,代码行数:16,代码来源:gnuplot.cpp

示例14: handleDSSelection

bool GUIManager::handleDSSelection ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
  DataManager *dm = static_cast<DataManager *>(
      lb->getFirstSelectedItem()->getUserData());
  _selectedDM = dm;
  std::vector<unsigned int> const & dim = dm->getDimensions();
  sb->setStepSize(1.0/float(dim.size()-1));
  sb->enable();
  CEGUI::WindowEventArgs w(sb);
  sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
  return true;
}
开发者ID:Nvveen,项目名称:Revolution,代码行数:16,代码来源:GUIManager.cpp

示例15: readFromFile

	// function that reads in data from file into data maps
	static bool readFromFile(DataManager<T>& data, 
						     const std::string& dataPath) {
		// declare vector for saving file names
		std::vector<std::string> fileList;
        try {
			// get file list
			getFileList(fileList, dataPath);
			// count number of files
			size_t noOfFiles{fileList.size()};
			// loop through all files
			for (size_t i{}; i < noOfFiles; ++i) {
				// declare experiment object
				Experiment<T> userExperiment;
				// pass file name to experiment read from file function
				userExperiment.readFromFile(fileList[i]);
				// insert data into maps
				data.insertExperiment(userExperiment);
			}  
        }
        catch (const std::invalid_argument& e) {
            ErrorMsg::print(e.what());
            return false;
        }
        return true;
	}	
开发者ID:snaiste,项目名称:oop,代码行数:26,代码来源:dataInput.hpp


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