int network_information_table_section::subtable::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for records**/ /* This line is probably buggy size needs to be adjusted */ numberOfRecords=((short)records.getCount() -(0)); } { /** fix dependent sizes for descriptor **/ } int retVal= 0; // write firstIndex ostream.writeUI8(firstIndex); retVal +=1; // write numberOfRecords ostream.writeUI8(numberOfRecords); retVal +=1; // write bf3 ostream.writeUI8(bf3); retVal +=1; // write records { for (ArrayList_iterator(network_information_table_section::subtable::Record) it= records.getIterator() ; it.hasNext();) { { retVal +=it.get()->write(ostream); } } } // write descriptor if ( descriptor != NULL ) { retVal +=descriptor->write(ostream); } return retVal; }
int network_information_table_section::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for tableHeader **/ } { /** fix dependent sizes for subtableInstance **/ if ( subtableInstance != NULL ) { tableHeader->setSection_length((short)subtableInstance->getSize()); } } int retVal= 0; // write tableHeader if ( tableHeader != NULL ) { retVal +=tableHeader->write(ostream); } // write bf2 ostream.writeUI8(bf2); retVal +=1; // write subtableInstance if ( subtableInstance != NULL ) { retVal +=subtableInstance->write(ostream); } // write CRC ostream.writeUI32(CRC); retVal +=4; return retVal; }
void TexturePaletteManager::write( DataOutputStream& dos ) const { int x( 0 ), y( 0 ), height( 0 ); TextureIndexMap::const_iterator it = _indexMap.begin(); while (it != _indexMap.end()) { const osg::Texture2D* texture = it->first; int index = it->second; std::string fileName; if ( _fltOpt.getStripTextureFilePath() ) fileName = osgDB::getSimpleFileName( texture->getImage()->getFileName() ); else fileName = texture->getImage()->getFileName(); dos.writeInt16( (int16) TEXTURE_PALETTE_OP ); dos.writeUInt16( 216 ); dos.writeString( fileName, 200 ); dos.writeInt32( index ); dos.writeInt32( x ); dos.writeInt32( y ); it++; x += texture->getImage()->s(); if (texture->getImage()->t() > height) height = texture->getImage()->t(); if (x > 1024) { x = 0; y += height; height = 0; } } }
int softwareVerMMsg::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for applicationNameByte**/ } { /** fix dependent sizes for applicationSignbyte**/ } { /** fix dependent sizes for applicationVersionbyte**/ } int retVal= 0; // write ApplicationStatusflag ostream.writeUI8(ApplicationStatusflag); retVal +=1; // write applicationNameByte { retVal += applicationNameByte->write(ostream); } // write applicationSignbyte { retVal += applicationSignbyte->write(ostream); } // write applicationVersionbyte { retVal += applicationVersionbyte->write(ostream); } return retVal; }
int codeVersionTable1_3::statusfld2::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for mcAddress **/ } { /** fix dependent sizes for sourceIpAddress **/ } { /** fix dependent sizes for destinationIpAddress **/ } int retVal= 0; // write mcAddress if ( mcAddress != NULL ) { retVal +=mcAddress->write(ostream); } // write sourceIpAddress if ( sourceIpAddress != NULL ) { retVal +=sourceIpAddress->write(ostream); } // write destinationIpAddress if ( destinationIpAddress != NULL ) { retVal +=destinationIpAddress->write(ostream); } // write sourcePortNumber ostream.writeUI16(sourcePortNumber); retVal +=2; // write destinatioPortNumber ostream.writeUI16(destinatioPortNumber); retVal +=2; // write applicationId ostream.writeUI16(applicationId); retVal +=2; // write modulationType ostream.writeUI8(modulationType); retVal +=1; // write bf2 ostream.writeUI16(bf2); retVal +=2; return retVal; }
int DSG_packetError::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for header **/ } int retVal= 0; // write header if ( header != NULL ) { retVal +=header->write(ostream); } // write length ostream.writeUI8(length); retVal +=1; // write transaction_id ostream.writeUI8(transaction_id); retVal +=1; return retVal; }
int CloseMmiCnf::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for header **/ } int retVal= 0; // write header if ( header != NULL ) { retVal +=header->write(ostream); } // write length ostream.writeUI8(length); retVal +=1; // write dialogNumber ostream.writeUI8(dialogNumber); retVal +=1; return retVal; }
void SaveHandler::func_22154_d() { try { File file = new File(saveDirectory, "session.lock"); DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file)); try { dataoutputstream.writeLong(now); } ly { dataoutputstream.close(); } } catch(IOException ioexception) { ioexception.printStackTrace(); throw new RuntimeException("Failed to check session lock, aborting"); } }
int OpenSessionResponse::write(DataOutputStream& ostream) { // throws IOException int retVal= 0; // write length ostream.writeUI8(length); retVal +=1; // write resourceIdentifier ostream.writeUI32(resourceIdentifier); retVal +=4; // write sessionStatus ostream.writeUI8(sessionStatus); retVal +=1; // write sessionNb ostream.writeUI16(sessionNb); retVal +=2; return retVal; }
int HomingCancelled::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for header **/ } int retVal= 0; // write header if ( header != NULL ) { retVal +=header->write(ostream); } // write length ostream.writeUI8(length); retVal +=1; return retVal; }
int diagnosticReq_2_Smode::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for selfDiagnostics**/ } int retVal= 0; // write length ostream.writeUI8(length); retVal +=1; // write selfDiagnostics { retVal += selfDiagnostics->write(ostream); } return retVal; }
void Engine::write_socket(DataOutputStream & network_out) { while(true) { if( waiting_to_socket_data.empty() ) { int cbPending = int(BIO_ctrl_pending(bioOut)); if( cbPending == 0 ) break; waiting_to_socket_data = Data(cbPending); int len = BIO_read(bioOut, waiting_to_socket_data.lock(), waiting_to_socket_data.getSize()); wLog("BIO_read: %d", len); waiting_to_socket_data = Data(waiting_to_socket_data, 0, len); } int slen = network_out.write(waiting_to_socket_data); wLog("sock.write: %d", slen); if( !waiting_to_socket_data.empty() ) break; } }
int DescriptorCollection::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for descriptors**/ /* This line is probably buggy size needs to be adjusted */ descriptor_count=((short)descriptors.getCount() -(0)); } int retVal= 0; // write descriptor_count ostream.writeUI8(descriptor_count); retVal +=1; // write descriptors { for (ArrayList_iterator(SCTE65DescriptorFactory::SCTE65Descriptor) it= descriptors.getIterator() ; it.hasNext();) { { retVal +=it.get()->write(ostream); } } } return retVal; }
int HistoryReq::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for header **/ } { /** fix dependent sizes for pincodeLength**/ } int retVal= 0; // write header if ( header != NULL ) { retVal +=header->write(ostream); } // write length ostream.writeUI8(length); retVal +=1; // write pincodeLength { retVal += pincodeLength->write(ostream); } return retVal; }
int main (int argc, char **argv) { if(isatty(STDIN_FILENO) && argc==1) { cout<<"No input data or parameters. Use -h,--help for more information"<<endl; exit(EXIT_FAILURE); } gengetopt_args_info args_info; TRY_EXCEPTION(); if (cmdline_parser (argc, argv, &args_info) != 0) exit(EXIT_FAILURE); #ifndef WITH_LIBXML if ( args_info.input_format_arg == input_format_arg_xml ) { cerr << "The software was built with WITH_LIBXML=OFF. Please rebuild it if you want XML functionality." << endl; exit(EXIT_FAILURE); } #endif // WITH_LIBXML if ( args_info.print_relaxng_input_given && args_info.print_relaxng_output_given ) { cerr << "error: --print-relaxng-input and --print-relaxng-output can not be used at the same time" << endl; exit(EXIT_FAILURE); } if ( args_info.print_relaxng_input_given ) { cout << fastphylo_distance_matrix_xml_relaxngstr << std::endl; exit(EXIT_SUCCESS); }; if ( args_info.print_relaxng_output_given ) { cout << fastphylo_tree_count_xml_relaxngstr << std::endl; exit(EXIT_SUCCESS); }; //---------------------------------------------- // DISTANCE METHODS std::vector<NJ_method> methods; if( args_info.number_of_runs_given && args_info.input_format_arg == input_format_arg_xml ) { cerr << "error: --number-of-runs can not be used together with input format xml." << endl; exit(EXIT_FAILURE); } switch ( args_info.method_arg ) { case method_arg_NJ: methods.push_back(NJ); break; case method_arg_FNJ: methods.push_back(FNJ); break; case method_arg_BIONJ: methods.push_back(BIONJ); break; default: cerr << "error: method chosen not available" << endl; exit(EXIT_FAILURE); } bool printCounts = args_info.print_counts_flag; try { char * inputfilename = NULL; char * outputfilename = NULL; DataInputStream *istream; DataOutputStream *ostream; switch( args_info.inputs_num ) { case 0: break; /* inputfilename will be null and indicate stdin as input */ case 1: inputfilename = args_info.inputs[0]; break; default: cerr << "Error: you can at most specify one input filename" << endl; exit(EXIT_FAILURE); } if( args_info.outfile_given ) outputfilename = args_info.outfile_arg; switch ( args_info.input_format_arg ) { case input_format_arg_phylip: istream = new PhylipDmInputStream(inputfilename); break; case input_format_arg_binary: istream = new BinaryInputStream(inputfilename); break; #ifdef WITH_LIBXML case input_format_arg_xml: istream = new XmlInputStream(inputfilename); break; #endif // WITH_LIBXML default: exit(EXIT_FAILURE); } switch (args_info.output_format_arg) { case output_format_arg_newick: ostream = new TreeTextOutputStream(outputfilename); break; case output_format_arg_xml: ostream = new XmlOutputStream(outputfilename); break; default: exit(EXIT_FAILURE); } //printf("%d\n", args_info.input_format_arg); // THE DATA WE WILL PROCESS vector<Sequence> seqs; vector<std::string> names; vector<DNA_b128_String> b128seqs; Extrainfos extrainfos; bool latestReadSuccessful = true; vector<string> speciesnames; readstatus status; int run = 0; status = END_OF_RUN; while (status == END_OF_RUN && (args_info.input_format_arg == input_format_arg_xml || run<args_info.number_of_runs_arg)) { string runId(""); run++; tree2int_map tree2count((size_t)(args_info.bootstraps_arg * 1.3)); str2int_hashmap name2id; if (args_info.input_format_arg==input_format_arg_binary) { StrFloMatrix dm; for (int runNo=1; (status = istream->readDM(dm, names, runId, extrainfos))==DM_READ; runNo++) { if (args_info.analyze_run_number_given) { if (runNo<args_info.analyze_run_number_arg) continue; if (runNo>args_info.analyze_run_number_arg) { status=END_OF_RUN; break; } } for(size_t namei=0; namei<dm.getSize(); namei++) name2id[dm.getIdentifier(namei)] = namei; buildTrees(dm, tree2count, methods,name2id); } } else { StrDblMatrix dm; for (int runNo=1; (status = istream->readDM(dm, names, runId, extrainfos))==DM_READ; runNo++) { if (args_info.analyze_run_number_given) { if (runNo<args_info.analyze_run_number_arg) continue; if (runNo>args_info.analyze_run_number_arg) { status=END_OF_RUN; break; } } for(size_t namei=0; namei<dm.getSize(); namei++) { name2id[dm.getIdentifier(namei)] = namei; } buildTrees(dm, tree2count, methods,name2id); } } if (status==END_OF_RUN) ostream->print(tree2count,printCounts, runId, names, extrainfos); if (args_info.analyze_run_number_given) break; }//end run loop delete ostream; delete istream; } catch(...){ throw; } CATCH_EXCEPTION(); cmdline_parser_free(&args_info); return 0; }
int codeVersionTable1_3::write(DataOutputStream& ostream) { // throws IOException { /** fix dependent sizes for header **/ } { /** fix dependent sizes for pgmmsg**/ } { /** fix dependent sizes for statusfldInstance **/ } { /** fix dependent sizes for statusfld2Instance **/ } { /** fix dependent sizes for statusfld3Instance **/ } { /** fix dependent sizes for codeFileByte**/ } { /** fix dependent sizes for codeVeriFicationCertiFication **/ } int retVal= 0; // write header if ( header != NULL ) { retVal +=header->write(ostream); } // write length ostream.writeUI8(length); retVal +=1; // write configurationCountChange ostream.writeUI8(configurationCountChange); retVal +=1; // write statusField ostream.writeUI8(statusField); retVal +=1; // write pgmmsg { for (ArrayList_iterator(codeVersionTableMsg) it= pgmmsg.getIterator() ; it.hasNext();) { { retVal +=it.get()->write(ostream); } } } // write bf1 ostream.writeUI8(bf1); retVal +=1; // write statusfldInstance if ( statusfldInstance != NULL ) { retVal +=statusfldInstance->write(ostream); } // write statusfld2Instance if ( statusfld2Instance != NULL ) { retVal +=statusfld2Instance->write(ostream); } // write statusfld3Instance if ( statusfld3Instance != NULL ) { retVal +=statusfld3Instance->write(ostream); } // write codeFileByte { retVal += codeFileByte->write(ostream); } // write codeVeriFicationCertiFication if ( codeVeriFicationCertiFication != NULL ) { retVal +=codeVeriFicationCertiFication->write(ostream); } return retVal; }
void LightSourcePaletteManager::write( DataOutputStream& dos ) const { using osg::Vec4f; static int const INFINITE_LIGHT = 0; static int const LOCAL_LIGHT = 1; static int const SPOT_LIGHT = 2; LightPalette::const_iterator it = _lightPalette.begin(); for ( ; it != _lightPalette.end(); ++it) { LightRecord m = it->second; static char lightName[64]; sprintf(lightName, "Light%02d", m.Light->getLightNum() ); int lightType = INFINITE_LIGHT; Vec4f const& lightPos = m.Light->getPosition(); if (lightPos.w() != 0) { if (m.Light->getSpotCutoff() < 180) lightType = SPOT_LIGHT; else lightType = LOCAL_LIGHT; } dos.writeInt16( (int16) LIGHT_SOURCE_PALETTE_OP ); dos.writeInt16( 240 ); dos.writeInt32( m.Index ); dos.writeFill(2*4, '\0'); // Reserved dos.writeString( lightName, 20 ); dos.writeFill(4, '\0'); // Reserved dos.writeVec4f(m.Light->getAmbient() ); dos.writeVec4f(m.Light->getDiffuse() ); dos.writeVec4f(m.Light->getSpecular() ); dos.writeInt32(lightType); dos.writeFill(4*10, '\0'); // Reserved dos.writeFloat32(m.Light->getSpotExponent() ); dos.writeFloat32(m.Light->getSpotCutoff() ); dos.writeFloat32(0); // Yaw (N/A) dos.writeFloat32(0); // Pitch (N/A) dos.writeFloat32(m.Light->getConstantAttenuation() ); dos.writeFloat32(m.Light->getLinearAttenuation() ); dos.writeFloat32(m.Light->getQuadraticAttenuation() ); dos.writeInt32(0); // Modeling flag (N/A) dos.writeFill(4*19, '\0'); // Reserved } }
void MaterialPaletteManager::write( DataOutputStream& dos ) const { using osg::Vec4f; MaterialPalette::const_iterator it = _materialPalette.begin(); for ( ; it != _materialPalette.end(); ++it) { MaterialRecord m = it->second; Vec4f const& ambient = m.Material->getAmbient(osg::Material::FRONT); Vec4f const& diffuse = m.Material->getDiffuse(osg::Material::FRONT); Vec4f const& specular = m.Material->getSpecular(osg::Material::FRONT); Vec4f const& emissive = m.Material->getEmission(osg::Material::FRONT); float shininess = m.Material->getShininess(osg::Material::FRONT); dos.writeInt16( (int16) MATERIAL_PALETTE_OP ); dos.writeInt16( 84 ); // Length - FIXME: hard-code/FLT version? dos.writeInt32( m.Index ); dos.writeString( m.Material->getName(), 12 ); dos.writeInt32( 0 ); // Flags dos.writeFloat32(ambient.r() ); dos.writeFloat32(ambient.g() ); dos.writeFloat32(ambient.b() ); dos.writeFloat32(diffuse.r() ); dos.writeFloat32(diffuse.g() ); dos.writeFloat32(diffuse.b() ); dos.writeFloat32(specular.r() ); dos.writeFloat32(specular.g() ); dos.writeFloat32(specular.b() ); dos.writeFloat32(emissive.r() ); dos.writeFloat32(emissive.g() ); dos.writeFloat32(emissive.b() ); dos.writeFloat32(shininess); dos.writeFloat32( diffuse.a() ); // alpha dos.writeFloat32(1.0f); // 'Reserved' - unused if (m.Material->getAmbientFrontAndBack() == false || m.Material->getDiffuseFrontAndBack() == false || m.Material->getSpecularFrontAndBack() == false || m.Material->getEmissionFrontAndBack() == false || m.Material->getShininessFrontAndBack() == false ) { std::string warning( "fltexp: No support for different front and back material properties." ); osg::notify( osg::WARN ) << warning << std::endl; _fltOpt.getWriteResult().warn( warning ); } } }