#6 option to modify sessions settings

open
nobody
None
5
2009-03-17
2009-03-17
Alex
No

I used to modify the settings parameters before running initiator/acceptor, but the new feature (revision 1966) throws ConfigError exception breaks that completely.

That could be nice to have such a feature to modify parameters. Is there are chance to get a non const Dictionary& get() method or something?

For example, I append the current date to the file paths, so the files are put into the write directory:

m_settings = new FIX::SessionSettings(config_file);

time_t ltime = time(0);
struct tm *newtime = gmtime(&ltime);
const int DTSTRSIZE = 50;
char timestr[DTSTRSIZE+1];
strftime(timestr, DTSTRSIZE, "\\%Y%m%d", newtime);

typedef std::set<FIX::SessionID> TSessionsSet;
TSessionsSet TheSet = m_settings->getSessions();
for(TSessionsSet::iterator it = TheSet.begin(); it != TheSet.end(); it++)
{
FIX::SessionID SessionID = *it;
// that could be nice to get reference to the Dictionary instead here:
FIX::Dictionary Dictionary = m_settings->get(SessionID);

std::string path = Dictionary.getString(FIX::FILE_LOG_PATH);
FIX::file_mkdir(path.c_str());
path += timestr;
if(suffix)
{
path += suffix;
}
Dictionary.setString(FIX::FILE_LOG_PATH, path);

path = Dictionary.getString(FIX::FILE_STORE_PATH);
FIX::file_mkdir(path.c_str());
path += timestr;
if(suffix)
{
path += suffix;
}
Dictionary.setString(FIX::FILE_STORE_PATH, path);

// here is I got the exception :(
m_settings->set(SessionID, Dictionary);
}
}
m_factory = new FIX::QFMyFileStoreFactory(*m_settings);
m_logFactory = new FIX::FileLogFactory(*m_settings);
m_initiator = new FIX::ThreadedSocketInitiator(*this, *m_factory, *m_settings, *m_logFactory);
......

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks