`ostream out` C++ Examples
60 C++ code examples are found related to "ostream out".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: PrettyPrinter.cpp From binlog with Apache License 2.0 | 13 votes |
void PrettyPrinter::printEventMessage(detail::OstreamBuffer& out, const Event& event) const { mserialize::string_view tags = event.source->argumentTags; Range args = event.arguments; ToStringVisitor visitor(out); const std::string& fmt = event.source->formatString; for (std::size_t i = 0; i < fmt.size(); ++i) { const char c = fmt[i]; if (c == '{' && fmt[i+1] == '}') { const mserialize::string_view tag = mserialize::detail::tag_pop(tags); mserialize::visit(tag, visitor, args); ++i; // skip } } else { out.put(c); } }
Example 2
Source File: benchfeatures.cpp From simdjson with Apache License 2.0 | 7 votes |
void print_usage(ostream& out) { out << "Usage: " << exe_name << " [-v] [-n #] [-s STAGE] [-a ARCH]" << endl; out << endl; out << "Runs the parser against jsonexamples/generated json files in a loop, measuring speed and other statistics." << endl; out << endl; out << "Options:" << endl; out << endl; out << "-n # - Number of iterations per file. Default: 400" << endl; out << "-i # - Number of times to iterate a single file before moving to the next. Default: 20" << endl; out << "-v - Verbose output." << endl; out << "-s STAGE - Stop after the given stage." << endl; out << " -s stage1 - Stop after find_structural_bits." << endl; out << " -s all - Run all stages." << endl; out << "-a ARCH - Use the parser with the designated architecture (HASWELL, WESTMERE" << endl; out << " or ARM64). By default, detects best supported architecture." << endl; }
Example 3
Source File: PrettyPrinter.cpp From binlog with Apache License 2.0 | 7 votes |
void printTimeZoneOffset(binlog::detail::OstreamBuffer& out, int seconds) { const char sign = (seconds >= 0) ? '+' : '-'; const int psecs = std::abs(seconds); const int hours = psecs / 3600; const int mins = (psecs / 60) - 60 * hours; out.put(sign); printTwoDigits(out, hours < 100 ? hours : 0); printTwoDigits(out, mins < 100 ? mins : 0); }
Example 4
Source File: PrettyPrinter.cpp From binlog with Apache License 2.0 | 7 votes |
void printTwoDigits(binlog::detail::OstreamBuffer& out, int i) { assert(0 <= i && i < 100); const int b = i % 10; const int a = (i - b) / 10; const char digits[2]{char('0' + a), char('0' + b)}; out.write(digits, 2); }
Example 5
Source File: LinearCode.cpp From libscapi with MIT License | 6 votes |
void LinearCode::writeTextFile(std::ostream & out) { out << plaintextBitSize() << " " << codewordBitSize() << "\n"; for (u64 row = 0; row < plaintextBitSize(); ++row) { BitIterator iter((u8*)(mG.data() + row * codewordBlkSize()), 0); for (u64 col = 0; col < codewordBitSize() - 1; ++col) { out << *iter++ << " "; } if (iter.mByte > (u8*)(mG.data() + mG.size())) throw std::runtime_error(LOCATION); out << *iter << "\n"; } }
Example 6
Source File: extra_logger_headers.cpp From ros-vrep-slam with MIT License | 6 votes |
void print_datetime_logger_header ( std::ostream& out, const std::string& logger_name, const log_level& l, const uint64 thread_id ) { using namespace std; char* buf; time_t t = time(0); buf = ctime(&t); // remove the trailing '\n' size_t size = strlen(buf); buf[size-1] = '\0'; out << l.name << " (" << buf << ") [" << thread_id << "] " << logger_name << ": "; }
Example 7
Source File: logger_kernel_1.cpp From ros-vrep-slam with MIT License | 6 votes |
void print_default_logger_header ( std::ostream& out, const std::string& logger_name, const log_level& l, const uint64 thread_id ) { using namespace std; static timestamper ts; static const uint64 first_time = ts.get_timestamp(); const uint64 cur_time = (ts.get_timestamp() - first_time)/1000; streamsize old_width = out.width(); out.width(5); out << cur_time << " " << l.name; out.width(old_width); out << " [" << thread_id << "] " << logger_name << ": "; }
Example 8
Source File: logger_kernel_1.cpp From ros-vrep-slam with MIT License | 6 votes |
void set_all_logging_output_streams ( std::ostream& out_ ) { logger::global_data& gd = logger::get_global_data(); auto_mutex M(gd.m); gd.loggers.reset(); while (gd.loggers.move_next()) { gd.loggers.element()->out.rdbuf(out_.rdbuf()); gd.loggers.element()->hook.clear(); } gd.set_output_stream("",out_); // set the default hook to be an empty member function pointer logger::hook_mfp hook; gd.set_output_hook("",hook); }
Example 9
Source File: EquidistantCamera.cc From CamLaserCalibraTool with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream &operator<<(std::ostream &out, const EquidistantCamera::Parameters ¶ms) { out << "Camera Parameters:" << std::endl; out << " model_type " << "KANNALA_BRANDT" << std::endl; out << " camera_name " << params.m_cameraName << std::endl; out << " image_width " << params.m_imageWidth << std::endl; out << " image_height " << params.m_imageHeight << std::endl; // projection: k2, k3, k4, k5, mu, mv, u0, v0 out << "Projection Parameters" << std::endl; out << " k2 " << params.m_k2 << std::endl << " k3 " << params.m_k3 << std::endl << " k4 " << params.m_k4 << std::endl << " k5 " << params.m_k5 << std::endl << " mu " << params.m_mu << std::endl << " mv " << params.m_mv << std::endl << " u0 " << params.m_u0 << std::endl << " v0 " << params.m_v0 << std::endl; return out; }
Example 10
Source File: iosockstream.cpp From ros-vrep-slam with MIT License | 6 votes |
virtual void on_connect ( std::istream& , std::ostream& out, const std::string& , const std::string& , unsigned short , unsigned short , uint64 ) { try { dlog << LINFO << "serv2: serving connection"; out << "one two three four five"; } catch (error& e) { error_string = e.what(); } }
Example 11
Source File: dumpbin.cpp From interop with GNU General Public License v3.0 | 6 votes |
static void write_bytes_as_string(std::ostream& out, const std::string& buffer, const size_t k_max_line) { std::string::const_iterator sit = buffer.begin(); if (sit == buffer.end()) return; out << ::int16_t(*sit); size_t char_count = length_of(::int16_t(*sit)); for (++sit; sit != buffer.end(); ++sit, ++char_count) { const ::int16_t val = ::int16_t(*sit); char_count += 1 + length_of(val); if (char_count > k_max_line) { out << "\n"; char_count = 1 + length_of(val); } out << "," << val; } out << std::endl; }
Example 12
Source File: benchmark_report.cpp From lightstep-tracer-cpp with MIT License | 6 votes |
std::ostream& operator<<(std::ostream& out, const BenchmarkReport& report) { std::cout << "Approx Span size (bytes): " << report.approx_span_size << "\n"; std::cout << "Total spans: " << report.num_spans_generated << "\n"; std::cout << "Dropped spans: " << report.num_dropped_spans << "\n"; auto dropped_span_percent = 100.0 * static_cast<double>(report.num_dropped_spans) / report.num_spans_generated; std::cout << "Dropped spans (%): " << dropped_span_percent << "\n"; auto num_spans_sent = report.num_spans_generated - report.num_dropped_spans; auto upload_rate = 1e6 * static_cast<double>(num_spans_sent) / report.duration.count(); std::cout << "Upload rate (spans/sec): " << upload_rate << "\n"; auto upload_rate_bytes = 1e6 * static_cast<double>(num_spans_sent) * report.approx_span_size / report.duration.count(); std::cout << "Approx upload (bytes/sec): " << upload_rate_bytes << "\n"; return out; }
Example 13
Source File: impedance.cc From duckdb with MIT License | 6 votes |
void report(std::ostream &out) { out << "{\"impedance\": [ " << endl; for (auto pair = occurances_in_failed_query.begin(); pair != occurances_in_failed_query.end(); ++pair) { out << "{\"prod\": \"" << pretty_type(pair->first) << "\"," << "\"bad\": " << pair->second << ", " << "\"ok\": " << occurances_in_ok_query[pair->first] << ", " << "\"limited\": " << limited[pair->first] << ", " << "\"failed\": " << failed[pair->first] << ", " << "\"retries\": " << retries[pair->first] << "} "; if (next(pair) != occurances_in_failed_query.end()) out << "," << endl; } out << "]}" << endl; }
Example 14
Source File: index_summary.cpp From interop with GNU General Public License v3.0 | 6 votes |
void print_array(std::ostream& out, I beg, I end, const size_t width, const char fillch) { std::ios::fmtflags f( out.flags() ); for(I start=beg;beg != end;++beg) { if(fillch != 0) { out << " "; out.width(width); out.fill(fillch); out << std::left << *beg; } else { if(beg != start) out << ","; out << *beg; } }
Example 15
Source File: BlockChain.cpp From bcos with GNU General Public License v3.0 | 6 votes |
std::ostream& dev::eth::operator<<(std::ostream& _out, BlockChain const& _bc) { string cmp = toBigEndianString(_bc.currentHash()); auto it = _bc.m_blocksDB->NewIterator(_bc.m_readOptions); for (it->SeekToFirst(); it->Valid(); it->Next()) if (it->key().ToString() != "best") { try { BlockHeader d(bytesConstRef(it->value())); _out << toHex(it->key().ToString()) << ": " << d.number() << " @ " << d.parentHash() << (cmp == it->key().ToString() ? " BEST" : "") << std::endl; } catch (...) { LOG(WARNING) << "Invalid DB entry:" << toHex(it->key().ToString()) << " -> " << toHex(bytesConstRef(it->value())); } } delete it; return _out; }
Example 16
Source File: Transaction.cpp From bcos with GNU General Public License v3.0 | 6 votes |
std::ostream& dev::eth::operator<<(std::ostream& _out, TransactionException const& _er) { switch (_er) { case TransactionException::None: _out << "None"; break; case TransactionException::BadRLP: _out << "BadRLP"; break; case TransactionException::InvalidFormat: _out << "InvalidFormat"; break; case TransactionException::OutOfGasIntrinsic: _out << "OutOfGasIntrinsic"; break; case TransactionException::InvalidSignature: _out << "InvalidSignature"; break; case TransactionException::InvalidNonce: _out << "InvalidNonce"; break; case TransactionException::NotEnoughCash: _out << "NotEnoughCash"; break; case TransactionException::OutOfGasBase: _out << "OutOfGasBase"; break; case TransactionException::BlockGasLimitReached: _out << "BlockGasLimitReached"; break; case TransactionException::BadInstruction: _out << "BadInstruction"; break; case TransactionException::BadJumpDestination: _out << "BadJumpDestination"; break; case TransactionException::OutOfGas: _out << "OutOfGas"; break; case TransactionException::OutOfStack: _out << "OutOfStack"; break; case TransactionException::StackUnderflow: _out << "StackUnderflow"; break; default: _out << "Unknown"; break; } return _out; }
Example 17
Source File: mnt4_pairing.cpp From zsl-q with Apache License 2.0 | 6 votes |
std::ostream& operator<<(std::ostream& out, const mnt4_ate_G2_precomp &prec_Q) { out << prec_Q.QX << OUTPUT_SEPARATOR << prec_Q.QY << OUTPUT_SEPARATOR << prec_Q.QY2 << OUTPUT_SEPARATOR << prec_Q.QX_over_twist << OUTPUT_SEPARATOR << prec_Q.QY_over_twist << "\n"; out << prec_Q.dbl_coeffs.size() << "\n"; for (const mnt4_ate_dbl_coeffs &dc : prec_Q.dbl_coeffs) { out << dc << OUTPUT_NEWLINE; } out << prec_Q.add_coeffs.size() << "\n"; for (const mnt4_ate_add_coeffs &ac : prec_Q.add_coeffs) { out << ac << OUTPUT_NEWLINE; } return out; }
Example 18
Source File: mnt6_pairing.cpp From zsl-q with Apache License 2.0 | 6 votes |
std::ostream& operator<<(std::ostream& out, const mnt6_ate_G2_precomp &prec_Q) { out << prec_Q.QX << OUTPUT_SEPARATOR << prec_Q.QY << OUTPUT_SEPARATOR << prec_Q.QY2 << OUTPUT_SEPARATOR << prec_Q.QX_over_twist << OUTPUT_SEPARATOR << prec_Q.QY_over_twist << "\n"; out << prec_Q.dbl_coeffs.size() << "\n"; for (const mnt6_ate_dbl_coeffs &dc : prec_Q.dbl_coeffs) { out << dc << OUTPUT_NEWLINE; } out << prec_Q.add_coeffs.size() << "\n"; for (const mnt6_ate_add_coeffs &ac : prec_Q.add_coeffs) { out << ac << OUTPUT_NEWLINE; } return out; }
Example 19
Source File: graphopt.cpp From libnd4j with Apache License 2.0 | 6 votes |
std::ostream& operator<< (std::ostream& out, GraphOpt const& opts) { if (opts._files.empty() && opts._opts.empty()) { out << "Empty options" << std::endl; return out; } out << "==================================================" << std::endl; out << "Files:" << std::endl; int index = 1; for (auto file: opts._files) { out << "File " << index++ << ": " << file << std::endl; } out << "Options:" << std::endl; for (char opt: opts._opts) { out << "Option: " << opt; if (opts._args.find(opt) != opts._args.end()) { out << " with arg: " << opts._args.at(opt) << std::endl; } else { out << std::endl; } }
Example 20
Source File: callback.cc From wasm-c-api with Apache License 2.0 | 6 votes |
auto operator<<(std::ostream& out, const wasm::Val& val) -> std::ostream& { switch (val.kind()) { case wasm::ValKind::I32: { out << val.i32(); } break; case wasm::ValKind::I64: { out << val.i64(); } break; case wasm::ValKind::F32: { out << val.f32(); } break; case wasm::ValKind::F64: { out << val.f64(); } break; case wasm::ValKind::ANYREF: case wasm::ValKind::FUNCREF: { if (val.ref() == nullptr) { out << "null"; } else { out << "ref(" << val.ref() << ")"; } } break; }
Example 21
Source File: bm_fullstack_trickle.cc From grpc-nebula-c with Apache License 2.0 | 6 votes |
void AddToLabel(std::ostream& out, benchmark::State& state) { out << " writes/iter:" << ((double)stats_->num_writes / (double)state.iterations()) << " cli_transport_stalls/iter:" << ((double) client_stats_.streams_stalled_due_to_transport_flow_control / (double)state.iterations()) << " cli_stream_stalls/iter:" << ((double)client_stats_.streams_stalled_due_to_stream_flow_control / (double)state.iterations()) << " svr_transport_stalls/iter:" << ((double) server_stats_.streams_stalled_due_to_transport_flow_control / (double)state.iterations()) << " svr_stream_stalls/iter:" << ((double)server_stats_.streams_stalled_due_to_stream_flow_control / (double)state.iterations()); }
Example 22
Source File: tsc.cc From smash with GNU General Public License v3.0 | 6 votes |
std::ostream &operator<<(std::ostream &out, const TimeStampCounter &tsc) { auto c = tsc.cycles(); int blocks[10]; int n = 0; for (int digits = std::log10(c); digits > 0; digits -= 3) { blocks[n++] = c % 1000; c /= 1000; } if (n == 0) { return out; } const auto lastFill = out.fill('0'); out << blocks[--n]; while (n > 0) { out << '\'' << std::setw(3) << blocks[--n]; } out.fill(lastFill); return out << " Cycles"; }
Example 23
Source File: TypePrints.cpp From free_gait with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator<< (std::ostream& out, const ControlLevel& controlLevel) { switch (controlLevel) { case ControlLevel::Position: out << "Position"; return out; case ControlLevel::Velocity: out << "Velocity"; return out; case ControlLevel::Acceleration: out << "Acceleration"; return out; case ControlLevel::Effort: out << "Effort"; return out; default: out << "Undefined"; return out; } }
Example 24
Source File: Transaction.cpp From lux with GNU Affero General Public License v3.0 | 6 votes |
std::ostream& dev::eth::operator<<(std::ostream& _out, TransactionException const& _er) { switch (_er) { case TransactionException::None: _out << "None"; break; case TransactionException::BadRLP: _out << "BadRLP"; break; case TransactionException::InvalidFormat: _out << "InvalidFormat"; break; case TransactionException::OutOfGasIntrinsic: _out << "OutOfGasIntrinsic"; break; case TransactionException::InvalidSignature: _out << "InvalidSignature"; break; case TransactionException::InvalidNonce: _out << "InvalidNonce"; break; case TransactionException::NotEnoughCash: _out << "NotEnoughCash"; break; case TransactionException::OutOfGasBase: _out << "OutOfGasBase"; break; case TransactionException::BlockGasLimitReached: _out << "BlockGasLimitReached"; break; case TransactionException::BadInstruction: _out << "BadInstruction"; break; case TransactionException::BadJumpDestination: _out << "BadJumpDestination"; break; case TransactionException::OutOfGas: _out << "OutOfGas"; break; case TransactionException::OutOfStack: _out << "OutOfStack"; break; case TransactionException::StackUnderflow: _out << "StackUnderflow"; break; case TransactionException::CreateWithValue: _out << "CreateWithValue"; break; case TransactionException::NoInformation: _out << "NoInformation"; break; default: _out << "Unknown"; break; } return _out; }
Example 25
Source File: BlockChain.cpp From lux with GNU Affero General Public License v3.0 | 6 votes |
std::ostream& dev::eth::operator<<(std::ostream& _out, BlockChain const& _bc) { string cmp = toBigEndianString(_bc.currentHash()); auto it = _bc.m_blocksDB->NewIterator(_bc.m_readOptions); for (it->SeekToFirst(); it->Valid(); it->Next()) if (it->key().ToString() != "best") { try { BlockHeader d(bytesConstRef(it->value())); _out << toHex(it->key().ToString()) << ": " << d.number() << " @ " << d.parentHash() << (cmp == it->key().ToString() ? " BEST" : "") << std::endl; } catch (...) { cwarn << "Invalid DB entry:" << toHex(it->key().ToString()) << " -> " << toHex(bytesConstRef(it->value())); } } delete it; return _out; }
Example 26
Source File: haicrypt_log.cpp From srt with Mozilla Public License 2.0 | 6 votes |
static void DumpCfgFlags(int flags, std::ostream& out) { static struct { int flg; const char* desc; } flgtable [] = { #define HCRYPTF(name) { HAICRYPT_CFG_F_##name, #name } HCRYPTF(TX), HCRYPTF(CRYPTO), HCRYPTF(FEC) #undef HCRYPTF }; size_t flgtable_size = sizeof(flgtable)/sizeof(flgtable[0]); size_t i; out << "{"; const char* sep = ""; const char* sep_bar = " | "; for (i = 0; i < flgtable_size; ++i) { if ( (flgtable[i].flg & flags) != 0 ) { out << sep << flgtable[i].desc; sep = sep_bar; } } out << "}"; }
Example 27
Source File: BaseMotionBase.cpp From free_gait with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator<< (std::ostream& out, const BaseMotionBase& baseMotion) { out << "Type: " << baseMotion.getType() << std::endl; switch (baseMotion.getType()) { case BaseMotionBase::Type::Auto: out << (dynamic_cast<const BaseAuto&>(baseMotion)) << std::endl; break; case BaseMotionBase::Type::Target: out << (dynamic_cast<const BaseTarget&>(baseMotion)) << std::endl; break; case BaseMotionBase::Type::Trajectory: out << (dynamic_cast<const BaseTrajectory&>(baseMotion)) << std::endl; break; default: throw std::runtime_error("BaseMotionBase::operator<< not implemented for this type."); break; } return out; }
Example 28
Source File: BaseMotionBase.cpp From free_gait with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator<< (std::ostream& out, const BaseMotionBase::Type& type) { switch (type) { case BaseMotionBase::Type::Auto: out << "Auto"; return out; case BaseMotionBase::Type::Target: out << "Target"; return out; case BaseMotionBase::Type::Trajectory: out << "Trajectory"; return out; default: out << "Undefined"; return out; } }
Example 29
Source File: TypePrints.cpp From free_gait with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator<< (std::ostream& out, const BranchEnum& branch) { switch (branch) { case BranchEnum::BASE: out << "BASE"; return out; case BranchEnum::LF_LEG: out << "LF_LEG"; return out; case BranchEnum::RF_LEG: out << "RF_LEG"; return out; case BranchEnum::LH_LEG: out << "LH_LEG"; return out; case BranchEnum::RH_LEG: out << "RH_LEG"; return out; default: out << "Undefined"; return out; } }
Example 30
Source File: TypePrints.cpp From free_gait with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator<< (std::ostream& out, const LimbEnum& limb) { switch (limb) { case LimbEnum::LF_LEG: out << "LF_LEG"; return out; case LimbEnum::RF_LEG: out << "RF_LEG"; return out; case LimbEnum::LH_LEG: out << "LH_LEG"; return out; case LimbEnum::RH_LEG: out << "RH_LEG"; return out; default: out << "Undefined"; return out; } }
Example 31
Source File: PrettyPrinter.cpp From binlog with Apache License 2.0 | 6 votes |
void PrettyPrinter::printEventField( detail::OstreamBuffer& out, char spec, const Event& event, const WriterProp& writerProp, const ClockSync& clockSync ) const { switch (spec) { case 'I': out << event.source->id; break; case 'S': out << severityToString(event.source->severity); break; case 'C': out << event.source->category; break; case 'M': out << event.source->function; break; case 'F': out << event.source->file; break; case 'G': printFilename(out, event.source->file); break; case 'L': out << event.source->line; break; case 'P': out << event.source->formatString; break; case 'T': out << event.source->argumentTags; break; case 'n': out << writerProp.name; break; case 't': out << writerProp.id; break; case 'd': printProducerLocalTime(out, clockSync, event.clockValue); break; case 'u': printUTCTime(out, clockSync, event.clockValue); break; case 'r': out << event.clockValue; break; case 'm': printEventMessage(out, event); break; case '%': out.put('%'); break; default: out << '%' << spec; break; } }
Example 32
Source File: generate_foreach_macro.cpp From binlog with Apache License 2.0 | 6 votes |
void write_foreach(std::ostream& out, int max_iteration) { out << "\n/** For each elem `e`, *except the first* in __VA_ARGS__, call F(d,e) */\n" << "#define " << prefix << "FOREACH(F, d, ...) \\\n " << prefix << "EXPAND(" << prefix << "CAT(" << prefix << "FOREACH_, " << prefix << "COUNT(__VA_ARGS__)) (F, d, __VA_ARGS__))\n"; out << "\n/** FOREACH_n ignores the first argument, and calls F n-1 times */\n"; for (int i = 1; i <= max_iteration+1; ++i) { out << "#define " << prefix << "FOREACH_" << i << "(F,d,_"; for (int j = 1; j < i; ++j) { out << ",a" << j; } out << ')'; for (int j = 1; j < i; ++j) { out << " F(d,a" << j << ")"; } out << "\n"; } }
Example 33
Source File: generate_foreach_macro.cpp From binlog with Apache License 2.0 | 6 votes |
void write_count(std::ostream& out, int max_count) { out << "\n/** Count the number of elements in the given __VA_ARGS__ */\n" << "#define " << prefix << "COUNT(...) " << prefix << "EXPAND(" << prefix << "COUNT_I(__VA_ARGS__"; for (int i = max_count; i != 0; --i) { out << ',' << i; } out << ",x))\n" << "#define " << prefix << "COUNT_I("; for (int i = 0; i < max_count+1; ++i) { out << 'a' << i << ','; } out << "...) a" << max_count << "\n"; }
Example 34
Source File: PrettyPrinter.cpp From binlog with Apache License 2.0 | 6 votes |
void printFilename(binlog::detail::OstreamBuffer& out, const std::string& path) { std::size_t i = path.size(); while (i != 0) { if (path[i-1] == '/' || path[i-1] == '\\') { break; } --i; } out.write(path.data() + i, path.size() - i); }
Example 35
Source File: hq_FSMConstructor.cpp From hrp with MIT License | 6 votes |
std::ostream& saveXml(std::ostream& out, const OnEvent& o){ string target=""; int next_counter=0; for(std::vector<EventAction>::const_iterator i=o.actions.begin();i!=o.actions.end();i++){ if(i->type=="next"){ target=o.id + "/" + i->text; next_counter++; } } string tab=""; xml_transition_bgn(out, o.tab, o.text, target); if(next_counter<(int)o.actions.size()){ out<<endl; tab=o.tab; } for(std::vector<EventAction>::const_iterator i=o.actions.begin();i!=o.actions.end();i++){ i->lib=o.lib; i->tab=o.tab+" "; if(i->type!="next") saveXml(out, *i)<<endl; } xml_transition_end(out, tab); return out; }
Example 36
Source File: entropy_encoder_kernel_2.cpp From android-face-landmarks with MIT License | 6 votes |
void entropy_encoder_kernel_2:: set_stream ( std::ostream& out_ ) { if (out != 0) { // if a stream is currently set then flush the buffers to it before // we switch to the new stream flush(); } out = &out_; streambuf = out_.rdbuf(); // reset the encoder state low = initial_low; high = initial_high; }
Example 37
Source File: metadata.cpp From possumwood with MIT License | 6 votes |
std::ostream& operator << (std::ostream& out, const Metadata& meta) { out << "*** Lytro metadata: ***" << std::endl; out << std::endl; Json::StyledWriter writer; out << "### Header" << std::endl; out << writer.write(meta.header()) << std::endl; out << "### Metadata" << std::endl; out << writer.write(meta.metadata()) << std::endl; out << "### Private metadata:" << std::endl; out << writer.write(meta.privateMetadata()) << std::endl; return out; }
Example 38
Source File: nest.cpp From timeloop with BSD 3-Clause "New" or "Revised" License | 6 votes |
std::ostream& operator << (std::ostream& out, const Nest& nest) { unsigned num_loops = nest.loops.size(); unsigned inv_storage_level = nest.storage_tiling_boundaries.size()-2; // Skip printing the first boundary. std::string indent = ""; for (unsigned loop_level = num_loops-1; loop_level != static_cast<unsigned>(-1); loop_level--) { if (inv_storage_level != static_cast<unsigned>(-1) && nest.storage_tiling_boundaries.at(inv_storage_level) == loop_level) { out << "------------------------------------------" << std::endl; inv_storage_level--; } out << indent; indent += " "; nest.loops.at(loop_level).Print(out, true); out << std::endl; } out << std::endl; return out; }
Example 39
Source File: uniforms.cpp From possumwood with MIT License | 6 votes |
std::ostream& operator << (std::ostream& out, const Uniforms& uniforms) { if(!uniforms.m_uniforms.empty()) { out << "Uniforms:" << std::endl; for(auto& i : uniforms.m_uniforms) out << " " << i->name << ": " << i->glslType << std::endl; } if(!uniforms.m_textures.empty()) { out << "Textures:" << std::endl; for(auto& i : uniforms.m_textures) out << " " << i.name << ": " << i.glslType << std::endl; } return out; }
Example 40
Source File: EquidistantCamera.cc From VINS-Mono-Learning with GNU General Public License v3.0 | 6 votes |
std::ostream& operator<< (std::ostream& out, const EquidistantCamera::Parameters& params) { out << "Camera Parameters:" << std::endl; out << " model_type " << "KANNALA_BRANDT" << std::endl; out << " camera_name " << params.m_cameraName << std::endl; out << " image_width " << params.m_imageWidth << std::endl; out << " image_height " << params.m_imageHeight << std::endl; // projection: k2, k3, k4, k5, mu, mv, u0, v0 out << "Projection Parameters" << std::endl; out << " k2 " << params.m_k2 << std::endl << " k3 " << params.m_k3 << std::endl << " k4 " << params.m_k4 << std::endl << " k5 " << params.m_k5 << std::endl << " mu " << params.m_mu << std::endl << " mv " << params.m_mv << std::endl << " u0 " << params.m_u0 << std::endl << " v0 " << params.m_v0 << std::endl; return out; }
Example 41
Source File: entropy_encoder_kernel_1.cpp From android-face-landmarks with MIT License | 6 votes |
void entropy_encoder_kernel_1:: set_stream ( std::ostream& out_ ) { if (out != 0) { // if a stream is currently set then flush the buffers to it before // we switch to the new stream flush(); } out = &out_; streambuf = out_.rdbuf(); // reset the encoder state buf_used = 0; buf = 0; low = initial_low; high = initial_high; }
Example 42
Source File: glsl.cc From curv with Apache License 2.0 | 6 votes |
void glsl_function_export(const Shape_Program& shape, std::ostream& out) { SC_Compiler sc(out, SC_Target::glsl, shape.system()); At_Program cx(shape); out << glsl_header; if (shape.viewed_shape_) { // output uniform variables for parametric shape for (auto& p : shape.viewed_shape_->param_) { out << "uniform " << p.second.pconfig_.sctype_ << " " << p.second.identifier_ << ";\n"; } } sc.define_function("dist", SC_Type::Num(4), SC_Type::Num(), shape.dist_fun_, cx); sc.define_function("colour", SC_Type::Num(4), SC_Type::Num(3), shape.colour_fun_, cx); }
Example 43
Source File: generate_mat_kernels.cpp From ngsolve with GNU Lesser General Public License v2.1 | 6 votes |
void GenerateMultAB (ostream & out, int h, int w, OP op, bool aligned_b) { out << "template <> INLINE void MatKernelMultAB<" << h << ", " << w << ", " << ToString(op) << ">" << endl; out << " (size_t n," << endl << " double * pa, size_t da," << endl << " " << (aligned_b ? "SIMD<double>" : "double") << " * pb, size_t db," << endl << " double * pc, size_t dc)" << endl << "{" << endl; out << "constexpr int SW = SIMD<double>::Size();" << endl; if (op == SET || op == SETNEG) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) out << "SIMD<double> sum" << i << j << "(0);" << endl; } else {
Example 44
Source File: extract.cpp From grit-engine with MIT License | 6 votes |
void process_txds (std::ostream &out, Txd::Names &texs, ImgHandle &img, const std::string &dest_dir, const std::string &modname) { (void) out; for (unsigned int i=0 ; i<img.i.size(); ++i) { const std::string &fname = img.i.fileName(i); if (fname.size()<4) continue; std::string ext = fname.substr(fname.size()-4,4); if (ext!=".txd") continue; //out<<"Extracting: "<<img.name<<"/"<<fname<<std::endl; img.i.fileOffset(img.f,i); process_txd(out, texs, img.name+"/"+fname, dest_dir, modname+"/", img.f); } }
Example 45
Source File: hq_FSMConstructor.cpp From hrp with MIT License | 6 votes |
std::ostream& saveXml(std::ostream& out, const Call& o){ string resolved = ""; if(o.type == "fsm"){ bool isResolved = o.lib->contains_fsm(o.text); if(not isResolved){ o.lib->errors<<"in "<<o.file<<":"<<o.line<<":"<<o.pos<<endl; o.lib->errors<<" FSM("<<o.text<<") definition does not found." <<endl; out<<o.tab<<"<error>"<<endl; out<<o.tab<<" "<<"in "<<o.file<<":"<<o.line<<":"<<o.pos<<endl; out<<o.tab<<" "<<" FSM("<<o.text<<") definition does not found." <<endl; out<<o.tab<<"</error>"; }else{ o.lib->saveXml_fsm(out, o.tab, o.text, o.id); } return out; }
Example 46
Source File: extract.cpp From grit-engine with MIT License | 6 votes |
void process_txd (std::ostream &out, Txd::Names &texs, const std::string &fname, const std::string &dest_dir, const std::string &modprefix, std::istream &in) { if (getenv("SKIP_TEXTURES")!=NULL) return; (void) out; std::string txddir = dest_dir+"/"+modprefix+fname; ensuredir(txddir); Txd txd(in,txddir); // extract dds files const Txd::Names &n = txd.getNames(); typedef Txd::Names::const_iterator TI; for (TI j=n.begin(),j_=n.end();j!=j_;++j) { const std::string &texname = *j; // build a list of all textures we // know about (relative to dest_dir) texs.insert(fname+"/"+texname+".dds"); } }
Example 47
Source File: control_messages.cc From neuropod with Apache License 2.0 | 6 votes |
std::ostream &operator<<(std::ostream &out, const MessageType value) { const char *s = 0; #define GENERATE_CASE(item) \ case (item): \ s = #item; \ break; switch (value) { GENERATE_CASE(LOAD_NEUROPOD); GENERATE_CASE(LOAD_SUCCESS); GENERATE_CASE(ADD_INPUT); GENERATE_CASE(INFER); GENERATE_CASE(RETURN_OUTPUT); GENERATE_CASE(SHUTDOWN); GENERATE_CASE(EXCEPTION); } #undef GENERATE_CASE return out << s; }
Example 48
Source File: Qualvector.cc From w2rap-contigger with MIT License | 6 votes |
void Print( std::ostream &out, const qualvector &q, const String &name, const int scores_per_line ) { out << '>' << name; for ( qvec::size_type i = 0; i < q.size(); ++i ) { if (i % scores_per_line) { out << ' '; } else { out << '\n'; } out << static_cast<unsigned int>(q[i]); }
Example 49
Source File: tensor_types.cc From neuropod with Apache License 2.0 | 6 votes |
std::ostream &operator<<(std::ostream &out, const TensorType value) { const char *s = 0; #define GENERATE_CASE(item) \ case (item): \ s = #item; \ break; switch (value) { GENERATE_CASE(FLOAT_TENSOR); GENERATE_CASE(DOUBLE_TENSOR); GENERATE_CASE(STRING_TENSOR); GENERATE_CASE(INT8_TENSOR); GENERATE_CASE(INT16_TENSOR); GENERATE_CASE(INT32_TENSOR); GENERATE_CASE(INT64_TENSOR); GENERATE_CASE(UINT8_TENSOR); GENERATE_CASE(UINT16_TENSOR); GENERATE_CASE(UINT32_TENSOR); GENERATE_CASE(UINT64_TENSOR); } #undef GENERATE_CASE return out << s; }
Example 50
Source File: options.cpp From lean2 with Apache License 2.0 | 5 votes |
std::ostream & operator<<(std::ostream & out, option_kind k) { switch (k) { case BoolOption: out << "Bool"; break; case IntOption: out << "Int"; break; case UnsignedOption: out << "Unsigned Int"; break; case DoubleOption: out << "Double"; break; case StringOption: out << "String"; break; case SExprOption: out << "S-Expression"; break; } return out; }
Example 51
Source File: link.cpp From mamba with BSD 3-Clause "New" or "Revised" License | 5 votes |
void application_entry_point_template(std::ostream& out, const std::string_view& source_full_path) { out << "# -*- coding: utf-8 -*-\n"; out << "if __name__ == '__main__':\n"; out << " import os\n"; out << " import sys\n"; out << " args = ['" << source_full_path << "']\n"; out << " if len(sys.argv) > 1:\n"; out << " args += sys.argv[1:]\n"; out << " os.execv(args[0], args)\n"; }
Example 52
Source File: TypePrintHelper.cpp From difuze with BSD 2-Clause "Simplified" License | 5 votes |
void printTypeRecursive(Type *targetType, llvm::raw_ostream &to_out, std::string &prefix_space) { if(targetType->isStructTy() || targetType->isPointerTy()) { if(targetType->isPointerTy()) { targetType = targetType->getContainedType(0); } bool is_handled = false; if(targetType->isStructTy()) { string src_st_name = targetType->getStructName().str(); if(src_st_name.find(".anon") != string::npos) { is_handled = true; // OK, this is anonymous struct or union. to_out << prefix_space << src_st_name << ":STARTELEMENTS:\n"; string child_space = prefix_space; child_space = child_space + " "; for(unsigned int curr_no=0; curr_no<targetType->getStructNumElements(); curr_no++) { // print by adding space printTypeRecursive(targetType->getStructElementType(0), to_out, child_space); } to_out << prefix_space << src_st_name << ":ENDELEMENTS:\n"; } } if(!is_handled) { // Regular structure, print normally. to_out << prefix_space << *targetType << "\n"; } } else {
Example 53
Source File: 10.32.cpp From Cpp-Primer-5th-Exercises with Apache License 2.0 | 5 votes |
int process_transaction(std::istream &in, std::ostream &out) { Sales_item total; if (in >> total) { Sales_item trans; while (in >> trans) { if (total.isbn() == trans.isbn()) { total += trans; } else { out << total << std::endl; total = trans; // Use default copy constructor } } out << total << std::endl; }
Example 54
Source File: ScaramuzzaCamera.cc From VINS-Mono-Learning with GNU General Public License v3.0 | 5 votes |
std::ostream& operator<< (std::ostream& out, const OCAMCamera::Parameters& params) { out << "Camera Parameters:" << std::endl; out << " model_type " << "scaramuzza" << std::endl; out << " camera_name " << params.m_cameraName << std::endl; out << " image_width " << params.m_imageWidth << std::endl; out << " image_height " << params.m_imageHeight << std::endl; out << std::fixed << std::setprecision(10); out << "Poly Parameters" << std::endl; for(int i=0; i < SCARAMUZZA_POLY_SIZE; i++) out << std::string("p") + boost::lexical_cast<std::string>(i) << ": " << params.m_poly[i] << std::endl; out << "Inverse Poly Parameters" << std::endl; for(int i=0; i < SCARAMUZZA_INV_POLY_SIZE; i++) out << std::string("p") + boost::lexical_cast<std::string>(i) << ": " << params.m_inv_poly[i] << std::endl; out << "Affine Parameters" << std::endl; out << " ac " << params.m_C << std::endl << " ad " << params.m_D << std::endl << " ae " << params.m_E << std::endl; out << " cx " << params.m_center_x << std::endl << " cy " << params.m_center_y << std::endl; return out; }
Example 55
Source File: utils.cpp From zsl-q with Apache License 2.0 | 5 votes |
void serialize_bit_vector(std::ostream &out, const bit_vector &v) { out << v.size() << "\n"; for (size_t i = 0; i < v.size(); ++i) { out << v[i] << "\n"; } }