本文整理汇总了C++中PtrVector::back方法的典型用法代码示例。如果您正苦于以下问题:C++ PtrVector::back方法的具体用法?C++ PtrVector::back怎么用?C++ PtrVector::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PtrVector
的用法示例。
在下文中一共展示了PtrVector::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
gflags::ParseCommandLineFlags(&argc, &argv, true);
// Detect the hardware concurrency level.
const std::size_t num_hw_threads =
DefaultsConfigurator::GetNumHardwareThreads();
// Use the command-line value if that was supplied, else use the value
// that we computed above, provided it did return a valid value.
// TODO(jmp): May need to change this at some point to keep one thread
// available for the OS if the hardware concurrency level is high.
const unsigned int real_num_workers = quickstep::FLAGS_num_workers != 0
? quickstep::FLAGS_num_workers
: (num_hw_threads != 0 ?
num_hw_threads
: 1);
if (real_num_workers > 0) {
printf("Starting Quickstep with %d worker thread(s) and a %.2f GB buffer pool\n",
real_num_workers,
(static_cast<double>(quickstep::FLAGS_buffer_pool_slots) * quickstep::kSlotSizeBytes)/quickstep::kAGigaByte);
} else {
LOG(FATAL) << "Quickstep needs at least one worker thread to run";
}
#ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS
if (quickstep::FLAGS_use_hdfs) {
LOG(INFO) << "Using HDFS as the default persistent storage, with namenode at "
<< quickstep::FLAGS_hdfs_namenode_host << ":"
<< quickstep::FLAGS_hdfs_namenode_port << " and block replication factor "
<< quickstep::FLAGS_hdfs_num_replications << "\n";
}
#endif
// Initialize the thread ID based map here before the Foreman and workers are
// constructed because the initialization isn't thread safe.
quickstep::ClientIDMap::Instance();
MessageBusImpl bus;
bus.Initialize();
// The TMB client id for the main thread, used to kill workers at the end.
const client_id main_thread_client_id = bus.Connect();
bus.RegisterClientAsSender(main_thread_client_id, kPoisonMessage);
// Setup the paths used by StorageManager.
string fixed_storage_path(quickstep::FLAGS_storage_path);
if (!fixed_storage_path.empty()
&& (fixed_storage_path.back() != quickstep::kPathSeparator)) {
fixed_storage_path.push_back(quickstep::kPathSeparator);
}
string catalog_path(fixed_storage_path);
catalog_path.append("catalog.pb.bin");
if (quickstep::FLAGS_initialize_db) { // Initialize the database
// TODO(jmp): Refactor the code in this file!
LOG(INFO) << "Initializing the database, creating a new catalog file and storage directory\n";
// Create the directory
// TODO(jmp): At some point, likely in C++-17, we will just have the
// filesystem path, and we can clean this up
#ifdef QUICKSTEP_OS_WINDOWS
std::filesystem::create_directories(fixed_storage_path);
LOG(FATAL) << "Failed when attempting to create the directory: " << fixed_storage_path << "\n";
LOG(FATAL) << "Check if the directory already exists. If so, delete it or move it before initializing \n";
#else
{
string path_name = "mkdir " + fixed_storage_path;
if (std::system(path_name.c_str())) {
LOG(FATAL) << "Failed when attempting to create the directory: " << fixed_storage_path << "\n";
}
}
#endif
// Create the default catalog file.
std::ofstream catalog_file(catalog_path);
if (!catalog_file.good()) {
LOG(FATAL) << "ERROR: Unable to open catalog.pb.bin for writing.\n";
}
quickstep::Catalog catalog;
catalog.addDatabase(new quickstep::CatalogDatabase(nullptr, "default"));
if (!catalog.getProto().SerializeToOstream(&catalog_file)) {
LOG(FATAL) << "ERROR: Unable to serialize catalog proto to file catalog.pb.bin\n";
return 1;
}
// Close the catalog file - it will be reopened below by the QueryProcessor.
catalog_file.close();
}
// Setup QueryProcessor, including CatalogDatabase and StorageManager.
std::unique_ptr<QueryProcessor> query_processor;
try {
query_processor.reset(new QueryProcessor(catalog_path, fixed_storage_path));
} catch (const std::exception &e) {
LOG(FATAL) << "FATAL ERROR DURING STARTUP: "
<< e.what()
//.........这里部分代码省略.........