当前位置: 首页>>代码示例>>C++>>正文


C++ oss函数代码示例

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


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

示例1: oss

std::string pciEntry::verbose() const {
    std::ostringstream oss(std::ostringstream::out);
    oss << " (vendor:" << hexFmt(vendor, 4, false) << " device:" << hexFmt(device, 4, false);
    if (subvendor != 0xffff || subdevice != 0xffff)
	oss << " subv:" << hexFmt(subvendor, 4, false) << " subd:" << hexFmt(subdevice, 4, false);
    oss << ")";

    return oss.str();
}
开发者ID:DrakXtools,项目名称:ldetect,代码行数:9,代码来源:pci.cpp

示例2: oss

 std::string BaseDeviate::make_repr(bool incl_seed)
 {
     // Remember: Don't start with nothing!  See discussion in FormatAndThrow in Std.h
     std::ostringstream oss(" ");
     oss << "galsim.BaseDeviate(";
     if (incl_seed) oss << "seed='"<<serialize()<<"'";
     oss<<")";
     return oss.str();
 }
开发者ID:craiglagegit,项目名称:GalSim,代码行数:9,代码来源:Random.cpp

示例3: oss

 std::string BinomialDeviate::make_repr(bool incl_seed)
 {
     std::ostringstream oss(" ");
     oss << "galsim.BinomialDeviate(";
     if (incl_seed) oss << seedstring(split(serialize(), ' ')) << ", ";
     oss << "N="<<getN()<<", ";
     oss << "p="<<getP()<<")";
     return oss.str();
 }
开发者ID:esheldon,项目名称:GalSim,代码行数:9,代码来源:Random.cpp

示例4: oss

 std::string SBMoffat::SBMoffatImpl::serialize() const
 {
     std::ostringstream oss(" ");
     oss.precision(std::numeric_limits<double>::digits10 + 4);
     oss << "galsim._galsim.SBMoffat("<<getBeta()<<", "<<getScaleRadius();
     oss << ", None, None, "<<getTrunc()<<", "<<getFlux();
     oss << ", galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:AriannaLanz,项目名称:GalSim,代码行数:9,代码来源:SBMoffat.cpp

示例5: main

int main(int argc, char* argv[]) {
    if (argc != 3) {
        std::cout << "usage: " << argv[0] << " hash file " << std::endl;
        std::cout << "       check the MD5 hash of a file" << std::endl;
        std::cout << "       Adobe Source Libraries v" << ADOBE_VERSION_MAJOR << "."
                  << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl;
        std::cout << "       Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000
                  << "." << BOOST_VERSION % 100 << std::endl;

        return 1;
    }

    bool success = false;

    try {
        adobe::md5_t m;
        boost::filesystem::path file_path(argv[2]);
        boost::filesystem::ifstream stream(file_path, std::ios::binary | std::ios::in);

        while (stream.good()) {
            boost::array<std::ifstream::char_type, 256 * 1024> buffer;

            stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size()));

            std::streamsize gcount(stream.gcount());

            if (gcount > 0)
                m.update(&buffer[0], static_cast<std::size_t>(gcount));
        }

        adobe::md5_t::digest_t hash(m.final());
        adobe::md5_t::digest_t::iterator first(hash.begin());
        adobe::md5_t::digest_t::iterator last(hash.end());

        std::string actual;
        std::ostringstream oss(actual);
        for (; first != last; ++first) {
            oss.width(2);
            oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*first);
        }


        std::string expected(argv[1]);
        success = oss.str() == expected;
        if (!success)
            std::cout << "Expected: " << expected << " actual: " << oss.str() << std::endl;
    }

    catch (const std::exception& error) {
        std::cerr << "Exception: " << error.what() << std::endl;
    }
    catch (...) {
        std::cerr << "Unknown exception" << std::endl;
    }
    return success ? 0 : 1;
}
开发者ID:BobArcher,项目名称:adobe_source_libraries,代码行数:56,代码来源:check_md5.cpp

