Go to the documentation of this file.00001
00002 #include <bprb/bprb_func_process.h>
00003
00004
00005
00006
00007
00008 #include <bprb/bprb_parameters.h>
00009 #include <bsta/bsta_random_wrapper.h>
00010 #include <vcl_ctime.h>
00011 #include <brdb/brdb_value.h>
00012
00013
00014 bool bsta_initialize_random_seed_process_cons(bprb_func_process& pro)
00015 {
00016 vcl_vector<vcl_string> input_types_(1);
00017 input_types_[0] = "unsigned";
00018
00019
00020 vcl_vector<vcl_string> output_types_(1);
00021 output_types_[0]= "bsta_random_wrapper_sptr";
00022
00023 bool good = pro.set_input_types(input_types_) &&
00024 pro.set_output_types(output_types_);
00025
00026
00027 brdb_value_sptr idx = new brdb_value_t<unsigned>(0);
00028 pro.set_input(0, idx);
00029
00030 return good;
00031 }
00032
00033 bool bsta_initialize_random_seed_process(bprb_func_process& pro)
00034 {
00035
00036 if (!pro.verify_inputs())
00037 {
00038 vcl_cout << pro.name() << ": Invalid inputs" << vcl_endl;
00039 return false;
00040 }
00041
00042
00043 unsigned seed = pro.get_input<unsigned>(0);
00044 if (!seed) {
00045 pro.set_output_val<bsta_random_wrapper_sptr>(0, new bsta_random_wrapper(vcl_clock()));
00046 }
00047 else {
00048 pro.set_output_val<bsta_random_wrapper_sptr>(0, new bsta_random_wrapper(seed));
00049 }
00050 return true;
00051 }
00052