Пример #1
0
/**

    Process HTTP response message from cimserver

    @param   httpResponse        Array<char> reply from cimserver

    @param   ostream             the ostream to which output should be written

    @param   estream             the ostream to which errors should be written

    @return  true  = wait for data from challenge response
    @return  false = client response has been received

 */
void WbemExecCommand::_handleResponse( Array<char>           responseMessage,
                                          ostream&           oStream,
                                          ostream&           eStream
                                       )
{
    String                       startLine;
    Array<HTTPHeader>            headers;
    Uint32                       contentLength;
    Uint32                       contentOffset       = 0;
    HTTPMessage*                 httpMessage;
    Boolean                      needsAuthentication = false;

    httpMessage = new HTTPMessage( responseMessage, 0 );
    httpMessage->parse( startLine, headers, contentLength );
    if( contentLength > 0 )
      {
    contentOffset = responseMessage.size() - contentLength;
      }
    else
      {
        contentOffset = responseMessage.size();
      }

    String httpVersion;
    Uint32 statusCode;
    String reasonPhrase;

    Boolean parsableMessage = HTTPMessage::parseStatusLine(
        startLine, httpVersion, statusCode, reasonPhrase);
    if (!parsableMessage || (statusCode != HTTP_STATUSCODE_OK))
      {

    // Received an HTTP error response
    // Output the HTTP error message and exit
    for (Uint32 i = 0; i < contentOffset; i++)
      {
        oStream << responseMessage[i];
      }
    oStream.flush();
    if( contentLength > 0 )
      {
        _printContent( oStream, responseMessage, contentOffset );
      }
    exit( 1 );
      }

    //
    // Received a valid HTTP response from the server.
    //
    if (_debugOutput2)
      {
        for (Uint32 i = 0; i < contentOffset; i++)
          {
                oStream << responseMessage[i];
          }
        oStream.flush();
      }
    _printContent( oStream, responseMessage, contentOffset );
}
Пример #2
0
void clustalFormat::write(ostream &out, const sequenceContainer& sd) {
	// setting some parameters
	const int numOfPositionInLine = 60;
	int maxLengthOfSeqName =0;
	for (sequenceContainer::constTaxaIterator p=sd.constTaxaBegin(); p != sd.constTaxaEnd(); ++p ) {
		int nameLen = (*p).name().size();
		if (nameLen>maxLengthOfSeqName) maxLengthOfSeqName=nameLen;
	}
	if (maxLengthOfSeqName<15) maxLengthOfSeqName=16;
	else maxLengthOfSeqName=maxLengthOfSeqName+4; // all this maxLengthOfSeqName is the 

	out<<"CLUSTAL V"<<endl;
	           // num. of space after the name.
	int currentPosition = 0;
	int charLen = sd.seqLen();
	//in case of codon alphabet the character length is : 3*(sequence_length)
	//	codon codonAlph;
	if (sd.alphabetSize()>=60) charLen*=3; 
	out<<endl<<endl;
	while (currentPosition < charLen ) {
		out.flush();
		//for (vector<const sequenceContainer::sequenceDatum*>::const_iterator it5= vec.begin(); it5!=vec.end(); ++ it5) {
		for (sequenceContainer::constTaxaIterator it5=sd.constTaxaBegin();it5!=sd.constTaxaEnd();++it5) {
			for (int iName = 0 ;iName<maxLengthOfSeqName; ++iName) {
				if (iName<(*it5).name().size()) {
					out<<(*it5).name()[iName];
					out.flush();
				}
				else out<<" ";
			}
			out.flush();
			out<<" ";
			
			if (charLen<numOfPositionInLine) 
				out<<it5->toString()<<endl;
			else {
				for (int k=currentPosition; k < currentPosition+numOfPositionInLine; ++k) {
					if (k>=charLen) 
						break;
					out<<it5->toString()[k];
					//in case of codon alphabet each position is three characters
					
					if (sd.alphabetSize()>=60){ 
						out<<it5->toString()[++k];
						out<<it5->toString()[++k];
					}
				}
				out<<endl;
			}
		}
		currentPosition +=numOfPositionInLine;
		out<<endl<<endl;
	}

	return;
}
Пример #3
0
void makeArrowObject(ostream& os)
{
    GluTriStripAdder adder(&os);
    g_adder = &adder;
    //float barRadius = 0.7, barLen = 15.0, triStartRadius = 1.5, triLen = 5.0;
    //float barRadius = 1.5, barLen = 12.0, triStartRadius = 2.4, triLen = 8.0;
    float barRadius = 1, barLen = 13.0, triStartRadius = 2, triLen = 7.0;

    int slices = 20;

    GLUquadric q;
    q.orientation = GLU_OUTSIDE;
    sgluCylinder(&q, barRadius, barRadius, barLen, slices, 1);

    q.orientation = GLU_INSIDE;
    sgluDisk(&q, 0, barRadius, slices, 1);

    adder.m_translate.z = barLen;

    q.orientation = GLU_OUTSIDE;
    sgluCylinder(&q, triStartRadius, 0, triLen, slices, 1);

    q.orientation = GLU_INSIDE;
    sgluDisk(&q, barRadius, triStartRadius, slices, 1);

    os << "\nVTX " << adder.m_addedVtx.size() << endl;

    adder.printJs(os);

    os.flush();

    g_adder = nullptr;
}
Пример #4
0
void TextWriter::write(ostream & output, map<int, list<Rule> > rules) {
	map<int, list<Rule> >::iterator im;
	for (im=rules.begin(); im!=rules.end(); ++im) {
		output << "====================" << endl;
		output << im->second.front().class_attribute.second << ": ";
		output << im->second.front().decision << endl;
		output << "--------------------" << endl;

		list<Rule>::iterator ir;
		for (ir=im->second.begin(); ir!=im->second.end(); ++ir) {
			map<string, string>::iterator ia;
			for (ia=ir->attributes.begin(); ia!=ir->attributes.end(); ++ia) {
				if (ia->second == "") continue;
                output << ia->first << "(" << ia->second << ")";
				if (ir->attributes.size() > 1 && ia!=--ir->attributes.end()) {
					output << ", ";
				}
			}
			output << endl;
		}
		output << endl;
	}
    
    output.flush();
}
Пример #5
0
void despoof::log(ostream &target, int severity, const string &text)
{
	auto prev = target.imbue(loglocale());
	target << "[" << severitytext(severity) << " " << as::datetime << time(0) << "] " << text << endl;
	target.flush();
	target.imbue(prev);
}
/** Pop bubbles discovered previously. */
size_t NetworkSequenceCollection::
performNetworkPopBubbles(ostream& out)
{
	Timer timer("NetworkPopBubbles");

	// Deal with any packets still in the queue. The barrier
	// synchronization guarantees that the packets have been
	// delivered, but we may not have dealt with them yet.
	pumpNetwork();
	assert(m_comm.receiveEmpty());

	size_t numPopped = 0;
	for (BranchGroupMap::iterator iter = m_bubbles.begin();
			iter != m_bubbles.end(); iter++) {
		assert(iter->second.getStatus() == BGS_JOINED);
		// Check whether this bubble has already been popped.
		if (!iter->second.isAmbiguous(m_data))
			continue;
		numPopped++;
		AssemblyAlgorithms::writeBubble(out,
				iter->second, m_numPopped + numPopped);
		AssemblyAlgorithms::collapseJoinedBranches(
				this, iter->second);
		assert(!iter->second.isAmbiguous(m_data));
		assert(m_comm.receiveEmpty());
	}
	m_bubbles.clear();
	out.flush();
	assert(out.good());

	logger(0) << "Removed " << numPopped << " bubbles.\n";
	return numPopped;
}
Пример #7
0
/**
 * Print an FST to an ostream.
 * @param fst	[in] FST to print.
 * @param os	[in,out] ostream.
 *
 * @return 0 on success; negative POSIX error code on error.
 */
