本文整理汇总了C++中table::Ptr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::getName方法的具体用法?C++ Ptr::getName怎么用?C++ Ptr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table::Ptr
的用法示例。
在下文中一共展示了Ptr::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeTemporaryTable
void AQMatrix::writeTemporaryTable()
{
if (this->matrix.empty())
return;
uint64_t packet = 0;
char filename[1024];
FILE * fd;
std::vector<std::map<uint64_t, FILE*> > fds(this->matrix.size());
uint32_t status = 11;
uint32_t invalid = 0;
uint32_t pos = 0;
uint64_t grpIndex = 1;
uint64_t size = (*this->matrix.begin()).indexes.size();
for (uint64_t i = 0; i < size; ++i, ++grpIndex)
{
for (size_t c = 0; c < this->matrix.size(); ++c)
{
pos = static_cast<uint32_t>(this->matrix[c].indexes[i]);
packet = pos / settings->packSize;
pos = (pos - 1) % settings->packSize;
auto it = fds[c].find(packet);
if (it == fds[c].end())
{
sprintf(filename, "%s/B001REG%.4luTMP%.4"PRIu64"P%.12"PRIu64".TMP", this->settings->tmpPath.c_str(), this->matrix[c].table_id, this->uid, packet);
fd = fopen(filename, "wb");
if (fd == nullptr)
{
throw aq::generic_error(aq::generic_error::COULD_NOT_OPEN_FILE, "cannot create temporary table file '%s'", filename);
}
if (!fds[c].insert(std::make_pair(packet, fd)).second)
{
throw aq::generic_error(aq::generic_error::GENERIC, "MEMORY ERROR");
}
fwrite(&status, sizeof(uint32_t), 1, fd);
}
else
{
fd = it->second;
}
fwrite(&invalid, sizeof(uint32_t), 1, fd);
fwrite(&pos, sizeof(uint32_t), 1, fd);
}
}
for (size_t c = 0; c < this->matrix.size(); ++c)
{
for (auto& v : fds[c])
{
fclose(v.second);
}
}
// FIXME : generate empty file => this is temporary
char tableName[128];
for (auto it = this->matrix.begin(); it != this->matrix.end(); ++it)
{
Table::Ptr table = this->baseDesc->getTable((*it).table_id);
uint64_t n = table->getTotalCount() / this->settings->packSize;
for (uint64_t i = 0; i <= n; ++i)
{
sprintf(filename, "%s/B001REG%.4luTMP%.4"PRIu64"P%.12"PRIu64".TMP", this->settings->tmpPath.c_str(), (*it).table_id, this->uid, i);
FILE * fd = fopen(filename, "ab");
fclose(fd);
}
sprintf(tableName, "B001REG%.4luTMP%.4"PRIu64"P%.12"PRIu64, (*it).table_id, this->uid, n + 1);
(*it).tableName = tableName;
(*it).baseTableName = table->getName();
}
}