[819] | 1 | #include "traffic_agent.h" |
---|
| 2 | |
---|
| 3 | void SignalGroup::from_setting(const libconfig::Setting& set) |
---|
| 4 | { |
---|
| 5 | UI::get(name,set, "name", UI::compulsory); |
---|
| 6 | UI::get(detectors, set, "detectors", UI::optional); |
---|
| 7 | // |
---|
| 8 | // TODO make some analysis of the detectors |
---|
| 9 | |
---|
| 10 | } |
---|
| 11 | |
---|
[820] | 12 | void BaseTrafficAgent::from_setting(const Setting& set) |
---|
[819] | 13 | { |
---|
| 14 | bdm::Participant::from_setting(set); |
---|
| 15 | |
---|
[840] | 16 | // load from file |
---|
[820] | 17 | UI::get(sg,set,"sg", UI::compulsory); |
---|
| 18 | UI::get(requests,set,"output",UI::compulsory); |
---|
[840] | 19 | Array<DetectorIn> det_in; |
---|
| 20 | UI::get(det_in, set, "input",UI::compulsory); |
---|
| 21 | |
---|
| 22 | // process sg == create handles |
---|
| 23 | sgh.set_length(sg.length()); |
---|
| 24 | for(int i=0;i<sg.length();i++){ |
---|
| 25 | sgh(i).connect_sg(sg(i),name); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | // process output == handles |
---|
| 29 | request_handler.set_length(requests.length()); |
---|
| 30 | for(int i=0;i<requests.length();i++){ |
---|
| 31 | request_handler(i).connect_request(requests(i),name); |
---|
| 32 | output_rv.add(request_handler(i).rv); |
---|
| 33 | } |
---|
[842] | 34 | |
---|
[840] | 35 | // process DetIn - create input |
---|
| 36 | for (int i=0; i<det_in.length(); i++){ |
---|
| 37 | input_rv.add(RV(det_in(i).name,2)); |
---|
| 38 | } |
---|
| 39 | input_data.set_size(input_rv._dsize()); |
---|
[819] | 40 | } |
---|