int fstPrint(IFst *fst, ostream &os)
{
	if (!fst) {
		// Invalid parameters.
		return -EINVAL;
	}

	vector<uint8_t> tree_lines;
	tree_lines.reserve(16);

	FstFileCount fc = {0, 0};
	int ret = fstPrint(fst, os, "/", 0, tree_lines, fc);
	if (ret != 0) {
		return ret;
	}

	// Print the file count.
	// NOTE: Formatting numbers using ostringstream() because
	// MSVC's printf() doesn't support thousands separators.
	// TODO: CMake checks?
	ostringstream dircount, filecount;
	dircount << fc.dirs;
	filecount << fc.files;

	os << '\n' <<
		// tr: Parameter is a number; it's formatted elsewhere.
		rp_sprintf(NC_("FstPrint", "%s directory", "%s directories", fc.dirs), dircount.str().c_str()) << ", " <<
		// tr: Parameter is a number; it's formatted elsewhere.
		rp_sprintf(NC_("FstPrint", "%s file", "%s files", fc.files), filecount.str().c_str()) << '\n';

	os.flush();
	return 0;
}
Пример #8
0
void PoK_point_Prover::respond(ostream &os, const ZZ_p &chall)
{
	if (!announced)
	{
		throw runtime_error("respond() invoked before announce().");
	}
	if (responded)
	{
		throw runtime_error("respond() invoked twice.");
	}

	ZZ_p fi = eval(com.f, index);

	// Compute the responses
	ZZ_p u1 = s1 - chall / gamma;
	ZZ_p u2 = s2 - fi * chall;

	responded = true;

	//    cout << "p:chall=" << chall << "\n";
	//    cout << "p:u1 = " << u1 << "\n";
	//    cout << "p:u2 = " << u2 << "\n";
	os << u1 << ' ' << u2;
	os.flush();
}
Пример #9
0
void CsvWriter::write(ostream & output, map<int, list<Rule> > rules) {
    // write header
	if (rules.empty()) return;
	map<string, string>::iterator at;
	for (at=rules.begin()->second.front().attributes.begin(); at!=rules.begin()->second.front().attributes.end(); ++at) {
		output << at->first << ";";		
	}
	output << rules.begin()->second.front().class_attribute.second << endl;

	map<int, list<Rule> >::iterator im;
	for (im=rules.begin(); im!=rules.end(); ++im) {
		list<Rule>::iterator ir;
		for (ir=im->second.begin(); ir!=im->second.end(); ++ir) {
            map<string, string>::iterator ia;
			for (ia=ir->attributes.begin(); ia!=ir->attributes.end(); ++ia) {
				if (ia->second!="") {
					output << ia->second;
				}
				output << ";";
			}
			output << ir->decision;
			output << endl;
		}
	}
    
    output.flush();
}
Пример #10
0
void  RandomSampleJob::ReportResultsHeader (ostream&   r)
{
  r << "Job"        << "\t"
    << "SVM"        << "\t"
    << "Feature"    << "\t"
    << "Compresion" << "\t"
    << ""           << "\t"   // C
    << ""           << "\t"   // Gamma
    << "Order"      << "\t" 
    << "Num"        << "\t"   // Examples
    << "Sample"     << "\t"   // Sample Accurcay
    << "Support"    << "\t"
    << "Train"      << "\t"
    << "Test"       << "\t"
    << endl;

  r << "Id"         << "\t"
    << "Kernel"     << "\t"
    << "Encoding"   << "\t"
    << "Method"     << "\t"
    << "C"          << "\t"
    << "Gamma"      << "\t"
    << "Num"        << "\t"
    << "Examples"   << "\t"  
    << "Accuracy"   << "\t"   // Sample Accuracy
    << "Points"     << "\t" 
    << "Time"       << "\t"   // Train Time
    << "Time"       << "\t"   // Test Time
    << endl;

  r.flush ();

}  /* ReportResultsHeader */
Пример #11
0
//compute union alignment
int prunionalignment(ostream& out,int m,int *a,int n,int* b)
{

  ostringstream sout;

  for (int j=1; j<=m; j++)
    if (a[j])
      sout << j-1 << "-" << a[j]-1 << " ";

  for (int i=1; i<=n; i++)
    if (b[i] && a[b[i]]!=i)
      sout << b[i]-1 <<  "-" << i-1 << " ";

  //fix the last " "
  string str = sout.str();
  if (str.length() == 0)
    str = "\n";
  else
    str.replace(str.length()-1,1,"\n");

  out << str;
  out.flush();

  return 1;
}
Пример #12
0
streamsize cb::transfer(istream &in, ostream &out, streamsize length,
                        SmartPointer<TransferCallback> callback) {
  char buffer[BUFFER_SIZE];
  streamsize total = 0;

  while (!in.fail() && !out.fail()) {
    in.read(buffer, length ? min(length, BUFFER_SIZE) : BUFFER_SIZE);
    streamsize bytes = in.gcount();
    out.write(buffer, bytes);

    total += bytes;
    if (!callback.isNull() && !callback->transferCallback(bytes)) break;

    if (length) {
      length -= bytes;
      if (!length) break;
    }
  }

  out.flush();

  if (out.fail() || length) THROW("Transfer failed");

  return total;
}
Пример #13
0
void SubmatrixQueriesTest::multiSizeBenchmarkBestPositionAndSubmatrixQueries(size_t maxNRows, size_t maxNCols, size_t minNRows, size_t minNCols, size_t stepSize, size_t nSamplePerSize, size_t nPosQueries, size_t nSMQueries, ostream &outputStream)
{
    size_t nRows = minNRows, nCols = minNCols;
    for (; nRows <= maxNRows && nCols <= maxNCols; nRows += stepSize, nCols += stepSize) {
        bench_time_t *benchmarks = new bench_time_t [2];
        
#ifdef __MACH__
        benchmarks[0] = 0;
        benchmarks[1] = 0;
#else
        benchmarks[0].tv_sec = 0; benchmarks[0].tv_nsec = 0;
        benchmarks[1].tv_sec = 0; benchmarks[1].tv_nsec = 0;
#endif
        
        cout << "Fastest queries benchmarks for size: " << nRows << " x " << nCols << " ...";
        
        SubmatrixQueriesTest::multipleBenchmarkBestPositionAndSubmatrixQueries(nRows,nCols, nSamplePerSize, nPosQueries, nSMQueries, benchmarks, benchmarks+1);
        
        cout << " done\n";
        
        outputStream << ((int)nRows) << " ; " << benchTimeAsMiliSeconds(benchmarks[0]) << " ; " << benchTimeAsMiliSeconds(benchmarks[1]) << "\n";
        outputStream.flush();
        
        delete [] benchmarks;
    }
    
}
Пример #14
0
 void Shard::printShardInfo( ostream& out ) {
     vector<Shard> all;
     staticShardInfo.getAllShards( all );
     for ( unsigned i=0; i<all.size(); i++ )
         out << all[i].toString() << "\n";
     out.flush();
 }