示例6: str

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerTest::EresParseAndSerializePlan
//
//	@doc:
//		Verifies that after parsing the given DXL file into a DXL tree,
//		it will be serialized back to the same string.
//
//---------------------------------------------------------------------------
GPOS_RESULT
CParseHandlerTest::EresParseAndSerializePlan
	(
	IMemoryPool *pmp,
	const CHAR *szDXLFileName,
	BOOL fValidate
	)
{
	CWStringDynamic str(pmp);
	COstreamString oss(&str);
	
	// read DXL file
	CHAR *szDXL = CDXLUtils::SzRead(pmp, szDXLFileName);

	GPOS_CHECK_ABORT;
		
	const CHAR *szValidationPath = NULL;
	
	if (fValidate)
	{  
	   szValidationPath = CTestUtils::m_szXSDPath;
	}

	// the root of the parsed DXL tree
	ULLONG ullPlanId = ULLONG_MAX;
	ULLONG ullPlanSpaceSize = ULLONG_MAX;
	CDXLNode *pdxlnRoot = CDXLUtils::PdxlnParsePlan(pmp, szDXL, szValidationPath, &ullPlanId, &ullPlanSpaceSize);
	
	GPOS_CHECK_ABORT;

	oss << "Serializing parsed tree" << std::endl;

	CWStringDynamic strPlan(pmp);
	COstreamString osPlan(&strPlan);

	CDXLUtils::SerializePlan(pmp, osPlan, pdxlnRoot, ullPlanId, ullPlanSpaceSize, true /*fSerializeHeaderFooter*/, true /*fIndent*/);

	GPOS_CHECK_ABORT;

	CWStringDynamic dstrExpected(pmp);
	dstrExpected.AppendFormat(GPOS_WSZ_LIT("%s"), szDXL);

	if (!dstrExpected.FEquals(&strPlan))
	{
		GPOS_TRACE(dstrExpected.Wsz());
		GPOS_TRACE(strPlan.Wsz());

		GPOS_ASSERT(!"Not matching");
	}
	
	// cleanup
	pdxlnRoot->Release();
	GPOS_DELETE_ARRAY(szDXL);
	
	return GPOS_OK;
}
开发者ID:whatcat,项目名称:gporca,代码行数:65,代码来源:CParseHandlerTest.cpp

示例7: str

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerTest::EresParseAndSerializePlan
//
//	@doc:
//		Verifies that after parsing the given DXL file into a DXL tree,
//		it will be serialized back to the same string.
//
//---------------------------------------------------------------------------
GPOS_RESULT
CParseHandlerTest::EresParseAndSerializePlan
	(
	IMemoryPool *mp,
	const CHAR *dxl_filename,
	BOOL fValidate
	)
{
	CWStringDynamic str(mp);
	COstreamString oss(&str);
	
	// read DXL file
	CHAR *dxl_string = CDXLUtils::Read(mp, dxl_filename);

	GPOS_CHECK_ABORT;
		
	const CHAR *szValidationPath = NULL;
	
	if (fValidate)
	{  
	   szValidationPath = CTestUtils::m_szXSDPath;
	}

	// the root of the parsed DXL tree
	ULLONG plan_id = gpos::ullong_max;
	ULLONG plan_space_size = gpos::ullong_max;
	CDXLNode *root_dxl_node = CDXLUtils::GetPlanDXLNode(mp, dxl_string, szValidationPath, &plan_id, &plan_space_size);
	
	GPOS_CHECK_ABORT;

	oss << "Serializing parsed tree" << std::endl;

	CWStringDynamic strPlan(mp);
	COstreamString osPlan(&strPlan);

	CDXLUtils::SerializePlan(mp, osPlan, root_dxl_node, plan_id, plan_space_size, true /*serialize_header_footer*/, true /*indentation*/);

	GPOS_CHECK_ABORT;

	CWStringDynamic dstrExpected(mp);
	dstrExpected.AppendFormat(GPOS_WSZ_LIT("%s"), dxl_string);

	if (!dstrExpected.Equals(&strPlan))
	{
		GPOS_TRACE(dstrExpected.GetBuffer());
		GPOS_TRACE(strPlan.GetBuffer());

		GPOS_ASSERT(!"Not matching");
	}
	
	// cleanup
	root_dxl_node->Release();
	GPOS_DELETE_ARRAY(dxl_string);
	
	return GPOS_OK;
}
开发者ID:b-xiang,项目名称:gporca,代码行数:65,代码来源:CParseHandlerTest.cpp

