Cat
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
var Class Reference

#include <inc/var.h>

Public Types

enum  Type {
  UNKNOWN, CHAR, INT, FLOAT,
  DOUBLE, STRING
}
 

Public Member Functions

 var ()
 Standard constructor. More...
 
 var (char)
 
 var (int)
 
 var (float)
 
 var (double)
 
 var (std::string)
 
virtual ~var ()
 Destructor. More...
 
char vchar ()
 
int vint ()
 
float vfloat ()
 
double vdouble ()
 
std::string vstring ()
 
std::vector< varvector (const char *,...)
 

Private Member Functions

void verbose (std::string msg)
 
void debug (std::string msg)
 
void info (std::string msg)
 
void warning (std::string msg)
 
void fatal (std::string msg)
 
void verbose (std::string msg, std::string name)
 
void debug (std::string msg, std::string name)
 
void info (std::string msg, std::string name)
 
void warning (std::string msg, std::string name)
 
void fatal (std::string msg, std::string name)
 

Private Attributes

char m_char
 
int m_type
 
int m_int
 
float m_float
 
double m_double
 
std::string m_string
 
MsgSvc m_log
 

Detailed Description

Author
Date
2006-10-26

Definition at line 19 of file var.h.

Member Enumeration Documentation

◆ Type

enum var::Type
Enumerator
UNKNOWN 
CHAR 
INT 
FLOAT 
DOUBLE 
STRING 

Definition at line 22 of file var.h.

22  {
23  UNKNOWN,
24  CHAR,
25  INT,
26  FLOAT,
27  DOUBLE,
28  STRING
29  };
Definition: var.h:25
Definition: var.h:24
Definition: var.h:26

Constructor & Destructor Documentation

◆ var() [1/6]

var::var ( )

Standard constructor.

Definition at line 21 of file var.cpp.

References m_type, and UNKNOWN.

21  {
23 }
int m_type
Definition: var.h:52

◆ var() [2/6]

var::var ( char  ch)

Definition at line 33 of file var.cpp.

References CHAR, m_char, and m_type.

33  {
34  m_type=CHAR;
35  m_char = ch;
36 }
char m_char
Definition: var.h:51
Definition: var.h:24
int m_type
Definition: var.h:52

◆ var() [3/6]

var::var ( int  i)

Definition at line 41 of file var.cpp.

References INT, m_int, and m_type.

41  {
42  m_type=INT;
43  m_int = i;
44 }
Definition: var.h:25
int m_int
Definition: var.h:53
int m_type
Definition: var.h:52

◆ var() [4/6]

var::var ( float  f)

Definition at line 49 of file var.cpp.

References cat::f, FLOAT, m_float, and m_type.

49  {
50  m_type=FLOAT;
51  m_float = f;
52 }
f
Definition: cat.py:54
float m_float
Definition: var.h:54
int m_type
Definition: var.h:52
Definition: var.h:26

◆ var() [5/6]

var::var ( double  d)

Definition at line 57 of file var.cpp.

References DOUBLE, m_double, and m_type.

57  {
58  m_type=DOUBLE;
59  m_double = d;
60 }
double m_double
Definition: var.h:55
int m_type
Definition: var.h:52

◆ var() [6/6]

var::var ( std::string  str)

Definition at line 65 of file var.cpp.

References m_string, m_type, and STRING.

65  {
66  m_type=STRING;
67  m_string = str;
68 }
std::string m_string
Definition: var.h:56
int m_type
Definition: var.h:52

◆ ~var()

var::~var ( )
virtual

Destructor.

Definition at line 27 of file var.cpp.

27 {}

Member Function Documentation

◆ debug() [1/2]

void var::debug ( std::string  msg)
inlineprivate

Definition at line 61 of file var.h.

References MsgSvc::DEBUG, and MsgSvc::msgSvc().

