mardi 29 septembre 2015

Not able to store data in a private member variable from a const member function - FIX8 c++

This is my header :

class my_router_client : public FIX8::my::mine_Router {

private:
    mine_session_client& _session;
    mutable std::vector<std::string> vSymbolList;

public:
    my_router_client(mine_session_client& session) : _session(session) {}

    virtual bool operator() (const FIX8::my::SecurityList *msg) const;
    void sendToServer(FIX8::Message *); 
    void logout();
    void itertool();
    };

I am trying to save the data obtained from security list response to the vSymbolList vector. After handling security response I am trying to iterate through the vector by itertool method. But every time I end up with an empty vector. I tried printing the contents of the vector inside securitylist response function

virtual bool operator() (const FIX8::CX::SecurityList *msg) const;

and I am able to print the contents. Is it some kind of race condition inside threads?

this is the security list response handler

bool cx_router_client::operator() (const CX::SecurityList *msg) const
{
    GroupBase *dad(msg->find_group< CX::SecurityList::NoRelatedSym >());
    if (dad) {
        for (size_t cnt(0); cnt < dad->size(); ++cnt) {
            CX::Symbol symbol;
            MessageBase *details(dad->get_element(cnt));
            details->get(symbol);
            string ss; 
            ss = symbol();
            vSymbolList.push_back(ss);
//          cout << "at :: :: " << vSymbolList[cnt] << endl;

        }   
        cout << "no of symbol : " << vSymbolList.size() << endl;
        hypersleep<h_seconds>(1);
    }   

    return true;
}

Aucun commentaire:

Enregistrer un commentaire