void CCMSDIntegrator::ParseCMSD(std::string filename) { CMSD::CCMSD doc = CMSD::CCMSD::LoadFromFile(filename); doc.SaveToFile((::ExeDirectory() + "Test1.xml").c_str(), true); //CMSD::CCMSD::DataSection d = doc.DataSection().first(); CMSD::CwhiteSpaceType root = doc.whiteSpace.first(); CMSD::CCMSDDocument cmsddocument = doc.CMSDDocument[0]; CMSD::CDataSectionType2 data = cmsddocument.DataSection[0]; for(int i=0; i< data.PartType.count() ; i++) { Part * apart ( (Part*) Part().CreateSave<Part>()); apart->Load(data.PartType[i].GetNode()); //std::vector<IObjectPtr> &someparts ( apart->objects()); //Part * part2=(Part *) someparts[0].get(); } for(int i=0; i< data.ProcessPlan.count() ; i++) { ProcessPlan * aplan ( (ProcessPlan *) IObject::CreateSave<ProcessPlan>()); aplan->Load(data.ProcessPlan[i].GetNode()); } for(int i=0; i< data.Resource.count() ; i++) { if(Cell::IsResourceCell(data.Resource[i].GetNode())) { Cell * acell( (Cell *) IObject::CreateSave<Cell>()); acell->Load(data.Resource[i].GetNode()); } else { Resource * aresource ((Resource *) IObject::CreateSave<Resource>()); aresource->Load(data.Resource[i].GetNode()); } } for(int i=0; i< data.Job.count() ; i++) { Job * ajob ( IObject::CreateSave<Job>() ); ajob->Load(data.Job[i].GetNode()); } for(int i=0; i< data.DistributionDefinition.count() ; i++) { Distribution * astat ( (Distribution *) IObject::CreateSave<Distribution>() ); astat->LoadDefinition(data.DistributionDefinition[i].GetNode()); } for(int i=0; i< data.Calendar.count() ; i++) { Calendar * calendar ( (Calendar *) IObject::CreateSave<Calendar>()); calendar->Load(data.Calendar[i].GetNode()); } for(int i=0; i< data.Layout.count() ; i++) { Layout * layout ((Layout *) IObject::CreateSave<Layout>()); layout->Load(data.Layout[i].GetNode()); } //CMSD::CInventoryItem inv = data.InventoryItem[0]; //inv.Location int j=0; }
void MakeCore(Resource &res) { assert(res.GetName() == "core"); res.Load(); for (token_map::iterator i = s_token_map.begin(); i != s_token_map.end(); ++i) { const std::string &token = i->first; std::string text = res.Get(token); if (text.empty()) { Output("%s/%s: token '%s' not found\n", res.GetName().c_str(), res.GetLangCode().c_str(), token.c_str()); text = token; } if (text.size() > size_t(STRING_RECORD_SIZE)) { Output("%s/%s: text for token '%s' is too long and will be truncated\n", res.GetName().c_str(), res.GetLangCode().c_str(), token.c_str()); text.resize(STRING_RECORD_SIZE); } // const_cast so we can set the string, see above char *record = const_cast<char*>(i->second); copy_string(record, text.c_str(), text.size(), STRING_RECORD_SIZE); } s_coreResource = res; }
void mgtk_test_handle_resource_start() { // Setup the UI ( mlisp test ) if ( !gResource.Load( "test.mlisp" ) ) { } }
int main(int argc, char *argv[]) { Resource test; printf("[Resource class test]\n"); if (argc > 1) { mgtk_init(argc, argv); test.Load(argv[1]); test.Print(); mgtk_start(); } }
int ResourceManager::Execute( ) { while( IsRunning( ) ) { mHasQueued.WaitFor( ); mQueueLock.Enter( ); while( !mQueue.empty( ) ) { Resource* res = mQueue.front( ); mQueue.pop( ); mQueueLock.Leave( ); res->Load( ); mQueueLock.Enter( ); } mHasQueued.Reset( ); mQueueLock.Leave( ); } return 0; };