• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ostream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ostream的典型用法代码示例。如果您正苦于以下问题:C++ ostream类的具体用法?C++ ostream怎么用?C++ ostream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ostream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: run

/*!

*/
void Md_method::run(Program_options & options, ostream & output)
{

  output.precision(10);


  string logfile=options.runid+".log";
  prop.setLog(logfile, log_label);

  int natoms=sys->nIons();

  Array1 < Array1 <int> > atom_move;
  Array1 < Array2 <doublevar> > displace;

  //Even numbered displacements are in + direction, odd are in 
  // - direction

  if(natoms==2) {
    //For a dimer, assume they are oriented in the z 
    //direction and only move in that direction.
    atom_move.Resize(4);
    displace.Resize(4);
    int count=0;
    for(int at=0; at < natoms; at++) {
      for(int s=0; s< 2; s++) {
        atom_move(count).Resize(1);
        displace(count).Resize(1,3);
        atom_move(count)(0)=at;
        displace(count)=0;
          if(s==0) 
            displace(count)(0,2)=0.00025;
          else
            displace(count)(0,2)=-0.00025;
          count++;
      }
    }
    
  }
  else {
    int ndim=0;
    for(int d=0; d< 3; d++) {
      if(restrict_dimension(d) ==0) ndim++;
    }
    atom_move.Resize(2*ndim*natoms);
    displace.Resize(2*ndim*natoms);
    int count=0;
    for(int at=0; at< natoms; at++) {
      for(int d=0; d< 3; d++) {
        if(!restrict_dimension(d) ) {
        for(int s=0; s< 2; s++) {
          atom_move(count).Resize(1);
          displace(count).Resize(1,3);
          atom_move(count)(0)=at;
          displace(count)=0;
          if(s==0) 
            displace(count)(0,d)=0.00025;
          else
            displace(count)(0,d)=-0.00025;
          count++;
        }
      }
      }
    }
  }
  
  prop.setDisplacement(atom_move, displace);
  Properties_final_average curravg;
  
  string vmcout=options.runid+".embed";
  ofstream vmcoutput;
  if(output) 
	vmcoutput.open(vmcout.c_str());

 
  Array3 <doublevar> ionpos(nstep+2, natoms, 3, 0.0);
  Array1 <doublevar> temppos(3);


  for(int s=0; s< 2; s++) {
    for(int at=0; at< natoms; at++) {
      sys->getIonPos(at, temppos);
      for(int d=0; d< 3; d++) {
        ionpos(s,at,d)=temppos(d);
      }
    }
  }

  if(readcheckfile != "") {
    read_check(ionpos);
  }


  for(int s=0; s< 2; s++) {
    Array2 <doublevar> pos(ionpos(s));
    recenter(pos, atomic_weights);
  }

//.........这里部分代码省略.........
开发者ID:WagnerGroup,项目名称:PK_ExperimentalMainline,代码行数:101,代码来源:Md_method.cpp


示例2: write

void Auto::write(ostream& os, Types types)
{
	os.write((char*)&types, sizeof(types));
}
开发者ID:freestylekf,项目名称:CourseMaterial-CppDeeplyEmbedded,代码行数:4,代码来源:Auto.cpp


示例3:

void DSA1Gen_Entry::write(ostream& strm) {
    strm.write(name.c_str(), 12);
    write32(strm, offset);
}
开发者ID:Henne,项目名称:BrightEyes,代码行数:4,代码来源:dsa1.cpp


示例4: ConstDecls

boolean ScrollerCode::ConstDecls(ostream& out) {
    out << "(const char*, Interactor* i);\n";
    return out.good();
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:4,代码来源:ibscroller.c


示例5: binwrite

template<class T> void binwrite(ostream& out, T x)
{
    out.write(reinterpret_cast<char*>(&x), sizeof(T));
}
开发者ID:Habatchii,项目名称:celestia,代码行数:4,代码来源:buildstardb.cpp


示例6: encode

void derivator_dictionary_encoder::encode(istream& is, istream& dictionary, bool verbose, ostream& os) {
  // Load the morphology
  cerr << "Loading morphology: ";
  auto dictionary_start = dictionary.tellg();
  unique_ptr<morpho> morpho(morpho::load(dictionary));
  if (!morpho) runtime_failure("Cannot load morpho model from given file!");
  if (morpho->get_derivator()) runtime_failure("The given morpho model already has a derivator!");
  auto dictionary_end = dictionary.tellg();
  cerr << "done" << endl;

  // Load the derivator
  cerr << "Loading derivator data: ";

  struct lemma_info {
    string sense;
    string comment;
    string parent;
    set<string> parents;
    unsigned children;
    unsigned mark;

    lemma_info(const string& sense = string(), const string& comment = string())
        : sense(sense), comment(comment), children(0), mark(0) {}
  };
  map<string, lemma_info> derinet;

  string line;
  string part_lid, lemma_lid, lemma_comment;
  vector<string> tokens;
  vector<string> parts;
  unordered_map<string, lemma_info> matched[2];
  vector<tagged_lemma_forms> matched_lemmas_forms;
  while (getline(is, line)) {
    split(line, '\t', tokens);
    if (tokens.size() != 2) runtime_failure("Expected two tab separated columns on derivator line '" << line << "'!");

    // Generate all possible lemmas and parents
    for (int i = 0; i < 2; i++) {
      split(tokens[i], ' ', parts);
      if (parts.size() > 2) runtime_failure("The derivator lemma desctiption '" << tokens[i] << "' contains two or more spaces!");
      bool is_lemma_id = parts.size() == 1;

      part_lid.assign(parts[0], 0, morpho->lemma_id_len(parts[0]));
      morpho->generate(parts[0], is_lemma_id ? nullptr : parts[1].c_str(), morpho::NO_GUESSER, matched_lemmas_forms);

      matched[i].clear();
      for (auto&& lemma_forms : matched_lemmas_forms) {
        lemma_lid.assign(lemma_forms.lemma, 0, morpho->lemma_id_len(lemma_forms.lemma));

        if (!is_lemma_id || part_lid == lemma_lid) {
          // Choose only the shortest lemma comment for the lemma id of lemma_form.lemma
          lemma_comment.assign(lemma_forms.lemma, lemma_lid.size(), string::npos);
          auto it = matched[i].emplace(lemma_lid, lemma_info(lemma_lid.substr(morpho->raw_lemma_len(lemma_lid)), lemma_comment));
          if (!it.second &&
              (lemma_comment.size() < it.first->second.comment.size() ||
               (lemma_comment.size() == it.first->second.comment.size() && lemma_comment < it.first->second.comment)))
            it.first->second.comment.assign(lemma_comment);
        }
      }
    }
    if (matched[0].empty() || matched[1].empty()) {
      if (verbose)
        cerr << "Could not match a lemma from line '" << line << "', skipping." << endl;
      continue;
    }

    // Store the possible parents
    derinet.insert(matched[0].begin(), matched[0].end());
    derinet.insert(matched[1].begin(), matched[1].end());
    for (auto&& lemma : matched[0])
      for (auto&& parent : matched[1])
        derinet[lemma.first].parents.insert(parent.first);
  }
  cerr << "done" << endl;

  // Choose unique parent for every lemma
  for (auto&& lemma : derinet)
    if (!lemma.second.parents.empty()) {
      // Try locating lexicographically smallest parent with the same sense
      for (auto&& parent : lemma.second.parents)
        if (derinet[parent].sense == lemma.second.sense) {
          lemma.second.parent.assign(parent);
          break;
        }

      // Otherwise, choose the lexicographically smallest parent
      if (lemma.second.parent.empty())
          lemma.second.parent.assign(*lemma.second.parents.begin());

      // Add this edge also to the parent
      derinet[lemma.second.parent].children++;

      if (verbose)
        cerr << lemma.first << lemma.second.comment << " -> " << lemma.second.parent << derinet[lemma.second.parent].comment << endl;
    }

  // Make sure the derinet contains no cycles
  unsigned mark = 0;
  for (auto&& lemma : derinet) {
    lemma.second.mark = ++mark;
//.........这里部分代码省略.........
开发者ID:ufal,项目名称:morphodita,代码行数:101,代码来源:derivator_dictionary_encoder.cpp


示例7: __SaveString

inline void __SaveString(const string &s, ostream &out) {
	size_t len= s.size();
	out.write((char*)&len, sizeof(len));
	out.write(s.c_str(), len*sizeof(char));
}
开发者ID:409544320,项目名称:face_recog.src,代码行数:5,代码来源:utils.cpp


示例8: write

//***************************************************************************
// PUBLIC METHOD:
// void ossimFfRevb::write(ostream& os) const
//
// Writes an EOSAT Fast Format Rev B formatted header.
//***************************************************************************
void ossimFfRevb::write(ostream& os) const
{
   const char PRODUCT_ID_DESC [PRODUCT_ORDER_NUMBER_DESC_SIZE + 1]
      = "PRODUCT =";

   const char WRS_DESC [WRS_DESC_SIZE + 1]
      = " WRS =";

   const char DATE_DESC [DATE_DESC_SIZE + 1]
      = " ACQUISITION DATE =";
   
   const char SATELLITE_NUMBER_DESC [SAT_NUMBER_DESC_SIZE + 1]
      = " SATELLITE =";
   
   const char INSTRUMENT_TYPE_DESC [INSTRUMENT_TYPE_DESC_SIZE + 1]
      = " INSTRUMENT =";
   
   const char PRODUCT_TYPE_DESC [PRODUCT_TYPE_DESC_SIZE + 1]
      = " PRODUCT TYPE =";
   
   const char PRODUCT_SIZE_DESC [PRODUCT_SIZE_DESC_SIZE + 1]
      = " PRODUCT SIZE =";
   
   const char PROCESSING_TYPE_DESC [PROCESSING_TYPE_DESC_SIZE + 1]
      = " TYPE OF GEODETIC PROCESSING =";
   
   const char RESAMPLING_ALGO_DESC [RESAMPLING_ALGO_DESC_SIZE + 1]
      = " RESAMPLING =";
   
   const char RADIANCE_DESC [RADIANCE_DESC_SIZE + 1]
      = " RAD GAINS/BIASES = ";

   const char VOLUME_NUMBER_DESC [VOLUME_NUMBER_DESC_SIZE + 1]
      = " TAPE SPANNING FLAG=";
   
   const char  FIRST_LINE_DESC [FIRST_LINE_DESC_SIZE + 1]
      = " START LINE #=";

   const char LINES_PER_VOLUME_DESC [LINES_PER_VOLUME_DESC_SIZE + 1]
      = " LINES PER VOL=";

   const char ORIENTATION_ANGLE_DESC [ORIENTATION_ANGLE_DESC_SIZE + 1]
      = " ORIENTATION =";

   const char MAP_PROJ_NAME_DESC [MAP_PROJ_NAME_DESC_SIZE + 1]
      = " PROJECTION =";
 
   const char USGS_PROJ_NUMBER_DESC [USGS_PROJ_NUMBER_DESC_SIZE + 1]
      = " USGS PROJECTION # =";
 
   const char USGS_MAP_ZONE_DESC [USGS_MAP_ZONE_DESC_SIZE + 1]
      = " USGS MAP ZONE =";
 
   const char PROJECTION_PARAMETER_DESC [USGS_PROJ_PARAMS_DESC_SIZE + 1]
      = " USGS PROJECTION PARAMETERS =";

   const char ELLIPSOID_DESC [ELLIPSOID_DESC_SIZE + 1]
      = " EARTH ELLIPSOID =";
      
   const char MAJOR_AXIS_DESC [MAJOR_AXIS_DESC_SIZE+ 1]
      = " SEMI-MAJOR AXIS =";
      
   const char MINOR_AXIS_DESC [MINOR_AXIS_DESC_SIZE+ 1]
      = " SEMI-MINOR AXIS =";
      
   const char PIXEL_GSD_DESC [PIXEL_GSD_DESC_SIZE + 1]
      = " PIXEL SIZE =";
   
   const char PIXELS_PER_LINE_DESC [PIXELS_PER_LINE_DESC_SIZE + 1]
      = " PIXELS PER LINE=";
   
   const char LINES_PER_IMAGE_DESC [LINES_PER_IMAGE_DESC_SIZE + 1]
      = " LINES PER IMAGE=";

   const char UL_DESC [CORNER_DESC_SIZE + 1]
      = " UL ";

   const char UR_DESC [CORNER_DESC_SIZE + 1]
      = " UR ";
   
   const char LR_DESC [CORNER_DESC_SIZE + 1]
      = " LR ";
   
   const char LL_DESC [CORNER_DESC_SIZE + 1]
      = " LL ";
   
   const char BANDS_PRESENT_DESC [BANDS_PRESENT_DESC_SIZE + 1]
      = " BANDS PRESENT =";
   
   const char BLOCKING_FACTOR_DESC [BLOCKING_FACTOR_DESC_SIZE + 1]
      = " BLOCKING FACTOR =";
   
   const char RECORD_LENGTH_DESC [RECORD_LENGTH_DESC_SIZE + 1]
      = " RECORD LENGTH =";
//.........这里部分代码省略.........
开发者ID:LucHermitte,项目名称:ossim,代码行数:101,代码来源:ossimFfRevb.cpp


示例9: os

IndentedStream::IndentedStreamBuffer::IndentedStreamBuffer
    (ostream& os, const string& indent): os(os), indent(indent)
{
    os.write(indent.data(), indent.size());
}
开发者ID:zhendongwang1123,项目名称:kedr-aux,代码行数:5,代码来源:mist_template_group.cpp


示例10: Save

void RandomDrop::Save(ostream& File)const {
    File.write(Id,4u);
    File.write((char*)&Chance,4u);
}
开发者ID:Zeatherann,项目名称:WorldEditor,代码行数:4,代码来源:RandomDrop.cpp


示例11: Print

//==============================================================================
void Epetra_BlockMap::Print(ostream & os) const
{
  int * FirstPointInElementList1 = 0;
  int * ElementSizeList1 = 0;
  if (!ConstantElementSize()) {
    FirstPointInElementList1 = FirstPointInElementList();
    ElementSizeList1 = ElementSizeList();
  }
  int MyPID = Comm().MyPID();
  int NumProc = Comm().NumProc();
  
  for (int iproc = 0; iproc < NumProc; iproc++) {
    if (MyPID == iproc) {
      if (MyPID == 0) {
  os <<  "\nNumber of Global Elements  = "; os << NumGlobalElements64(); os << endl;
  os <<    "Number of Global Points    = "; os << NumGlobalPoints64(); os << endl;
  os <<    "Maximum of all GIDs        = "; os << MaxAllGID64(); os << endl;
  os <<    "Minimum of all GIDs        = "; os << MinAllGID64(); os << endl;
  os <<    "Index Base                 = "; os << IndexBase(); os << endl;
  if (ConstantElementSize())
    os <<  "Constant Element Size      = "; os << ElementSize(); os << endl;
      }
      os << endl;
      
      os <<    "Number of Local Elements   = "; os << NumMyElements(); os << endl;
      os <<    "Number of Local Points     = "; os << NumMyPoints(); os << endl;
      os <<    "Maximum of my GIDs         = "; os << MaxMyGID64(); os << endl;
      os <<    "Minimum of my GIDs         = "; os << MinMyGID64(); os << endl;
      os << endl;
      
      os.width(14);
      os <<  "     MyPID"; os << "    ";
      os.width(14);
      os <<  "       Local Index "; os << " ";
      os.width(14);
      os <<  "      Global Index "; os << " ";
      if (!ConstantElementSize()) {
  os.width(14);
  os <<" FirstPointInElement "; os << " ";
  os.width(14);
  os <<"   ElementSize "; os << " ";
      }
      os << endl;
      
      for (int i = 0; i < NumMyElements(); i++) {
  os.width(14);
  os <<  MyPID; os << "    ";
  os.width(14);
  os <<  i; os << "    ";
  os.width(14);

  if(BlockMapData_->GlobalIndicesLongLong_)
  {
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
    long long * MyGlobalElements1 = MyGlobalElements64();
    os <<  MyGlobalElements1[i]; os << "    ";
#else
    throw ReportError("Epetra_BlockMap::Print: ERROR, GlobalIndicesLongLong but no API for it.",-1);
#endif
  }
  else if(BlockMapData_->GlobalIndicesInt_)
  {
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
    int * MyGlobalElements1 = MyGlobalElements();
    os <<  MyGlobalElements1[i]; os << "    ";
#else
    throw ReportError("Epetra_BlockMap::Print: ERROR, no GlobalIndicesLongLong but no API for it.",-1);
#endif
  }

  if (!ConstantElementSize()) {    
    os.width(14);
    os << FirstPointInElementList1[i]; os << "    ";
    os.width(14);
    os << ElementSizeList1[i]; os << "    ";
  }
  os << endl;
      }
      
      os << flush;
      
    }
    // Do a few global ops to give I/O a chance to complete
    Comm().Barrier();
    Comm().Barrier();
    Comm().Barrier();
  }
  return;
}
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:90,代码来源:Epetra_BlockMap.cpp


示例12: outputTo

  ExitCodes outputTo(ostream& os)
  {
    //-------------------------------------------------------------
    // Parameter handling
    //-------------------------------------------------------------

    // File names
    String in = getStringOption_("in");

    // File type
    FileHandler fh;
    FileTypes::Type in_type = FileTypes::nameToType(getStringOption_("in_type"));

    if (in_type == FileTypes::UNKNOWN)
    {
      in_type = fh.getType(in);
      writeDebug_(String("Input file type: ") + FileTypes::typeToName(in_type), 2);
    }

    if (in_type == FileTypes::UNKNOWN)
    {
      writeLog_("Error: Could not determine input file type!");
      return PARSE_ERROR;
    }

    MSExperiment<Peak1D> exp;
    FeatureMap feat;
    ConsensusMap cons;

    if (in_type == FileTypes::FEATUREXML) //features
    {
      FeatureXMLFile().load(in, feat);
      feat.updateRanges();
    }
    else if (in_type == FileTypes::CONSENSUSXML)     //consensus features
    {
      ConsensusXMLFile().load(in, cons);
      cons.updateRanges();
    }

    //-------------------------------------------------------------
    // meta information
    //-------------------------------------------------------------
    if (getFlag_("m"))
    {
      os << endl
         << "-- General information --" << endl
         << endl
         << "file name: " << in << endl
         << "file type: " <<  FileTypes::typeToName(in_type) << endl;

      //basic info
      os << endl
         << "-- Meta information --" << endl
         << endl;

      if (in_type == FileTypes::FEATUREXML) //features
      {
        os << "Document id       : " << feat.getIdentifier() << endl << endl;
      }
      else if (in_type == FileTypes::CONSENSUSXML)       //consensus features
      {
        os << "Document id       : " << cons.getIdentifier() << endl << endl;
      }
    }

    //-------------------------------------------------------------
    // data processing
    //-------------------------------------------------------------
    if (getFlag_("p"))
    {
      //basic info
      os << endl
         << "-- Data processing information --" << endl
         << endl;

      //get data processing info
      vector<DataProcessing> dp;
      if (in_type == FileTypes::FEATUREXML) //features
      {
        dp = feat.getDataProcessing();
      }
      else if (in_type == FileTypes::CONSENSUSXML)       //consensus features
      {
        dp = cons.getDataProcessing();
      }
      int i = 0;
      for (vector<DataProcessing>::iterator it = dp.begin(); it != dp.end(); ++it)
      {
        os << "Data processing " << i << endl;
        os << "\tcompletion_time:   " << (*it).getCompletionTime().getDate() << 'T' << (*it).getCompletionTime().getTime() << endl;
        os << "\tsoftware name:     " << (*it).getSoftware().getName() << " version " << (*it).getSoftware().getVersion() << endl;
        for (set<DataProcessing::ProcessingAction>::const_iterator paIt = (*it).getProcessingActions().begin(); paIt != (*it).getProcessingActions().end(); ++paIt)
        {
          os << "\t\tprocessing action: " << DataProcessing::NamesOfProcessingAction[*paIt] << endl;
        }
      }
      ++i;
    }

//.........这里部分代码省略.........
开发者ID:BioinformaticsArchive,项目名称:OpenMS,代码行数:101,代码来源:MapStatistics.cpp


示例13: Save

void Doodad::Save(ostream& File)const{
    File.write(Id,4u);
    File.write((char*)&Z,4u);
    File.write((char*)&X,4u);
    File.write((char*)&Y,4u);
}
开发者ID:Zeatherann,项目名称:WorldEditor,代码行数:6,代码来源:Doodad.cpp


示例14: Definition

boolean ScrollerCode::Definition (ostream& out) {
    boolean ok = true;
    if (
	_emitProperty || _emitInstanceDecls || 
        _emitForward || _emitClassHeaders || _emitHeaders
    ) {
        return CodeView::Definition(out);

    } else if (_emitExpHeader) {
	InteractorComp* icomp = GetIntComp();
	MemberNameVar* mnamer = icomp->GetMemberNameVar();
        SubclassNameVar* snamer = icomp->GetClassNameVar();
        if (!snamer->IsSubclass()) {
            if (
                _scope && mnamer->GetExport() && !_namelist->Search("scroller")
            ) {
                _namelist->Append("scroller");
                out << "#include <InterViews/scroller.h>\n";
            }
        } else {
            ok = ok && CodeView::Definition(out);
        }

    } else if (_emitCorehHeader) {
	InteractorComp* icomp = GetIntComp();
        SubclassNameVar* snamer = icomp->GetClassNameVar();
        const char* subclass = snamer->GetName();
        if (snamer->IsSubclass() && strcmp(subclass, _classname) == 0) {
            if (!_namelist->Search("scroller")) {
                _namelist->Append("scroller");
                out << "#include <InterViews/scroller.h>\n";
            }
        }
    } else if (_emitInstanceInits) {
        InteractorComp* icomp = GetIntComp();
        InteractorComp* ctarget = nil;
        const char* mname = icomp->GetMemberNameVar()->GetName();
	MemberNameVar* mnamer = (MemberNameVar*) icomp->GetState(
	    "AdjusteeVar"
	);
        const char* scrollee = mnamer->GetName();

	if (*scrollee == '\0') {
            if (_err_count < 10) {
                strcat(_errbuf, mname);
                strcat(_errbuf, " has undefined scrolling target.\n");
                _err_count++;
            } 
	    return false;

        } else if (!Search(mnamer, ctarget)) {
            if (_err_count < 10) {
                strcat(_errbuf, mname);
                strcat(
                    _errbuf, "'s scrolling target is not in the same hierarchy.\n"
                );
                _err_count++;
            } 
	    return false;

        } else if (ctarget != nil && !icomp->IsRelatableTo(ctarget)) {
            if (_err_count < 10) {
                strcat(_errbuf, mname);
                strcat(
                    _errbuf, 
                    "'s adjusting target is not subclassed nor adjustable.\n"
                );
                _err_count++;
            }
	    return false;
        }
	if (_instancelist->Find((void*) scrollee)) {
            if (!_instancelist->Find((void*) mname)) {
                _instancelist->Append(new UList((void*)mname));

        	scrollee = (*scrollee == '\0') ? "nil" : scrollee;

        	BeginInstantiate(out);
        	out << "(";
        	InstanceName(out);
        	out << scrollee << ")";
        	EndInstantiate(out);
		_icomplete = true;
            }
	} else {
	    _icomplete = false;
	}

    } else if (
	_emitBSDecls || _emitBSInits || 
	_emitFunctionDecls || _emitFunctionInits
    ) {
        return true;

    } else if (
        _emitCoreDecls || _emitCoreInits || _emitClassDecls || _emitClassInits
    ) {
	ok = ok && CodeView::Definition(out);
        
    } else if (_emitMain) {
//.........这里部分代码省略.........
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:101,代码来源:ibscroller.c


示例15: writeIntLsb

// Write int in Least Significant bytes
void writeIntLsb(ostream &out, long l, int size) {
   if (size <= 0) return;
   out.put(l&255);  
   writeIntLsb(out, l>>8, size-1); 
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:6,代码来源:MpAudioFileUtils.cpp


示例16: dump

   void EngAlmanac::dump(ostream& s, bool checkFlag) const
   {
      ios::fmtflags oldFlags = s.flags();

      s.fill(' ');

      s << "****************************************************************"
        << "***************" << endl
        << "Broadcast Almanac (Engineering Units)" << endl
        << endl;

      s << endl << "           Iono Parameters" << endl << endl;
      s << "Alpha:    " << scientific << setprecision(6);
      for (int i=0; i<4; i++)
         s << setw(13) << alpha[i] << "  ";
      s << " various" << endl;
      s << " Beta:    " << fixed << setprecision(1);
      for (int i=0; i<4; i++)
         s << setw(13) << beta[i] << "  ";
      s << " various" << endl;

      s << endl << "           UTC Paramters" << endl << endl;
      s << scientific << setprecision(8)
        << "A0:       " << setw(15) << A0      << " sec" << endl
        << "A1:       " << setw(15) << A1      << " sec/sec" << endl
        << fixed << setprecision(1)
        << "dt_ls:    " << setw(15) << dt_ls   << " sec" << endl
        << "t_ot:     " << setw(15) << t_ot    << " sec" << endl
        << "wn_t:     " << setw(15) << wn_t    << " week" << endl
        << "wn_lsf    " << setw(15) << wn_lsf  << " week" << endl
        << "dn:       " << setw(15) << (int)dn << " days" << endl
        << "dt_lsf:   " << setw(15) << dt_lsf  << " sec" << endl;

      s << endl << "           Orbit Parameters" << endl << endl;
      for (AlmOrbits::const_iterator i = almPRN.begin(); i != almPRN.end(); i++)
         s<< scientific << (*i).second;

      s << endl << "           Special Message" << endl << endl;
      StringUtils::hexDumpData(s, special_msg);


      s << endl << "           Page 25 Health, AS, & SV config" << endl << endl;

      s << "Toa:    " << setfill(' ') << setw(8) << t_oa
        << ", week: " << setw(5) << wn_a << " (" << alm_wk << ")" << endl << endl
        << "PRN   health  AS  cfg    PRN   health  AS  cfg" << endl;
      string bits[33];

      for (SVBitsMap::const_iterator i = health.begin(); i != health.end(); i++)
      {
         int prn = i->first;
         if (prn >= 1 && prn <= 32)
            bits[prn] = int2bin(i->second, 6);
      }

      for (SVBitsMap::const_iterator i = SV_config.begin(); i != SV_config.end(); i++)
      {
         int prn = i->first;
         if (prn >= 1 && prn <= 32)
         {
            bits[prn] += "  " + int2bin(i->second, 4);
            bits[prn].insert(9, "   ");
         }
      }

      for (int i=1; i<=16; i++)
         s << setw(2) << i    << "    " << bits[i] << "    "
           << setw(2) << i+16 << "    " << bits[i+16] << endl;

      s << endl;

      if (checkFlag)
         check(s);

      s << endl;

      s.flags(oldFlags);
   } // end of dump()
开发者ID:JC5005,项目名称:GPSTk,代码行数:78,代码来源:EngAlmanac.cpp


示例17:

/*static*/ void ast_node::output_annot(ostream& stream,int level,const char* annot)
{
    for (int i = 0;i < level;++i)
        stream.put('\t');
    stream << '[' << annot << "]\n";
}
开发者ID:EthanRutherford,项目名称:ramsey,代码行数:6,代码来源:ast.cpp


示例18: writeIntLsb

// Write int in Least Significant bytes
void writeIntLsb(ostream &out, long l, int size) {
   if (size <= 0) return;
   out.put((char)(l & 0xFF));  
   writeIntLsb(out, l>>8, size-1); 
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:6,代码来源:MpAudioFileUtils.cpp


示例19: pagesizealign

void MemoryMap::pagesizealign(ostream &out)
{
	size_t at = out.tellp();
	size_t offs = at % pagesize;
	if(offs) { out.seekp(pagesize - offs, ios::cur); }
}
开发者ID:mslonina,项目名称:swarm,代码行数:6,代码来源:memorymap.cpp


示例20: outputPhrasePair

void outputPhrasePair(const PhraseAlignmentCollection &phrasePair, float totalCount, int distinctCount, ostream &phraseTableFile, bool isSingleton )
{
  if (phrasePair.size() == 0) return;

  const PhraseAlignment &bestAlignment = findBestAlignment( phrasePair );
    
  // compute count
  float count = 0;
  for(size_t i=0; i<phrasePair.size(); i++) {
    count += phrasePair[i]->count;
  }

  // compute domain counts
  map< string, float > domainCount;
  if (domainFlag) {
    for(size_t i=0; i<phrasePair.size(); i++) {
      string d = domain->getDomainOfSentence( phrasePair[i]->sentenceId );
      if (domainCount.find( d ) == domainCount.end())
        domainCount[ d ] = phrasePair[i]->count;
      else
        domainCount[ d ] += phrasePair[i]->count;
    }
  }

  // collect count of count statistics
  if (goodTuringFlag || kneserNeyFlag) {
    totalDistinct++;
    int countInt = count + 0.99999;
    if(countInt <= COC_MAX)
      countOfCounts[ countInt ]++;
  }

  // compute PCFG score
  float pcfgScore = 0;
  if (pcfgFlag && !inverseFlag) {
    float pcfgSum = 0;
    for(size_t i=0; i<phrasePair.size(); ++i) {
        pcfgSum += phrasePair[i]->pcfgSum;
    }
    pcfgScore = pcfgSum / count;
  }

  // output phrases
  const PHRASE &phraseS = phrasePair[0]->GetSource();
  const PHRASE &phraseT = phrasePair[0]->GetTarget();

  // do not output if hierarchical and count below threshold
  if (hierarchicalFlag && count < minCountHierarchical) {
    for(size_t j=0; j<phraseS.size()-1; j++) {
      if (isNonTerminal(vcbS.getWord( phraseS[j] )))
        return;
    }
  }

  // source phrase (unless inverse)
  if (! inverseFlag) {
    printSourcePhrase(phraseS, phraseT, bestAlignment, phraseTableFile);
    phraseTableFile << " ||| ";
  }

  // target phrase
  printTargetPhrase(phraseS, phraseT, bestAlignment, phraseTableFile);
  phraseTableFile << " ||| ";

  // source phrase (if inverse)
  if (inverseFlag) {
    printSourcePhrase(phraseS, phraseT, bestAlignment, phraseTableFile);
    phraseTableFile << " ||| ";
  }

  // lexical translation probability
  if (lexFlag) {
    double lexScore = computeLexicalTranslation( phraseS, phraseT, bestAlignment);
    phraseTableFile << maybeLogProb( lexScore );
  }

  // unaligned word penalty
  if (unalignedFlag) {
    double penalty = computeUnalignedPenalty( phraseS, phraseT, bestAlignment);
    phraseTableFile << " " << maybeLogProb( penalty );
  }

  // unaligned function word penalty
  if (unalignedFWFlag) {
    double penalty = computeUnalignedFWPenalty( phraseS, phraseT, bestAlignment);
    phraseTableFile << " " << maybeLogProb( penalty );
  }

  if (singletonFeature) {
    phraseTableFile << " " << (isSingleton ? 1 : 0);
  }
  
  if (crossedNonTerm && !inverseFlag) {
    phraseTableFile << " " << calcCrossedNonTerm(phraseS, bestAlignment);
  }
  
  // target-side PCFG score
  if (pcfgFlag && !inverseFlag) {
    phraseTableFile << " " << maybeLogProb( pcfgScore );
  }
//.........这里部分代码省略.........
开发者ID:Avmb,项目名称:mosesdecoder,代码行数:101,代码来源:score.cpp



注:本文中的ostream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ostringstream类代码示例发布时间:2022-05-31
下一篇:
C++ ossimRefPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap