DDSSubscription Class Reference

#include <DDSSubscription.h>

List of all members.

Public Types

typedef std::map< TString,
TString > 
StreamMap
typedef StreamMap::iterator StreamMapItr
typedef StreamMap::const_iterator StreamMapConstItr

Public Member Functions

 DDSSubscription (DDS::EDataSource datasource=DDS::kDaq, DDS::EKeepUpMode=DDS::kFileKeepUp)
virtual ~DDSSubscription ()
DDS::EDataSource GetDataSource () const
DDS::EKeepUpMode GetKeepUpMode () const
const StreamMapGetStreamMap () const
Int_t GetKeepUpWindow () const
UInt_t GetNumStream () const
UInt_t GetMaxSyncDelay () const
Bool_t IsOffLine () const
std::ostream & Print (std::ostream &ms) const
void Print (Option_t *option="") const
void SetDataSource (DDS::EDataSource datasource)
void SetKeepUpMode (DDS::EKeepUpMode keepupmode)
void SetOffLine (Bool_t offLine=true)
void AddStream (Per::EStreamType streamtype, string selection="")
void RemoveStream (Per::EStreamType streamtype)
void Reset ()
void SetSelection (Per::EStreamType streamtype, std::string selection="")
void SetSelection (std::string stream, std::string selection="")
void SetMaxSyncDelay (UInt_t maxSyncDelay)
int SetStreams (std::string streamlist)
void SetKeepUpWindow (Int_t keepUpWindow)

Private Attributes

DDS::EDataSource fDataSource
DDS::EKeepUpMode fKeepUpMode
Bool_t fOffLine
StreamMap fStreamMap
UInt_t fMaxSyncDelay
Int_t fKeepUpWindow

Detailed Description

Definition at line 27 of file DDSSubscription.h.


Member Typedef Documentation

typedef std::map<TString, TString> DDSSubscription::StreamMap

Definition at line 31 of file DDSSubscription.h.

typedef StreamMap::const_iterator DDSSubscription::StreamMapConstItr

Definition at line 34 of file DDSSubscription.h.

typedef StreamMap::iterator DDSSubscription::StreamMapItr

Definition at line 33 of file DDSSubscription.h.


Constructor & Destructor Documentation

DDSSubscription::DDSSubscription ( DDS::EDataSource  datasource = DDS::kDaq,
DDS::EKeepUpMode  keepupmode = DDS::kFileKeepUp 
)

Definition at line 54 of file DDSSubscription.cxx.

00055                                                            :
00056                  fDataSource(datasource),fKeepUpMode(keepupmode),
00057                  fOffLine(false),fMaxSyncDelay(15),fKeepUpWindow(30) {
00058   // 
00059   // Purpose: Default constructor for DDSSubscription class.  
00060   //  
00061   // Arguments: datasource  defines source of data
00062   //                        (default = DDS::kDaq)
00063   //            keepupmode  enumerated keepup mode (default = DDS::kFileKeepUp)
00064   //
00065   // Return: n/a.
00066   //
00067   // Contact: S. Kasahara
00068   //
00069 
00070 }

DDSSubscription::~DDSSubscription (  )  [virtual]

Definition at line 72 of file DDSSubscription.cxx.

00072                                   {
00073   // Purpose: Destructor.
00074   //
00075   // Argument: n/a.
00076   //
00077   // Return: n/a.
00078   //
00079   // Contact: S. Kasahara
00080   //
00081 
00082 }


Member Function Documentation

void DDSSubscription::AddStream ( Per::EStreamType  streamtype,
string  selection = "" 
)

Definition at line 33 of file DDSSubscription.cxx.

References Per::AsString().

00033                                                                           {
00034   //
00035   // Purpose: Add new stream to subscription list.
00036   //
00037   // Argument: streamtype  stream of type Per::EStreamType to be added.
00038   //           selection   selection cut to be applied to entries in this
00039   //                       stream (default="" => no selection cuts applied).
00040   // 
00041   // Return: none.
00042   //
00043   // Contact: S. Kasahara
00044   //
00045   // Notes: If the requested stream is already in subscription list, the 
00046   //        requested selection string is applied to the existing stream.
00047   //
00048 
00049   // If streamtype is not already in map, this will add it
00050   fStreamMap[Per::AsString(streamtype)] = selection.c_str();
00051 
00052 }

