7 #include "PlusConfigure.h" 12 #include "vtksys/CommandLineArguments.hxx" 14 int main (
int argc,
char* argv[])
16 bool printHelp(
false);
17 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
19 vtksys::CommandLineArguments args;
20 args.Initialize(argc, argv);
22 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
23 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
27 std::cerr <<
"Problem parsing arguments" << std::endl;
28 std::cout <<
"\nHelp:" << args.GetHelp() << std::endl;
36 std::cout <<
"\nHelp:" << args.GetHelp() << std::endl;
42 vtkSmartPointer<vtkPlusDeviceFactory> deviceFactory = vtkSmartPointer<vtkPlusDeviceFactory>::New();
44 std::ostringstream printself;
45 deviceFactory->PrintSelf(printself, vtkIndent());
46 LOG_INFO(
"device factory printself: " << printself.str());
51 LOG_INFO(
"Testing device factory create instance function with NULL device type...");
52 if ( deviceFactory->CreateInstance(NULL, device,
"aDevice") ==
PLUS_SUCCESS )
54 LOG_ERROR(
"Expected failure in creating device instance, but method call returned with success");
59 LOG_ERROR(
"NULL device expected!");
66 LOG_INFO(
"Testing device factory create instance function with a not existing device type...");
67 if ( deviceFactory->CreateInstance(
"NotExistingAbc", device,
"aDevice") ==
PLUS_SUCCESS )
69 LOG_ERROR(
"Expected failure in creating not existing device instance, but the operation was successful");
74 LOG_ERROR(
"NULL device expected!");
81 LOG_INFO(
"Testing device factory create instance function with FakeTracker device type...");
82 if ( deviceFactory->CreateInstance(
"FakeTracker", device,
"FakeTracker") !=
PLUS_SUCCESS )
84 LOG_ERROR(
"Failed to create Fakedevice device instance!");
87 if ( dynamic_cast<vtkPlusFakeTracker*>(device) == NULL )
89 LOG_ERROR(
"Failed to create FakeTracker device instance!");
96 LOG_INFO(
"Testing video source factory create instance function with NULL video source type...");
97 if ( deviceFactory->CreateInstance(NULL, device,
"someDevice") ==
PLUS_SUCCESS )
99 LOG_ERROR(
"Expected failure in creating video source instance, but method call returned with success");
102 if ( device != NULL )
104 LOG_ERROR(
"NULL video source expected!");
111 LOG_INFO(
"Testing video source factory create instance function with not existing video source type...");
112 if ( deviceFactory->CreateInstance(
"NotExistingAbc", device,
"anotherDevice") ==
PLUS_SUCCESS )
114 LOG_ERROR(
"Expected failure in creating not existing video source instance, but the operation was successful");
117 if ( device != NULL )
119 LOG_ERROR(
"NULL video source expected!");
126 LOG_INFO(
"Testing video source factory create instance function with SavedDataset video source type...");
127 if ( deviceFactory->CreateInstance(
"SavedDataSource", device,
"vidDevice") !=
PLUS_SUCCESS )
129 LOG_ERROR(
"Failed to create SavedDataset video source instance!");
132 if ( dynamic_cast<vtkPlusSavedDataSource*>(device) == NULL )
134 LOG_ERROR(
"Failed to create SavedDataset video source instance!");
140 LOG_INFO(
"Test finished successfully!");
Abstract interface for tracker and video devices.
int main(int argc, char *argv[])
static vtkIGSIOLogger * Instance()