class IO2GGenericTableResponseReader

Parents
IAddRef

Brief

The class provides methods to read a stream of trading table rows coming from the trading server.

Details

The IO2GGenericTableResponseReader is a generic class that provides methods to read responses to requests for initial trading tables information.
The IO2GGenericTableResponseReader can be used to process the contents of the following response types: GetOffers, GetAccounts, GetTrades, GetClosedTrades, GetOrders, and GetMessages.

You cannot create an instance of the class directly. You can only use the methods of the class on the following subclasses:
IO2GOffersTableResponseReader
IO2GAccountsTableResponseReader
IO2GTradesTableResponseReader
IO2GClosedTradesTableResponseReader
IO2GOrdersTableResponseReader
IO2GMessagesTableResponseReader
IO2GTable.
Note: The IO2GTable class is available only when your application uses the IO2GTableManager. The usage of the IO2GTable class is similar to the that of the IO2GGenericTableResponseReader class: it can not be instantiated directly and you can use its methods only on the following subclasses:
IO2GOffersTable
IO2GAccountsTable
IO2GTradesTable
IO2GClosedTradesTable
IO2GOrdersTable
IO2GMessagesTable
IO2GSummaryTable

If initial trading table information is received as a response to the IO2GLoginRules.getTableRefreshResponse request, you can process the response in the main thread of your program.
If initial trading table information is received as a response to the IO2GRequestFactory.createRefreshTableRequest request, you must process the response by using the IO2GResponseListener.onRequestCompleted method.

Example

Get initial accounts and trades information [hide]

 IO2GResponse *response = loginRules->getTableRefreshResponse(Accounts);
 IO2GResponseReaderFactory *factory = mSession->getResponseReaderFactory();
 if (factory)
 {
     //...
     IO2GAccountsTableResponseReader *accountsReader = factory->createAccountsTableReader(response);
     //...
     useGenericTableInterface(accountsReader);
     //...
     accountsReader->release();
     factory->release();
 }
 response->release();
 
 void EventListener::useGenericTableInterface(IO2GGenericTableResponseReader *genericReader)
 {
    IO2GTableColumnCollection *columns = genericReader->columns();
    //Process columns
    //...
    for (int i = 0; i < genericReader->size(); i++)
    {
        int count = columns->size();
        for (int j = 0; j < count; j++)
        {
            const void* value = genericReader->getCell(i, j);
            std::string sIsValid = boolToString(genericReader->isCellValid(i, j));
            //...
        }
    }
    columns->release();
 }

Public Methods

columns

Gets an instance of the class that provides access to the list of table columns.

getCell

Gets the value of a cell.

getGenericRow

Gets a generic row by its index.

getType

Gets the type of a trading table.

isCellValid

Checks whether the cell value can be used or not.

size

Gets the number of rows in the reader.

back