DDS::EDataSource DDSSubscription::GetDataSource (  )  const [inline]

Definition at line 42 of file DDSSubscription.h.

References fDataSource.

00042 { return fDataSource; }

DDS::EKeepUpMode DDSSubscription::GetKeepUpMode (  )  const [inline]

Definition at line 43 of file DDSSubscription.h.

References fKeepUpMode.

00043 { return fKeepUpMode; }

Int_t DDSSubscription::GetKeepUpWindow (  )  const [inline]

Definition at line 45 of file DDSSubscription.h.

References fKeepUpWindow.

00045 { return fKeepUpWindow; }

UInt_t DDSSubscription::GetMaxSyncDelay (  )  const [inline]

Definition at line 47 of file DDSSubscription.h.

References fMaxSyncDelay.

00047 { return fMaxSyncDelay; }

UInt_t DDSSubscription::GetNumStream (  )  const [inline]

Definition at line 46 of file DDSSubscription.h.

References fStreamMap.

Referenced by Print().

00046 { return fStreamMap.size(); }

const StreamMap& DDSSubscription::GetStreamMap (  )  const [inline]

Definition at line 44 of file DDSSubscription.h.

References fStreamMap.

00044 { return fStreamMap; }  

Bool_t DDSSubscription::IsOffLine (  )  const [inline]

Definition at line 48 of file DDSSubscription.h.

References fOffLine.

Referenced by Print().

00048 { return fOffLine; }

void DDSSubscription::Print ( Option_t *  option = ""  )  const

Definition at line 120 of file DDSSubscription.cxx.

References Print().

00120                                                         { 
00121   Print(std::cout); 
00122 }

std::ostream & DDSSubscription::Print ( std::ostream &  ms  )  const

Definition at line 85 of file DDSSubscription.cxx.

References bfld::AsString(), fDataSource, fKeepUpMode, fKeepUpWindow, fMaxSyncDelay, fStreamMap, GetNumStream(), IsOffLine(), and Munits::second.

Referenced by operator<<(), and Print().

00085                                                        {
00086   //
00087   // Purpose: Print DDSSubscription status on std::ostream.
00088   //
00089   // Argument: ms  std::ostream to print on.
00090   //
00091   // Return: std::ostream reference.
00092   //
00093   // Contact: S. Kasahara
00094   //
00095 
00096   ms << "    DataSource " << DDS::AsString(fDataSource) << "." << endl;
00097   ms << "    KeepUpMode " << DDS::AsString(fKeepUpMode) << "." << endl;
00098   ms << "    MaxSyncDelay " << fMaxSyncDelay << "." << endl;
00099   ms << "    KeepUpWindow " << fKeepUpWindow << "." << endl;
00100   if (this -> IsOffLine()) ms << "    OffLine true." << endl; 
00101   else                     ms << "    OffLine false." << endl;
00102 
00103   ms << "    Number of streams = " << GetNumStream() << endl;
00104   Int_t istream = 0;
00105   for (StreamMapConstItr citr = fStreamMap.begin(); citr != fStreamMap.end();
00106        ++citr) {
00107     ms << "    " << ++istream << ")" << "Stream: " << citr->first << ".";
00108     if ( (citr -> second).IsNull() ) {
00109       ms << " No selection cut specified." << endl;
00110     }
00111     else {
00112       ms << " Selection cut: " << citr->second << "." << endl;
00113     }
00114   }  
00115 
00116   return ms;
00117 
00118 }

void DDSSubscription::RemoveStream ( Per::EStreamType  streamtype  ) 

Definition at line 124 of file DDSSubscription.cxx.

References Per::AsString(), and fStreamMap.

00124                                                             {
00125   //
00126   // Purpose: Remove stream from subscription list.
00127   //
00128   // Argument: streamtype  requested stream
00129   // 
00130   // Return: none.
00131   //
00132   // Contact: S. Kasahara
00133   //
00134 
00135   StreamMapItr itr = fStreamMap.find(Per::AsString(streamtype));
00136   if (itr != fStreamMap.end()) {
00137     fStreamMap.erase(itr);
00138   }   
00139 
00140 }

void DDSSubscription::Reset (  ) 

Definition at line 142 of file DDSSubscription.cxx.

