SdlAudioSink::SdlAudioSink(const AudioSource &source, int device_id) : bytes_per_sample(source.BytesPerSample()), ring_buf(RINGBUF_POWER, source.BytesPerSample()), position_sample_count(0), source_out(false), state(Audio::State::STOPPED) { const char *name = SDL_GetAudioDeviceName(device_id, 0); if (name == nullptr) { throw ConfigError(std::string("invalid device id: ") + std::to_string(device_id)); } SDL_AudioSpec want; SDL_zero(want); want.freq = source.SampleRate(); want.format = FORMATS[static_cast<int>(source.OutputSampleFormat())]; want.channels = source.ChannelCount(); want.callback = &SDLCallback; want.userdata = (void *)this; SDL_AudioSpec have; SDL_zero(have); this->device = SDL_OpenAudioDevice(name, 0, &want, &have, 0); if (this->device == 0) { throw ConfigError(std::string("couldn't open device: ") + SDL_GetError()); } }
int HarnessTestExecutor :: validateParameters (void) { try { _ie.tcfile = getAbsolutePath (_ie.tcfile, false); if (_ie.tcfile.empty ()) throw ConfigError (FILE_LINE_FUNCTION, ERR_CONFIG_TESTCASEFILENAME_EMPTY); if (!bfs::is_regular (_ie.tcfile)) { stringstream ss; ss << "Test case file " << _ie.tcfile << " either does not exist or is not a regular file."; throw SystemError (FILE_LINE_FUNCTION, ss.str()); } if (_ie.debugLevel < MIN_DEBUG_LEVEL || _ie.debugLevel > MAX_DEBUG_LEVEL) { stringstream ss; ss << "Invalid value specified for option --debug. Valid range is [" << MIN_DEBUG_LEVEL << "-" << MAX_DEBUG_LEVEL << "]"; throw ConfigError (FILE_LINE_FUNCTION, ss.str()); } } catch (harnessexceptions :: ConfigError &e) { PRINT_ERROR (e.what ()); return FAILURE; } return SUCCESS; }
Index::Index (Config const &config) : default_K(config.get<int>("donkey.defaults.hint_K", 1)), default_R(config.get<float>("donkey.defaults.hint_R", donkey::default_hint_R())) { if (default_K <= 0) throw ConfigError("invalid defaults.hint_K"); if (!isnormal(default_R)) throw ConfigError("invalid defaults.hint_R"); }
void PostgreSQLStore::populateCache() { std::stringstream queryString; queryString << "SELECT creation_time, incoming_seqnum, outgoing_seqnum FROM sessions WHERE " << "beginstring=" << "'" << m_sessionID.getBeginString().getValue() << "' and " << "sendercompid=" << "'" << m_sessionID.getSenderCompID().getValue() << "' and " << "targetcompid=" << "'" << m_sessionID.getTargetCompID().getValue() << "' and " << "session_qualifier=" << "'" << m_sessionID.getSessionQualifier() << "'"; PostgreSQLQuery query( queryString.str() ); if( !m_pConnection->execute(query) ) throw ConfigError( "No entries found for session in database" ); int rows = query.rows(); if( rows > 1 ) throw ConfigError( "Multiple entries found for session in database" ); if( rows == 1 ) { struct tm time; std::string sqlTime = query.getValue( 0, 0 ); strptime( sqlTime.c_str(), "%Y-%m-%d %H:%M:%S", &time ); m_cache.setCreationTime (UtcTimeStamp (&time)); m_cache.setNextTargetMsgSeqNum( atol( query.getValue( 0, 1 ) ) ); m_cache.setNextSenderMsgSeqNum( atol( query.getValue( 0, 2 ) ) ); } else { UtcTimeStamp time = m_cache.getCreationTime(); char sqlTime[ 20 ]; int year, month, day, hour, minute, second, millis; time.getYMD (year, month, day); time.getHMS (hour, minute, second, millis); STRING_SPRINTF( sqlTime, "%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second ); std::stringstream queryString2; queryString2 << "INSERT INTO sessions (beginstring, sendercompid, targetcompid, session_qualifier," << "creation_time, incoming_seqnum, outgoing_seqnum) VALUES(" << "'" << m_sessionID.getBeginString().getValue() << "'," << "'" << m_sessionID.getSenderCompID().getValue() << "'," << "'" << m_sessionID.getTargetCompID().getValue() << "'," << "'" << m_sessionID.getSessionQualifier() << "'," << "'" << sqlTime << "'," << m_cache.getNextTargetMsgSeqNum() << "," << m_cache.getNextSenderMsgSeqNum() << ")"; PostgreSQLQuery query2( queryString2.str() ); if( !m_pConnection->execute(query2) ) throw ConfigError( "Unable to create session in database" ); } }
void MemMapper::LateInit() { // Make connections for (TiXmlElement *el = xml_config.FirstChildElement("connect"); el != NULL; el = el->NextSiblingElement("connect")) { const char *type = el->Attribute("type"); const char *dest = el->Attribute("dest"); if (type == NULL || dest == NULL) throw ConfigError(el, "MemMapper <connect> missing type or dest attribute"); std::string type_str = std::string(type); if (type_str == "Z80CPU") z80 = mbee.GetDevice<Z80CPU>(dest); else if (type_str == "Bank0") bank0 = mbee.GetDevice<RAM>(dest); else if (type_str == "Bank1") bank1 = mbee.GetDevice<RAM>(dest); else if (type_str == "Bank2") bank2 = mbee.GetDevice<RAM>(dest); else if (type_str == "Bank3") bank3 = mbee.GetDevice<RAM>(dest); else if (type_str == "ROM1") rom1 = mbee.GetDevice<ROM>(dest); else if (type_str == "ROM2") rom2 = mbee.GetDevice<ROM>(dest); else if (type_str == "ROM3") rom3 = mbee.GetDevice<ROM>(dest); else if (type_str == "CRTCMemory") crtcmem = mbee.GetDevice<CRTCMemory>(dest); } if (z80 == NULL) throw ConfigError(&xml_config, "MemMapper missing Z80CPU connection"); if (bank0 == NULL) throw ConfigError(&xml_config, "MemMapper missing Bank0 connection"); if (bank1 == NULL) throw ConfigError(&xml_config, "MemMapper missing Bank1 connection"); if (bank2 == NULL) throw ConfigError(&xml_config, "MemMapper missing Bank2 connection"); if (bank3 == NULL) throw ConfigError(&xml_config, "MemMapper missing Bank3 connection"); if (rom1 == NULL) throw ConfigError(&xml_config, "MemMapper missing ROM1 connection"); if (rom2 == NULL) throw ConfigError(&xml_config, "MemMapper missing ROM2 connection"); if (rom3 == NULL) throw ConfigError(&xml_config, "MemMapper missing ROM3 connection"); if (crtcmem == NULL) throw ConfigError(&xml_config, "MemMapper missing CRTCMemory connection"); }
void FileStore::open( bool deleteFile ) { if ( m_msgFile ) fclose( m_msgFile ); if ( m_headerFile ) fclose( m_headerFile ); if ( m_seqNumsFile ) fclose( m_seqNumsFile ); if ( m_sessionFile ) fclose( m_sessionFile ); m_msgFile = 0; m_headerFile = 0; m_seqNumsFile = 0; m_sessionFile = 0; if ( deleteFile ) { file_unlink( m_msgFileName.c_str() ); file_unlink( m_headerFileName.c_str() ); file_unlink( m_seqNumsFileName.c_str() ); file_unlink( m_sessionFileName.c_str() ); } populateCache(); m_msgFile = file_fopen( m_msgFileName.c_str(), "r+" ); if ( !m_msgFile ) m_msgFile = file_fopen( m_msgFileName.c_str(), "w+" ); if ( !m_msgFile ) throw ConfigError( "Could not open body file: " + m_msgFileName ); m_headerFile = file_fopen( m_headerFileName.c_str(), "r+" ); if ( !m_headerFile ) m_headerFile = file_fopen( m_headerFileName.c_str(), "w+" ); if ( !m_headerFile ) throw ConfigError( "Could not open header file: " + m_headerFileName ); m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "r+" ); if ( !m_seqNumsFile ) m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "w+" ); if ( !m_seqNumsFile ) throw ConfigError( "Could not open seqnums file: " + m_seqNumsFileName ); bool setCreationTime = false; m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r" ); if ( !m_sessionFile ) setCreationTime = true; else fclose( m_sessionFile ); m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r+" ); if ( !m_sessionFile ) m_sessionFile = file_fopen( m_sessionFileName.c_str(), "w+" ); if ( !m_sessionFile ) throw ConfigError( "Could not open session file" ); if ( setCreationTime ) setSession(); setNextSenderMsgSeqNum( getNextSenderMsgSeqNum() ); setNextTargetMsgSeqNum( getNextTargetMsgSeqNum() ); }
void SimpleConfig::_parse(std::istream &is) { std::vector<std::string> lines; std::vector<std::string>::iterator L; std::string line; int state = 0; line.reserve(256); while (is.good() && !is.eof()) { char buffer[1024]; is.getline(buffer, 1024); buffer[1023] = 0; lines.push_back(buffer); } line = ""; state = 0; std::string section; std::string comment; int line_no = 0; for (L = lines.begin(); L != lines.end(); L++) { line = TrimString(*L, WHITESPACE); line_no++; if (line == "") { if (L+1 != lines.end()) { _addComment(line); } } else { char c = line[0]; if (c == SECTION_START) { int e = line.find(SECTION_END); if (e < 0) { throw ConfigError("missing end-section tag", m_file, line_no, *L); } section = line.substr(1, e-1); _addSection(section); } else if (c == COMMENT_CHAR) { _addComment(line); } else { int eq = line.find_first_of(EQUAL_CHAR); if (eq < 0) { throw ConfigError("missing equal sign in key-value pair", m_file, line_no, *L); } std::string key = TrimString(line.substr(0, eq), WHITESPACE); std::string value = TrimString(line.substr(eq+1), WHITESPACE); _addValue(section, key, value); } } } }
/* static */ void SdlAudioSink::InitLibrary() { if (SDL_Init(SDL_INIT_AUDIO) != 0) { throw ConfigError(std::string("could not initialise SDL: ") + SDL_GetError()); } }
void SessionFactory::processFixtDataDictionaries(const SessionID& sessionID, const Dictionary& settings, DataDictionaryProvider& provider) throw(ConfigError) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, TRANSPORT_DATA_DICTIONARY); provider.addTransportDataDictionary(sessionID.getBeginString(), dataDictionary); for(Dictionary::const_iterator data = settings.begin(); data != settings.end(); ++data) { const std::string& key = data->first; const std::string frontKey = key.substr(0, strlen(APP_DATA_DICTIONARY)); if( frontKey == string_toUpper(APP_DATA_DICTIONARY) ) { if( key == string_toUpper(APP_DATA_DICTIONARY) ) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, APP_DATA_DICTIONARY); provider.addApplicationDataDictionary(Message::toApplVerID(settings.getString(DEFAULT_APPLVERID)), dataDictionary); } else { std::string::size_type offset = key.find('.'); if( offset == std::string::npos ) throw ConfigError(std::string("Malformed ") + APP_DATA_DICTIONARY + ": " + key); std::string beginStringQualifier = key.substr(offset+1); DataDictionary dataDictionary = createDataDictionary(sessionID, settings, key); provider.addApplicationDataDictionary(Message::toApplVerID(beginStringQualifier), dataDictionary); } } } }
void SensorDriver::set_correction(const std::vector<int> &correction) { if (correction.size() > num_temps()) throw ConfigError(MSG_CONF_CORRECTION_LEN(path_, correction.size(), num_temps_)); else if (correction.size() < num_temps()) log(TF_WRN) << MSG_CONF_CORRECTION_LEN(path_, correction.size(), num_temps_) << flush; correction_ = correction; }
int DataDictionary::lookupXMLFieldNumber ( DOMDocument* pDoc, const std::string& name ) const { NameToField::const_iterator i = m_names.find(name); if( i == m_names.end() ) throw ConfigError("Field " + name + " not defined in fields section"); return i->second; }
int DataDictionary::lookupXMLFieldNumber( DOMDocument* pDoc, DOMNode* pNode ) const { DOMAttributesPtr attrs = pNode->getAttributes(); std::string name; if(!attrs->get("name", name)) throw ConfigError("No name given to field"); return lookupXMLFieldNumber( pDoc, name ); }
const message_order &DataDictionary::getMessageOrderedFields(const std::string & msgType) const EXCEPT ( ConfigError ) { MsgTypeToOrderedFields::const_iterator iter = m_messageOrderedFields.find(msgType); if (iter == m_messageOrderedFields.end()) throw ConfigError("<Message> " + msgType + " does not have a stored message order"); return iter->second.getMessageOrder(); }
const Dictionary& SessionSettings::get( const SessionID& sessionID ) const EXCEPT ( ConfigError ) { Dictionaries::const_iterator i; i = m_settings.find( sessionID ); if ( i == m_settings.end() ) throw ConfigError( "Session not found" ); return i->second; }
void DataDictionary::addXMLGroup( DOMDocument* pDoc, DOMNode* pNode, const std::string& msgtype, DataDictionary& DD, bool groupRequired ) { DOMAttributesPtr attrs = pNode->getAttributes(); std::string name; if(!attrs->get("name", name)) throw ConfigError("No name given to group"); int group = lookupXMLFieldNumber( pDoc, name ); int delim = 0; int field = 0; DataDictionary groupDD; DOMNodePtr node = pNode->getFirstChildNode(); while(node.get()) { if( node->getName() == "field" ) { field = lookupXMLFieldNumber( pDoc, node.get() ); groupDD.addField( field ); DOMAttributesPtr attrs = node->getAttributes(); std::string required; if( attrs->get("required", required) && ( required == "Y" || required =="y" ) && groupRequired ) { groupDD.addRequiredField(msgtype, field); } } else if( node->getName() == "component" ) { field = addXMLComponentFields( pDoc, node.get(), msgtype, groupDD, false ); } else if( node->getName() == "group" ) { field = lookupXMLFieldNumber( pDoc, node.get() ); groupDD.addField( field ); DOMAttributesPtr attrs = node->getAttributes(); std::string required; if( attrs->get("required", required ) && ( required == "Y" || required =="y" ) && groupRequired) { groupDD.addRequiredField(msgtype, field); } bool isRequired = false; if( attrs->get("required", required) ) isRequired = (required == "Y" || required == "y"); addXMLGroup( pDoc, node.get(), msgtype, groupDD, isRequired ); } if( delim == 0 ) delim = field; RESET_AUTO_PTR(node, node->getNextSiblingNode()); } if( delim ) DD.addGroup( msgtype, group, delim, groupDD ); }
bool Dictionary::getBool( const std::string& key ) const throw( ConfigError, FieldConvertError ) { try { return BoolConvertor::convert( getString(key) ); } catch ( FieldConvertError& ) { throw ConfigError( "Illegal value " + getString(key) + " for " + key ); } }
std::string Dictionary::getString( const std::string& key, bool capitalize ) const throw( ConfigError, FieldConvertError ) { Data::const_iterator i = m_data.find( string_toUpper(key) ); if ( i == m_data.end() ) throw ConfigError( key + " not defined" ); std::string result = i->second; if( capitalize ) std::transform(result.begin(), result.end(), result.begin(), toupper); return result; }
void SessionSettings::validate( const Dictionary& dictionary ) const EXCEPT ( ConfigError ) { std::string beginString = dictionary.getString( BEGINSTRING ); if( beginString != BeginString_FIX40 && beginString != BeginString_FIX41 && beginString != BeginString_FIX42 && beginString != BeginString_FIX43 && beginString != BeginString_FIX44 && beginString != BeginString_FIXT11 ) { throw ConfigError( std::string(BEGINSTRING) + " must be FIX.4.0 to FIX.4.4 or FIXT.1.1" ); } std::string connectionType = dictionary.getString( CONNECTION_TYPE ); if( connectionType != "initiator" && connectionType != "acceptor" ) { throw ConfigError( std::string(CONNECTION_TYPE) + " must be 'initiator' or 'acceptor'" ); } }
void ConfigEntry<std::string>::readValueFromStream(std::istream& is) { std::string line; std::getline(is, line); size_t open_quote = line.find('"'); size_t close_quote = line.rfind('"'); if (open_quote != std::string::npos && close_quote != std::string::npos) { m_value = line.substr(open_quote + 1, close_quote - open_quote - 1); } else { throw ConfigError("Unable to find quoted string in :" + line); } }
void DataDictionary::readFromURL( const std::string& url ) throw( ConfigError ) { #ifdef HAVE_LIBXML DOMDocumentPtr pDoc = DOMDocumentPtr(new LIBXML_DOMDocument()); #elif _MSC_VER DOMDocumentPtr pDoc = DOMDocumentPtr(new MSXML_DOMDocument()); #else DOMDocumentPtr pDoc = DOMDocumentPtr(new LIBXML_DOMDocument()); #endif if(!pDoc->load(url)) throw ConfigError(url + ": Could not parse data dictionary file"); try { readFromDocument( pDoc ); } catch( ConfigError& e ) { throw ConfigError( url + ": " + e.what() ); } }
void Acceptor::initialize() throw ( ConfigError ) { std::set < SessionID > sessions = m_settings.getSessions(); std::set < SessionID > ::iterator i; if ( !sessions.size() ) throw ConfigError( "No sessions defined" ); SessionFactory factory( m_application, m_messageStoreFactory, m_pLogFactory ); for ( i = sessions.begin(); i != sessions.end(); ++i ) { if ( m_settings.get( *i ).getString( CONNECTION_TYPE ) == "acceptor" ) { m_sessionIDs.insert( *i ); m_sessions[ *i ] = factory.create( *i, m_settings.get( *i ) ); } } if ( !m_sessions.size() ) throw ConfigError( "No sessions defined for acceptor" ); }
// just like the Initiator::initialize function void AsioSocketInitiator::initialize() { std::set < SessionID > sessions = m_settings.getSessions(); std::set < SessionID > ::iterator i; if ( !sessions.size() ) throw ConfigError( "No sessions defined" ); SessionFactory factory( m_application, m_messageStoreFactory, m_pLogFactory ); for ( i = sessions.begin(); i != sessions.end(); ++i ) { if ( m_settings.get( *i ).getString( m_connection_type_label ).compare ( m_initiator_label ) == 0 ) { m_sessions[ *i ] = factory.create( *i, m_settings.get( *i ) ); ConnectSession ( *i, m_settings.get( *i ) ); } } if ( !m_sessions.size() ) throw ConfigError( "No sessions defined for initiator" ); }
void DataDictionary::readFromStream( std::istream& stream ) throw( ConfigError ) { #ifdef HAVE_LIBXML DOMDocumentPtr pDoc = DOMDocumentPtr(new LIBXML_DOMDocument()); #elif _MSC_VER DOMDocumentPtr pDoc = DOMDocumentPtr(new MSXML_DOMDocument()); #else DOMDocumentPtr pDoc = DOMDocumentPtr(new LIBXML_DOMDocument()); #endif if(!pDoc->load(stream)) throw ConfigError("Could not parse data dictionary stream"); readFromDocument( pDoc ); }
void IConfig::loadFromStream(std::istream& is) { loadDefault(); std::string entry_name; bool read = true; while (read) { while (char c = is.get()) { if (!is.good()) { read = false; break; } // trim spaces at the beginning if (c == ' ' || c == '\n' || c == '\r') { continue; } // skip comment line if (c == '#') { is.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); continue; } // next config header, finish parsing if (c == '[') { read = false; } is.unget(); break; } if (!read) { break; } is >> entry_name; if (m_strEntryMap.count(entry_name)) { m_strEntryMap[entry_name]->readValueFromStream(is); } else { throw ConfigError("Unrecognized config entry: " + entry_name); } } onLoad(); }
/*ARGSUSED*/ void ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) { Arg args[1]; XtSetArg(args[0], XtNstring, &ident_string); XtGetValues(ident_widget, args, 1); if (config_function == NULL || (*config_function)()) { XtPopdown(shell); config_popped = False; config_status = True; xf86info.lists[xf86info.cur_list].cur_function = 0; } else ConfigError(); }
message_order const& DataDictionary::getTrailerOrderedFields() const EXCEPT ( ConfigError ) { if( m_trailerOrder ) return m_trailerOrder; if (m_trailerOrderedFields.size() == 0) throw ConfigError("<Trailer> does not have a stored message order"); int * tmp = new int[m_trailerOrderedFields.size() + 1]; int * i = tmp; OrderedFields::const_iterator iter; for( iter = m_trailerOrderedFields.begin(); iter != m_trailerOrderedFields.end(); *(i++) = *(iter++) ) {} *i = 0; m_trailerOrder = message_order(tmp); delete [] tmp; return m_trailerOrder; }
void Drives::LateInit() { // Make connections for (TiXmlElement *el = xml_config.FirstChildElement("connect"); el != NULL; el = el->NextSiblingElement("connect")) { const char *type = el->Attribute("type"); const char *dest = el->Attribute("dest"); if (type == NULL || dest == NULL) throw ConfigError(el, "Drives <connect> missing type or dest attribute"); std::string type_str = std::string(type); if (type_str == "FDC") fdc = mbee.GetDevice<FDC>(dest); } if (fdc == NULL) throw ConfigError(&xml_config, "Drives missing FDC connection"); // Load any Disks specified for (TiXmlElement *el = xml_config.FirstChildElement("disk"); el != NULL; el = el->NextSiblingElement("disk")) { int drv; if (el->Attribute("drive", &drv) == NULL) throw ConfigError(el, "<disk> missing drive attribute"); const char *file = el->Attribute("filename"); if (file == NULL) throw ConfigError(el, "<disk> missing filename attribute"); try { LoadDisk(drv, mbee.GetConfigFileName().GetPath(wxPATH_GET_SEPARATOR) + file); } catch (OutOfRange &) { throw ConfigError(el, "<disk> specifies an invalid drive"); } catch (DiskImageError &) { throw ConfigError(el, "Disk image could not be loaded"); } } }
FileStore::FileStore( std::string path, const SessionID& s ) : m_msgFile( 0 ), m_headerFile( 0 ), m_seqNumsFile( 0 ), m_sessionFile( 0 ) { file_mkdir( path.c_str() ); if ( path.empty() ) path = "."; const std::string& begin = s.getBeginString().getString(); const std::string& sender = s.getSenderCompID().getString(); const std::string& target = s.getTargetCompID().getString(); const std::string& qualifier = s.getSessionQualifier(); std::string sessionid = begin + "-" + sender + "-" + target; if( qualifier.size() ) sessionid += "-" + qualifier; std::string prefix = file_appendpath(path, sessionid + "."); m_msgFileName = prefix + "body"; m_headerFileName = prefix + "header"; m_seqNumsFileName = prefix + "seqnums"; m_sessionFileName = prefix + "session"; try { open( false ); } catch ( IOException & e ) { throw ConfigError( e.what() ); } }
int Dictionary::getDay( const std::string& key ) const throw( ConfigError, FieldConvertError ) { try { std::string value = getString(key); if( value.size() < 2 ) throw FieldConvertError(0); std::string abbr = value.substr(0, 2); std::transform( abbr.begin(), abbr.end(), abbr.begin(), tolower ); if( abbr == "su" ) return 1; if( abbr == "mo" ) return 2; if( abbr == "tu" ) return 3; if( abbr == "we" ) return 4; if( abbr == "th" ) return 5; if( abbr == "fr" ) return 6; if( abbr == "sa" ) return 7; if( value.size() < 2 ) throw FieldConvertError(0); } catch ( FieldConvertError& ) { throw ConfigError( "Illegal value " + getString(key) + " for " + key ); } return -1; }
/////////////////////////////////////////////////////////////////////////////// // Process the configuration settings. This will set up the recordCopier. // Note: Check HaveConfigurationError() for the result. /////////////////////////////////////////////////////////////////////////////// void GeoLoadCombineAddressRange::ProcessConfiguration() { if (!configChanged) { return; } ::ProcessConfiguration(); // Output record starts out empty outputRecord = new Record; // Make a new record copier recordCopier = new RecordCopier; // Must have an output DataSourceList outputs = GetOutputs(); if (outputs.size() == 0) { ConfigError("Must have at least one output attached"); } // Get references to all inputs. DataSourceRef input = GetFirstInput(); if (input == 0) { ConfigError("Must have at least one input attached"); return; } // Output is always copy of input record schema outputRecord = new Record(*input->GetRecord()); // Copy entire record; this is only very slightly wasteful of CPU. recordCopier->AddRecordTransfers(outputRecord); // Configuration processing. Walk the DataItem hierarchy and // transform that into the data-file, file format, and record layout. DataItemRef tmp; /////////////////////////////////////////////////////////////////////////////// // Specified fields /////////////////////////////////////////////////////////////////////////////// postcodeFieldName = ""; tlidFieldName = ""; leftRightFieldName = ""; fraddrFieldName = ""; toaddrFieldName = ""; tmp = config["ZIP"]; if (tmp != 0) { postcodeFieldName = TsString(*tmp); } if (outputRecord->GetField(postcodeFieldName) == 0) { ConfigError("ZIP field '" + postcodeFieldName + "' does not exist on input record"); } tmp = config["TLID"]; if (tmp != 0) { tlidFieldName = TsString(*tmp); } if (outputRecord->GetField(tlidFieldName) == 0) { ConfigError("TLID field '" + tlidFieldName + "' does not exist on input record"); } tmp = config["LEFTRIGHT"]; if (tmp != 0) { leftRightFieldName = TsString(*tmp); } if (outputRecord->GetField(leftRightFieldName) == 0) { ConfigError("LEFTRIGHT field '" + leftRightFieldName + "' does not exist on input record"); } tmp = config["FRADDR"]; if (tmp != 0) { fraddrFieldName = TsString(*tmp); } if (outputRecord->GetField(fraddrFieldName) == 0) { ConfigError("FRADDR field '" + fraddrFieldName + "' does not exist on input record"); } tmp = config["TOADDR"]; if (tmp != 0) { toaddrFieldName = TsString(*tmp); } if (outputRecord->GetField(toaddrFieldName) == 0) { ConfigError("TOADDR field '" + toaddrFieldName + "' does not exist on input record"); } }