本文整理汇总了C++中DataItem::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ DataItem::getData方法的具体用法?C++ DataItem::getData怎么用?C++ DataItem::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataItem
的用法示例。
在下文中一共展示了DataItem::getData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
HashTable hash_table;
hash_table.insert(1, 20);
hash_table.insert(2, 70);
hash_table.insert(42, 80);
hash_table.insert(4, 25);
hash_table.insert(12, 44);
hash_table.insert(14, 32);
hash_table.insert(17, 11);
hash_table.insert(13, 78);
hash_table.insert(37, 97);
hash_table.display();
DataItem item = hash_table.search(37);
if (item != HashTable::emptyItem && item != HashTable::dummyItem)
cout << "Element found: " << item.getData() << endl;
else
cout << "Element not found" << endl;
hash_table.remove(37);
item = hash_table.search(37);
if (item != HashTable::emptyItem && item != HashTable::dummyItem)
cout << "Element found: " << item.getData() << endl;
else
cout << "Element not found" << endl;
hash_table.display();
return 0;
}
示例2: getData
PyObject* DataRecord::getData(int verbose)
{
PyObject*p = PyDict_New();
PyObject* k1 = Py_BuildValue("s", "category");
PyObject* v1 = Py_BuildValue("H", m_pCategory->m_id);
PyDict_SetItem(p, k1, v1);
Py_DECREF(k1);
Py_DECREF(v1);
PyObject* k2 = Py_BuildValue("s", "len");
PyObject* v2 = Py_BuildValue("l", m_nLength);
PyDict_SetItem(p, k2, v2);
Py_DECREF(k2);
Py_DECREF(v2);
char hexcrc[9];
sprintf(hexcrc, "%08X", m_nCrc);
PyObject* k3 = Py_BuildValue("s", "crc");
PyObject* v3 = Py_BuildValue("s", hexcrc);
PyDict_SetItem(p, k3, v3);
Py_DECREF(k3);
Py_DECREF(v3);
PyObject* k4 = Py_BuildValue("s", "ts");
PyObject* v4 = Py_BuildValue("l", m_nTimestamp);
PyDict_SetItem(p, k4, v4);
Py_DECREF(k4);
Py_DECREF(v4);
if (m_bFormatOK)
{
// go through all present data items in this record
std::list<DataItem*>::iterator it;
for ( it=m_lDataItems.begin() ; it != m_lDataItems.end(); it++ )
{
DataItem* di = (DataItem*)(*it);
if (di)
{
PyObject* v1 = di->getData(verbose);
char tmp[20];
snprintf(tmp, 20, "I%s", di->m_pDescription->m_strID.c_str());
PyObject* k1 = Py_BuildValue("s", tmp);
PyDict_SetItem(p, k1, v1);
Py_DECREF(k1);
Py_DECREF(v1);
}
}
}
return p;
}
示例3: getData
PyObject* DataRecord::getData()
{
UAP* pUAP = m_pCategory->getUAP(m_pFSPECData, m_nFSPECLength);
PyObject*p = PyDict_New();
PyObject* k1 = Py_BuildValue("s", "category");
PyObject* v1 = Py_BuildValue("H", m_pCategory->m_id);
PyDict_SetItem(p, k1, v1);
Py_DECREF(k1);
Py_DECREF(v1);
PyObject* k2 = Py_BuildValue("s", "len");
PyObject* v2 = Py_BuildValue("l", m_nLength);
PyDict_SetItem(p, k2, v2);
Py_DECREF(k2);
Py_DECREF(v2);
char hexcrc[9];
sprintf(hexcrc, "%08X", m_nCrc);
PyObject* k3 = Py_BuildValue("s", "crc");
PyObject* v3 = Py_BuildValue("s", hexcrc);
PyDict_SetItem(p, k3, v3);
Py_DECREF(k3);
Py_DECREF(v3);
PyObject* k4 = Py_BuildValue("s", "ts");
PyObject* v4 = Py_BuildValue("l", m_nTimestamp);
PyDict_SetItem(p, k4, v4);
Py_DECREF(k4);
Py_DECREF(v4);
if (!pUAP)
{
Tracer::Error("UAP for CAT%03d not found!", m_pCategory->m_id);
}
else
{
// go through all present data items in this record
std::list<DataItem*>::iterator it;
for ( it=m_lDataItems.begin() ; it != m_lDataItems.end(); it++ )
{
DataItem* di = (DataItem*)(*it);
if (di)
{
PyObject* v1 = di->getData();
char tmp[20];
sprintf(tmp, "I%s", di->m_pDescription->m_strID.c_str());
PyObject* k1 = Py_BuildValue("s", tmp);
PyDict_SetItem(p, k1, v1);
Py_DECREF(k1);
Py_DECREF(v1);
}
}
}
if (!m_bFormatOK)
{
// TODO err
}
return p;
}