Пример #15
0
//------------------------------------------------------------------------//
bool TokenFile::Write(ostream &Output, TokenList* pTokenList, DWORD dwFlags)
{
	Clear();
	
	if(dwFlags & TF_CASE_SENSITIVE)
		m_bCaseSensitive = true;
	else
		m_bCaseSensitive = false;

	// clear the queue
	while(!m_queBuffer.empty())
		m_queBuffer.pop();

	m_pTokenList = pTokenList;
	WriteHeader();
	GenerateTables();
	WriteTables();
	WriteTokens();

	while(!m_queBuffer.empty())
	{
		Output.put(m_queBuffer.front());
		m_queBuffer.pop();
	}

	Output.flush();
	return true;
}
Пример #16
0
/**
 * This function write a batch on the standart output it is suposed to
 * be read by the function BatchR::inputR
 */
void BatchR::outputR(ostream &f) {
    unsigned long int check = 8427;   //magic value
    f.write(reinterpret_cast<char*>(&check),sizeof(check));
    f.write(reinterpret_cast<char*>(&I),sizeof(I));
    f.write(reinterpret_cast<char*>(&Isucc),sizeof(Isucc));
    size_t v = Mean.size();
	f.write(reinterpret_cast<char*>(&v),sizeof(size_t));
    v = bernVar.size();
    f.write(reinterpret_cast<char*>(&v),sizeof(size_t));
	
    for(unsigned int i =0; i< Mean.size(); i++){
        bool tmpbool = IsBernoulli[i];
        f.write(reinterpret_cast<char*>(&tmpbool),sizeof(bool));
        f.write(reinterpret_cast<char*>(&Mean[i]),sizeof(Mean[0]));
        f.write(reinterpret_cast<char*>(&M2[i]),sizeof(Mean[0]));
       	f.write(reinterpret_cast<char*>(&M3[i]),sizeof(Mean[0]));
       	f.write(reinterpret_cast<char*>(&M4[i]),sizeof(Mean[0]));
		f.write(reinterpret_cast<char*>(&Min[i]),sizeof(Mean[0]));
       	f.write(reinterpret_cast<char*>(&Max[i]),sizeof(Mean[0]));
    }
    for(unsigned int i =0; i< bernVar.size(); i++)
        f.write(reinterpret_cast<char*>(&bernVar[i]),sizeof(bernVar[0]));
    f.write(reinterpret_cast<char*>(&simTime),sizeof(simTime));

    f.flush();
}
Пример #17
0
    void
    ProfileWriter::DumpProfileHeader(ostream& os)
{
    os << "<?xml version=\"1.0\"?>" << endl;
    os << "<!DOCTYPE PROFILE [\n" << PROFILEdtd << "]>" << endl;
    os.flush();
}
Пример #18
0
void WordIndex::traverseWords (
    BSTNode< MapNode<string, OccurrenceSet> >* node
  , ostream & stream
) {
  if (NULL == node) {
    return;
  }

  if (NULL != node->GetLeft()) {
    traverseWords(node->GetLeft(), stream);
  }
  
  if (NULL != node->GetRight()) {
    traverseWords(node->GetRight(), stream);
  }

  stream << ("    <word>\n");
  stream << ("      <value>");
  stream.flush();
  try {
    stream << StringUtil::EncodeToXmlCopy(node->GetValue().GetKey());
  } catch (CS240Exception & exception) {
    cout << exception.GetMessage() << endl;
  }
  stream << ("</value>\n");
  traverseOccurrences(node->GetValue().GetValue().GetRoot(), stream);
  stream << ("    </word>\n");
}
Пример #19
0
	void SkippingDisabledBlock(NxsString blockName) 
		{
		if (outf != 0L)
			{
			*outf << "[!Skipping disabled block (" << blockName << ")...]\n";
			outf->flush();
			}
		}
