MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / validate

Method validate

tools/openpgl_debug/openpgl_debug.cpp:48–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 PGL_DEVICE_TYPE device_type{PGL_DEVICE_TYPE_NONE};
47
48 bool validate()
49 {
50 bool valid = true;
51 switch (type)
52 {
53 case HELP:
54 break;
55
56 case FIT_FIELD:
57 if(samples_file_names.size() == 0 /*||
58 !file_exists(samples_file_name)*/)
59 {
60 std::cout << "ERROR: Samples file not set" << std::endl;
61 valid = false;
62 }
63 else
64 {
65 for (int i = 0; i < samples_file_names.size(); i++)
66 {
67 if (!file_exists(samples_file_names[i]))
68 {
69 std::cout << "ERROR: Samples file does not exists: " << samples_file_names[i] << std::endl;
70 valid = false;
71 }
72 }
73 }
74 if (device_type == PGL_DEVICE_TYPE_NONE)
75 {
76 std::cout << "ERROR: Device type not set." << std::endl;
77 valid = false;
78 }
79 break;
80 case UPDATE_FIELD:
81 if (field_file_name == "" || !file_exists(field_file_name))
82 {
83 std::cout << "ERROR: Field file not set or does not exists: " << field_file_name << std::endl;
84 valid = false;
85 }
86 if(samples_file_names.size() == 0 /*||
87 !file_exists(samples_file_name)*/)
88 {
89 std::cout << "ERROR: Samples file not set" << std::endl;
90 valid = false;
91 }
92 else
93 {
94 for (int i = 0; i < samples_file_names.size(); i++)
95 {
96 if (!file_exists(samples_file_names[i]))
97 {
98 std::cout << "ERROR: Samples file does not exists: " << samples_file_names[i] << std::endl;
99 valid = false;
100 }
101 }
102 }
103 if (device_type == PGL_DEVICE_TYPE_NONE)
104 {
105 std::cout << "ERROR: Device type not set." << std::endl;

Callers 1

mainFunction · 0.45

Calls 2

file_existsFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected