本文整理汇总了C++中PidStoreLoader::LoadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ PidStoreLoader::LoadFromFile方法的具体用法?C++ PidStoreLoader::LoadFromFile怎么用?C++ PidStoreLoader::LoadFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PidStoreLoader
的用法示例。
在下文中一共展示了PidStoreLoader::LoadFromFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testInconsistentData
/**
* Check that loading a file with an inconsistent descriptor fails.
*/
void PidStoreTest::testInconsistentData() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
GetTestDataFile("inconsistent_pid.proto"));
OLA_ASSERT_NULL(root_store);
}
示例2: testPidStoreLoadDuplicateName
/**
* Check that loading a file with duplicate pid names fails.
*/
void PidStoreTest::testPidStoreLoadDuplicateName() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
GetTestDataFile("duplicate_pid_name.proto"));
OLA_ASSERT_NULL(root_store);
}
示例3: testPidStoreLoadInvalidEstaPid
/**
* Check that loading a file with an out-of-range ESTA pid fails.
*/
void PidStoreTest::testPidStoreLoadInvalidEstaPid() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
GetTestDataFile("invalid_esta_pid.proto"));
OLA_ASSERT_NULL(root_store);
}
示例4: testPidStoreLoadMissingFile
/**
* Check that loading a missing file fails.
*/
void PidStoreTest::testPidStoreLoadMissingFile() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
GetTestDataFile("missing_file_pids.proto"));
OLA_ASSERT_NULL(root_store);
}
示例5: testPidStoreLoadDuplicateManufacturer
/**
* Check that loading a file with duplicate manufacturers fails.
*/
void PidStoreTest::testPidStoreLoadDuplicateManufacturer() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
GetTestDataFile("duplicate_manufacturer.proto"));
OLA_ASSERT_NULL(root_store);
}
示例6:
/**
* Load a pid store from a file
*/
const RootPidStore *RootPidStore::LoadFromFile(const std::string &file,
bool validate) {
PidStoreLoader loader;
return loader.LoadFromFile(file, validate);
}
示例7: testPidStoreFileLoad
/**
* Check that loading from a file works
*/
void PidStoreTest::testPidStoreFileLoad() {
PidStoreLoader loader;
auto_ptr<const RootPidStore> root_store(
loader.LoadFromFile(GetTestDataFile("test_pids.proto")));
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>(70), all_pids.size());
// check for device info
const PidDescriptor *device_info = esta_store->LookupPID("DEVICE_INFO");
OLA_ASSERT_NOT_NULL(device_info);
OLA_ASSERT_EQ(static_cast<uint16_t>(96), device_info->Value());
OLA_ASSERT_EQ(string("DEVICE_INFO"), device_info->Name());
// check descriptors
OLA_ASSERT_TRUE(device_info->GetRequest());
OLA_ASSERT_TRUE(device_info->GetResponse());
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
device_info->SetRequest());
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
device_info->SetResponse());
ola::messaging::SchemaPrinter printer;
device_info->GetResponse()->Accept(&printer);
string expected = (
"protocol_major: uint8\nprotocol_minor: uint8\ndevice_model: uint16\n"
"product_category: uint16\nsoftware_version: uint32\n"
"dmx_footprint: uint16\ncurrent_personality: uint8\n"
"personality_count: uint8\ndmx_start_address: uint16\n"
"sub_device_count: uint16\nsensor_count: uint8\n");
OLA_ASSERT_EQ(expected, printer.AsString());
// 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());
const PidDescriptor *serial_number = open_lighting_store->LookupPID(
"SERIAL_NUMBER");
OLA_ASSERT_NOT_NULL(serial_number);
OLA_ASSERT_EQ(static_cast<uint16_t>(32768), serial_number->Value());
OLA_ASSERT_EQ(string("SERIAL_NUMBER"), serial_number->Name());
// check descriptors
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
serial_number->GetRequest());
OLA_ASSERT_EQ(static_cast<const Descriptor*>(NULL),
serial_number->GetResponse());
OLA_ASSERT_TRUE(serial_number->SetRequest());
OLA_ASSERT_TRUE(serial_number->SetResponse());
printer.Reset();
serial_number->SetRequest()->Accept(&printer);
string expected2 = "serial_number: uint32\n";
OLA_ASSERT_EQ(expected2, printer.AsString());
}
示例8: testInconsistentData
/**
* Check that loading a file with an inconsistent descriptor fails.
*/
void PidStoreTest::testInconsistentData() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
"./testdata/inconsistent_pid.proto");
CPPUNIT_ASSERT(!root_store);
}
示例9: testPidStoreLoadInvalidEstaPid
/**
* Check that loading a file with an out-of-range ESTA pid fails.
*/
void PidStoreTest::testPidStoreLoadInvalidEstaPid() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
"./testdata/invalid_esta_pid.proto");
CPPUNIT_ASSERT(!root_store);
}
示例10: testPidStoreLoadDuplicateName
/**
* Check that loading a file with duplicate pid names fails.
*/
void PidStoreTest::testPidStoreLoadDuplicateName() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
"./testdata/duplicate_pid_name.proto");
CPPUNIT_ASSERT(!root_store);
}
示例11: testPidStoreLoadDuplicateManufacturer
/**
* Check that loading a file with duplicate manufacturers fails.
*/
void PidStoreTest::testPidStoreLoadDuplicateManufacturer() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
"./testdata/duplicate_manufacturer.proto");
CPPUNIT_ASSERT(!root_store);
}
示例12: testPidStoreLoadMissingFile
/**
* Check that loading a missing file fails.
*/
void PidStoreTest::testPidStoreLoadMissingFile() {
PidStoreLoader loader;
const RootPidStore *root_store = loader.LoadFromFile(
"./testdata/missing_file_pids.proto");
CPPUNIT_ASSERT(!root_store);
}