Пример #20
0
	void SkippingBlock(NxsString blockName)
		{
		if (outf != 0L)
			{
			*outf << "[!Skipping unknown block (" << blockName << ")...]\n";
			outf->flush();
			}
		}
Пример #21
0
 inline void printEnd(const char *str=NULL) {
   if (o == NULL) return; 
   if (str != NULL) *o<<str; 
   *o<<endl; 
   if (dlm == NULL) {
     o->flush(); 
   }
 }
Пример #22
0
bool Properties::save(ostream &os)
{
	StringMap::const_iterator iter = m_map.begin();
	for (; iter != m_map.end(); ++iter) {
		os << iter->first << "=" << iter->second << '\n';
	}
	os.flush();
	return true;
}
Пример #23
0
void absref_transmit::print(ostream& file, int l) const  {
  if (l > 0) {
    Ifile<<"absref_transmit::print(l="<<l<<") qaref="<<qaref
	 <<" qaref_pointer="<<qaref_pointer
	 <<" qaref_other="<<qaref_other
	 <<"\n";
    file.flush();
  }
}
Пример #24
0
void BooleanDAG::mrprint(ostream& out){
  out<<"dag "<< this->get_name()<<" :"<<endl;
  for(int i=0; i<nodes.size(); ++i){
  	if(nodes[i] != NULL){
  		out<<nodes[i]->mrprint()<<endl;
  	}    
  }
  out.flush();
}
Пример #25
0
/****************************************************************
 * Function for displaying the board.
**/
void Board::display(ostream& outStream)
{
  int count = ZERO;
  int count2 = ZERO;

  outStream << "**************************************************" << endl;
  for(int row = ZERO; row < NINE; ++row)
  {
    for(int col = ZERO; col < NINE; ++col)
    {
      vector<int> theRow = this->theBoard[row];
      if(DUMMY == theRow[col])
      {
        outStream << " . ";
        outStream.flush();
      }
      else
      {
        outStream << " " << theRow[col] << " ";
        outStream.flush();
      }
      count++;
      if((0 == count%THREE) && (col < NINE))
      {
        outStream << "|";
        outStream.flush();
      }
    
    } // for(int col = ONE; col <= NINE; ++col)
    outStream << endl;
    outStream.flush();
    count2++;
    if((0 == count2%THREE) && (row < NINE))
    {
      outStream << "---------|---------|---------" << endl;
      outStream.flush();
    }
  } // for(int row = ONE; row <= NINE; ++row)

  outStream << "**************************************************" << endl;

} // void Board::display()
Пример #26
0
	// writes all summary statistics on one single line
	// in the same order as that provided by the header
	void Trace(ostream& os)	{
	os << GetLogPrior() << '\t' << GetLogLikelihood() << '\t' << GetLength();
		os << '\t' << lambda->val();
		os << '\t' << alpha->val();
		os << '\t' << GetMeanRate();
		os << '\t' << GetVarRate();
		os << '\t' << stationary->val().GetEntropy();
		os << '\t' << relrate->val().GetMean() << '\t' << relrate->val().GetEntropy();
		os << '\n';
		os.flush();
	}
	void Mangrove_PluginMetadata::debug(ostream &os)
	{
		/* Now, we export the debug representation of the current metadata. */
		assert(os.good());
		os<<endl<<endl;
		os<<"\tThe dynamic plugin of interest has been written and created by ";
		if(this->getCAuthor().empty()==true) os<<"<not set>"<<endl;
		else os<<this->getCAuthor()<<endl;
		os<<"\tLast version: ";
		if(this->getCVersion().empty()==true) os<<"<not set>"<<endl;
		else os<<this->getCVersion()<<endl;
		os<<"\tThe dynamic plugin of interest is described by the ";
		if(this->getCSmartClassName().empty()==true) os<<"<not set> smart class, ";
		else os<<"'"<<this->getCSmartClassName()<<"' smart class, ";
		os<<"which may create:"<<endl<<endl;
		os<<"\t\tinstances of the ";
		if(this->getCVirtualPluginName().empty()==true) os<<"<not set> class";
		else os<<"'"<<this->getCVirtualPluginName()<<"' class";
		os<<" as the Virtual Plugin"<<endl;
		os<<"\t\tinstances of the ";
		if(this->getCTemplatePluginName().empty()==true) os<<"<not set> class";
		else os<<"'"<<this->getCTemplatePluginName()<<"' class";
		os<<" as the Template Plugin"<<endl<<endl;
		os.flush();
		os<<"\tThe current dynamic plugin has ";
		if(this->getCBaseName().empty()==true) os<<"<not set>";
		else os<<"'"<<this->getCBaseName()<<"'";
		os<<" as the basename for the corresponding library"<<endl;
		os<<"\tThe current dynamic plugin has ";
		if(this->getCUniqueIdentifier().empty()==true) os<<"<not set>";
		else os<<"'"<<this->getCUniqueIdentifier()<<"'";
		os<<" as the unique identifier"<<endl<<endl;
		os.flush();
		os<<"\tThe current dynamic plugin is specialized for modeling ";
		if(this->getCPluginType()==MANGROVE_PLUGIN_IO_COMPONENT) os<<"a soup of the top topological entities"<<endl<<endl;
		else if(this->getCPluginType()==MANGROVE_PLUGIN_MANGROVE) os<<"a mangrove, describing a specific topological data structure"<<endl<<endl;
		else if(this->getCPluginType()==MANGROVE_PLUGIN_MANGROVE_BUILDER) os<<"a component for constructing a specific mangrove from a soup of the top topological entities"<<endl<<endl;
		else { os<<"an unknown task."<<endl<<endl; }
		os.flush();
	}