References fStreamMap.

00142                             {
00143   //
00144   // Purpose: Remove all streams from subscription list.
00145   //
00146   // Argument: none.
00147   // 
00148   // Return: none.
00149   //
00150   // Contact: S. Kasahara
00151   //
00152 
00153   fStreamMap.clear();
00154 
00155 }

void DDSSubscription::SetDataSource ( DDS::EDataSource  datasource  )  [inline]

Definition at line 53 of file DDSSubscription.h.

References fDataSource.

Referenced by ReadDispatcherModule::ConnectToServer(), and main().

00053 {fDataSource = datasource;}

void DDSSubscription::SetKeepUpMode ( DDS::EKeepUpMode  keepupmode  )  [inline]

Definition at line 54 of file DDSSubscription.h.

References fKeepUpMode.

Referenced by main().

00054 {fKeepUpMode = keepupmode;}

void DDSSubscription::SetKeepUpWindow ( Int_t  keepUpWindow  )  [inline]

Definition at line 63 of file DDSSubscription.h.

References fKeepUpWindow.

00063 { fKeepUpWindow = keepUpWindow; }

void DDSSubscription::SetMaxSyncDelay ( UInt_t  maxSyncDelay  )  [inline]

Definition at line 61 of file DDSSubscription.h.

References fMaxSyncDelay.

00061 { fMaxSyncDelay = maxSyncDelay; }

void DDSSubscription::SetOffLine ( Bool_t  offLine = true  )  [inline]

Definition at line 55 of file DDSSubscription.h.

References fOffLine.

00055 { fOffLine = offLine; }

void DDSSubscription::SetSelection ( std::string  stream,
std::string  selection = "" 
)

Definition at line 179 of file DDSSubscription.cxx.

References fStreamMap.

00179                                                                         {
00180    //
00181    // Purpose: Modify selection string for requested stream.
00182    //
00183    // Argument: stream      streamname
00184    //           selection   selection cut to be applied to entries in this
00185    //                       stream (default ="" => no selection cuts applied).
00186    // 
00187    // Return: none.
00188    //
00189    // Contact: S. Kasahara
00190    //
00191    // Notes: If the requested stream does not already exist in subscription 
00192    //        list, the stream is added to the list. 
00193    //
00194  
00195    // If streamtype is not already in map, this will add it
00196    fStreamMap[stream.c_str()] = selection.c_str();
00197  
00198 }

void DDSSubscription::SetSelection ( Per::EStreamType  streamtype,
std::string  selection = "" 
)
int DDSSubscription::SetStreams ( std::string  streamlist  ) 

Definition at line 200 of file DDSSubscription.cxx.

References fStreamMap, and UtilString::StringTok().

Referenced by ReadDispatcherModule::ConnectToServer(), and main().

00200                                                    {
00201   //
00202   // Purpose: Set active streams in subscription to correspond to those
00203   //          in delimiter separated (,;: ) streamList.
00204   //
00205   // Argument: streamList  delimiter (,;: ) separated list of streams.
00206   // 
00207   // Return: Number of streams set.
00208   //
00209   // Contact: S. Kasahara
00210   //
00211 
00212 
00213   fStreamMap.clear();
00214   std::vector<std::string> ls;
00215   UtilString::StringTok(ls,streamList,",:; ");
00216 
00217   std::vector<std::string>::iterator vitr;
00218   for ( vitr = ls.begin(); vitr != ls.end(); vitr++ ) {
00219     fStreamMap[(*vitr).c_str()] = "";
00220   }
00221   return fStreamMap.size();
00222 
00223 }


Member Data Documentation

Definition at line 68 of file DDSSubscription.h.

Referenced by GetDataSource(), Print(), and SetDataSource().

Definition at line 69 of file DDSSubscription.h.

Referenced by GetKeepUpMode(), Print(), and SetKeepUpMode().

Definition at line 73 of file DDSSubscription.h.

Referenced by GetKeepUpWindow(), Print(), and SetKeepUpWindow().

Definition at line 72 of file DDSSubscription.h.

Referenced by GetMaxSyncDelay(), Print(), and SetMaxSyncDelay().

Bool_t DDSSubscription::fOffLine [private]

Definition at line 70 of file DDSSubscription.h.

Referenced by IsOffLine(), and SetOffLine().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1