const DataDictionary * SessionFactory::createDataDictionary(const SessionID& sessionID, const Dictionary& settings, const std::string& settingsKey) throw(ConfigError) { DataDictionary * pDD = 0; std::string path = settings.getString( settingsKey ); Dictionaries::iterator i = m_dictionaries.find( path ); if ( i != m_dictionaries.end() ) { pDD = i->second; } else { pDD = new DataDictionary( path ); m_dictionaries[ path ] = pDD; } DataDictionary * pCopyOfDD = new DataDictionary(*pDD); if( settings.has( VALIDATE_FIELDS_OUT_OF_ORDER ) ) pCopyOfDD->checkFieldsOutOfOrder( settings.getBool( VALIDATE_FIELDS_OUT_OF_ORDER ) ); if( settings.has( VALIDATE_FIELDS_HAVE_VALUES ) ) pCopyOfDD->checkFieldsHaveValues( settings.getBool( VALIDATE_FIELDS_HAVE_VALUES ) ); if( settings.has( VALIDATE_USER_DEFINED_FIELDS ) ) pCopyOfDD->checkUserDefinedFields( settings.getBool( VALIDATE_USER_DEFINED_FIELDS ) ); return pCopyOfDD; }
DataDictionary SessionFactory::createDataDictionary(const SessionID& sessionID, const Dictionary& settings, const std::string& settingsKey) throw(ConfigError) { DataDictionary dataDictionary; std::string path = settings.getString( settingsKey ); Dictionaries::iterator i = m_dictionaries.find( path ); if ( i != m_dictionaries.end() ) dataDictionary = *i->second; else { DataDictionary* p = CreateDictionaryFromResourceID( path ); dataDictionary = *p; m_dictionaries[ path ] = p; } if( settings.has( VALIDATE_FIELDS_OUT_OF_ORDER ) ) { dataDictionary.checkFieldsOutOfOrder ( settings.getBool( VALIDATE_FIELDS_OUT_OF_ORDER ) ); } if( settings.has( VALIDATE_FIELDS_HAVE_VALUES ) ) { dataDictionary.checkFieldsHaveValues ( settings.getBool( VALIDATE_FIELDS_HAVE_VALUES ) ); } if( settings.has( VALIDATE_USER_DEFINED_FIELDS ) ) { dataDictionary.checkUserDefinedFields ( settings.getBool( VALIDATE_USER_DEFINED_FIELDS ) ); } return dataDictionary; }