void jsonifyModule(const Module& module, rapidjson::Value& moduleValue, rapidjson::Document& document){ moduleValue.SetObject(); moduleValue.AddMember("name", module.getName().c_str(), document.GetAllocator()); moduleValue.AddMember("description", module.getDescription().c_str(), document.GetAllocator()); moduleValue.AddMember("type", module.getType().getName().c_str(), document.GetAllocator()); //add inputs rapidjson::Value inputsValue; inputsValue.SetObject(); for(unsigned int i=0; i<module.getInputSize(); ++i){ auto inputLink = module.getInput(i); auto outputLink = inputLink->getOutputLink(); //only add connected links if(outputLink){ std::string sourceString = outputLink->getOwner().getName() + "." + outputLink->getModuleOutput().getName(); rapidjson::Value source(sourceString.c_str(), document.GetAllocator()); rapidjson::Value inputName(inputLink->getModuleInput().getName().c_str(), document.GetAllocator()); inputsValue.AddMember(inputName, source, document.GetAllocator()); } else { //add custom unlinked values rapidjson::Value vectorValue; vectorValue.SetArray(); auto unlinkedValue = inputLink->getUnlinkedValue(); for(int j=0; j<unlinkedValue.getSignalType().dimensionality; ++j){ vectorValue.PushBack(unlinkedValue[j], document.GetAllocator()); } rapidjson::Value inputName(inputLink->getModuleInput().getName().c_str(), document.GetAllocator()); inputsValue.AddMember(inputName, vectorValue, document.GetAllocator()); } } moduleValue.AddMember("inputs", inputsValue, document.GetAllocator()); }
extern "C" JNIEXPORT void JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_closeBinaryMapFile(JNIEnv* ienv, jobject path) { const char* utf = ienv->GetStringUTFChars((jstring) path, NULL); std::string inputName(utf); ienv->ReleaseStringUTFChars((jstring) path, utf); closeBinaryMapFile(inputName); }
int main(int argc, char** argv) { if (argc != 2) die_printf("Usage: %s <file>\n", argv[0]); try { std::string inputName(argv[1]); std::string outputName = sys::Path::basename(inputName); outputName += ".gz"; std::cout << "Attempting to zip: " << std::endl << "\tInput: " << inputName << std::endl << "\tTarget: " << outputName << std::endl;; io::FileInputStream input(inputName); zip::GZipOutputStream output(outputName); input.streamTo(output); input.close(); output.close(); } catch (except::Exception& ex) { std::cout << ex.toString() << std::endl; exit(EXIT_FAILURE); } return 0; }
extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_initBinaryMapFile(JNIEnv* ienv, jobject obj, jobject path) { // Verify that the version of the library that we linked against is const char* utf = ienv->GetStringUTFChars((jstring) path, NULL); std::string inputName(utf); ienv->ReleaseStringUTFChars((jstring) path, utf); return (initBinaryMapFile(inputName) != NULL); }
html::Form::HiddenField *html::Form::HiddenField::clone() const { html::Form::HiddenField *result = new html::Form::HiddenField(*this); result->name = name; result->inputName(inputName()); result->value(value()); return result; }
/** * Extract Attribute data from the shader */ void Program::ExtractAttributeData() { Log("\tInput :"); char tempNameAR[1024]; { GLint numInput = 0; glGetProgramInterfaceiv(_program, GL_PROGRAM_INPUT, GL_ACTIVE_RESOURCES, &numInput); const GLenum propertiesAR[2] = { GL_TYPE, GL_LOCATION }; for (int input = 0; input < numInput; input++) { GLint valuesAR[2]; glGetProgramResourceiv(_program, GL_PROGRAM_INPUT, input, 2, propertiesAR, 2, NULL, valuesAR); glGetProgramResourceName(_program, GL_PROGRAM_INPUT, input, 1024, NULL, tempNameAR); std::string inputName(tempNameAR); if (inputName.size() >= 3 && inputName.substr(0, 3) == "gl_") continue; else { _inputs.insert(std::make_pair(inputName, AttributeInfo(inputName, GLenum(valuesAR[0]), valuesAR[1], GLUtil::SizeofGLSLType(GLenum(valuesAR[0]))))); Log("\t\t" + inputName + " " + ToString(valuesAR[1]) + " " + GLUtil::GLSLTypeToStr(GLenum(valuesAR[0]))); } } } Log("\tOutput :"); { GLint numOutput = 0; glGetProgramInterfaceiv(_program, GL_PROGRAM_OUTPUT, GL_ACTIVE_RESOURCES, &numOutput); const GLenum propertiesAR[2] = { GL_TYPE, GL_LOCATION }; for (int outpout = 0; outpout < numOutput; outpout++) { GLint valuesAR[2]; glGetProgramResourceiv(_program, GL_PROGRAM_OUTPUT, outpout, 2, propertiesAR, 2, NULL, valuesAR); glGetProgramResourceName(_program, GL_PROGRAM_OUTPUT, outpout, 1024, NULL, tempNameAR); std::string outputName(tempNameAR); if (outputName.size() >= 3 && outputName.substr(0, 3) != "gl_") { _outputs.insert(std::make_pair(outputName, AttributeInfo(outputName, GLenum(valuesAR[0]), valuesAR[1], GLUtil::SizeofGLSLType(GLenum(valuesAR[0]))))); Log("\t\t" + outputName + " " + ToString(valuesAR[1]) + " " + GLUtil::GLSLTypeToStr(GLenum(valuesAR[0]))); } } } }
void CBEBouquetWidget::renameBouquet() { std::string newName = inputName(Bouquets[selected].name, LOCALE_BOUQUETEDITOR_NEWBOUQUETNAME); if (newName != Bouquets[selected].name) { g_Zapit->renameBouquet(selected, ZapitTools::Latin1_to_UTF8(newName.c_str()).c_str()); Bouquets.clear(); g_Zapit->getBouquets(Bouquets, true); bouquetsChanged = true; } paintHead(); paint(); paintFoot(); }
void CBEBouquetWidget::addBouquet() { std::string newName = inputName("", LOCALE_BOUQUETEDITOR_BOUQUETNAME); if (!(newName.empty())) { g_Zapit->addBouquet(ZapitTools::Latin1_to_UTF8(newName.c_str()).c_str()); Bouquets.clear(); g_Zapit->getBouquets(Bouquets, true); selected = Bouquets.empty() ? 0 : (Bouquets.size() - 1); bouquetsChanged = true; } paintHead(); paint(); paintFoot(); }
int main() { int size,i; char **p; printf("请输入要排序的人数:\n"); scanf("%d",&size); printf("请输入%d个学生的姓名,每输入一个以回车键结束:\n",size); p=inputName(size); sort(p,size); printName(p,size); Free(p,size); p=NULL; system("pause"); return 0; }
void CBEBouquetWidget::renameBouquet() { if ((*Bouquets)[selected]->bFav) return; std::string newName = inputName((*Bouquets)[selected]->Name.c_str(), LOCALE_BOUQUETEDITOR_NEWBOUQUETNAME); if (newName != (*Bouquets)[selected]->Name) { //g_Zapit->renameBouquet(selected, ZapitTools::Latin1_to_UTF8(newName.c_str()).c_str()); //Bouquets.clear(); //g_Zapit->getBouquets(Bouquets, true, true); g_bouquetManager->Bouquets[selected]->Name = newName; g_bouquetManager->Bouquets[selected]->bUser = true; //Bouquets = &g_bouquetManager->Bouquets; bouquetsChanged = true; } paintHead(); paint(); paintFoot(); }
User IoHandler::printUserMenu(UserList &userList) { User currentUser; string userName; char a; while (true){ system("cls"); cout << "====================================================" << endl; cout << " 행맨게임을 시작합니다. " << endl; cout << "====================================================" << endl; cout << "(기록해 둔 게임 성적을 load되거나 새로운 사용자가 등록됩니다.)" << endl; userName = inputName("사용자의 이름을 입력하세요 : "); cout << endl << endl; if (userList.isUserExist(userName) == true) { cout << "등록된 사용자가 있습니다. 등록된 사용자의 게임 성적을 load하려면 L을, " << endl; cout << "새로운 사용자 이름을 등록하려면 N을 입력하세요 [L/N] : "; cin >> a; cout << endl << endl; if (a == 'L' || a == 'l') { User user(userList.getUserByName(userName).getName()); currentUser = user; cout << "기존 사용자 [" << currentUser.getName() << "]을/를 불러옵니다. "; cin >> a; break; } else if (a == 'N' || a == 'n')
int main() { askForName(std::cout); sayGreeting(std::cout, inputName(std::cin)); }
int main() { askForName(std::cout); sayGreeting(std::cout, inputName(std::cin), inputName(std::cin)); // order is unspecified }
/*! * We want to create a SIDD NITF from something * else. For this simple example, I will use * sio.lite to read in the image data. * * SICD data is read in from the first argument. To test multi-image * SIDD, the <N times> argument uses the target <input-file> over and * over as different images in the NITF. * * The segmentation loophole can be exploitated by overriding the product * size (essentially bluffing the 10GB limit, and overriding ILOC_R=99999, * although you may not extend those limits -- they are NITF format maxes. */ int main(int argc, char** argv) { if (argc != 5 && argc != 7) { die_printf( "Usage: %s <sicd-xml> <input-file> <N times> <output-file> (Max product size) (N rows limit)\n", argv[0]); } // The input SIO file std::string inputName(argv[2]); // How many images to write (from the one source) unsigned int repeatN = str::toType<unsigned int>(argv[3]); // Output file name std::string outputName(argv[4]); // Get a NITF or GeoTIFF writer six::WriteControl* writer = getWriteControl(outputName); // Is the SIO in big-endian? bool needsByteSwap = false; try { try { sys::OS().getEnv(six::SCHEMA_PATH); } catch(const except::Exception& ) { throw except::Exception(Ctxt( "Must specify SIDD schema path via " + std::string(six::SCHEMA_PATH) + " environment variable")); } six::XMLControlFactory::getInstance(). addCreator( six::DataType::COMPLEX, new six::XMLControlCreatorT<six::sicd::ComplexXMLControl>() ); six::XMLControlFactory::getInstance(). addCreator( six::DataType::DERIVED, new six::XMLControlCreatorT<six::sidd::DerivedXMLControl>() ); // Get a Complex Data structure from an XML file six::Options options; // Set up the sicd io::FileInputStream fis(argv[1]); xml::lite::MinidomParser parser; parser.parse(fis); std::auto_ptr<logging::Logger> log (new logging::NullLogger()); six::Data* complexData = six::XMLControlFactory::getInstance().newXMLControl( six::DataType::COMPLEX, log.get())->fromXML(parser.getDocument(), std::vector<std::string>()); // Create a file container mem::SharedPtr<six::Container> container(new six::Container( six::DataType::DERIVED)); // We have a source for each image std::vector<io::InputStream*> sources; // For each image for (unsigned int i = 0; i < repeatN; ++i) { // Make an sio.lite reader sio::lite::FileReader *sioReader = new sio::lite::FileReader( new io::FileInputStream(inputName)); // Get the header out sio::lite::FileHeader* fileHeader = sioReader->readHeader(); /* * Yeah, this is getting set over and over, but that way its * easy to make this test case into a program with multiple images */ needsByteSwap = sys::isBigEndianSystem() && fileHeader->isDifferentByteOrdering(); six::PixelType pixelType; // If we got past here, it must be one of our types six::LUT* lut = getPixelInfo(fileHeader, pixelType); // Make the object six::sidd::DerivedDataBuilder builder; six::sidd::DerivedData* data = builder.steal(); //steal it builder.addDisplay(pixelType); builder.addGeographicAndTarget(six::RegionType::GEOGRAPHIC_INFO); builder.addMeasurement(six::ProjectionType::PLANE); builder.addExploitationFeatures(1); data->setNumRows(fileHeader->getNumLines()); data->setNumCols(fileHeader->getNumElements()); data->productCreation->productName = "ProductName"; data->productCreation->productClass = "Classy"; data->productCreation->classification.classification = "U"; six::sidd::ProcessorInformation& processorInformation = *data->productCreation->processorInformation; processorInformation.application = "ProcessorName"; processorInformation.profile = "Profile"; processorInformation.site = "Ypsilanti, MI"; data->display->pixelType = pixelType; data->display->decimationMethod = six::DecimationMethod::BRIGHTEST_PIXEL; data->display->magnificationMethod = six::MagnificationMethod::NEAREST_NEIGHBOR; // Give'em our LUT if (lut) { if (pixelType == six::PixelType::RGB24I) { data->display->remapInformation.reset( new six::sidd::ColorDisplayRemap(lut)); } else { data->display->remapInformation.reset( new six::sidd::MonochromeDisplayRemap("PEDF", lut)); } } data->setImageCorners(makeUpCornersFromDMS()); six::sidd::PlaneProjection* planeProjection = (six::sidd::PlaneProjection*) data->measurement->projection.get(); planeProjection->timeCOAPoly = six::Poly2D(0, 0); planeProjection->timeCOAPoly[0][0] = 1; data->measurement->arpPoly = six::PolyXYZ(0); data->measurement->arpPoly[0] = 0.0; planeProjection->productPlane.rowUnitVector = 0.0; planeProjection->productPlane.colUnitVector = 0.0; six::sidd::Collection* parent = data->exploitationFeatures->collections[0].get(); parent->information->resolution.rg = 0; parent->information->resolution.az = 0; parent->information->collectionDuration = 0; parent->information->collectionDateTime = six::DateTime(); parent->information->radarMode = six::RadarModeType::SPOTLIGHT; parent->information->sensorName = "the sensor"; data->exploitationFeatures->product.resolution.row = 0; data->exploitationFeatures->product.resolution.col = 0; data->annotations.push_back(mem::ScopedCopyablePtr< six::sidd::Annotation>(new six::sidd::Annotation)); six::sidd::Annotation *ann = (*data->annotations.rbegin()).get(); std::cout << "Hey: " << ann->spatialReferenceSystem.get() << std::endl; ann->identifier = "1st Annotation"; ann->objects.push_back(mem::ScopedCloneablePtr< six::sidd::SFAGeometry>(new six::sidd::SFAPoint)); sources.push_back(sioReader); container->addData(data); } container->addData(complexData); /* * Under normal circumstances, the library uses the * segmentation algorithm in the SICD spec, and numRowsLimit * is set to Contants::ILOC_SZ. If the user sets this, they * want us to create an alternate numRowsLimit to force the * library to segmeht on smaller boundaries. * * This is handy especially for debugging, since it will force * the algorithm to segment early. * */ if (argc == 7) { std::cout << "Overriding NITF product size and max ILOC" << std::endl; writer->getOptions().setParameter( six::NITFWriteControl::OPT_MAX_PRODUCT_SIZE, str::toType< long>(argv[5])); writer->getOptions().setParameter( six::NITFWriteControl::OPT_MAX_ILOC_ROWS, str::toType<long>(argv[6])); } // Override auto-byte swap writer->getOptions().setParameter(six::WriteControl::OPT_BYTE_SWAP, six::Parameter((sys::Uint16_T) needsByteSwap)); // Init the container writer->initialize(container); // Save the file writer->save(sources, outputName); // Delete the sources (sio read streams) for (unsigned int i = 0; i < sources.size(); ++i) { delete sources[i]; } } catch (except::Exception& ex) { std::cout << ex.toString() << std::endl; } delete writer; return 0; }