Main Page | Class List | File List | Class Members | File Members

PingTarget Class Reference

Contains name, ip and response statistics for a ping target. More...

#include <PingTarget.h>

List of all members.

Public Member Functions

const char * GetName () const
 Returns name.
const char * GetIpAddr () const
 Returns Internet address in dotted format.
in_addr GetInetAddr () const
 Returns in_addr.
long GetId () const
 Returns id.
USHORT MakeSequence (long sequence) const
 Returns ICMP sequence for this target.
bool IsResponseAdded () const
long GetReceived () const
 Returns received valid response count.
long GetSkipped () const
 Returns skipped count (unreachable or timeout).
long GetResponseCount () const
 Returns total count of responses.
double GetCurrent () const
 Returns last recorded value.
double GetMin () const
 Returns minimum recorded value or 0.
double GetMax () const
 Returns maximum recorded value or 0.
double GetAvg () const
 Returns average or 0.
double GetStdDev () const
 Returns standard deviation or 0.
double GetSkippedPercent () const
 Returns percentage skipped responses or 0.

Protected Member Functions

 PingTarget (PingTargets &targets, const char *name, in_addr inetAddr, long id)
void AddResponseTime (double ms=-1.0)
 Adds response time to for statistics.
void ClearResponseFlag ()
 Sets m_bResponseAdded to false.

Protected Attributes

std::string m_sName
in_addr m_inetAddr
long m_lId
bool m_bResponseAdded
 set to true, when response is added.
long m_lReceived
 Received valid responses for statistics.
long m_lSkipped
 Unreachable or timeout responses.
double m_dCurrent
 Last response.
double m_dMin
 Minimum recorded.
double m_dMax
 Maximum recorded.
double m_dSum
 Sum of all values for average.
double m_dSumSquares
 Sum of squares for standard deviation.
PingTargetsm_targets

Private Member Functions

PingTargetoperator= (PingTarget &)

Friends

class PingTargets
std::ostream & operator<< (std::ostream &os, const PingTarget &t)


Detailed Description

Contains name, ip and response statistics for a ping target.

Constructor is proteced and objects are created with PingTargets::AddTarget and PingTargets::AddTargets.

Definition at line 15 of file PingTarget.h.


Constructor & Destructor Documentation

PingTarget::PingTarget PingTargets targets,
const char *  name,
in_addr  inetAddr,
long  id
[protected]
 

Definition at line 17 of file PingTarget.cpp.

References m_bResponseAdded, m_dCurrent, m_dMax, m_dMin, m_dSum, m_dSumSquares, m_inetAddr, m_lId, m_lReceived, m_lSkipped, m_sName, and safe_assign().

Here is the call graph for this function:


Member Function Documentation

void PingTarget::AddResponseTime double  ms = -1.0  )  [protected]
 

Adds response time to for statistics.

-1 is unreachable or timeout.

Definition at line 44 of file PingTarget.cpp.

References m_bResponseAdded, m_dCurrent, m_dMax, m_dMin, m_dSum, m_dSumSquares, m_lReceived, and m_lSkipped.

Referenced by PingTargets::AddResponse(), and PingTargets::AddUnreachableResponses().

void PingTarget::ClearResponseFlag  )  [protected]
 

Sets m_bResponseAdded to false.

Definition at line 64 of file PingTarget.cpp.

References m_bResponseAdded.

double PingTarget::GetAvg  )  const
 

Returns average or 0.

Definition at line 85 of file PingTarget.cpp.

References m_dSum, and m_lReceived.

Referenced by GetStdDev(), operator<<(), and PingTargets::PrintStatistics().

double PingTarget::GetCurrent  )  const [inline]
 

Returns last recorded value.

-1.0 is unreachable or timeout.

Definition at line 39 of file PingTarget.h.

References m_dCurrent.

Referenced by operator<<(), PingTargets::PrintLogCurrent(), and PingTargets::PrintStatistics().

long PingTarget::GetId  )  const [inline]
 

Returns id.

Definition at line 25 of file PingTarget.h.

References m_lId.

Referenced by operator<<().

in_addr PingTarget::GetInetAddr  )  const [inline]
 

Returns in_addr.

Definition at line 23 of file PingTarget.h.

References m_inetAddr.

Referenced by main().

const char * PingTarget::GetIpAddr  )  const
 

Returns Internet address in dotted format.

Definition at line 34 of file PingTarget.cpp.

References m_inetAddr.

Referenced by operator<<().

double PingTarget::GetMax  )  const
 

Returns maximum recorded value or 0.

Definition at line 77 of file PingTarget.cpp.

References m_dMax, and m_lReceived.

Referenced by operator<<(), and PingTargets::PrintStatistics().

double PingTarget::GetMin  )  const
 

Returns minimum recorded value or 0.

Definition at line 69 of file PingTarget.cpp.

References m_dMin, and m_lReceived.

