ReconstructMe SDK  1.1.739-75658
Real-time 3D reconstruction engine
 All Classes Files Functions Typedefs Enumerations Enumerator Groups Pages
example_reconstructmesdk_options.cpp

Content

This example shows how to modify options.

Boost is only used to generate examples and is not necessary for working with this SDK.

#include <boost/test/unit_test.hpp>
#include <stdio.h>
#include <cstdlib>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
BOOST_AUTO_TEST_CASE(options)
{
// Create a new context that has default options applied
// By default, each object comes with a set of sensible
// predefined values. In this example compile time options.
// Create empty options binding, not bound to any specific options
// Bind the compile options.
const char *value;
int length;
reme_options_get(c, o, "volume_size.x", &value, &length);
printf("Volume size in x-dim is: %s", value);
// Increase resolution in all dimensions
reme_options_set(c, o, "volume_size.x", "512");
reme_options_set(c, o, "volume_size.y", "512");
reme_options_set(c, o, "volume_size.z", "512");
// Export options in a human read-able format
reme_options_save_to_file(c, o, "options.txt");
// Export options in a human read-able format
reme_options_load_from_file(c, o, "options.txt");
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_CASE(options_repeated)
{
// Create a new context that has default options applied
// Create empty options binding
reme_options_t o, o_sub;
reme_options_create(c, &o_sub);
// Bind to OpenCL infos
// See method documentation for protocol buffer specification
// See how many devices are available
int num_devices = 0;
reme_options_get_repeated_count(c, o, "devices", &num_devices);
printf("Found %i OpenCL compatible devices\n", num_devices);
// Each device is a nested message. Iterate over all of them
const char *value;
int length;
for (int i = 0; i < num_devices; i += 1) {
printf("----\n");
reme_options_bind_repeated_message(c, o, "devices", i, o_sub);
reme_options_get(c, o_sub, "name", &value, &length);
printf("Device '%s' \n", value);
reme_options_get(c, o_sub, "vendor", &value, &length);
printf(" - by '%s' \n", value);
reme_options_get(c, o_sub, "type", &value, &length);
printf(" - type %s \n", value);
// Note in the above code we must interleave get and printf
// because of memory management rules.
}
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_SUITE_END()