本文整理汇总了C++中PidStoreLoader::LoadFromDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ PidStoreLoader::LoadFromDirectory方法的具体用法?C++ PidStoreLoader::LoadFromDirectory怎么用?C++ PidStoreLoader::LoadFromDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PidStoreLoader
的用法示例。
在下文中一共展示了PidStoreLoader::LoadFromDirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DataLocation
const RootPidStore *RootPidStore::LoadFromDirectory(
const std::string &directory,
bool validate) {
PidStoreLoader loader;
string data_source = directory;
if (directory.empty()) {
data_source = DataLocation();
}
return loader.LoadFromDirectory(data_source, validate);
}
示例2: testPidStoreDirectoryLoad
/**
* Check that loading from a directory works. This also tests the override
* mechanism.
*/
void PidStoreTest::testPidStoreDirectoryLoad() {
PidStoreLoader loader;
auto_ptr<const RootPidStore> root_store(loader.LoadFromDirectory(
GetTestDataFile("pids")));
OLA_ASSERT_NOT_NULL(root_store.get());
// check version
OLA_ASSERT_EQ(static_cast<uint64_t>(1302986774), root_store->Version());
// Check all the esta pids are there
const PidStore *esta_store = root_store->EstaStore();
OLA_ASSERT_NOT_NULL(esta_store);
vector<const PidDescriptor*> all_pids;
esta_store->AllPids(&all_pids);
OLA_ASSERT_EQ(static_cast<size_t>(4), all_pids.size());
// check manufacturer pids
const PidStore *open_lighting_store =
root_store->ManufacturerStore(ola::OPEN_LIGHTING_ESTA_CODE);
OLA_ASSERT_NOT_NULL(open_lighting_store);
OLA_ASSERT_EQ(1u, open_lighting_store->PidCount());
// FOO_BAR in the overrides file replaces SERIAL_NUMBER.
const PidDescriptor *serial_number = open_lighting_store->LookupPID(
"SERIAL_NUMBER");
OLA_ASSERT_NULL(serial_number);
const PidDescriptor *foo_bar = open_lighting_store->LookupPID(
"FOO_BAR");
OLA_ASSERT_NOT_NULL(foo_bar);
OLA_ASSERT_EQ(static_cast<uint16_t>(32768), foo_bar->Value());
OLA_ASSERT_EQ(string("FOO_BAR"), foo_bar->Name());
// check descriptors
OLA_ASSERT_TRUE(foo_bar->GetRequest());
OLA_ASSERT_TRUE(foo_bar->GetResponse());
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
foo_bar->SetRequest());
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
foo_bar->SetResponse());
ola::messaging::SchemaPrinter printer;
foo_bar->GetResponse()->Accept(&printer);
string expected2 = "baz: uint32\n";
OLA_ASSERT_EQ(expected2, printer.AsString());
}
示例3:
/**
* Load all pid definition files in a directory
*/
const RootPidStore *RootPidStore::LoadFromDirectory(
const std::string &directory,
bool validate) {
PidStoreLoader loader;
return loader.LoadFromDirectory(directory, validate);
}