Leviathan  0.8.0.0
Leviathan game engine
Leviathan::DebugVariableNotifier Class Reference

#include <DebugVariableNotifier.h>

Public Member Functions

 DebugVariableNotifier ()=delete
 

Static Public Member Functions

static DLLEXPORT void UpdateVariable (const std::string &name, VariableBlock *valueofvariable)
 
static DLLEXPORT void PrintVariables ()
 

Static Protected Attributes

static std::map< std::string, std::shared_ptr< VariableBlock > > CapturedValues
 

Detailed Description

Definition at line 11 of file DebugVariableNotifier.h.

Constructor & Destructor Documentation

◆ DebugVariableNotifier()

Leviathan::DebugVariableNotifier::DebugVariableNotifier ( )
delete

Member Function Documentation

◆ PrintVariables()

DLLEXPORT void Leviathan::DebugVariableNotifier::PrintVariables ( )
static

Definition at line 15 of file DebugVariableNotifier.cpp.

15  {
16  // prefix value (note: we use Write to avoid having excessive [INFO] tags) //
17  Logger::Get()->Write("// ------------------ DebugVariableNotifier ------------------ //");
18 
19  // loop variables and print them //
20  for(auto iterator = CapturedValues.begin(); iterator != CapturedValues.end(); iterator++) {
21  // convert variable to std::string for printing //
22  string toprintvalue;
23  iterator->second->ConvertAndAssingToVariable<string>(toprintvalue);
24 
25  // print data from format ->first is name and ->second is variable //
26  Logger::Get()->Write("\""+iterator->first+"\": "+toprintvalue);
27  }
28 
29  Logger::Get()->Write("// ------------------ PrintVariables ------------------ //");
30 }
DLLEXPORT void Write(const std::string &data) override
Definition: Logger.cpp:113
static std::map< std::string, std::shared_ptr< VariableBlock > > CapturedValues
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106

◆ UpdateVariable()

DLLEXPORT void Leviathan::DebugVariableNotifier::UpdateVariable ( const std::string &  name,
VariableBlock valueofvariable 
)
static

Definition at line 9 of file DebugVariableNotifier.cpp.

11 {
12  CapturedValues[name] = std::shared_ptr<VariableBlock>(valueofvariable);
13 }
static std::map< std::string, std::shared_ptr< VariableBlock > > CapturedValues

Member Data Documentation

◆ CapturedValues

map< std::string, std::shared_ptr< VariableBlock > > Leviathan::DebugVariableNotifier::CapturedValues
staticprotected

Definition at line 24 of file DebugVariableNotifier.h.


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