本文整理汇总了C++中outstream函数的典型用法代码示例。如果您正苦于以下问题:C++ outstream函数的具体用法?C++ outstream怎么用?C++ outstream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outstream函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Step3_Convert
void Step3_Convert(const TString filename)
{
TFile* file = new TFile(filename, "READ");
std::vector<TString> hists;
// No bracket enclosed initializer list in root 5
hists.push_back("NeulandDigiMon/hDepth");
hists.push_back("NeulandDigiMon/hForemostEnergy");
hists.push_back("NeulandDigiMon/hEtot");
//for (const TString& hist : hists)
for(Int_t i = 0; i < hists.size(); i++)
{
const TString hist = hists.at(i);
std::cout << hist << std::endl;
TH1D* h = (TH1D*)file->GetObjectChecked(hist, "TH1D");
const TString outfile = (TString(filename).ReplaceAll("digi.root", TString(hist).ReplaceAll("NeulandDigiMon/", "") + ".dat"));
ofstream outstream(outfile);
SingleExportAscii(h, outstream);
outstream.close();
}
}
示例2: FreeImage_SetOutputMessage
//---------------------------------------------------------------------
DataStreamPtr FreeImageCodec::code(MemoryDataStreamPtr& input, Codec::CodecDataPtr& pData) const
{
// Set error handler
FreeImage_SetOutputMessage(FreeImageSaveErrorHandler);
FIBITMAP* fiBitmap = encode(input, pData);
// open memory chunk allocated by FreeImage
FIMEMORY* mem = FreeImage_OpenMemory();
// write data into memory
FreeImage_SaveToMemory((FREE_IMAGE_FORMAT)mFreeImageType, fiBitmap, mem);
// Grab data information
BYTE* data;
DWORD size;
FreeImage_AcquireMemory(mem, &data, &size);
// Copy data into our own buffer
// Because we're asking MemoryDataStream to free this, must create in a compatible way
BYTE* ourData = OGRE_ALLOC_T(BYTE, size, MEMCATEGORY_GENERAL);
memcpy(ourData, data, size);
// Wrap data in stream, tell it to free on close
DataStreamPtr outstream(OGRE_NEW MemoryDataStream(ourData, size, true));
// Now free FreeImage memory buffers
FreeImage_CloseMemory(mem);
// Unload bitmap
FreeImage_Unload(fiBitmap);
return outstream;
}
示例3: outstream
void JRoomModelClientRoomProcessor::requestRoomList()
{
QByteArray outdata;
QDataStream outstream(&outdata,QIODevice::WriteOnly);
outstream<<(JID)ERP_RoomList;
sendData(JRoomModelClientSocket::instance(),outdata);
}
示例4: run_sapi_textless_lipsync
/**
@brief This function demonstrates how to perform "Textless Lipsync"
Given an audio file, this method will use SAPI to guess at words
and word timings and phoneme timings in the specified audio file.
The results are printed to std::out.
This is the best code to look at first
@param strAudioFile - [in] audio file
**/
void
run_sapi_textless_lipsync(std::wstring& strAudioFile, std::wstring outFile)
{
// 1. [optional] declare the SAPI 5.1 estimator.
// NOTE: for different phoneme sets: create a new estimator
phoneme_estimator sapi51Estimator;
// 2. declare the sapi lipsync object and call the lipsync method to
// start the lipsync process
sapi_textless_lipsync lsp(&sapi51Estimator);
if (lsp.lipsync(strAudioFile))
{
// 3. Run the message loop and wait till the lipsync is finished
run_lipsync_message_loop(lsp);
// 4. finalize the lipsync results for printing
// this call will estimate phoneme timings
lsp.finalize_phoneme_alignment();
// 5. print the results to the output stream
//lsp.print_results(std::cout);
// 5'. print results in a file
std::wstring strOutFile = outFile + L".phonemes.xml";
std::ofstream outstream(strOutFile.c_str());
outstream << "<PhonemeTimings audiofile=\"" << wstring_2_string(strAudioFile) << "\" >" << std::endl;
lsp.print_results(outstream);
outstream << "</PhonemeTimings>" << std::endl;
outstream.close();
}
else
{
std::wcerr << lsp.getErrorString() << std::endl;
}
}
示例5: encode
//---------------------------------------------------------------------
DataStreamPtr FreeImageCodec::code(MemoryDataStreamPtr& input, Codec::CodecDataPtr& pData) const
{
FIBITMAP* fiBitmap = encode(input, pData);
// open memory chunk allocated by FreeImage
FIMEMORY* mem = FreeImage_OpenMemory();
// write data into memory
FreeImage_SaveToMemory((FREE_IMAGE_FORMAT)mFreeImageType, fiBitmap, mem);
// Grab data information
BYTE* data;
DWORD size;
FreeImage_AcquireMemory(mem, &data, &size);
// Copy data into our own buffer
BYTE* ourData = new BYTE[size];
memcpy(ourData, data, size);
// Wrap data in stream, tell it to free on close
DataStreamPtr outstream(new MemoryDataStream(ourData, size, true));
// Now free FreeImage memory buffers
FreeImage_CloseMemory(mem);
// Unload bitmap
FreeImage_Unload(fiBitmap);
return outstream;
}
示例6: outstream
void JRequestGameInfoSocket::rqsGameList()
{
QByteArray outdata;
QDataStream outstream(&outdata,QIODevice::WriteOnly);
outstream<<(JID)SubServer::EGP_GameList;
sendData(outdata);
}
示例7: outstream
bool WebGame::Utility::writeToFile(const Utility::StringGroupType& infos,
const std::string& file_name,
const std::string&
#ifdef WIN32
locinfo
#endif
) {
#ifdef WIN32
std::locale loc = std::locale::global(std::locale(locinfo.c_str())) ;
#endif
std::ofstream outstream(file_name.c_str(), std::ios_base::out |
std::ios_base::trunc) ;
if(!outstream.is_open()) {
#ifdef WIN32
std::locale::global(loc) ;
#endif
return false ;
}
bool ok = writeToFile(infos, outstream) ;
#ifdef WIN32
std::locale::global(loc) ;
#endif
return ok ;
}
示例8: outstream
/*!
\brief 发送游戏信息
\a gi 表示游戏信息。
\sa SubServer::SGameInfo2
*/
void JSendGsInfoSocket::sendGameInfo(const SubServer::SGameInfo2& gi)
{
QByteArray outdata;
QDataStream outstream(&outdata,QIODevice::WriteOnly);
outstream<<(JID)SubServer::ESP_GameInfo;
outstream<<gi;
sendData(outdata);
}
示例9: outstream
void JMainServerCommandProcessor::replyCommandResult(JID type,JCode result)
{
QByteArray outdata;
QDataStream outstream(&outdata,QIODevice::WriteOnly);
outstream<<type;
outstream<<result;
sendData(outdata);
}
示例10: outstream
void JDownloadGameFileSocket::rqsGameFile(const QString& gamename,const JVersion& version,const QString& path)
{
m_path=path;
QByteArray outdata;
QDataStream outstream(&outdata,QIODevice::WriteOnly);
outstream<<gamename<<version;
sendData(outdata);
}
示例11: storeRegionInfo
void storeRegionInfo(const QVector<ExonData>& exons)
{
QSharedPointer<QFile> out = Helper::openFileForWriting("regions.tsv");
QTextStream outstream(out.data());
outstream << "#region\tsize\tmedian_ncov\tmad_ncov\tcv_ncov\tcnvs" << endl;
foreach(const ExonData& exon, exons)
{
outstream << exon.name << "\t" << (exon.end-exon.start) << "\t" << exon.median << "\t" << exon.mad << "\t" << (exon.mad/exon.median) << "\t" << exon.cnvs << endl;
}
}
示例12: storeSampleCorrel
void storeSampleCorrel(const QVector<SampleData>& data)
{
QSharedPointer<QFile> out = Helper::openFileForWriting("samples_correl_all.tsv");
QTextStream outstream(out.data());
outstream << "#sample\tdoc_mean\tref_correl\tqc" << endl;
foreach(const SampleData& sample, data)
{
outstream << sample.name << "\t" << sample.doc_mean << "\t" << sample.ref_correl << "\t" << sample.qc << endl;
}
}
示例13: outstream
/// \brief Writes the network to file.
/// \param filename A string
/// If filename is nonempty, output is written to the file named filename.
/// If filename is empty, output is written to stdout.
/// The processes are not written to file, only the filenames of the original processes.
void network::save(const std::string& filename) const
{
std::ofstream outstream(filename.c_str(), std::ofstream::out);
if (!outstream)
{
throw mcrl2::runtime_error("cannot open output file: " + filename);
}
write(outstream);
outstream.close();
}
示例14: storeSampleInfo
void storeSampleInfo(const QVector<SampleData>& data)
{
QSharedPointer<QFile> out = Helper::openFileForWriting("samples.tsv");
QTextStream outstream(out.data());
outstream << "#sample\tdoc_mean\tref_correl\tcnvs\tcnvs_merged" << endl;
foreach(const SampleData& sample, data)
{
if (sample.qc!="") continue;
outstream << sample.name << "\t" << sample.doc_mean << "\t" << sample.ref_correl << "\t" << sample.cnvs << "\t" << sample.cnvs_merged << endl;
}
}
示例15: file
QString dataController::addSection(QString sectionInfo) {
QFile file("../ServerSide/Data/Sections.txt");
if(!file.open(QIODevice::Append))
{
qDebug() << "error opening the Section data" << endl;
}
QTextStream outstream(&file);
outstream<<sectionInfo;
file.close();
return("yay");
}