contrib/brl/bbas/bsta/bsta_random_wrapper.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/bsta_random_wrapper.h
00002 #ifndef bsta_random_wrapper_h_
00003 #define bsta_random_wrapper_h_
00004 //:
00005 // \file
00006 // \brief A simple wrapper class around vnl_random, needed to be used across python processes
00007 // \author Ozge C. Ozcanli
00008 // \date February 08, 2012
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //
00013 // \endverbatim
00014 
00015 #include <vbl/vbl_ref_count.h>
00016 #include <vbl/vbl_smart_ptr.h>
00017 #include <vsl/vsl_binary_io.h>
00018 
00019 #include <vnl/vnl_random.h>
00020 
00021 class bsta_random_wrapper : public vbl_ref_count
00022 {
00023  public:
00024    bsta_random_wrapper(unsigned long seed) : rng_(seed) {}
00025    bsta_random_wrapper() {}
00026    
00027    vnl_random rng_;
00028 };
00029 
00030 typedef vbl_smart_ptr<bsta_random_wrapper> bsta_random_wrapper_sptr;
00031 
00032 
00033 //--- IO read/write for sptrs--------------------------------------------------
00034 //: Binary write boxm2_scene scene to stream
00035 void vsl_b_write(vsl_b_ostream& os, bsta_random_wrapper const& scene);
00036 void vsl_b_write(vsl_b_ostream& os, const bsta_random_wrapper* &p);
00037 void vsl_b_write(vsl_b_ostream& os, bsta_random_wrapper_sptr& sptr);
00038 void vsl_b_write(vsl_b_ostream& os, bsta_random_wrapper_sptr const& sptr);
00039 
00040 //: Binary load boxm2_scene scene from stream.
00041 void vsl_b_read(vsl_b_istream& is, bsta_random_wrapper &scene);
00042 void vsl_b_read(vsl_b_istream& is, bsta_random_wrapper* p);
00043 void vsl_b_read(vsl_b_istream& is, bsta_random_wrapper_sptr& sptr);
00044 void vsl_b_read(vsl_b_istream& is, bsta_random_wrapper_sptr const& sptr);
00045 
00046 #endif // bsta_random_wrapper_h_