Re: [Quickfix-users] Access to DataDictionary
Brought to you by:
orenmnero
From: <or...@qu...> - 2010-03-23 17:38:04
|
The problem with that is it would presume a single data dictionary provider per application, which might not always be the case. --oren > -------- Original Message -------- > Subject: [Quickfix-users] Access to DataDictionary > From: Marc Rossi <mro...@gm...> > Date: Sat, March 20, 2010 4:13 pm > To: qui...@li... > > > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html<hr>Trying to get easy access to the DataDictionary from within a method that > only has a FIX::Message reference to work with. My current solution is as > follows: > > std::string hdrStr; > m_message.getHeader().calculateString(hdrStr); > > FIX::BeginString beginString; > m_message.getHeader().getField(beginString); > > FIX::Session *session = FIX::Session::lookupSession(hdrStr, true); > const FIX::DataDictionaryProvider& ddp = > session->getDataDictionaryProvider(); > const FIX::DataDictionary& dd = > ddp.getSessionDataDictionary(beginString); > > The only issue this presents is that the > DataDictionaryProvider::getSessionDataDictionary() method is not const > friendly > (neither is the getApplicationDataDictionary() method). I have provided > patches for both DataDictionaryProvider.h & .cpp > to make those methods const friendly. > > One question I have is if there is any reason the DataDictionaryProvider > class can't provide static methods to return > DataDictionary references? So instead of jumping through the hoops above I > could simply do a: > > const FIX::DataDictionary& dd = > FIX::DataDictionaryProvider::getDataDictionary(beginString); > > Any thoughts? > > TIA, > Marc > > > --- /tmpi/quickfix/src/C++/DataDictionaryProvider.h 2010-03-07 > 20:26:26.000000000 -0600 > +++ DataDictionaryProvider.h 2010-03-19 13:53:12.000000000 -0500 > @@ -44,10 +44,10 @@ > DataDictionaryProvider() {} > DataDictionaryProvider( const DataDictionaryProvider& copy ); > > - const DataDictionary& getSessionDataDictionary(const BeginString& > beginString) > + const DataDictionary& getSessionDataDictionary(const BeginString& > beginString) const > throw( DataDictionaryNotFound ); > > - const DataDictionary& getApplicationDataDictionary(const ApplVerID& > applVerID) > + const DataDictionary& getApplicationDataDictionary(const ApplVerID& > applVerID) const > throw( DataDictionaryNotFound ); > > void addTransportDataDictionary(const BeginString& beginString, const > DataDictionary& dd); > > > --- /home/mrossi/quickfix/src/C++/DataDictionaryProvider.cpp 2010-03-07 > 20:26:26.000000000 -0600 > +++ DataDictionaryProvider.cpp 2010-03-19 13:54:44.000000000 -0500 > @@ -36,9 +36,9 @@ > } > > const DataDictionary& DataDictionaryProvider::getSessionDataDictionary > -(const BeginString& beginString) throw( DataDictionaryNotFound ) > +(const BeginString& beginString) const throw( DataDictionaryNotFound ) > { > - std::map<std::string, DataDictionary>::iterator find = > + std::map<std::string, DataDictionary>::const_iterator find = > m_transportDictionaries.find(beginString); > if( find != m_transportDictionaries.end() ) > return find->second; > @@ -47,9 +47,9 @@ > } > > const DataDictionary& DataDictionaryProvider::getApplicationDataDictionary > -(const ApplVerID& applVerID) throw( DataDictionaryNotFound ) > +(const ApplVerID& applVerID) const throw( DataDictionaryNotFound ) > { > - std::map<std::string, DataDictionary>::iterator find = > + std::map<std::string, DataDictionary>::const_iterator find = > m_applicationDictionaries.find(applVerID); > if( find != m_applicationDictionaries.end() ) > return find->second;<hr>------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev<hr>_______________________________________________ > Quickfix-users mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-users |