void Ice::BadMagicException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown magic number: "; ios_base::fmtflags originalFlags = out.flags(); // Save stream state ostream::char_type originalFill = out.fill(); out.flags(ios_base::hex); // Change to hex out.fill('0'); // Fill with leading zeros out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[0])) << ", "; out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[1])) << ", "; out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[2])) << ", "; out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[3])); out.fill(originalFill); // Restore stream state out.flags(originalFlags); if(!reason.empty()) { out << "\n" << reason; } }
//--------------------------------------------------------------------------------- // Function: boxLine() // Title: Box Line // Description: // draws a a line of text aligned in the middle of the box // Programmer: Paul Bladek // // Date: 10/3/2006 // // Version: 1.01 // // Environment: Hardware: i3 // Software: OS: Windows 7; // Compiles under Microsoft Visual C++ 2012 // // Output: Formatted text to sout // // Called By: header() // endbox() // // Parameters: sout: ostream&; stream to print to // text: const string&; text to print // length: unsigned short; length of the box // alignment: unsigned char; 'L' (left), 'C'(center),'R'(right) // fillc: char; fill character // // Returns: void // // History Log: // 10/3/2006 PB completed v 1.01 // //--------------------------------------------------------------------------------- void boxLine(ostream& sout, const string& text, unsigned short length, unsigned char alignment, char fillc) { long originalformat = sout.flags(); // saves original format alignment = toupper(alignment); if(alignment != LEFT && alignment != RIGHT && alignment != CENTER) throw exception(); if(length > MAX_LINE_LENGTH) length = MAX_LINE_LENGTH; sout << setfill(fillc); // change fill character sout.put(VERT); if(alignment == CENTER) { sout << setw((length + static_cast<streamsize>(text.length())) / 2 - 1) << text << setw((length - static_cast<streamsize>(text.length())) / 2 - 1) << fillc; if(text.length() % 2 == 0) sout << fillc; } else { if(alignment == LEFT) sout << left; sout << setw(length - OFFSET) << text; } sout.flags(originalformat); // reset flags sout.put(VERT); sout << endl; }
// Student::Write ///////////////////////////////////////// void Student::Write(ostream &os) const { ios::fmtflags flags; int precision; // Write Person portion Person::Write(os); // Write the rest. if (&os == &cout || &os == &cerr) { // Get original state. precision = cout.precision(); flags = os.flags(); // Display GPA os << fixed << setprecision(2); os << "GPA: " << GPA(); if (Student::Debug()) { os << " (Address is 0x" << &m_gpa << ')'; } // Restore original state. cout.precision(precision); os.flags(flags); } else { os << GPA(); } os << '\n' << flush; }
void StackTrace::print(ostream &out, const char * const linePrefix) const { if (!m_success) { out << "<stack trace is unavailable>"; return; } const ios_base::fmtflags backup = out.flags(); for (int i = 0, n = m_elements.size(); i < n; ++i) { out << linePrefix; assert(m_elements[i] != 0); const StackTraceElement &element = *m_elements[i]; out << (!element.m_function.empty() ? element.m_function.c_str() : "<unknown>") << " <" << element.m_address; if (element.m_offset != 0) { out.flags(ios::hex); assert(element.m_offset > 0); out << '+' << element.m_offset; } const afc::String * const fileNamePtr = element.m_file.get(); out << ">\tat " << (fileNamePtr == nullptr ? "<unknown source>" : fileNamePtr->c_str()); if (element.m_line != StackTraceElement::NO_LINE) { out.flags(ios::dec); out << ':' << element.m_line; } out << '\n'; } out.flags(backup); }
void Trajectory::Draw(ostream &os) const { ios::fmtflags oldflags = os.flags(); os.setf(ios::fixed); Context all; os << "time \\ var "; for(ivmap::const_iterator i=traj.begin();i!=traj.end();++i) { os.width(5); os << i->first << " "; all.AddVar(i->first,2); } os << endl; Instantiation oldv(all,-1); for(Index ii = Begin(all);!ii.Done();++ii) { //os << "_____________________________________________________________" << endl; os << ii.Time() << " "; for(ivmap::const_iterator i=traj.begin();i!=traj.end();++i) { if (oldv.Value(i->first)!=ii.Values().Value(i->first)) { os.width(5); os << ii.Values().Value(i->first) << " "; } else { os << " "; } } os << endl; oldv = ii.Values(); } os.flags(oldflags); }
void PackedNavBits::dump(ostream& s) const throw() { ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); s << "****************************************************************" << "************" << endl << "Packed Nav Bits" << endl << endl << "SatID: " << getsatSys() << endl << endl << "Carrier: " << ObsID::cbDesc[obsID.band] << " " << "Code: " << ObsID::tcDesc[obsID.code] << "NavID: " << navID << endl; if (rxID.size()>0) s << " RxID: " << rxID << endl; s << endl << "Number Of Bits: " << dec << getNumBits() << endl << endl; s << " Week(10bt) SOW UTD SOD" << " MM/DD/YYYY HH:MM:SS\n"; s << " Xmit Time: "; s << printTime( transmitTime, "%4F(%4G) %6.0g %3j %5.0s %02m/%02d/%04Y %02H:%02M:%02S"); s << endl; s << endl << "Packed Bits, Left Justified, 32 Bits Long:\n"; int numBitInWord = 0; int word_count = 0; uint32_t word = 0; for(size_t i = 0; i < bits.size(); ++i) { word <<= 1; if (bits[i]) word++; numBitInWord++; if (numBitInWord >= 32) { s << " 0x" << setw(8) << setfill('0') << hex << word << dec << setfill(' '); numBitInWord = 0; word_count++; //Print four words per line if (word_count %5 == 0) s << endl; } } word <<= 32 - numBitInWord; if (numBitInWord > 0 ) s << " 0x" << setw(8) << setfill('0') << hex << word << dec << setfill(' '); s.setf(ios::fixed, ios::floatfield); s.precision(3); s.flags(oldFlags); // Reset whatever conditions pertained on entry } // end of PackedNavBits::dump()
void MetaNumeric::print(ostream& stream) { stream << resetiosflags(stream.flags()); stream << setfill(' '); if (!numeric) { stream << " '" << actual_name << "' : non-numeric values are present or all values are missing" << endl; } else { stream << resetiosflags(stream.flags()); stream << setprecision(7); stream << setw(12) << left << " N" << " = " << n << endl; stream << setw(12) << left << " Mean" << " = " << mean << endl; stream << setw(12) << left << " StdDev" << " = " << sd << endl; if (print_min == true) { stream << setw(12) << left << " Min" << " = " << min << endl; } if (print_max == true) { stream << setw(12) << left << " Max" << " = " << max << endl; } if (print_median == true) { stream << setw(12) << left << " Median" << " = " << median << endl; } if (print_skewness == true) { stream << setw(12) << left << " Skewness" << " = " << skew << endl; } if (print_kurtosis == true) { stream << setw(12) << left << " Kurtosis" << " = " << kurtosis << endl; } stream << setw(12) << left << " No. of NAs" << " = " << na << endl; if (print_quantiles == true) { stream << endl; stream << " Quantiles:" << endl; stream << fixed; stream << setprecision(0); stream << " Min (" << quantiles[0][0] * 100 << "%)"; stream << "\t = " << setprecision(3) << quantiles[0][1] << endl; for (unsigned int j = 1; j < 4; j++) { stream << setprecision(0); stream << " " << quantiles[j][0] * 100 << "%"; stream << "\t\t = " << setprecision(3) << quantiles[j][1] << endl; } stream << setprecision(0); stream << " Median (" << quantiles[4][0] * 100 << "%)"; stream << "\t = " << setprecision(3) << quantiles[4][1] << endl; for (unsigned int j = 5; j < 8; j++) { stream << setprecision(0); stream << " " << quantiles[j][0] * 100 << "%"; stream << "\t\t = " << setprecision(3) << quantiles[j][1] << endl; } stream << setprecision(0); stream << " Max (" << quantiles[8][0] * 100 << "%)"; stream << "\t = " << setprecision(3) << quantiles[8][1] << endl; } stream << resetiosflags(stream.flags()); stream << setfill(' '); } }
void BrcKeplerOrbit::dump(ostream& s) const throw() { const ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); s << "****************************************************************" << "************" << endl << "Broadcast Ephemeris (Engineering Units)" << endl << endl << "PRN : " << setw(2) << PRNID << endl << endl; s << " Week(10bt) SOW DOW UTD SOD" << " MM/DD/YYYY HH:MM:SS\n"; s << endl; s << "Eph Epoch: "; timeDisplay(s, getOrbitEpoch()); s << endl; s.setf(ios::scientific, ios::floatfield); s.precision(8); s << endl << " ORBIT PARAMETERS" << endl << endl << "Semi-major axis: " << setw(16) << Ahalf << " m**.5" << endl << "Motion correction: " << setw(16) << dn << " rad/sec" << endl << "Eccentricity: " << setw(16) << ecc << endl << "Arg of perigee: " << setw(16) << w << " rad" << endl << "Mean anomaly at epoch: " << setw(16) << M0 << " rad" << endl << "Right ascension: " << setw(16) << OMEGA0 << " rad " << setw(16) << OMEGAdot << " rad/sec" << endl << "Inclination: " << setw(16) << i0 << " rad " << setw(16) << idot << " rad/sec" << endl; s << endl << " HARMONIC CORRECTIONS" << endl << endl << "Radial Sine: " << setw(16) << Crs << " m Cosine: " << setw(16) << Crc << " m" << endl << "Inclination Sine: " << setw(16) << Cis << " rad Cosine: " << setw(16) << Cic << " rad" << endl << "In-track Sine: " << setw(16) << Cus << " rad Cosine: " << setw(16) << Cuc << " rad" << endl; s << endl; s.flags(oldFlags); } // end of BrcKeplerOrbit::dump()
void OrbElemRinex :: dump(ostream& s) const throw( InvalidRequest ) { ios::fmtflags oldFlags = s.flags(); dumpHeader(s); dumpBody(s); s.flags(oldFlags); } // end of dump()
//***************************************************************************** // METHOD: ossimDblGrid::save() // // Saves the grid to the stream in compact ASCII format (not necessarily // human readable). // //***************************************************************************** bool ossimDblGrid::save(ostream& os, const char* descr) const { static const char MODULE[] = "ossimDblGrid::save()"; if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entering...\n"; //*** // Preserve the stream's settings: //*** ios::fmtflags new_options = ios::scientific|ios::dec; //ios::streamsize new_precision = 12; int new_precision = 12; ios::fmtflags old_options = os.flags(new_options); int old_precision = os.precision(new_precision); //*** // Verify the description string is not too long: //*** char descr_buf[81]; std::strncpy(descr_buf, descr, 80); descr_buf[80] = '\0'; //*** // write magic number tag and the grid size X, Y, num params: //*** os << MAGIC_NUMBER << " " << descr_buf << "\n" << theSize.x << " " << theSize.y << " " << theOrigin.u << " " << theOrigin.v << " " << theSpacing.u << " " << theSpacing.v << " " << theNullValue << " " << (int) theDomainType << "\n"; if(theGridData) { //*** // Loop to write grid points: //*** int max_index = theSize.x*theSize.y; for (int i=0; i<max_index; i++) os << theGridData[i] << " "; } os << "\n"; //*** // Restore the stream's state: //*** os.flags(old_options); os.precision(old_precision); if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " returning...\n"; return true; }
void CNavDataElement::dumpHeader(ostream& s) const throw( InvalidRequest ) { s << "****************************************************************" << "************" << endl << "Broadcast Data (Engineering Units) - " << getNameLong(); s << endl; SVNumXRef svNumXRef; int NAVSTARNum = 0; s << endl; s << "PRN : " << setw(2) << satID.id << " / " << "SVN : " << setw(2); try { NAVSTARNum = svNumXRef.getNAVSTAR(satID.id, ctXmit ); s << NAVSTARNum << " "; } catch(NoNAVSTARNumberFound) { s << "XX"; } s << endl << endl; const ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); s << endl; s << " TIMES OF INTEREST" << endl << endl; s << " Week(10bt) SOW DOW UTD SOD" << " MM/DD/YYYY HH:MM:SS\n"; s << "Transmit Time:"; timeDisplay(s, ctXmit); s << endl; // Special case for those data elements that do not possess an // epoch time. if (ctEpoch>CommonTime::BEGINNING_OF_TIME) { s << "Epoch Time: "; timeDisplay(s, ctEpoch); s << endl; } s.flags(oldFlags); }
void OrbElemRinex :: dumpTerse(ostream& s) const throw(InvalidRequest ) { // Check if the subframes have been loaded before attempting // to dump them. if (!dataLoaded()) { InvalidRequest exc("No data in the object"); GPSTK_THROW(exc); } ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); SVNumXRef svNumXRef; int NAVSTARNum = 0; try { NAVSTARNum = svNumXRef.getNAVSTAR(satID.id, ctToe ); s << setw(2) << " " << NAVSTARNum << " "; } catch(NoNAVSTARNumberFound) { s << " XX "; } s << setw(2) << satID.id << " ! "; string tform = "%3j %02H:%02M:%02S"; s << printTime(beginValid, tform) << " ! "; s << printTime(ctToe, tform) << " ! "; s << printTime(endValid, tform) << " ! "; s << setw(4) << setprecision(1) << getAccuracy() << " ! "; s << "0x" << setfill('0') << hex << setw(3) << IODC << " ! "; s << "0x" << setfill('0') << setw(2) << health; s << setfill(' ') << dec; s << " " << setw(2) << health << " ! "; s << endl; s.flags(oldFlags); } // end of dumpTerse()
//-------------------------------------------------------------------------------------------------- void printCorrelations(ostream& os, RooFitResult *res) { ios_base::fmtflags flags = os.flags(); const RooArgList parlist = res->floatParsFinal(); os << " Correlation Matrix" << endl; os << " --------------------" << endl; for(Int_t i=0; i<parlist.getSize(); i++) { for(Int_t j=0; j<parlist.getSize(); j++) os << " " << setw(7) << setprecision(4) << fixed << res->correlationMatrix()(i,j); os << endl; } os.flags(flags); }
void CPicture::DumpTags( ostream& os, bool bRaw /*=false*/ ) { CTagMap::const_iterator i; int idx = os.xalloc(); for( i = TAGMAP.begin(); i != TAGMAP.end(); ++i ) { os << (*i).second; if( (*i).first > 30000 ) { if( PICT_DATA_PSHORT == (*i).second.Type() ) { LPWORD pWord = (LPWORD) (*i).second.pVal(); if( !bRaw ) os << endl << szT1; for( int ii = 0; ii < (*i).second.Count(); ii++ ) { if( !bRaw && ii > 0 && ii % 4 == 0 ) os << endl; if( ii > 0 ) os << szT1; os << pWord[ii]; } } else if( PICT_DATA_PDOUBLE == (*i).second.Type() ) { if( !bRaw ) os << endl << szT1; int f = os.flags(); os.flags( f | ios::fixed ); os.precision( 5 ); double *pDbl = (double*) (*i).second.pVal(); for( int ii = 0; ii < (*i).second.Count(); ii++ ) { if( !bRaw && ii > 0 && ii % 6 == 0 ) os << endl; if( ii > 0 ) os << szT1; os << pDbl[ii]; } os.flags(f); } else if( PICT_DATA_PLONG == (*i).second.Type() ) { if( !bRaw ) os << endl << szT1; long *pLng = (long*) (*i).second.pVal(); for( int ii = 0; ii < (*i).second.Count(); ii++ ) { if( !bRaw && ii > 0 && ii % 6 == 0 ) os << endl; if( ii > 0 ) os << szT1; os << pLng[ii]; } } } os << endl; } }
ostream& __STL_CALL operator<<(ostream& __os, const basic_string<_CharT,_Traits,_Alloc>& __s) { __STL_USING_VENDOR_STD streambuf* __buf = __os.rdbuf(); if (__buf) { size_t __n = __s.size(); size_t __pad_len = 0; const bool __left = (__os.flags() & ios::left) !=0; const size_t __w = __os.width(); if (__w > 0) { __n = min(__w, __n); __pad_len = __w - __n; } if (!__left) __sgi_string_fill(__os, __buf, __pad_len); const size_t __nwritten = __buf->sputn(__s.data(), __n); if (__left) __sgi_string_fill(__os, __buf, __pad_len); if (__nwritten != __n) __os.clear(__os.rdstate() | ios::failbit); __os.width(0); } else __os.clear(__os.rdstate() | ios::badbit); return __os; }
void EscapeString(const string& str, ostream& os) { for(size_t i = 0; i < str.size(); i++) { if(str[i] == '\"') os << "\\\""; else if(str[i] == '\\') os << "\\\\"; else if(!isprint(str[i])) { ostream::fmtflags f = os.flags(); os << "\\x" << hex << setw(2) << setfill('0') << (int)(unsigned char)str[i]; os.flags(f); } else os << str[i]; } }
MVS_API void reset(ostream& os) noexcept { os.clear(); os.fill(os.widen(' ')); os.flags(ios_base::skipws | ios_base::dec); os.precision(6); os.width(0); };
//-------------------------------------------------------------------------------------------------- void printChi2AndKSResults(ostream& os, const Double_t chi2prob, const Double_t chi2ndf, const Double_t ksprob, const Double_t ksprobpe) { ios_base::fmtflags flags = os.flags(); os << " Chi2 Test" << endl; os << " -----------" << endl; os << " prob = " << chi2prob << endl; os << " chi2/ndf = " << chi2ndf << endl; os << endl; os << " KS Test" << endl; os << " ---------" << endl; os << " prob = " << ksprob << endl; os << " prob = " << ksprobpe << " with 1000 pseudo-experiments" << endl; os << endl; os.flags(flags); }
void Print(ostream& os, const VarValue& v) override { JsonHandle jh(CopyToJsonT(v)); size_t flags = (Indent ? JSON_INDENT(Indent) : 0) | (Compact ? JSON_COMPACT : 0); if ((os.flags() & ios::adjustfield) == ios::left) flags |= JSON_COMPACT; if (char *s = json_dumps(jh, flags)) { os << s; FreeWrap(s); } else os << "null"; }
// ======================================================= // * Display the cell parameters in human-readable form void Cell::print( ostream& os ) { unsigned i; ios_base::fmtflags savedFlags = os.flags(); os.setf(ios::fixed); os << "Cell { " << endl; os << " (a,b,c) = "; os << setprecision(6) << setw(12) << a << " , "; os << setprecision(6) << setw(12) << b << " , "; os << setprecision(6) << setw(12) << c << endl; os << " (alpha,beta,gamma) = "; os << setprecision(6) << setw(12) << alpha << " , "; os << setprecision(6) << setw(12) << beta << " , "; os << setprecision(6) << setw(12) << gamma << endl; for ( i = 0 ; i < 3 ; i++ ) { os << " a" << i+1 << " = < "; os << setprecision(6) << setw(12) << av[i].x << " , "; os << setprecision(6) << setw(12) << av[i].y << " , "; os << setprecision(6) << setw(12) << av[i].z << " >" << endl; } os << " volume, real = " << setprecision(6) << setw(12) << volume << endl; for ( i = 0 ; i < 3 ; i++ ) { os << " b" << i+1 << " = < "; os << setprecision(6) << setw(12) << bv[i].x << " , "; os << setprecision(6) << setw(12) << bv[i].y << " , "; os << setprecision(6) << setw(12) << bv[i].z << " >" << endl; } os << " volume, reciprocal = " << setprecision(6) << setw(12) << 1.0 / volume << endl; os << " [ " << setprecision(6) << setw(12) << G.t[0]; os << " ]" << endl; os << " metric tensor (g) = [ " << setprecision(6) << setw(12) << G.t[1] << " "; os << setprecision(6) << setw(12) << G.t[2] << " ]" << endl; os << " [ " << setprecision(6) << setw(12) << G.t[3] << " "; os << setprecision(6) << setw(12) << G.t[4] << " "; os << setprecision(6) << setw(12) << G.t[5] << " ]" << endl; os << "}" << endl; os.setf(savedFlags); }
void BrcClockCorrection::dump(ostream& s) const { const ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); s << "****************************************************************" << "************" << endl << "Broadcast Ephemeris (Engineering Units)" << endl << endl << "PRN : " << setw(2) << PRNID << endl << endl; s << " Week(10bt) SOW DOW UTD SOD" << " MM/DD/YYYY HH:MM:SS\n"; s << "Clock Epoch: "; timeDisplay(s, getEpochTime()); s << endl; s.setf(ios::scientific, ios::floatfield); s.precision(11); s << endl << " CLOCK" << endl << endl << "Bias T0: " << setw(18) << af0 << " sec" << endl << "Drift: " << setw(18) << af1 << " sec/sec" << endl << "Drift rate: " << setw(18) << af2 << " sec/(sec**2)" << endl; s << "****************************************************************" << "************" << endl; s.flags(oldFlags); }
void PatternConverter::formatAndAppend(ostream& output, const InternalLoggingEvent& loggingEvent) { string str; convert(str, loggingEvent); std::size_t len = str.length(); if(len > _maxLen) output << str.substr(len - _maxLen); else if(static_cast<int>(len) < _minLen) { std::ios_base::fmtflags const original_flags = output.flags(); char const fill = output.fill(' '); output.setf(_leftAlign ? std::ios_base::left : std::ios_base::right, std::ios_base::adjustfield); output.width(_minLen); output << str; output.fill(fill); output.flags(original_flags); } else output << str; }
void RecordFactory::PrintCurrency(ostream &os, double value) { long double dv = value * 100; // stupid library! divides by 100 for some reason... // Construct a ostreamb12uf_iterator on cout typedef std::ostreambuf_iterator<char, std::char_traits<char> > Iter; Iter begin(os); // Get a money put facet const std::money_put<char, Iter> &mp = std::use_facet<std::money_put<char, Iter> >(std::locale()); ios::fmtflags flgs = os.setf(ios_base::showbase|ios_base::internal); streamsize orig = os.width(5); mp.put(begin, false, os, '0', dv); os.width(orig); os.flags(flgs); }
static void printStep(int step, double x, double dx, double f_of_x, ostream& os) { int w = os.width(); int p = os.precision(); ios::fmtflags f = os.flags(); os.setf(ios::right, ios::adjustfield); os << " " << setw(4) << step << " "; os.setf(ios::left, ios::adjustfield); os << setprecision(14) << setw(20) << x << " " << setw(20) << dx << " " << setw(20) << f_of_x << endl; os.width(w); os.precision(p); os.setf(f); }
// ======================================================= // * Display the crystal cell parameters in human-readable // form void CrystalCell::print( ostream& os ) { ios_base::fmtflags savedFlags = os.flags(); os << "CrystalCell { basisSize=" << basisSize << " basisCount=" << basisCount << endl; os.setf(ios::fixed); for ( unsigned i = 0 ; i < basisCount ; i++ ) { os.setf(ios::left); os << setw(3) << basis[i].atomicNumber << ' '; os.unsetf(ios::left); os << setprecision(6) << setw(10) << basis[i].atomPosition.x << ' '; os << setprecision(6) << setw(10) << basis[i].atomPosition.y << ' '; os << setprecision(6) << setw(10) << basis[i].atomPosition.z << endl; } os.unsetf(ios::fixed); // Ask our superclass to print its info, too: Cell::print(os); os << "}\n"; os.setf(savedFlags); }
static void write_64(hash_t h, ostream &out) { std::ios_base::fmtflags original_flags = out.flags(); out << "0x" << (hex) << h << "ULL"; out.flags(original_flags); }
void MetaNumeric::print_html(ostream& stream, char path_separator) { if (!numeric) { stream << "<div class = \"result\">"; stream << "'" << actual_name << "' : non-numeric values are present or all values are missing"; stream << "</div>"; } else { stream << "<div class = \"container\">"; stream << "<div class = \"spacer\"> </div>"; stream << "<div class = \"float\">"; stream << "<table class = \"groups\">"; stream << "<tr><th colspan = \"2\">Statistics</th></tr>"; stream << "<tr><td>N</td><td>" << n << "</td></tr>"; stream << "<tr><td>Mean</td><td>" << mean << "</td></tr>"; stream << "<tr><td>StdDev</td><td>" << sd << "</td></tr>"; if (print_min == true) { stream << "<tr><td>Min</td><td>" << min << "</td></tr>"; } if (print_max == true) { stream << "<tr><td>Max</td><td>" << max << "</td></tr>"; } if (print_median == true) { stream << "<tr><td>Median</td><td>" << median << "</td></tr>"; } if (print_skewness == true) { stream << "<tr><td>Skewness</td><td>" << skew << "</td></tr>"; } if (print_kurtosis == true) { stream << "<tr><td>Kurtosis</td><td>" << kurtosis << "</td></tr>"; } stream << "<tr><td>No. of NAs</td><td>" << na << "</td></tr>"; stream << "</table>"; stream << "</div>"; if (print_quantiles == true) { stream << fixed; stream << "<div class = \"float\">"; stream << "<table class = \"groups\">"; stream << "<tr><th colspan = \"2\">Quantiles</th></tr>"; stream << setprecision(0) << "<tr><td>Min (" << quantiles[0][0] * 100 << "%)</td>"; stream << setprecision(3) << "<td>" << quantiles[0][1] << "</td></tr>"; for (unsigned int j = 1; j < 4; j++) { stream << setprecision(0) << "<tr><td>" << quantiles[j][0] * 100 << "%</td>"; stream << setprecision(3) << "<td>" << quantiles[j][1] << "</td></tr>"; } stream << setprecision(0) << "<tr><td>Median (" << quantiles[4][0] * 100 << "%)</td>"; stream << setprecision(3) << "<td>" << quantiles[4][1] << "</td></tr>"; for (unsigned int j = 5; j < 8; j++) { stream << setprecision(0) << "<tr><td>" << quantiles[j][0] * 100 << "%</td>"; stream << setprecision(3) << "<td>" << quantiles[j][1] << "</td></tr>"; } stream << setprecision(0) << "<tr><td>Max (" << quantiles[8][0] * 100 << "%)</td>"; stream << setprecision(3) << "<td>" << quantiles[8][1] << "</td></tr>"; stream << "</table>"; stream << "</div>"; } if (get_plot() != NULL) { stream << "<div class = \"float\">"; stream << "<a href = \"" << (auxiliary::is_absolute_path(get_plot()->get_name(), path_separator) ? "file:///" : "") << get_plot()->get_name() << ".png\">"; stream << "<img src = \"" << (auxiliary::is_absolute_path(get_plot()->get_name(), path_separator) ? "file:///" : "") << get_plot()->get_name() << ".png\" alt = \"" << get_plot()->get_name() << ".png\" title = \"Click to enlarge the figure\" width = \"400\" height = \"300\" />"; stream << "</a>"; stream << "</div>"; } stream << "<div class = \"spacer\"> </div>"; stream << "</div>"; stream << resetiosflags(stream.flags()); } }
// ======================================================= // * Generate a listing of cartesian coordinates for a // cell propogated through (i,j,k) translations. The // coordinates are centered on the origin. void CrystalCell::Propogate( unsigned i, unsigned j, unsigned k, ostream& os, unsigned opts ) { TVector3D xform = { 0.0 , 0.0 , 0.0 }; TPoint3D pt; unsigned li,lj,lk,bb; ios_base::fmtflags savedFlags = os.flags(); ANSRDB* periodicTable = ANSRDB::DefaultANSRDB(); // Vector-transform to be used on each point such // that we center the generated lattice at the // origin: if (opts == kCrystalCellPropogateCentered) { Vector3D_ScaledSum(&xform,(double)i,&av[0],&xform); Vector3D_ScaledSum(&xform,(double)j,&av[1],&xform); Vector3D_ScaledSum(&xform,(double)k,&av[2],&xform); Vector3D_Scalar(&xform,-0.5,&xform); } // Simply loop and generate points: os.setf(ios::fixed); for ( li = 0 ; li < i ; li++ ) { for ( lj = 0 ; lj < j ; lj++ ) { for ( lk = 0 ; lk < k ; lk++ ) { for ( bb = 0 ; bb < basisCount ; bb++ ) { pt = basis[bb].atomPosition; if (li) pt.x += (double)li; if (lj) pt.y += (double)lj; if (lk) pt.z += (double)lk; pt = FractionalToCartesian(pt); Vector3D_Sum(&pt,&xform,&pt); TElementSymbol symbol = periodicTable->LookupSymbolForNumber(basis[bb].atomicNumber); if (symbol == kANSRInvalidSymbol) { os.setf(ios::left); os << " " << setw(3) << basis[bb].atomicNumber << " "; os.unsetf(ios::left); os << setprecision(6) << setw(12) << pt.x << ' '; os << setprecision(6) << setw(12) << pt.y << ' '; os << setprecision(6) << setw(12) << pt.z << endl; } else { os.setf(ios::left); os << " " << setw(3) << (char*)&symbol << " "; os.unsetf(ios::left); os << setprecision(6) << setw(12) << pt.x << ' '; os << setprecision(6) << setw(12) << pt.y << ' '; os << setprecision(6) << setw(12) << pt.z << endl; } } } } } os.setf(savedFlags); }
StreamParameters::StreamParameters(const ostream &stream) { m_precision = stream.precision(); m_width = stream.width(); m_flags = stream.flags(); m_filler = stream.fill(); }
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()