DDSClientId Class Reference

#include <DDSClientId.h>

List of all members.

Public Member Functions

 DDSClientId (DDS::EClientType type=DDS::kUnknownClientType, string clientname="")
virtual ~DDSClientId ()
DDS::EClientType GetClientType () const
string GetClientName () const
string GetUserName () const
string GetRealName () const
string GetHostName () const
const VldTimeStampGetStartTime () const
int GetChildPid () const
std::ostream & Print (std::ostream &ms) const
void Print (Option_t *option="") const

Protected Member Functions

void Connected (int childpid)

Private Attributes

DDS::EClientType fClientType
string fClientName
string fUserName
string fRealName
string fHostName
VldTimeStamp fStartTime
int fChildPid

Friends

class DDSParentServer

Detailed Description

Definition at line 28 of file DDSClientId.h.


Constructor & Destructor Documentation

DDSClientId::DDSClientId ( DDS::EClientType  type = DDS::kUnknownClientType,
string  clientname = "" 
)

Definition at line 28 of file DDSClientId.cxx.

References fClientName, fHostName, fRealName, fUserName, gSystem(), Msg::kWarning, and MSG.

00028                                                                      :
00029                  fClientType(clienttype), fClientName(clientname), 
00030                  fUserName(""), fRealName(""), fHostName(""),fStartTime(0), 
00031                  fChildPid(0) {
00032   // Default constructor 
00033 
00034   if ( fClientName.size() > 30 ) {
00035     fClientName.resize(30);
00036     MSG("DDS",Msg::kWarning) << "Client name exceeds 30 character limit."
00037                              << "\nTruncated to " 
00038                              << fClientName.c_str() << endl;
00039   }
00040   
00041   // Fill identifying user information using system functions
00042   UserGroup_t* usergrp = gSystem->GetUserInfo(gSystem->GetUid());
00043   if ( usergrp ) {
00044     fUserName = usergrp -> fUser; // username
00045     fRealName = usergrp -> fRealName; // user's full name
00046   }
00047   else {
00048     MSG("DDS",Msg::kWarning) 
00049        << "Failed to identify user info for client w/uid "
00050        << gSystem->GetUid() << "." << endl;
00051   }
00052   if ( usergrp ) delete usergrp; usergrp = 0; // has ownership
00053 
00054   // This system's host name and ip address
00055   fHostName = gSystem->HostName();
00056   
00057 }

DDSClientId::~DDSClientId (  )  [virtual]

Definition at line 60 of file DDSClientId.cxx.

00060                           {
00061   // Destructor.
00062 
00063 }


Member Function Documentation

void DDSClientId::Connected ( int  childpid  )  [protected]

Definition at line 66 of file DDSClientId.cxx.

References fChildPid, and fStartTime.

00066                                         {
00067   // Purpose:  Invoked by DDSParentServer when client connection with
00068   //           child established.  Also sets start time of connection
00069   //           to Now.
00070   //           Protected method accessible only by DDSParentServer friend.
00071 
00072   fChildPid = childpid;
00073   fStartTime = VldTimeStamp(); // set to current time
00074 
00075 }

int DDSClientId::GetChildPid (  )  const [inline]

Definition at line 46 of file DDSClientId.h.

References fChildPid.

00046 { return fChildPid; }

string DDSClientId::GetClientName (  )  const [inline]

Definition at line 41 of file DDSClientId.h.

References fClientName.

00041 { return fClientName; }

DDS::EClientType DDSClientId::GetClientType (  )  const [inline]

Definition at line 40 of file DDSClientId.h.

References fClientType.

00040 { return fClientType; }

string DDSClientId::GetHostName (  )  const [inline]

Definition at line 44 of file DDSClientId.h.

References fHostName.

00044 { return fHostName; }

string DDSClientId::GetRealName (  )  const [inline]

Definition at line 43 of file DDSClientId.h.

References fRealName.

00043 { return fRealName; }

const VldTimeStamp& DDSClientId::GetStartTime (  )  const [inline]

Definition at line 45 of file DDSClientId.h.

References fStartTime.

00045 { return fStartTime; }

string DDSClientId::GetUserName (  )  const [inline]

Definition at line 42 of file DDSClientId.h.

References fUserName.

00042 { return fUserName; }

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

Definition at line 105 of file DDSClientId.cxx.

References Print().

00105                                                     { 
00106   // Purpose: Print method in TObject::Print format
00107 
00108   Print(std::cout); 
00109 
00110 }

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

Definition at line 78 of file DDSClientId.cxx.

References bfld::AsString(), VldTimeStamp::AsString(), fChildPid, fClientName, fClientType, fHostName, fRealName, fStartTime, fUserName, and VldTimeStamp::GetSec().

Referenced by Print().

00078                                                    {
00079   // Purpose: Print DDSClientId status on std::ostream.
00080 
00081   VldTimeStamp currentTime;
00082   if ( fStartTime.GetSec() == 0 ) currentTime = VldTimeStamp(0);
00083 
00084   os << fUserName.c_str() 
00085      << " \"" << fRealName.c_str() << "\" "  
00086      << fHostName.c_str() << " Type: "
00087      << DDS::AsString(fClientType);
00088 
00089   if ( !fClientName.empty() ) os <<  "/" << fClientName.c_str();
00090 
00091   if ( fChildPid ) {
00092     os << "\n   CS pid " << fChildPid << " Start: " 
00093        << fStartTime.AsString("s") << " UpTime(sec): "
00094        << (currentTime-fStartTime).GetSec() << "." << endl;
00095   }
00096   else 
00097     os << endl;
00098 
00099 
00100   return os;
00101 
00102 }


Friends And Related Function Documentation

friend class DDSParentServer [friend]

Definition at line 30 of file DDSClientId.h.


Member Data Documentation

int DDSClientId::fChildPid [private]

Definition at line 64 of file DDSClientId.h.

Referenced by Connected(), GetChildPid(), and Print().

string DDSClientId::fClientName [private]

Definition at line 59 of file DDSClientId.h.

Referenced by DDSClientId(), GetClientName(), and Print().

Definition at line 58 of file DDSClientId.h.

Referenced by GetClientType(), and Print().

string DDSClientId::fHostName [private]

Definition at line 62 of file DDSClientId.h.

Referenced by DDSClientId(), GetHostName(), and Print().

string DDSClientId::fRealName [private]

Definition at line 61 of file DDSClientId.h.

Referenced by DDSClientId(), GetRealName(), and Print().

Definition at line 63 of file DDSClientId.h.

Referenced by Connected(), GetStartTime(), and Print().

string DDSClientId::fUserName [private]

Definition at line 60 of file DDSClientId.h.

Referenced by DDSClientId(), GetUserName(), and Print().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1