Exemple #1
0
void OutputResult(	const ArbreCube& bouleau,
					const std::vector<bool>& FindLowest,
					ALGO SelectedAlgo,
					std::string& FichierResultat,
					std::vector<std::string>* Labels )
{
	for( std::vector<bool>::const_iterator iteUL = FindLowest.begin(); iteUL != FindLowest.end(); ++iteUL)
		FichierResultat += (*iteUL) ? "l" : "u";
	FichierResultat += ".res";

	std::ofstream OutputStream( FichierResultat.c_str());
	if( ! OutputStream.is_open())
	{
		std::cout << "Couldn't open file " << FichierResultat << " to store the result, sending to screen" << std::endl;

		if( SelectedAlgo == DEPTH)
			bouleau.AfficheClos( std::cout, Labels);
		else
			bouleau.AfficheResultat( std::cout, Labels);
	}
	else
	{
		std::cout << "Saving result into file " << FichierResultat << std::endl;

		if( SelectedAlgo == DEPTH)
			bouleau.AfficheClos( OutputStream, Labels);
		else
			bouleau.AfficheResultat( OutputStream, Labels);
	}
}
Exemple #2
0
int main() {
    OStream s = OutputBinaryFileStream("test00_output.txt");
    int a = 0, b = 1, c = 2;
    a = (a + b * (c - a) / 2) - (a - b);
    s << 1819043144 << 1998597231 << 1684828783 << 169943329;
    s = OutputStream();
    s << a << b << c;
    return 0;
}
Exemple #3
0
void ClientManage::operator()(){
    while(is_burn_){
        OutputStream();
        Execute();
        InputStream();
        boost::xtime time;
        time.sec = 0;
        time.nsec = 10;
        boost::thread::sleep(time);
    }
}
Exemple #4
0
int main() {
    OStream s = OutputStream();
    int a = 4, b = 4, c = 5;
    if (a == b && b != c) {
        s << 1;
    }
    if (a == b && b == c) {
        s << 2;
    }
    if (a == b || b == c) {
        s << 3;
    }
    if (a != b || b == c) {
        s << 4;
    }
    if (a) {
        s << 5;
    }
    if (0) {
        s << 6;
    }
    return 0;
}
bool FCFileHandlerBase::write(const FCPtrStore Containers, const BoostPath& FilePath, const FCFileType::FCTypeVector& IgnoreTypes, bool Compress)
{
	 //Determine the file extension
	 std::string Extension(boost::filesystem::extension(FilePath));
	 boost::algorithm::trim_if(Extension,boost::is_any_of("."));

	 _RootFilePath = FilePath;
     _RootFilePath.remove_filename();

	 //Get the FileType for this extension
	 FCFileTypeP TheFileType(getFileType(Extension, FCFileType::OSG_WRITE_SUPPORTED));

	 //Is that extension supported for reading
	 if(TheFileType == NULL)
	 {
		SWARNING << "FCFileHandlerBase::write(): Cannot write Field Container file: " << FilePath.string() << ", because no File types support " << Extension <<  " extension." << std::endl;
		return false;
	 }
	 else
	 {
		 //Open up the input stream of the file
		 std::ofstream OutputStream(FilePath.string().c_str(), std::ios::binary);

		 if(!OutputStream)
		 {
			SWARNING << "FCFileHandlerBase::write(): Couldn't open output stream for file " << FilePath.string() << std::endl;
			return false;
		 }
		 else
		 {
			 bool Result;
			 Result = write(Containers, OutputStream, Extension, IgnoreTypes, Compress);
			 OutputStream.close();
			 return Result;
		 }
	 }
}
Exemple #6
0
int main() {
    OStream os = OutputStream();
    x = f(x) + x;
    os << x;
    return x;
}