byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
Public Member Functions | Public Attributes | List of all members
CommonDevice Class Reference

#include "CommonDevice.h"

Inheritance diagram for CommonDevice:
Inheritance graph
[legend]

Public Member Functions

 CommonDevice ()
 
void log (std::string message)
 
void printMessage (std::string message)
 
void warn (std::string message)
 
virtual ~CommonDevice ()
 

Public Attributes

int enableLog
 
int enableWarn
 
std::string instanceName
 

Detailed Description

Definition at line 24 of file CommonDevice.h.

Constructor & Destructor Documentation

◆ CommonDevice()

CommonDevice::CommonDevice ( )
inline

Definition at line 27 of file CommonDevice.h.

27  {
28  enableWarn = 1;
29  enableLog = 0;
30  };

References enableLog, and enableWarn.

◆ ~CommonDevice()

virtual CommonDevice::~CommonDevice ( )
inlinevirtual

Definition at line 31 of file CommonDevice.h.

31  {
32 
33  };

Member Function Documentation

◆ log()

void CommonDevice::log ( std::string  message)
inline

Definition at line 51 of file CommonDevice.h.

51  {
52  #ifdef ENABLELOGS
53  if(enableLog)
54  CommonDevice::printMessage(std::string(" info : ").append(message));
55  #endif
56  }
void printMessage(std::string message)
Definition: CommonDevice.h:37

References enableLog, and printMessage().

Here is the call graph for this function:

◆ printMessage()

void CommonDevice::printMessage ( std::string  message)
inline

Definition at line 37 of file CommonDevice.h.

37  {
38  time_t timestamp = time(0);
39  struct tm tstruct;
40  char timeChars[80];
41  tstruct = *localtime(&timestamp);
42  strftime(timeChars, sizeof(timeChars), "%d %b %Y %H:%M:%S @ ", &tstruct);
43  std::cout << timeChars << instanceName << message << std::endl;
44  }
std::string instanceName
Definition: CommonDevice.h:33

References instanceName.

Referenced by log(), and warn().

Here is the caller graph for this function:

◆ warn()

void CommonDevice::warn ( std::string  message)
inline

Definition at line 45 of file CommonDevice.h.

45  {
46  #ifdef ENABLEWARN
47  if(enableWarn)
48  CommonDevice::printMessage(std::string(" warning: ").append(message));
49  #endif
50  }

References enableWarn, and printMessage().

Here is the call graph for this function:

Member Data Documentation

◆ enableLog

int CommonDevice::enableLog

Definition at line 36 of file CommonDevice.h.

Referenced by CommonDevice(), and log().

◆ enableWarn

int CommonDevice::enableWarn

Definition at line 35 of file CommonDevice.h.

Referenced by CommonDevice(), and warn().

◆ instanceName

std::string CommonDevice::instanceName

Definition at line 34 of file CommonDevice.h.

Referenced by printMessage().


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