Esempio n. 1
0
	bool ParseData::parse(StringBuilder& sb)
	{
		if( sb.size() < 107 ) 
			return false;
		phi = (short)sb.parseInt(5,4);
		psi = (short)sb.parseInt(10,4);
		ASSERT( 
			180 >= phi &&
			-180 <= phi &&
			180 >= psi &&
			-180 <= psi, 
			ParseException, "Phi/Psi range error");
		rotID.setTo(sb, 24, 7 );
		rotID.removeAll(' ');
		ASSERT(rotID.size() == 4, ParseException, "RotID is bad");
		probability = (float)sb.parseDouble(33, 8);
		float chi;
		chis.clear();
		chi = (float)sb.parseDouble( 42, 7 );
		if( chi != 0.0 ) // As a coder, this line makes me vomit, but unfortunatly their library is written this way. Eugh!
			chis.push_back(chi);
		chi = (float)sb.parseDouble( 50, 7 );
		if( chi != 0.0 ) // Why could they not have a gap, or at least use NULL or something ?!?
			chis.push_back(chi);
		chi = (float)sb.parseDouble( 58, 7 );
		if( chi != 0.0 ) 
			chis.push_back(chi);
		chi = (float)sb.parseDouble( 66, 7 );
		if( chi != 0.0 ) 
			chis.push_back(chi);
		return true;		
	}