Пример #28
0
	void NexusError(NxsString msg, file_pos pos, long line, long col)
		{
		cerr << "\nError found at line " << line << ", column " << col ;
		cerr << " (file position " << pos << "):\n" << msg << endl;

		if (outf != 0L)
			{
			*outf << "\nError found at line " << line << ", column " << col ;
			*outf << " (file position " << pos << "):\n" << msg;
			outf->flush();
			}
		exit(2);
		}
Пример #29
0
void CSimulation::print_pos(ostream &pos_stream) {
	for (vector<CPlanet>::iterator it = m_SS.m_planets.begin();
			it < m_SS.m_planets.end(); it++) {
		pos_stream << (*(it->getDynamicsPtr())).m_position << endl;
	}
	for (vector<CSatellite>::iterator it = m_SS.m_sats.begin();
			it < m_SS.m_sats.end(); it++) {
		pos_stream << (*(it->getDynamicsPtr())).m_position << endl;
	}
	pos_stream << "-\n";
	pos_stream.flush();

}
Пример #30
0
void ContextImpl::createCheckpoint(ostream& stream) {
    stream.write(CHECKPOINT_MAGIC_BYTES, sizeof(CHECKPOINT_MAGIC_BYTES)/sizeof(CHECKPOINT_MAGIC_BYTES[0]));
    writeString(stream, getPlatform().getName());
    int numParticles = getSystem().getNumParticles();
    stream.write((char*) &numParticles, sizeof(int));
    int numParameters = parameters.size();
    stream.write((char*) &numParameters, sizeof(int));
    for (map<string, double>::const_iterator iter = parameters.begin(); iter != parameters.end(); ++iter) {
        writeString(stream, iter->first);
        stream.write((char*) &iter->second, sizeof(double));
    }
    updateStateDataKernel.getAs<UpdateStateDataKernel>().createCheckpoint(*this, stream);
    stream.flush();
}