NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_NesgLog Class Reference

Specific logs for MA framework. More...

#include <NA_NesgLog.h>

List of all members.

Public Member Functions

 NA_NesgLog ()
 Constructor.
 ~NA_NesgLog ()
 Destructor.
void write (const char *logline,...)
 Write a log line in the simulation console.
void unsetLog ()
 Deactivate the logs.
NA_NesgLogoperator<< (const std::string &t)
 Override the operator << for strings.
template<typename T >
NA_NesgLogoperator<< (const T &t)
 Override the operator << for generic objects.
NA_NesgLogoperator<< (std::ostream &(t)(std::ostream &))
 Override the operator << for objects like endl.

Private Attributes

bool active
 Flag to active the logs or not.

Detailed Description

Specific logs for MA framework.

This class provides some methods and macros to make the debug process easier. An example of use is showed following:

  LOG << "Dropping Attack Probability received: "<< dmsg->getDroppingAttackProbability() << "\n";
See also:
NA_Utils
Author:
Gabriel Maciá Fernández, gmacia@ugr.es
Date:
01/22/2013

Definition at line 57 of file NA_NesgLog.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 29 of file NA_NesgLog.cc.

                       {
    active = true;
}

Destructor.

Definition at line 67 of file NA_NesgLog.h.

                  {
    }

Member Function Documentation

NA_NesgLog& NA_NesgLog::operator<< ( const std::string &  t) [inline]

Override the operator << for strings.

Parameters:
tthe string to write on log
Returns:

Definition at line 88 of file NA_NesgLog.h.

                                               {
        if (active)
            EV << t;
        return *this;
    } // For strings
template<typename T >
NA_NesgLog& NA_NesgLog::operator<< ( const T &  t) [inline]

Override the operator << for generic objects.

Parameters:
ta generic object to write on log
Returns:

Definition at line 100 of file NA_NesgLog.h.

                                                            {
        if (active)
            EV << t;
        return *this;
    } // For generic objects
NA_NesgLog& NA_NesgLog::operator<< ( std::ostream &  t)(std::ostream &) [inline]

Override the operator << for objects like endl.

Parameters:
t
Returns:

Definition at line 112 of file NA_NesgLog.h.

                                                         {
        if (active)
            EV << t;
        return *this;
    } // For objects like endl

Deactivate the logs.

Definition at line 45 of file NA_NesgLog.cc.

                          {
    active = false;
}
void NA_NesgLog::write ( const char *  logline,
  ... 
)

Write a log line in the simulation console.

Parameters:
logline

Definition at line 33 of file NA_NesgLog.cc.

                                               {
    if (active) {
        va_list argList;
        char cbuffer[1024];
        va_start(argList, logline);
        vsnprintf(cbuffer, 1024, logline, argList);
        va_end(argList);

        EV << NESGLOGHEADER << cbuffer << endl;
    }
}

Member Data Documentation

bool NA_NesgLog::active [private]

Flag to active the logs or not.

Definition at line 122 of file NA_NesgLog.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerator Defines