void TowerB::destroy() { mSceneManager->destroyEntity("TowerFrostEntity" + convertInt(ID)); mSceneManager->destroySceneNode("TowerFrostScenenode" + convertInt(ID)); mSceneManager->destroyParticleSystem("TowerBFrost" + convertInt(ID)); }
void TowerA::destroy() { mSceneManager->destroyEntity("TowerFireEntity" + convertInt(ID)); mSceneManager->destroySceneNode("TowerFireScenenode" + convertInt(ID)); mSceneManager->destroyParticleSystem("TowerABlast" + convertInt(ID)); }
std::string Homology::_getDomainString(const std::vector<int>& domain, const std::vector<int>& subdomain) const { std::string domainString = "{"; if(domain.empty()) domainString += "0"; else{ for(unsigned int i = 0; i < domain.size(); i++){ std::string temp = convertInt(domain.at(i)); domainString += temp; if (domain.size()-1 > i){ domainString += ","; } } } domainString += "}"; if(!subdomain.empty()){ domainString += ",{"; for(unsigned int i = 0; i < subdomain.size(); i++){ std::string temp = convertInt(subdomain.at(i)); domainString += temp; if (subdomain.size()-1 > i){ domainString += ","; } } domainString += "}"; } return domainString; }
/** * creates the xml for a coordinator node, the identifier of * this type of node depends upon the number of colliding nodes * @params: node id and node position * @return: the xml string */ string generateCSC::xmlCoordinatorMote(int id, position p) { //header string xml = "\t\t<mote>\n\t\t\t<breakpoints />\n\t\t\t"; xml +="<interface_config>\n\t\t\t\tse.sics.cooja.interfaces.Position"; //position xml += "\n\t\t\t\t<x>" + convertInt(p.x) + "</x>"; xml += "\n\t\t\t\t<y>" + convertInt(p.y) + "</y>"; int colliders = motePositions.retrieveColliders(p); //check if colliders number exceeds the maximum value if(colliders == -1) return ""; //footer xml += "\n\t\t\t\t<z>0.0</z>\n\t\t\t</interface_config>"; xml += "\n\t\t\t<interface_config>\n\t\t\t\tse.sics.cooja.mspmote.interfaces.MspMoteID"; xml += "\n\t\t\t\t<id>" + convertInt(id) + "</id>\n\t\t\t</interface_config>"; xml += "\n\t\t\t<motetype_identifier>sky" + \ convertInt(colliders) + "</motetype_identifier>"; xml += "\n\t\t</mote>\n"; return xml; }
std::string EnemyDragon::appropriateName(NAME_TYPE type) { if(type == SCENE_NODE) return "EnemyDragonScenenode" + convertInt(ID); else if(type == ENTITY) return "EnemyDragonEntity" + convertInt(ID); return NULL; }
std::string Bullet::appropriateName(NAME_TYPE type) { if(type == SCENE_NODE) return "bulletScenenode" + convertInt(ID); else if(type == ENTITY) return "bulletEntity" + convertInt(ID); return NULL; }
std::string TowerA::appropriateName(NAME_TYPE type) { if(type == SCENE_NODE) return "TowerFireScenenode" + convertInt(ID); else if(type == ENTITY) return "TowerFireEntity" + convertInt(ID); return NULL; }
std::string BaseTower::appropriateName(NAME_TYPE type) { if(type == SCENE_NODE) return "TowerScenenode" + convertInt(ID); else if(type == ENTITY) return "TowerEntity" + convertInt(ID); else if(type == PARTICLE) return "TowerParticle" + convertInt(ID); return NULL; }
void MazeController::ligacoes(int value, Maze** maze) { std::list<Liga> p; for (int i = 0; i < value; i++) { for (int j = 0; j < value; j++) { if (i == 5 && j == 5) if (maze[i][j].north == 0){ Liga l; l.aX = j; l.aY = i; l.bX = j; l.bY = i - 1; p.push_back(l); } if (maze[i][j].south == 0){ Liga l; l.aX = j; l.aY = i; l.bX = j; l.bY = i + 1; p.push_back(l); } if (maze[i][j].east == 0) { Liga l; l.aX = j; l.aY = i; l.bX = j + 1; l.bY = i; p.push_back(l); } if (maze[i][j].west == 0) { Liga l; l.aX = j; l.aY = i; l.bX = j - 1; l.bY = i; p.push_back(l); } } } ofstream myfile; myfile.open("example.txt"); int i = 0; while (!p.empty()) { PlTermv av(1); string arg1 = "("; string arg2 = "("; Liga x = p.front(); arg1 += convertInt(x.aX) + ","; arg1 += convertInt(x.aY) + ")"; arg2 += convertInt(x.bX) + ","; arg2 += convertInt(x.bY) + ")"; p.pop_front(); string ligacao = "liga(" + arg1 + "," + arg2 + ")"; av[0] = PlCompound(ligacao.c_str()); PlQuery query("asserta", av); if (query.next_solution()) myfile << ligacao << "." << endl; i++; PlTermv parm(2); parm[0] = PlCompound(arg1.c_str()); PlQuery query2("liga", parm); while (query2.next_solution()){ cout << arg1 << " ---> "; printf(parm[1]); cout << " " << endl; } } myfile.close(); }
string MazeController::cam_curto(int ax, int ay, int mx, int my){ string aaaa1 = "(" + convertInt(ax) + ',' + convertInt(ay) + ')'; string aaaa2 = "(" + convertInt(mx) + ',' + convertInt(my) + ')'; PlTermv av2(3); av2[0] = PlCompound(aaaa1.c_str()); av2[1] = PlCompound(aaaa2.c_str()); PlQuery query("encontra_caminho", av2); string f; query.next_solution(); f += (char*)av2[2]; return f; }
void rebin( int mass=450, double scale=1., double maxErr=0.1, std::string inFileName="", std::string outFileName="", bool make_plots = false ){ // // Mike4x4-style bin ganging // std::cout << "Doing 2D rebinning to 1D, Mike-style\n" << "mass = " << mass << std::endl << "scale factor (optional) = " << scale << std::endl << "max uncertainty = " << maxErr << std::endl << "input file with 2D templates: " << inFileName << std::endl << "output file: " << outFileName << std::endl; std::string channel = "ejets"; int rebin_x = 4; int rebin_y = 4; TString inFileN = inFileName; TFile *infile = new TFile(inFileN); const int nhists = 10; TString histonames[nhists]={ //array of data and background histograms "tprime"+convertInt(mass), "DATA", // data histogram must be first in this list "top", "ewk", "tprime"+convertInt(mass)+"__jes__plus", "tprime"+convertInt(mass)+"__jes__minus", "top__jes__plus", "top__jes__minus", "ewk__jes__plus", "ewk__jes__minus" }; TFile *outfile = new TFile("temp_rebinfile.root","RECREATE"); TH2F *hists[nhists]; for(int nh = 0 ; nh < nhists; ++nh){ hists[nh] = (TH2F*)infile->Get(histonames[nh]); hists[nh] -> Rebin2D(rebin_x,rebin_y); hists[nh] -> Write(); } outfile->Write(); outfile->Close(); combineBins(channel, mass, scale, maxErr,"temp_rebinfile.root", outFileName, "", make_plots); return; }
void EnemyDragon::setUp() { userGUI = UserGUI::getSingletonPtr(); entity = mSceneManager->createEntity(appropriateName(ENTITY), "dragonfootsoldier.mesh"); entity->setQueryFlags(NONE_MASK); sceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(appropriateName(SCENE_NODE)); sceneNode->attachObject(entity); sceneNode->scale(20,20,20); moveCD = 0.8f; allowMoving = false; finishedCurrentMovingSegment = true; assignedCurrentMovingSegment = false; mAnimationState = entity->getAnimationState("Run"); mAnimationState->setLoop(true); entity->getAnimationState("Run")->setEnabled(true); entity->getAnimationState("Run")->setWeight(1.0); killed = false; caught = false; fall = false; tolerance = 4.0f; mWalkSpeed = 85.0f; mDirection = Ogre::Vector3::ZERO; happy2Dead = 5.0f; nearlyDieTime = 3.0f; nearlyDie = false; die = false; reachHome = false; saveBody = 5.0f; ps = mSceneManager->createParticleSystem("EnemyDragonBlast" + convertInt(ID), "TRPlayer/Torch"); sceneNode->attachObject(ps); ps->setVisible(false); lifeValue = 150; worthMoney = 15; mtext = new MovableText("EnemyDragonTXT" + convertInt(ID), convertInt(lifeValue), "StarWars"); mtext->setTextAlignment(MovableText::H_CENTER, MovableText::V_ABOVE); // Center horizontally and display above the node mtext->setLocalTranslation(Vector3(0,80,0)); sceneNode->attachObject(mtext); attackToHome = false; mtext->setCharacterHeight(0.3f); frostCoefficient = 1.0f; fireLastingTime = 0.0f; }
types::Callable::ReturnValue commonInt(types::typed_list &in, int _iRetCount, types::typed_list &out, std::string _stName) { if (in.size() != 1) { Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), _stName.c_str(), 1); return types::Function::Error; } if (in[0]->isDouble() == false && in[0]->isInt() == false && in[0]->isBool() == false) { Scierror(999, _("%s: Wrong type for input argument #%d: %s, %s or %s expected.\n"), _stName.c_str(), 1, "integer", "boolean", "double"); return types::Function::Error; } types::GenericType* pGT = in[0]->getAs<types::GenericType>(); if (pGT->getDims() == 2 && pGT->getRows() == 0 && pGT->getCols() == 0) { out.push_back(types::Double::Empty()); return types::Function::OK; } T* pOut = new T(pGT->getDims(), pGT->getDimsArray()); convertInt(in[0], pOut); out.push_back(pOut); return types::Function::OK; }
void Bullet::destroy() { //mSceneManager->destroyParticleSystem("blast" + convertInt(ID)); if(type == BULLET_NORMAL) { mSceneManager->destroyEntity(appropriateName(ENTITY)); mSceneManager->destroySceneNode(appropriateName(SCENE_NODE)); }else if(type == LIGHT_CHAIN) { mSceneManager->destroyEntity("LightChainScenenode" + convertInt(ID)); mSceneManager->destroySceneNode("LightChainEntity" + convertInt(ID)); mSceneManager->destroyParticleSystem("LightChainParticle" + convertInt(ID)); } }
void writeSD(char name[], int score) { short int handler = alt_up_sd_card_fopen(SCORE_NAME, true); int index = 0; char score_str[4]; if (handler == -1) { handler = alt_up_sd_card_fopen(SCORE_NAME, false); setPositionToEnd(handler); } if (handler >= 0) { while (name[index] != '\0') { alt_up_sd_card_write(handler, name[index]); index++; } alt_up_sd_card_write(handler, 0x2F); // slash index = 0; convertInt(score_str, score); while (score_str[index] != '\0') { alt_up_sd_card_write(handler, score_str[index]); index++; } alt_up_sd_card_fclose(handler); } else { printf("Handler:%d\n", handler); printf("Cannot write the score. \n"); } }
int main(int argc, char *argv[]) { int redemarrage = atoi(argv[7]); int position = atoi(argv[6]); GUI_ARINC_partition("Partition1", position, redemarrage); int nbarg = argc; char **argument = new char*[argc]; int i = 0; for (i = 0; i <= nbarg; i++) { argument[i] = argv[i]; } COMMUNICATION_VECTOR myCvector; myCvector = init_communication(argument, NULL); std::string name = argv[0]; int portID; int sock; vector_get(&(myCvector.vqueuing_port), 0, &portID); std::cout << "QueingPort : " << portID << std::endl; vector_get(&(myCvector.vqueuing_socket), 0, &sock); std::cout << "Queuing socket : " << sock << std::endl; std::string emetteur = myCvector.emetteur; std::string commande = "java TestJNI " + name + " " + convertInt(portID) + " " + convertInt(sock) + " " + emetteur; system(commande.c_str()); }
int File_manager::save_file(string filename, string temp){ upgrade_lock<shared_mutex> up_guard(l_mutex); path f(filename); path t=temp; t+=f; path d=database; d+=f; system::error_code ec; try { copy_file(t, d, copy_option::fail_if_exists, ec); while(ec.value()==EEXIST){ d=database; d+=convertInt(rand()%10000000); d+=f; copy_file(t, d, copy_option::fail_if_exists, ec); cout<<d<<endl; } } catch (const filesystem_error& ex) { cout << ex.what() << '\n'; return -3; } return 0; }
void Instruction::setData(const ArgVal* d) { if(!d || !d->isNum()) { setData((uint16_t)0); return; } setData(convertInt(d->getNum())); }
string PostCal::convertConfig2String(int * config, int size) { string result = "0"; for(int i = 0; i < size; i++) if(config[i]==1) result+= "_" + convertInt(i); return result; }
std::string toString() { std::string result = "["; for (int i = 0; i < dim; i++) { result.append(convertInt(getNumConflictsVectorized(i+1))); if (i+1 < dim) { result.append(","); } } result.append("]"); return result; }
void TowerB::setUp() { entity = mSceneManager->createEntity("TowerFrostEntity" + convertInt(ID), "Dryad.mesh"); entity->setQueryFlags(TOWER_FROST_MASK); sceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode("TowerFrostScenenode" + convertInt(ID)); sceneNode->attachObject(entity); sceneNode->scale(0.1,0.1,0.1); bulletFactory = BulletFactory::getSingletonPtr(); enemyFactory = EnemyFactory::getSingletonPtr(); die = false; range = 250; debug = DebugOverlay::getSingletonPtr(); ps = mSceneManager->createParticleSystem("TowerBBlast" + convertInt(ID), "Examples/Snow"); sceneNode->attachObject(ps); ps->setVisible(false); }
/** * creates the xml for a listener node, sky15 is the identifier * for a listener node * @param: node id and node position * @return: the xml string */ string generateCSC::xmlListenerMote(int id, position p) { //header string xml = "\t\t<mote>\n\t\t\t<breakpoints />\n\t\t\t"; xml += "<interface_config>\n\t\t\t\tse.sics.cooja.interfaces.Position"; //position xml += "\n\t\t\t\t<x>" + convertInt(p.x) + "</x>"; xml += "\n\t\t\t\t<y>" + convertInt(p.y) + "</y>"; xml += "\n\t\t\t\t<z>0.0</z>\n\t\t\t</interface_config>"; //footer xml += "\n\t\t\t<interface_config>\n\t\t\t\tse.sics.cooja.mspmote.interfaces.MspMoteID"; xml += "\n\t\t\t\t<id>" + convertInt(id) + "</id>\n\t\t\t</interface_config>"; xml += "\n\t\t\t<motetype_identifier>sky15</motetype_identifier>"; xml += "\n\t\t</mote>\n"; //cout<<xml<<endl; return xml; }
void TowerA::setUp() { entity = mSceneManager->createEntity("TowerFireEntity" + convertInt(ID), "tower2.mesh"); entity->setQueryFlags(TOWER_FIRE_MASK); sceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode("TowerFireScenenode" + convertInt(ID)); sceneNode->attachObject(entity); sceneNode->scale(3,3,3); bulletFactory = BulletFactory::getSingletonPtr(); enemyFactory = EnemyFactory::getSingletonPtr(); die = false; range = 500; debug = DebugOverlay::getSingletonPtr(); ps = mSceneManager->createParticleSystem("TowerABlast" + convertInt(ID), "TRPlayer/Torch"); sceneNode->attachObject(ps); ps->setVisible(false); }
bool ConnetMySql() { string Host,Login,Password,db,St,filename,ty; unsigned int Port=0; filename = db_conf;//"/etc/palarabic.conf"; if(ExistsFile(filename)){ vector<string> arr,arr2; St = ReadAllFile(filename); arr = Split(St,"\n"); if ((int)arr[0].find("File Config DataBase (Bouhssini)")== -1) goto aa; for (Uint i=2;i<arr.size();i++) { arr2 = Split(arr[i],"="); if ((int)LCASE(arr2[0]).find("host")!=-1) Host = Trim(arr2[1]); else if ((int)LCASE(arr2[0]).find("port")!=-1) Port = atoi(Trim(arr2[1]).c_str()); else if ((int)LCASE(arr2[0]).find("login")!=-1) Login = Trim(arr2[1]).c_str(); else if ((int)LCASE(arr2[0]).find("password")!=-1) Password = Trim(arr2[1]).c_str(); else if ((int)LCASE(arr2[0]).find("db")!=-1) db = Trim(arr2[1]).c_str(); else if ((int)LCASE(arr2[0]).find("type")!=-1) ty = Trim(arr2[1]).c_str(); } if (LCASE(ty)!="mysql") goto Err; }else{ Host = "localhost"; Port = 3306; Login = "******"; Password = "******"; db = "maahad_hakiba"; ty = "MySQL" ; WriteFile(filename,"## File Config DataBase (Bouhssini) ##\n"); WriteFile(filename,"#######################################\n"); WriteFile(filename,"\n"); WriteFile(filename,"Host = "+Host+"\n"); WriteFile(filename,"Port = "+convertInt(Port)+"\n"); WriteFile(filename,"Login = "******"\n"); WriteFile(filename,"Password = "******"\n"); WriteFile(filename,"DB = "+db+"\n"); WriteFile(filename,"Type = "+ty+"\n"); } aa: conn = mysql_init(NULL); if (conn == NULL) goto Err; if (mysql_real_connect(conn, Host.c_str(), Login.c_str(), Password.c_str(), db.c_str(), Port, NULL, 0)==NULL) goto Err; mysql_query(conn, "SET CHARACTER SET utf8"); mysql_query(conn, "SET NAMES utf8"); return true; Err: conn = NULL; return false; }
void setlevel_one() { for(uint8_t i=0;i<N_NAVI_NEMICHE_MODELLO_1;i++) { enemy[i] = new nave(49,29,100,30,1.5,300); enemy[i]->setAnimation(animation_enemy[i]); enemy[i]->setScale(30); if(i==1) enemy[i]->setPosx(resx+(200)); else enemy[i]->setPosx(resx+100); enemy[i]->setPosy((i*200)+90); enemies[i]=true; } Stage_one = animation_manager->createAnimation(); for(int i=0;i<31;i++) { std::string app; app = "./img/Firststage[" + convertInt(i) + "].png"; text_Stage_one[i] = res->createTextureResource(app.c_str()); if(i==18) { for(int k=0;k<60;k++) { Stage_one->pushFrame(text_Stage_one[i]); } } else { Stage_one->pushFrame(text_Stage_one[i]); } } Stage_one->setBlending(true); Stage_one->setFPS(30); Stage_one->setPosition(0,0); Stage_one->setLoop(false); timer_scritta.reset(); }
std::string toString() { std::string result = "["; for (int i = 1; i <= dim; i++) { if(checkCandidate(i)) { result.append(convertInt(i)); if (i+1<=dim) { result.append(","); } } } result.append("]"); return result; }
std::string Boton::getRosalilaInputs() { if(usando_joystick) { if(joystick>=0) return convertInt(joystick); if(joystick==-8) return std::string("up"); if(joystick==-2) return std::string("down"); if(joystick==-4) return std::string("left"); if(joystick==-6) return std::string("right"); return std::string("d"); }else { return std::string(keyToString()); } }
void setAll(int& x,int& y,int& xBlock,int& yBlock) { x = 375; y = 250; if(!font.loadFromFile("ethnocentric rg.ttf")) { //error... }; text = convertInt(score1); score.setString(text); score.setFont(font); score.setCharacterSize(24); score.setColor(sf::Color(60,60,255)); square.setPosition(x,y); xBlock = 100; yBlock = 100; }
void MigrationOutliner::outline_ForToFunction(SgForStatement *f){ #define TOOL "OutlineFor_ToFunction" string msg; msg = "START: outline For loops"; DEBUG(TOOL,msg); //get parent function to create appropriate Name //append name to reflect position string addon = convertInt(counter); string outlineFuncName = "foorLOOP"; outlineFuncName +=addon; ++counter; //make parameterList SgFunctionParameterList *pList = new SgFunctionParameterList(); //make the func SgFunctionDeclaration *outlined = buildDefiningFunctionDeclaration(outlineFuncName, buildVoidType(), pList, f->get_scope()); //query for dependencies //make function declaration copy at top? //SgFunctionDeclaration* outlineFunc_Decl = buildNondefiningFunctionDeclaration(outlineFuncName, buildVoidType(), pList, f->get_scope()); //fill function with guts SgStatement* loop_body = f->get_loop_body(); //SgBasicBlock* lbody = loop_body->get_definition(); ROSE_ASSERT(loop_body != NULL); copyToFunctionBody(loop_body,outlined); appendStatement(outlined, f->get_scope()); //add dependencies to function parameters //insert funciton declaration in same file as where for loop originates //insert function definition at EOF }
void BaseTower::destroy() { if(type == 1) { mSceneManager->destroyEntity(appropriateName(ENTITY)); mSceneManager->destroySceneNode(appropriateName(SCENE_NODE)); mSceneManager->destroyParticleSystem(appropriateName(PARTICLE)); }else if (type == 2){ mSceneManager->destroyEntity("TowerFireEntity" + convertInt(ID)); mSceneManager->destroySceneNode("TowerFireScenenode" + convertInt(ID)); mSceneManager->destroyParticleSystem("TowerABlast" + convertInt(ID)); }else if (type == 3){ mSceneManager->destroyEntity("TowerFrostEntity" + convertInt(ID)); mSceneManager->destroySceneNode("TowerFrostScenenode" + convertInt(ID)); mSceneManager->destroyParticleSystem("TowerBBlast" + convertInt(ID)); } }