[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. cpp: Boxm2 C++ Package.

Chapter summary:
C++ implementation of the library.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Processes

The algorithms such as rendering, updating the volume or change detection in c++ are developed and the API to such algorithms are subclasses of boxm2_cpp_process_base. For example, class boxm2_render_process: public boxm2_cpp_process_base. Such process has three virtual functions

Few processes are discussed below:

Each process uses inputs as processing inputs and return output if any through output vector. The process is light-weight as it only process the data provided to it. Multiple processes might be called in a given system which leads to discussion of boxm2_cpp_processor.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 cpp Processor

A processor boxm2_cpp_processor is subclass from boxm2_processor. The cpp processor is responsible for calling cpp processes and passing them inputs. The processor is a high level manager which interacts with the user and translates the user actions into different process calls. Example of usage of such a processor is shown below:

An example of C++ rendering algorithm is shown below.

 
  //: load the scene
  boxm2_scene_sptr scene = new boxm2_scene(scene_file());
  // initialize the cache
  boxm2_nn_cache cache( scene.ptr() );

  //: initialize the cpp processor
  boxm2_cpp_processor cpp_pro;
  cpp_pro.init();
  cpp_pro.set_scene(scene.ptr());

  //: initialize process
  boxm2_cpp_render_process cpp_render;
  cpp_render.init();
  cpp_render.set_cache(&cache);

  //: inputs for the process.
  brdb_value_sptr brdb_scene_sptr = new brdb_value_t<boxm2_scene_sptr>(scene);
  brdb_value_sptr brdb_cam = new brdb_value_t<vpgl_camera_double_sptr>(cam);
  brdb_value_sptr brdb_inimg = new brdb_value_t<vil_image_view_base_sptr>(floatimg);

  vcl_vector<brdb_value_sptr> input;
  input.push_back(brdb_scene_sptr);
  input.push_back(brdb_cam);
  input.push_back(brdb_inimg);

  //init output vector
  vcl_vector<brdb_value_sptr> output;

  //: run the process
  cpp_pro.run(&cpp_render, input, output);
  vcl_cout<<"Time taken is :" <<t.all()<<vcl_endl;
  cpp_pro.finish();

In this example, processor is initialized and then it is used to call rendering process. Similarly multiple processes can be called using this processor.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on May, 1 2013 using texi2html 1.76.