public method IO2GTableListener.onDeleted
Brief
Processes a notification about the row deletion from a table.
| Declaration | ||||
|
||||
| Parameters | |
rowID |
The identifier of a row. The parameter has the value of the row identifier for a specific trading table. For example, for the Accounts table, it has the value of the AccountID field. The complete list of the identifiers is shown below. |
rowData |
The object representing a row of a table. In order to process the parameter, you need to know what table it belongs to. This could be accomplished by calling the
|
Details
Table name |
|
Cast |
Casting syntax |
AccountID |
|
||
OfferID |
|
||
TradeID |
|
||
TradeID |
|
||
OrderID |
|
||
MsgID |
|
||
OfferID |
|
To get notifications about row deletions from a specific table, an instance of the class implementing the
IO2GTableListener interface must be subscribed to the Delete operation of this table.
It is accompished by calling the IO2GTable.subscribeUpdate
method with the O2GTableUpdateType.Delete parameter.
For example, if you want to get notifications about the deletions from the Trades table, write the following line:
tradesTable->subscribeUpdate(Delete, tableListener);
For the implementation details, please see the example below:
Process a notification about deletions from the Trades table [hide]
// Create session which uses table manager
mSession = CO2GTransport::createSession();
mSession->useTableManager(Yes, NULL);
//...
// After the login, get instances of the table manager and Trades table
IO2GTableManager *tableManager = mSession->getTableManager();
IO2GTradesTable *tradesTable = (IO2GTradesTable *)tableManager->getTable(Trades);
// ...
// Subscribe listener, listen to deletions from the Trades table, unsubscribe listener
TableListener *tableListener = new TableListener();
tradesTable->subscribeUpdate(Update, tableListener);
uni::Sleep(1000);
offersTable->unsubscribeUpdate(Update, tableListener);
// Implementation of IO2GTableListener interface public method onDeleted
void TableListener::onDeleted(const char *rowID, IO2GRow rowData)
{
IO2GTradeTableRow *trade = (IO2GTradeTableRow *)(rowData);
std::cout << "Trade information deleted " << rowID << std::endl;
std::cout << "TradeID: " << trade.getTradeID() <<
" Close = " << trade.getClose() << std::endl;
}
Declared in IO2GTableListener