Go to the documentation of this file.00001
00002 #include <bprb/bprb_func_process.h>
00003
00004
00005 #include <vcl_iostream.h>
00006 #include <bbgm/bbgm_image_of.h>
00007 #include <bbgm/bbgm_image_sptr.h>
00008 #include <brdb/brdb_value.h>
00009 #include <vbl/io/vbl_io_smart_ptr.h>
00010 #include <bbgm/bbgm_loader.h>
00011
00012
00013 bool bbgm_load_image_of_process_cons(bprb_func_process& pro)
00014 {
00015 vcl_vector<vcl_string> in_types(1), out_types(1);
00016 in_types[0]="vcl_string";
00017 pro.set_input_types(in_types);
00018 out_types[0]="bbgm_image_sptr";
00019 pro.set_output_types(out_types);
00020 return true;
00021 }
00022
00023 bool bbgm_load_image_of_process(bprb_func_process& pro)
00024 {
00025
00026 if (!pro.verify_inputs()) {
00027 vcl_cerr << "In bbgm_load_image_of_process::execute - invalid inputs\n";
00028 return false;
00029 }
00030
00031 vcl_string binary_filename = pro.get_input<vcl_string>(0);
00032
00033 vsl_b_ifstream istr(binary_filename);
00034 if (!istr) {
00035 vcl_cerr << "Failed to load background image from "
00036 << binary_filename << vcl_endl;
00037 return false;
00038 }
00039
00040
00041
00042 bbgm_loader::register_loaders();
00043 vsl_b_istream& bis = static_cast<vsl_b_istream&>(istr);
00044 bbgm_image_sptr image;
00045 vsl_b_read(bis, image);
00046
00047 brdb_value_sptr output0 = new brdb_value_t<bbgm_image_sptr>(image);
00048 pro.set_output(0, output0);
00049 return true;
00050 }
00051