本文整理汇总了C++中ProjectConfiguration::setBackendType方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectConfiguration::setBackendType方法的具体用法?C++ ProjectConfiguration::setBackendType怎么用?C++ ProjectConfiguration::setBackendType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::setBackendType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
try {
// init command line parser
util::ProgramOptions::init(argc, argv);
int stack_id = optionStackId.as<int>();
std::string comp_dir = optionComponentDir.as<std::string>();
std::string pg_host = optionPGHost.as<std::string>();
std::string pg_user = optionPGUser.as<std::string>();
std::string pg_pass = optionPGPassword.as<std::string>();
std::string pg_dbase = optionPGDatabase.as<std::string>();
std::cout << "Testing PostgreSQL stores with stack ID " << stack_id << std::endl;
// init logger
logger::LogManager::init();
logger::LogManager::setGlobalLogLevel(logger::Debug);
// create new project configuration
ProjectConfiguration pc;
pc.setBackendType(ProjectConfiguration::PostgreSql);
StackDescription stack;
stack.id = stack_id;
pc.setCatmaidStack(Raw, stack);
pc.setComponentDirectory(comp_dir);
pc.setPostgreSqlHost(pg_host);
pc.setPostgreSqlUser(pg_user);
pc.setPostgreSqlPassword(pg_pass);
pc.setPostgreSqlDatabase(pg_dbase);
PostgreSqlSliceStore sliceStore(pc, Membrane);
// Add first set of slices
boost::shared_ptr<Slice> slice1 = createSlice(10, 0);
boost::shared_ptr<Slice> slice2 = createSlice(10, 1);
boost::shared_ptr<Slice> slice3 = createSlice(10, 2);
Slices slices = Slices();
slices.add(slice1);
slices.add(slice2);
slices.add(slice3);
Block block(0, 0, 0);
sliceStore.associateSlicesToBlock(slices, block);
Blocks blocks;
blocks.add(block);
Blocks missingBlocks;
boost::shared_ptr<Slices> retrievedSlices =
sliceStore.getSlicesByBlocks(blocks, missingBlocks);
// Create conflict set where each slice
ConflictSet conflictSet1;
conflictSet1.addSlice(slice1->hashValue());
conflictSet1.addSlice(slice2->hashValue());
conflictSet1.addSlice(slice3->hashValue());
ConflictSets conflictSets;
conflictSets.add(conflictSet1);
sliceStore.associateConflictSetsToBlock(conflictSets, block);
boost::shared_ptr<ConflictSets> retrievedConflictSets =
sliceStore.getConflictSetsByBlocks(blocks, missingBlocks);
for (const ConflictSet& cs : *retrievedConflictSets) {
std::cout << "ConflictSet hash: " << hash_value(cs);
for (const SliceHash& sh : cs.getSlices()) {
std::cout << " Slice hash: " << sh;
}
std::cout << std::endl;
}
PostgreSqlSegmentStore segmentStore(pc, Membrane);
util::box<unsigned int, 2> segmentBounds(0, 0, 0, 0);
std::vector<double> segmentFeatures;
segmentFeatures.push_back(0.0);
segmentFeatures.push_back(1.0);
segmentFeatures.push_back(2.0);
SegmentDescription segment(0, segmentBounds);
segment.addLeftSlice(slice1->hashValue());
segment.addRightSlice(slice2->hashValue());
segment.setFeatures(segmentFeatures);
boost::shared_ptr<SegmentDescriptions> segments = boost::make_shared<SegmentDescriptions>();
segments->add(segment);
segmentStore.associateSegmentsToBlock(*segments, block);
boost::shared_ptr<SegmentDescriptions> retrievedSegments =
segmentStore.getSegmentsByBlocks(blocks, missingBlocks, false);
} catch (boost::exception& e) {
handleException(e, std::cerr);
}
}