00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef RECOBLACKBOARD_H
00019 #define RECOBLACKBOARD_H
00020
00021 #include <odinreco/odinreco.h>
00022 #include <odinreco/data.h>
00023 #include <odinreco/step.h>
00024
00035 class RecoBlackBoard {
00036
00037 public:
00038
00042 RecoBlackBoard() {}
00043
00044 ~RecoBlackBoard();
00045
00049 void announce(const STD_string& label) {ann[label]++;}
00050
00054 void post(const STD_string& label, const RecoData& data);
00055
00059 bool announced(const STD_string& label) const {return ann.find(label)!=ann.end();}
00060
00066 bool inquire(const STD_string& label, RecoData& data, bool blocking=false);
00067
00068
00069 private:
00070
00071 bool get_data(const STD_string& label, RecoData& data);
00072
00073
00074 typedef STD_map<RecoCoord, RecoData> CoordDataMap;
00075 typedef STD_map<STD_string,CoordDataMap> LabelDataMap;
00076 LabelDataMap posted;
00077
00078
00079 typedef STD_map<RecoCoord, Event*> CoordEventMap;
00080 typedef STD_map<STD_string,CoordEventMap> LabelEventMap;
00081 LabelEventMap eventmap;
00082
00083 Mutex mutex;
00084
00085 STD_map<STD_string,UInt> ann;
00086
00087 };
00088
00089
00093
00094
00095
00096 class RecoPost : public RecoStep {
00097
00098
00099 STD_string label() const {return "post";}
00100 STD_string description() const {return "Post data on blackboard";}
00101 bool process(RecoData& rd, RecoController& controller);
00102 RecoCoord input_coord() const {return RecoCoord::any();}
00103 void modify_coord(RecoCoord& coord) const {}
00104 bool query(RecoQueryContext& context);
00105 RecoStep* allocate() const {return new RecoPost;}
00106 void init();
00107
00108 JDXstring postlabel;
00109
00110 };
00111
00112
00113
00114 #endif
00115