BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesRndmGenSvc.cxx File Reference
#include "BesRndmGenSvc.h"
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <iostream>
#include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/Incident.h"
#include "GaudiKernel/MsgStream.h"

Go to the source code of this file.

Functions

bool interpretSeeds (const string &buffer, string &stream, std::vector< unsigned long > &seed)

Function Documentation

◆ interpretSeeds()

bool interpretSeeds ( const string & buffer,
string & stream,
std::vector< unsigned long > & seed )

Definition at line 18 of file BesRndmGenSvc.cxx.

18 {
19 bool status( false );
20 seed.clear();
21 // split the space-separated string in 3 words:
22 typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
23 boost::char_separator<char> sep( " " );
24 tokenizer tokens( buffer, sep );
25 if ( status = ( distance( tokens.begin(), tokens.end() ) == 32 ) )
26 {
27 tokenizer::iterator token( tokens.begin() );
28 stream = *token++;
29 try
30 {
31 for ( int i = 0; i < 31; i++ )
32 {
33 long tmp = boost::lexical_cast<long>( *token++ );
34 seed.push_back( tmp );
35 }
36 } catch ( boost::bad_lexical_cast e )
37 { status = false; }
38 }
39 return status;
40}

Referenced by BesRndmGenSvc::initialize(), and interpretSeeds().