DDSPSStatus Class Reference

#include <DDSPSStatus.h>

List of all members.

Public Types

typedef map< int, DDSClientId * >
::iterator 
ClientMapItr
typedef map< int, DDSClientId * >
::const_iterator 
ClientMapConstItr

Public Member Functions

 DDSPSStatus ()
virtual ~DDSPSStatus ()
const DDSClientIdGetClientId (int pid) const
std::ostream & Print (std::ostream &ms) const
void Print (Option_t *option="") const
void SetClientId (int pid, DDSClientId *)
void RemoveClientId (int pid)

Private Attributes

std::map< int, DDSClientId * > fClientMap

Detailed Description

Definition at line 34 of file DDSPSStatus.h.


Member Typedef Documentation

typedef map<int, DDSClientId*>::const_iterator DDSPSStatus::ClientMapConstItr

Definition at line 40 of file DDSPSStatus.h.

typedef map<int, DDSClientId*>::iterator DDSPSStatus::ClientMapItr

Definition at line 39 of file DDSPSStatus.h.


Constructor & Destructor Documentation

DDSPSStatus::DDSPSStatus (  ) 

Definition at line 34 of file DDSPSStatus.cxx.

00034                          : fClientMap() {
00035   // Default constructor 
00036   
00037 }

DDSPSStatus::~DDSPSStatus (  )  [virtual]

Definition at line 40 of file DDSPSStatus.cxx.

References fClientMap.

00040                           {
00041   // Destructor.
00042 
00043   // Owns all DDSClientId's in map
00044   for ( ClientMapItr itr=fClientMap.begin(); itr != fClientMap.end(); itr++ ) {
00045     DDSClientId* clientid = itr->second;
00046     if ( clientid ) delete clientid; clientid = 0;
00047   }
00048   fClientMap.clear();
00049 
00050 }


Member Function Documentation

const DDSClientId * DDSPSStatus::GetClientId ( int  pid  )  const

Definition at line 53 of file DDSPSStatus.cxx.

References fClientMap, and Munits::second.

00053                                                               {
00054   // Purpose: Retrieve ClientId corresponding child process id childpid from 
00055   // map. If not in map, return null.
00056 
00057   ClientMapConstItr citr = fClientMap.find(childpid);
00058   if ( citr == fClientMap.end() ) return 0;
00059   
00060   return citr -> second;
00061 
00062 }

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

Definition at line 121 of file DDSPSStatus.cxx.

References Print().

00121                                                     { 
00122   // Purpose: Print method in TObject::Print format
00123 
00124   Print(std::cout); 
00125 
00126 }

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

Definition at line 92 of file DDSPSStatus.cxx.

References fClientMap, and Munits::second.

Referenced by Print().

00092                                                    {
00093   // Purpose: Print DDSPSStatus status on std::ostream.
00094 
00095   os << "DDSParentServer Status: ";
00096 
00097   if ( fClientMap.size() == 0 ) { 
00098     os << "No active clients." << endl;
00099     return os;
00100   }
00101   
00102   // Loop over map containing active clients
00103   if ( fClientMap.size() == 1 ) 
00104     os << fClientMap.size() << " active client." << endl;
00105   else
00106     os << fClientMap.size() << " active clients." << endl;
00107 
00108   int ic = 0;
00109   for ( ClientMapConstItr citr = fClientMap.begin(); citr != fClientMap.end(); 
00110                                                      citr++ ) {
00111     DDSClientId* clientid = citr -> second;
00112     os << ic++ << ") " << *clientid;
00113   }
00114   os << endl;
00115   
00116   return os;
00117 
00118 }

void DDSPSStatus::RemoveClientId ( int  pid  ) 

Definition at line 74 of file DDSPSStatus.cxx.

References fClientMap, Msg::kWarning, MSG, and Munits::second.

Referenced by DDSParentServer::CheckChildStatus().

00074                                              {
00075   // Purpose:  Remove map entry corresponding to child process id childpid.
00076 
00077   ClientMapItr itr = fClientMap.find(childpid);
00078   if ( itr == fClientMap.end() ) {
00079     MSG("DDS",Msg::kWarning) << "DDSPSStatus::RemoveClientId w/Child pid " 
00080     << childpid << "\nbut no matching pid in map." << endl;
00081     return;  
00082   }
00083 
00084   if ( itr -> second ) delete (itr->second);
00085   fClientMap.erase(itr);
00086 
00087   return;
00088 
00089 }

void DDSPSStatus::SetClientId ( int  pid,
DDSClientId cid 
)

Definition at line 65 of file DDSPSStatus.cxx.

References fClientMap.

Referenced by DDSParentServer::SpawnChildServer().

00065                                                             {
00066   // Purpose:  Set client id in fClientMap associated with child process id
00067   //           childpid.  ClientId is owned by this.
00068 
00069   fClientMap.insert(make_pair(childpid,cid));
00070 
00071 }


Member Data Documentation

std::map<int, DDSClientId*> DDSPSStatus::fClientMap [private]

Definition at line 58 of file DDSPSStatus.h.

Referenced by GetClientId(), Print(), RemoveClientId(), SetClientId(), and ~DDSPSStatus().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1