示例8: oss

 std::string SBAdd::SBAddImpl::repr() const 
 {
     std::ostringstream oss(" ");
     oss << "galsim._galsim.SBAdd([";
     ConstIter sptr = _plist.begin(); 
     oss << sptr->repr();
     for (++sptr; sptr!=_plist.end(); ++sptr) oss << ", " << sptr->repr();
     oss << "], galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:craiglagegit,项目名称:GalSim,代码行数:10,代码来源:SBAdd.cpp

示例9: writeU16

void NodeMetadata::serialize(std::ostream &os)
{
	u8 buf[2];
	writeU16(buf, typeId());
	os.write((char*)buf, 2);

	std::ostringstream oss(std::ios_base::binary);
	serializeBody(oss);
	os<<serializeString(oss.str());
}
开发者ID:Jobava,项目名称:Voxelands,代码行数:10,代码来源:nodemetadata.cpp

示例10: oss

string  uniqAlUnitColumnCollection::print(const vocTable & voc) const {
  ostringstream oss("");
  int count=0;
  for (vector<uniqAlUnitColumn>::const_iterator it=collection.begin();it!=collection.end();++it){
    //    if (it != collection.begin()){oss<<", ";}
    oss<<count<<" ["<<it->print(voc)<<"] ";
    ++count;
  }
  return oss.str();
}
开发者ID:patrik-lambert,项目名称:bia-aligner,代码行数:10,代码来源:alUnit.cpp

示例11: oss

 std::string SBAutoCorrelate::SBAutoCorrelateImpl::serialize() const
 {
     std::ostringstream oss(" ");
     oss.precision(std::numeric_limits<double>::digits10 + 4);
     oss << "galsim._galsim.SBAutoCorrelate(" << _adaptee.serialize() << ", ";
     if (_real_space) oss << "True";
     else oss << "False";
     oss << ", galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:AriannaLanz,项目名称:GalSim,代码行数:10,代码来源:SBConvolve.cpp

示例12: mda

//---------------------------------------------------------------------------
//	@function:
//		CMDAccessorTest::EresUnittest_Navigate
//
//	@doc:
//		Test fetching a MD object from the cache and navigating its dependent
//		objects
//
//---------------------------------------------------------------------------
GPOS_RESULT
CMDAccessorTest::EresUnittest_Navigate()
{
	CAutoMemoryPool amp;
	IMemoryPool *mp = amp.Pmp();
	
	// setup a file-based provider
	CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
	pmdp->AddRef();

	CMDAccessor mda(mp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
	
	// lookup a function in the MD cache
	CMDIdGPDB *mdid_func = GPOS_NEW(mp) CMDIdGPDB(GPDB_FUNC_TIMEOFDAY /* OID */, 1 /* major version */, 0 /* minor version */);

	const IMDFunction *pmdfunc = mda.RetrieveFunc(mdid_func);
	
	// lookup function return type
	IMDId *pmdidFuncReturnType = pmdfunc->GetResultTypeMdid();
	const IMDType *pimdtype = mda.RetrieveType(pmdidFuncReturnType);
		
	// lookup equality operator for function return type
	IMDId *pmdidEqOp = pimdtype->GetMdidForCmpType(IMDType::EcmptEq);

#ifdef GPOS_DEBUG
	const IMDScalarOp *md_scalar_op =
#endif
	mda.RetrieveScOp(pmdidEqOp);
		
#ifdef GPOS_DEBUG
	// print objects
	CWStringDynamic str(mp);
	COstreamString oss(&str);
	
	oss << std::endl;
	oss << std::endl;

	pmdfunc->DebugPrint(oss);
	oss << std::endl;

	pimdtype->DebugPrint(oss);
	oss << std::endl;
	
	md_scalar_op->DebugPrint(oss);
	oss << std::endl;
					
	GPOS_TRACE(str.GetBuffer());
	
#endif
	
	mdid_func->Release();
	
	return GPOS_OK;
}
开发者ID:b-xiang,项目名称:gporca,代码行数:63,代码来源:CMDAccessorTest.cpp

示例13: oss

// Generates a human-readable string representation of a token.
std::string Token::toString()
{
	std::ostringstream oss("");
	oss << "[Token]" 
		<< "\nText: \"" << stringValue << "\""
		<< "\nFile: \"" << tokenFileName << "\""
		<< "\nLocation: Line " << tokenLocation.first_line << "." << tokenLocation.first_column << " - " 
		<< tokenLocation.last_line << "." << tokenLocation.last_column 
		<< std::endl;
	return oss.str();
}
开发者ID:smallzhan,项目名称:cplus2asp,代码行数:12,代码来源:Token.cpp

示例14: tryStringFind

void tryStringFind()
{
    std::ostringstream oss(std::ostringstream::out);
    oss<<"ls -l | wc -w";

    std::string cmd = oss.str();
    std::string mem1(10,' ');
    std::copy(cmd.begin(), std::find(cmd.begin(), cmd.end(), '|'), mem1.begin());

    std::cout<<"cmd : "<<cmd<<std::endl;
    std::cout<<"membre1 : "<<mem1<<std::endl;
}
开发者ID:NiNjA-CodE,项目名称:C_CPP,代码行数:12,代码来源:algorithm.cpp

示例15: oss

bool v4l_capture::init_all(size_t _width, size_t _height, unsigned int _devId)
{
  width = _width;
  height = _height;
  std::ostringstream oss("");
  oss << "/dev/video" << _devId;
  dev_name = oss.str();
  if (!open_device()) return false;
  init_device();
  if (!start_capturing()) return false;
  return true;
}
开发者ID:YoheiKakiuchi,项目名称:hrpsys-base,代码行数:12,代码来源:camera.cpp


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