00001 #ifndef DDSSUBSCRIPTION_H 00002 #define DDSSUBSCRIPTION_H 00003 00005 // // 00006 // DDSSubscription // 00007 // // 00008 // Package: DDS (Data Dispatcher System). // 00009 // // 00010 // S. Kasahara 5/2001 // 00011 // Subscription class used to specify client's subscription needs to server // 00013 00014 #include <map> 00015 #include "TObject.h" 00016 #include "TString.h" 00017 00018 #include "Persistency/Per.h" 00019 #include "Dispatcher/DDS.h" 00020 00021 using std::string; 00022 00023 class DDSSubscription; 00024 00025 std::ostream& operator << (std::ostream& ms, DDSSubscription* sub); 00026 00027 class DDSSubscription : public TObject { 00028 00029 public: 00030 // Typedefs and enumerations. 00031 typedef std::map<TString, TString> StreamMap; 00032 // std::map<string, string> doesn't work with ROOT I/O yet 00033 typedef StreamMap::iterator StreamMapItr; 00034 typedef StreamMap::const_iterator StreamMapConstItr; 00035 00036 // Constructor and destructor. 00037 DDSSubscription(DDS::EDataSource datasource = DDS::kDaq, 00038 DDS::EKeepUpMode = DDS::kFileKeepUp); 00039 virtual ~DDSSubscription (); // destructor 00040 00041 // State testing member functions. 00042 DDS::EDataSource GetDataSource() const { return fDataSource; } 00043 DDS::EKeepUpMode GetKeepUpMode() const { return fKeepUpMode; } 00044 const StreamMap& GetStreamMap() const { return fStreamMap; } 00045 Int_t GetKeepUpWindow() const { return fKeepUpWindow; } 00046 UInt_t GetNumStream() const { return fStreamMap.size(); } 00047 UInt_t GetMaxSyncDelay() const { return fMaxSyncDelay; } 00048 Bool_t IsOffLine() const { return fOffLine; } 00049 std::ostream& Print(std::ostream& ms) const; 00050 void Print(Option_t* option = "") const; 00051 00052 // State changing member functions 00053 void SetDataSource(DDS::EDataSource datasource) {fDataSource = datasource;} 00054 void SetKeepUpMode(DDS::EKeepUpMode keepupmode) {fKeepUpMode = keepupmode;} 00055 void SetOffLine(Bool_t offLine = true) { fOffLine = offLine; } 00056 void AddStream(Per::EStreamType streamtype, string selection=""); 00057 void RemoveStream(Per::EStreamType streamtype); 00058 void Reset(); 00059 void SetSelection(Per::EStreamType streamtype,std::string selection=""); 00060 void SetSelection(std::string stream,std::string selection=""); 00061 void SetMaxSyncDelay(UInt_t maxSyncDelay) { fMaxSyncDelay = maxSyncDelay; } 00062 int SetStreams(std::string streamlist); //delimiter separated stream list 00063 void SetKeepUpWindow(Int_t keepUpWindow) { fKeepUpWindow = keepUpWindow; } 00064 00065 private: 00066 00067 // Data members. 00068 DDS::EDataSource fDataSource; // data source 00069 DDS::EKeepUpMode fKeepUpMode; // keepup mode 00070 Bool_t fOffLine; // use offlinefile softlink instead of currentfile 00071 StreamMap fStreamMap; // map of <stream,selection> pairs 00072 UInt_t fMaxSyncDelay; // max time (sec) to wait for synchronized data set 00073 Int_t fKeepUpWindow; // keep up w/in this time window (sec) to end 00074 ClassDef(DDSSubscription,3) // MINOS Data Dispatcher System Subscription 00075 }; 00076 00077 #endif // DDSSUBSCRIPTION_H 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091
1.3.9.1