Referenced by operator<<(), and PingTargets::PrintStatistics().

const char* PingTarget::GetName  )  const [inline]
 

Returns name.

Definition at line 19 of file PingTarget.h.

References m_sName.

Referenced by operator<<(), PingTargets::PrintLogHeader(), and PingTargets::PrintStatistics().

long PingTarget::GetReceived  )  const [inline]
 

Returns received valid response count.

Definition at line 30 of file PingTarget.h.

References m_lReceived.

long PingTarget::GetResponseCount  )  const [inline]
 

Returns total count of responses.

Definition at line 34 of file PingTarget.h.

References m_lReceived, and m_lSkipped.

Referenced by operator<<().

long PingTarget::GetSkipped  )  const [inline]
 

Returns skipped count (unreachable or timeout).

Definition at line 32 of file PingTarget.h.

References m_lSkipped.

Referenced by operator<<(), and PingTargets::PrintStatistics().

double PingTarget::GetSkippedPercent  )  const
 

Returns percentage skipped responses or 0.

Definition at line 108 of file PingTarget.cpp.

References m_lReceived, and m_lSkipped.

Referenced by operator<<(), and PingTargets::PrintStatistics().

double PingTarget::GetStdDev  )  const
 

Returns standard deviation or 0.

Definition at line 95 of file PingTarget.cpp.

References GetAvg(), m_dSumSquares, and m_lReceived.

Referenced by operator<<(), and PingTargets::PrintStatistics().

Here is the call graph for this function:

bool PingTarget::IsResponseAdded  )  const [inline]
 

Definition at line 28 of file PingTarget.h.

References m_bResponseAdded.

Referenced by PingTargets::AddUnreachableResponses().

USHORT PingTarget::MakeSequence long  sequence  )  const
 

Returns ICMP sequence for this target.

Definition at line 39 of file PingTarget.cpp.

References m_lId, m_targets, and PingTargets::MakeSequence().

Referenced by main().

Here is the call graph for this function:

PingTarget& PingTarget::operator= PingTarget  )  [private]
 


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const PingTarget t
[friend]
 

Definition at line 120 of file PingTarget.cpp.

friend class PingTargets [friend]
 

Definition at line 85 of file PingTarget.h.


Member Data Documentation

bool PingTarget::m_bResponseAdded [protected]
 

set to true, when response is added.

Definition at line 66 of file PingTarget.h.

Referenced by AddResponseTime(), ClearResponseFlag(), IsResponseAdded(), and PingTarget().

double PingTarget::m_dCurrent [protected]
 

Last response.

-1 is unreachable or unrecorded.

Definition at line 74 of file PingTarget.h.

Referenced by AddResponseTime(), GetCurrent(), and PingTarget().

double PingTarget::m_dMax [protected]
 

Maximum recorded.

Definition at line 78 of file PingTarget.h.

Referenced by AddResponseTime(), GetMax(), and PingTarget().

double PingTarget::m_dMin [protected]
 

Minimum recorded.

Definition at line 76 of file PingTarget.h.

Referenced by AddResponseTime(), GetMin(), and PingTarget().

double PingTarget::m_dSum [protected]
 

Sum of all values for average.

Definition at line 80 of file PingTarget.h.

Referenced by AddResponseTime(), GetAvg(), and PingTarget().

double PingTarget::m_dSumSquares [protected]
 

Sum of squares for standard deviation.

Definition at line 82 of file PingTarget.h.

Referenced by AddResponseTime(), GetStdDev(), and PingTarget().

in_addr PingTarget::m_inetAddr [protected]
 

Definition at line 63 of file PingTarget.h.

Referenced by GetInetAddr(), GetIpAddr(), and PingTarget().

long PingTarget::m_lId [protected]
 

Definition at line 64 of file PingTarget.h.

Referenced by GetId(), MakeSequence(), and PingTarget().

long PingTarget::m_lReceived [protected]
 

Received valid responses for statistics.

Definition at line 69 of file PingTarget.h.

Referenced by AddResponseTime(), GetAvg(), GetMax(), GetMin(), GetReceived(), GetResponseCount(), GetSkippedPercent(), GetStdDev(), and PingTarget().

long PingTarget::m_lSkipped [protected]
 

Unreachable or timeout responses.

Definition at line 71 of file PingTarget.h.

Referenced by AddResponseTime(), GetResponseCount(), GetSkipped(), GetSkippedPercent(), and PingTarget().

std::string PingTarget::m_sName [protected]
 

Definition at line 62 of file PingTarget.h.

Referenced by PingTargets::AddTarget(), GetName(), and PingTarget().

PingTargets& PingTarget::m_targets [protected]
 

Definition at line 84 of file PingTarget.h.

Referenced by MakeSequence().


The documentation for this class was generated from the following files:
Generated on Sun Jun 26 13:44:03 2005 for pingem by  doxygen 1.4.3