61 { m_log.msgSvc (MsgSvc::DEBUG , msg, std::string("var") ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ debug() [2/2]

void var::debug ( std::string  msg,
std::string  name 
)
inlineprivate

Definition at line 67 of file var.h.

References MsgSvc::DEBUG, and MsgSvc::msgSvc().

67 { m_log.msgSvc (MsgSvc::DEBUG , msg, name ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ fatal() [1/2]

void var::fatal ( std::string  msg)
inlineprivate

Definition at line 64 of file var.h.

References MsgSvc::FATAL, and MsgSvc::msgSvc().

64 { m_log.msgSvc (MsgSvc::FATAL , msg, std::string("var") ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ fatal() [2/2]

void var::fatal ( std::string  msg,
std::string  name 
)
inlineprivate

Definition at line 70 of file var.h.

References MsgSvc::FATAL, and MsgSvc::msgSvc().

70 { m_log.msgSvc (MsgSvc::FATAL , msg, name ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ info() [1/2]

void var::info ( std::string  msg)
inlineprivate

Definition at line 62 of file var.h.

References MsgSvc::INFO, and MsgSvc::msgSvc().

62 { m_log.msgSvc (MsgSvc::INFO , msg, std::string("var") ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ info() [2/2]

void var::info ( std::string  msg,
std::string  name 
)
inlineprivate

Definition at line 68 of file var.h.

References MsgSvc::INFO, and MsgSvc::msgSvc().

68 { m_log.msgSvc (MsgSvc::INFO , msg, name ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ vchar()

char var::vchar ( )
inline

Definition at line 40 of file var.h.

References m_char.

40 { return m_char; }
char m_char
Definition: var.h:51

◆ vdouble()

double var::vdouble ( )
inline

Definition at line 43 of file var.h.

References m_double.

43 { return m_double; }
double m_double
Definition: var.h:55

◆ vector()

std::vector< var > var::vector ( const char *  format,
  ... 
)

Definition at line 74 of file var.cpp.

Referenced by vstring().

74  {
75  va_list pa;
76  vars varlist;
77  va_start(pa, format);
78 /* while (*format != '\0') {
79  if (*format=='%') {
80  format++;
81  switch (*format) {
82  case 'c' : // char
83  varlist.push_back( var((char)(va_arg(pa,char))));
84  break;
85  case 'i' : // integer
86  varlist.push_back( var((int)(va_arg(pa,int))));
87  break;
88  case 'f' : // float
89  varlist.push_back( var((float)(va_arg(pa,float))));
90  break;
91  case 'd' : // double
92  varlist.push_back( var((double)(va_arg(pa,double))));
93  break;
94  case 's' : // string
95  varlist.push_back( var(std::string((va_arg(pa,char*)))));
96  break;
97  default:
98  std::cout<<"hello"<<std::endl;
99  // nothing
100 // application()->warning("Could not figure out the type of the variable ("+std::string(format)+").","var::vector");
101  } // end switch
102  ++format;
103  }
104  }*/
105  va_end(pa);
106  return varlist;
107 }
std::vector< var > vars
Definition: var.h:73

◆ verbose() [1/2]

void var::verbose ( std::string  msg)
inlineprivate

Definition at line 60 of file var.h.

References MsgSvc::msgSvc(), and MsgSvc::VERBOSE.

60 { m_log.msgSvc (MsgSvc::VERBOSE , msg, std::string("var") ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ verbose() [2/2]

void var::verbose ( std::string  msg,
std::string  name 
)
inlineprivate

Definition at line 66 of file var.h.

References MsgSvc::msgSvc(), and MsgSvc::VERBOSE.

66 { m_log.msgSvc (MsgSvc::VERBOSE , msg, name ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ vfloat()

float var::vfloat ( )
inline

Definition at line 42 of file var.h.

References m_float.

42 { return m_float; }
float m_float
Definition: var.h:54

◆ vint()

int var::vint ( )
inline

Definition at line 41 of file var.h.

References m_int.

41 { return m_int; }
int m_int
Definition: var.h:53

◆ vstring()

std::string var::vstring ( )
inline

Definition at line 44 of file var.h.

References m_string, and vector().

44 { return m_string; }
std::string m_string
Definition: var.h:56

◆ warning() [1/2]

void var::warning ( std::string  msg)
inlineprivate

Definition at line 63 of file var.h.

References MsgSvc::msgSvc(), and MsgSvc::WARNING.

63 { m_log.msgSvc (MsgSvc::WARNING , msg, std::string("var") ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

◆ warning() [2/2]

void var::warning ( std::string  msg,
std::string  name 
)
inlineprivate

Definition at line 69 of file var.h.

References MsgSvc::msgSvc(), and MsgSvc::WARNING.

69 { m_log.msgSvc (MsgSvc::WARNING , msg, name ); }
MsgSvc m_log
Definition: var.h:58
void msgSvc(MsgSvc::MsgLevel, std::string, std::string call=std::string(""))
Definition: MsgSvc.cpp:42

Member Data Documentation

◆ m_char

char var::m_char
private

Definition at line 51 of file var.h.

Referenced by var(), and vchar().

◆ m_double

double var::m_double
private

Definition at line 55 of file var.h.

Referenced by var(), and vdouble().

◆ m_float

float var::m_float
private

Definition at line 54 of file var.h.

Referenced by var(), and vfloat().

◆ m_int

int var::m_int
private

Definition at line 53 of file var.h.

Referenced by var(), and vint().

◆ m_log

MsgSvc var::m_log
private

Definition at line 58 of file var.h.

◆ m_string

std::string var::m_string
private

Definition at line 56 of file var.h.

Referenced by var(), and vstring().

◆ m_type

int var::m_type
private

Definition at line 52 of file var.h.

Referenced by var().


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