void addSupplier() { char ch='y'; FILE *fp; system("cls"); fp=fopen("supplier.data","a"); if(fp==NULL) { printf("file can not be opened !!"); exit(0); } while(ch=='y') { Box_up(); bigBox(); gotoxy(26,4); printf(" *** CAIRO PHARMACY *** "); gotoxy(28,12); printf("%c %c",175,175); printf(" Add supplier "); gotoxy(46,12); printf("%c %c",174,174); supp_data.supplier_ID=getSupplier_ID(); gotoxy(4,14); printf("* Supplier ID :%d",supp_data.supplier_ID); gotoxy(4,17); printf("* supplier Name: "); gotoxy(4,20); printf("* supplier Mobile: "); gotoxy(4,23); printf("* supplier E-mail: "); gotoxy(4,26); printf("* supplier City: "); gotoxy(22,17); getAllData(supp_data.supplier_name,0); gotoxy(23,20); getAllData(supp_data.supplier_mobile,1); gotoxy(23,23); getAllData(supp_data.supplier_E_mail,0); gotoxy(23,26); getAllData(supp_data.supplier_name,0); gotoxy(7,28); printf("[ Save / Cancel ] ::"); gotoxy(26,28); printf(" please Enter the first character: "); ch=(getch()); } }
int main() { std::vector<obj> proba; proba = getAllData(); // std::cout << proba << std::endl; }
void getAllData(Container& vals) const { int64_t npair; if (this->rank == 0) { getAllData(vals, 0); npair = vals.size(); } else { getAllData(0); } this->arena.Bcast(&npair, 1, 0); if (this->rank != 0) vals.resize(npair); this->arena.Bcast(vals, 0); }
BOOL execute(TestInfo* pTestInfo, SQLHANDLE secHandle, char* tempStr, short expRet) { RETCODE returncode; LogMsg(NONE,"%s\n", tempStr); returncode = SQLExecDirect(secHandle, (SQLCHAR *)tempStr, SQL_NTS ); if( returncode != expRet) { LogAllErrors (pTestInfo->henv, pTestInfo->hdbc, secHandle); if(returncode != SQL_SUCCESS_WITH_INFO) { LogMsg(ERRMSG, "Failed\n"); return FALSE; } return TRUE; } else { if (expRet == SQL_SUCCESS) { returncode = getAllData(secHandle, returncode); if(returncode == FALSE) LogMsg(ERRMSG, "Unable to get data\n"); } else { //LogAllErrors (pTestInfo->henv, pTestInfo->hdbc, secHandle); LogMsg(NONE,"Passed\n"); } SQLFreeStmt(secHandle,SQL_CLOSE); return TRUE; } }
void TableView::view() { QTextEdit* pte=new QTextEdit(); pte->setReadOnly(true); pte->setText(getAllData(*db,name.toStdString()).c_str()); // l->setGeometry(100,100,400,400); pte->show(); }
std::string GeometryPort::getHash() const { if (!hasData()) return ""; std::string hashes; std::vector<const Geometry*> geometries = getAllData(); if (geometries.size() == 1) return geometries.front()->getHash(); else { for (size_t i=0; i<geometries.size(); i++) hashes += geometries.at(i)->getHash(); return VoreenHash::getHash(hashes); } }
void Tracks::timerCallBack(const ros::TimerEvent &) { bool send = getAllData(); kraken_msgs::imuData data; if(count<=5) { _offset = _data; count++; } else { data = _data; //data[roll] = (((int)((_data.data[roll]-_offset.data[roll])*10000))%((int)(360*10000)))/10000.0; data.data[roll] = data.data[roll]/360.0*2*pi; //data[pitch] = (((int)((_data.data[pitch]-_offset.data[pitch])*10000))%((int)(360*10000)))/10000.0; data.data[pitch] = data.data[pitch]/360.0*2*pi; //data.data[yaw] = (((int)((_data.data[yaw]-_offset.data[yaw])*10000))%((int)(360*10000)))/10000.0; data.data[yaw] = data.data[yaw]/360.0*2*pi; if(send) _publisher.publish(data); } }
/** Loads the kart properties from a file. * \param filename Filename to load. * \param node Name of the xml node to load the data from */ void KartProperties::load(const std::string &filename, const std::string &node) { // Get the default values from STKConfig. This will also allocate any // pointers used in KartProperties copyFrom(&stk_config->getDefaultKartProperties()); // m_kart_model must be initialised after assigning the default // values from stk_config (otherwise all kart_properties will // share the same KartModel m_kart_model = new KartModel(/*is_master*/true); const XMLNode * root = 0; m_root = StringUtils::getPath(filename); m_ident = StringUtils::getBasename(StringUtils::getPath(filename)); try { root = new XMLNode(filename); if(!root || root->getName()!="kart") { std::ostringstream msg; msg << "Couldn't load kart properties '" << filename << "': no kart node."; delete m_kart_model; throw std::runtime_error(msg.str()); } getAllData(root); } catch(std::exception& err) { fprintf(stderr, "Error while parsing KartProperties '%s':\n", filename.c_str()); fprintf(stderr, "%s\n", err.what()); } if(root) delete root; // Set a default group (that has to happen after init_default and load) if(m_groups.size()==0) m_groups.push_back(DEFAULT_GROUP_NAME); // Load material std::string materials_file = m_root+"/materials.xml"; file_manager->pushModelSearchPath (m_root); file_manager->pushTextureSearchPath(m_root); // addShared makes sure that these textures/material infos stay in memory material_manager->addSharedMaterial(materials_file); m_icon_file = m_root+"/"+m_icon_file; // Make permanent is important, since otherwise icons can get deleted // (e.g. when freeing temp. materials from a track, the last icon // would get deleted, too. m_icon_material = material_manager->getMaterial(m_icon_file, /*is_full+path*/true, /*make_permanent*/true); if(m_minimap_icon_file!="") m_minimap_icon = irr_driver->getTexture(m_root+"/"+m_minimap_icon_file); else m_minimap_icon = NULL; // Only load the model if the .kart file has the appropriate version, // otherwise warnings are printed. if (m_version >= 1) { const bool success = m_kart_model->loadModels(*this); if (!success) { delete m_kart_model; file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); throw std::runtime_error("Cannot load kart models"); } } if(m_gravity_center_shift.getX()==UNDEFINED) { m_gravity_center_shift.setX(0); // Default: center at the very bottom of the kart. m_gravity_center_shift.setY(m_kart_model->getHeight()*0.5f); m_gravity_center_shift.setZ(0); } m_kart_model->setDefaultPhysicsPosition(m_gravity_center_shift, m_wheel_radius ); m_wheel_base = fabsf( m_kart_model->getWheelPhysicsPosition(0).getZ() -m_kart_model->getWheelPhysicsPosition(2).getZ()); // Now convert the turn radius into turn angle: for(unsigned int i=0; i<m_turn_angle_at_speed.size(); i++) { m_turn_angle_at_speed.setY( i, sin(m_wheel_base/m_turn_angle_at_speed.getY(i)) ); } m_shadow_texture = irr_driver->getTexture(m_shadow_file); file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); } // load
/** Loads the stk configuration file. After loading it checks if all necessary * values are actually defined, otherwise an error message is printed and STK * is aborted. * /param filename Name of the configuration file to load. */ void STKConfig::load(const std::string &filename) { // Avoid loading the default config file if a user-specific // config file has already been loaded. if(m_has_been_loaded) return; m_has_been_loaded = true; init_defaults(); XMLNode *root = 0; try { root = new XMLNode(filename); if(!root || root->getName()!="config") { if(root) delete root; std::ostringstream msg; msg << "Couldn't load config '" << filename << "': no config node."; throw std::runtime_error(msg.str()); } getAllData(root); } catch(std::exception& err) { Log::error("StkConfig", "FATAL ERROR while reading '%s':", filename.c_str()); Log::fatal("StkConfig", " %s", err.what()); } delete root; // Check that all necessary values are indeed set // ----------------------------------------------- #define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \ Log::fatal("StkConfig", "Missing default value for '%s' in '%s'.", \ strA,filename.c_str()); \ } if(m_score_increase.size()==0 || (int)m_score_increase.size()!=m_max_karts) { Log::fatal("StkConfig", "Not or not enough scores defined in stk_config"); } if(m_leader_intervals.size()==0) { Log::fatal("StkConfig", "No follow leader interval(s) defined in stk_config"); } if(m_switch_items.size()!=Item::ITEM_LAST-Item::ITEM_FIRST+1) { Log::fatal("StkConfig", "Wrong number of item switches defined in stk_config"); } CHECK_NEG(m_max_karts, "<karts max=..." ); CHECK_NEG(m_item_switch_time, "item-switch-time" ); CHECK_NEG(m_bubblegum_counter, "bubblegum disappear counter"); CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" ); CHECK_NEG(m_max_skidmarks, "max-skidmarks" ); CHECK_NEG(m_min_kart_version, "<kart-version min...>" ); CHECK_NEG(m_max_kart_version, "<kart-version max=...>" ); CHECK_NEG(m_min_track_version, "min-track-version" ); CHECK_NEG(m_max_track_version, "max-track-version" ); CHECK_NEG(m_skid_fadeout_time, "skid-fadeout-time" ); CHECK_NEG(m_near_ground, "near-ground" ); CHECK_NEG(m_delay_finish_time, "delay-finish-time" ); CHECK_NEG(m_music_credit_time, "music-credit-time" ); CHECK_NEG(m_leader_time_per_kart, "leader time-per-kart" ); CHECK_NEG(m_penalty_time, "penalty-time" ); CHECK_NEG(m_max_display_news, "max-display-news" ); CHECK_NEG(m_replay_max_time, "replay max-time" ); CHECK_NEG(m_replay_delta_angle, "replay delta-angle" ); CHECK_NEG(m_replay_delta_pos2, "replay delta-position" ); CHECK_NEG(m_replay_dt, "replay delta-t" ); CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" ); // Square distance to make distance checks cheaper (no sqrt) m_replay_delta_pos2 *= m_replay_delta_pos2; m_default_kart_properties->checkAllSet(filename); } // load
/** Loads the stk configuration file. After loading it checks if all necessary * values are actually defined, otherwise an error message is printed and STK * is aborted. * /param filename Name of the configuration file to load. */ void STKConfig::load(const std::string &filename) { // Avoid loading the default config file if a user-specific // config file has already been loaded. if(m_has_been_loaded) return; m_has_been_loaded = true; init_defaults(); XMLNode *root = 0; try { root = new XMLNode(filename); if(!root || root->getName()!="config") { if(root) delete root; std::ostringstream msg; msg << "Couldn't load config '" << filename << "': no config node."; throw std::runtime_error(msg.str()); } getAllData(root); } catch(std::exception& err) { fprintf(stderr, "Error while parsing KartProperties '%s':\n", filename.c_str()); fprintf(stderr, "%s", err.what()); fprintf(stderr, "\n"); } delete root; // Check that all necessary values are indeed set // ----------------------------------------------- #define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \ fprintf(stderr,"Missing default value for '%s' in '%s'.\n", \ strA,filename.c_str());exit(-1); \ } if(m_score_increase.size()==0 || (int)m_score_increase.size()!=m_max_karts) { fprintf(stderr,"Not or not enough scores defined in stk_config"); exit(-1); } if(m_leader_intervals.size()==0) { fprintf(stderr,"No follow leader interval(s) defined in stk_config"); exit(-1); } if(m_switch_items.size()!=Item::ITEM_LAST-Item::ITEM_FIRST+1) { fprintf(stderr,"No item switches defined in stk_config"); exit(-1); } CHECK_NEG(m_max_karts, "<karts max=..." ); CHECK_NEG(m_gp_order, "grand-prix order=..." ); CHECK_NEG(m_parachute_friction, "parachute-friction" ); CHECK_NEG(m_parachute_done_fraction, "parachute-done-fraction" ); CHECK_NEG(m_parachute_time, "parachute-time" ); CHECK_NEG(m_parachute_time_other, "parachute-time-other" ); CHECK_NEG(m_bomb_time, "bomb-time" ); CHECK_NEG(m_bomb_time_increase, "bomb-time-increase" ); CHECK_NEG(m_anvil_time, "anvil-time" ); CHECK_NEG(m_anvil_weight, "anvil-weight" ); CHECK_NEG(m_item_switch_time, "item-switch-time" ); CHECK_NEG(m_bubble_gum_counter, "bubblegum disappear counter"); CHECK_NEG(m_explosion_impulse, "explosion-impulse" ); CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" ); CHECK_NEG(m_max_history, "max-history" ); CHECK_NEG(m_max_skidmarks, "max-skidmarks" ); CHECK_NEG(m_min_kart_version, "<kart-version min...>" ); CHECK_NEG(m_max_kart_version, "<kart-version max=...>" ); CHECK_NEG(m_min_track_version, "min-track-version" ); CHECK_NEG(m_max_track_version, "max-track-version" ); CHECK_NEG(m_skid_fadeout_time, "skid-fadeout-time" ); CHECK_NEG(m_near_ground, "near-ground" ); CHECK_NEG(m_delay_finish_time, "delay-finish-time" ); CHECK_NEG(m_music_credit_time, "music-credit-time" ); CHECK_NEG(m_leader_time_per_kart, "leader time-per-kart" ); CHECK_NEG(m_penalty_time, "penalty-time" ); m_kart_properties.checkAllSet(filename); } // load
/** Loads the kart properties from a file. * \param filename Filename to load. * \param node Name of the xml node to load the data from */ void KartProperties::load(const std::string &filename, const std::string &node) { // Get the default values from STKConfig. This will also allocate any // pointers used in KartProperties const XMLNode* root = new XMLNode(filename); std::string kart_type; if (root->get("type", &kart_type)) { // Handle the case that kart_type might be incorrect try { copyFrom(&stk_config->getKartProperties(kart_type)); } catch (std::out_of_range &) { copyFrom(&stk_config->getDefaultKartProperties()); } // try .. catch } else copyFrom(&stk_config->getDefaultKartProperties()); // m_kart_model must be initialised after assigning the default // values from stk_config (otherwise all kart_properties will // share the same KartModel m_kart_model = std::make_shared<KartModel>(/*is_master*/true); m_root = StringUtils::getPath(filename)+"/"; m_ident = StringUtils::getBasename(StringUtils::getPath(filename)); // If this is an addon kart, add "addon_" to the identifier - just in // case that an addon kart has the same directory name (and therefore // identifier) as an included kart. if(Addon::isAddon(filename)) { m_ident = Addon::createAddonId(m_ident); m_is_addon = true; } try { if(!root || root->getName()!="kart") { std::ostringstream msg; msg << "Couldn't load kart properties '" << filename << "': no kart node."; throw std::runtime_error(msg.str()); } getAllData(root); m_characteristic = std::make_shared<XmlCharacteristic>(root); combineCharacteristics(PLAYER_DIFFICULTY_NORMAL); } catch(std::exception& err) { Log::error("[KartProperties]", "Error while parsing KartProperties '%s':", filename.c_str()); Log::error("[KartProperties]", "%s", err.what()); } if(root) delete root; // Set a default group (that has to happen after init_default and load) if(m_groups.size()==0) m_groups.push_back(DEFAULT_GROUP_NAME); // Load material std::string materials_file = m_root+"materials.xml"; std::string unique_id = StringUtils::insertValues("karts/%s", m_ident.c_str()); file_manager->pushModelSearchPath(m_root); file_manager->pushTextureSearchPath(m_root, unique_id); #ifndef SERVER_ONLY if (CVS->isGLSL()) { SP::SPShaderManager::get()->loadSPShaders(m_root); } #endif STKTexManager::getInstance() ->setTextureErrorMessage("Error while loading kart '%s':", m_name); // addShared makes sure that these textures/material infos stay in memory material_manager->addSharedMaterial(materials_file); m_icon_file = m_root+m_icon_file; // Make permanent is important, since otherwise icons can get deleted // (e.g. when freeing temp. materials from a track, the last icon // would get deleted, too. m_icon_material = material_manager->getMaterial(m_icon_file, /*is_full_path*/true, /*make_permanent*/true, /*complain_if_not_found*/true, /*strip_path*/false); if (m_minimap_icon_file!="") { m_minimap_icon = STKTexManager::getInstance() ->getTexture(m_root+m_minimap_icon_file); } else m_minimap_icon = NULL; // Only load the model if the .kart file has the appropriate version, // otherwise warnings are printed. if (m_version >= 1) { const bool success = m_kart_model->loadModels(*this); if (!success) { file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); throw std::runtime_error("Cannot load kart models"); } } if(m_gravity_center_shift.getX()==UNDEFINED) { m_gravity_center_shift.setX(0); // Default: center at the very bottom of the kart. // If the kart is 'too high', its height will be changed in // kart.cpp, the same adjustment needs to be made here. if (m_kart_model->getHeight() > m_kart_model->getLength()*0.6f) m_gravity_center_shift.setY(m_kart_model->getLength()*0.6f*0.5f); else m_gravity_center_shift.setY(m_kart_model->getHeight()*0.5f); m_gravity_center_shift.setZ(0); } // The longer the kart,the bigger its turn radius if using an identical // wheel base, exactly proportionally to its length. // The wheel base is used to compensate this // We divide by 1.425 to have a default turn radius which conforms // closely (+-0,1%) with the specifications in kart_characteristics.xml m_wheel_base = fabsf(m_kart_model->getLength()/1.425f); m_shadow_material = material_manager->getMaterialSPM(m_shadow_file, "", "alphablend"); STKTexManager::getInstance()->unsetTextureErrorMessage(); file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); } // load
/** Loads the kart properties from a file. * \param filename Filename to load. * \param node Name of the xml node to load the data from */ void KartProperties::load(const std::string &filename, const std::string &node) { // Get the default values from STKConfig. This will also allocate any // pointers used in KartProperties const XMLNode* root = new XMLNode(filename); std::string kart_type; if (root->get("type", &kart_type)) { // Handle the case that kart_type might be incorrect try { copyFrom(&stk_config->getKartProperties(kart_type)); } catch (std::out_of_range) { copyFrom(&stk_config->getDefaultKartProperties()); } // try .. catch } else copyFrom(&stk_config->getDefaultKartProperties()); // m_kart_model must be initialised after assigning the default // values from stk_config (otherwise all kart_properties will // share the same KartModel m_kart_model.reset(new KartModel(/*is_master*/true)); m_root = StringUtils::getPath(filename)+"/"; m_ident = StringUtils::getBasename(StringUtils::getPath(filename)); // If this is an addon kart, add "addon_" to the identifier - just in // case that an addon kart has the same directory name (and therefore // identifier) as an included kart. if(Addon::isAddon(filename)) m_ident = Addon::createAddonId(m_ident); try { if(!root || root->getName()!="kart") { std::ostringstream msg; msg << "Couldn't load kart properties '" << filename << "': no kart node."; throw std::runtime_error(msg.str()); } getAllData(root); m_characteristic.reset(new XmlCharacteristic(root)); combineCharacteristics(); } catch(std::exception& err) { Log::error("[KartProperties]", "Error while parsing KartProperties '%s':", filename.c_str()); Log::error("[KartProperties]", "%s", err.what()); } if(root) delete root; // Set a default group (that has to happen after init_default and load) if(m_groups.size()==0) m_groups.push_back(DEFAULT_GROUP_NAME); // Load material std::string materials_file = m_root+"materials.xml"; file_manager->pushModelSearchPath (m_root); file_manager->pushTextureSearchPath(m_root); irr_driver->setTextureErrorMessage("Error while loading kart '%s':", m_name); // addShared makes sure that these textures/material infos stay in memory material_manager->addSharedMaterial(materials_file); m_icon_file = m_root+m_icon_file; // Make permanent is important, since otherwise icons can get deleted // (e.g. when freeing temp. materials from a track, the last icon // would get deleted, too. m_icon_material = material_manager->getMaterial(m_icon_file, /*is_full_path*/true, /*make_permanent*/true, /*complain_if_not_found*/true, /*strip_path*/false); if(m_minimap_icon_file!="") m_minimap_icon = irr_driver->getTexture(m_root+m_minimap_icon_file); else m_minimap_icon = NULL; if (m_minimap_icon == NULL) { m_minimap_icon = getUnicolorTexture(m_color); } // Only load the model if the .kart file has the appropriate version, // otherwise warnings are printed. if (m_version >= 1) { const bool success = m_kart_model->loadModels(*this); if (!success) { file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); throw std::runtime_error("Cannot load kart models"); } } if(m_gravity_center_shift.getX()==UNDEFINED) { m_gravity_center_shift.setX(0); // Default: center at the very bottom of the kart. // If the kart is 'too high', its height will be changed in // kart.cpp, the same adjustment needs to be made here. if (m_kart_model->getHeight() > m_kart_model->getLength()*0.6f) m_gravity_center_shift.setY(m_kart_model->getLength()*0.6f*0.5f); else m_gravity_center_shift.setY(m_kart_model->getHeight()*0.5f); m_gravity_center_shift.setZ(0); } // In older STK versions the physical wheels where moved 'wheel_radius' // into the physical body (i.e. 'hypothetical' wheel shape would not // poke out of the physical shape). In order to make the karts a bit more // stable, the physical wheel position (i.e. location of raycast) were // moved to be on the corner of the shape. In order to retain the same // steering behaviour, the wheel base (which in turn determines the // turn angle at certain speeds) is shortened by 2*wheel_radius // Wheel radius was always 0.25, and is now not used anymore, but in order // to keep existing steering behaviour, the same formula is still // used. m_wheel_base = fabsf(m_kart_model->getLength() - 2*0.25f); m_shadow_texture = irr_driver->getTexture(m_shadow_file); irr_driver->unsetTextureErrorMessage(); file_manager->popTextureSearchPath(); file_manager->popModelSearchPath(); } // load