コード例 #1
0
ファイル: CtpmmdZitContainer.cpp プロジェクト: SeanGo/warmgui
bool CCtpmmdZitContainer::NewData(DataObjectPtr dop)
{
    char* buf = (char*)dop->GetData();
    size_t len = dop->GetDataLength();

    if ((DataObject::MARKET_DATA_TYPE)(*(int*)buf) == DataObject::MARKET_DATA_TYPE_CTPMMD) {
        buf += sizeof(int), len -= sizeof(int);
        CTPMMD* ctpmmd = (CTPMMD*)buf;
        if (_data_len > (size_t)ctpmmd->fIndex) {
            _curpos = (size_t)ctpmmd->fIndex;
            memcpy(_ctpmmd + _curpos, ctpmmd, sizeof(CTPMMD));
#           ifdef _DEBUG
            /*CTPMMD* pctpmmd = _ctpmmd + _curpos;
            MYTRACE(L"CTPMMD %.02f %.02f %.02f %.02f %.02f %.02f %.02f\n",
                pctpmmd->fIndex,
                pctpmmd->m_time,
                pctpmmd->LastPrice,
                pctpmmd->Volume,
                pctpmmd->relVolume,
                pctpmmd->OpenInterest,
                pctpmmd->relInterest);*/
#           endif //_DEBUG
            _world.renew_world(_ctpmmd + _curpos);
            ++_count;
        } else {
            //shift to left
            //but not now
        }
        return true;
    }
    return false;
}
コード例 #2
0
ファイル: DataContainer.cpp プロジェクト: SeanGo/warmgui
GLYPH_CHANGED_TYPE IDataContainer::AddData(DataObjectPtr dop)
{
    GLYPH_CHANGED_TYPE change = GLYPH_CHANGED_TYPE_NONE;
    MARKET_DATA_TYPE datatype = (MARKET_DATA_TYPE)*(int*)(dop->GetData());

    if (NewData(dop)) {
        //TCHAR name[MAX_PATH];
        //CChineseCodeLib::Gb2312ToUnicode(name, MAX_PATH, _name);
        //MYTRACE(L"container name is %s\n", name);

        //calculators
        for (CalConstIter iter = _cals.begin(); iter != _cals.end(); iter++) {
            (*iter)->NewData(this, datatype);
        }

        //canvases
        for (DataCanvasArray::const_iterator iter = _canvases.begin(); iter != _canvases.end(); iter++) {
            GLYPH_CHANGED_TYPE c = (*iter)->NewData(this, datatype);
            change = (GLYPH_CHANGED_TYPE)((int)change | (int)c);
        }

        //data graphs
        for (DataGraphConstIter iter = _dgraph.begin(); iter != _dgraph.end(); iter++) {
            GLYPH_CHANGED_TYPE c = (*iter)->NewData(this, datatype);
            change = (GLYPH_CHANGED_TYPE)((int)change | (int)c);
        }
    }

    return change;
}
コード例 #3
0
ファイル: CtpmmdZitContainer.cpp プロジェクト: SeanGo/warmgui
bool CZitdataContainer::NewData(DataObjectPtr dop)
{
    char* buf = (char*)dop->GetData();
    size_t len = dop->GetDataLength();

    if ((DataObject::MARKET_DATA_TYPE)(*(int*)buf) == DataObject::EUCLID_CALUC_TO_TRANSMIT) {
        buf += sizeof(int), len -= sizeof(int);

        return _zit_data.AppendData(buf, len);
    }
    return false;
}