Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
smbios.cpp File Reference
#include "precompiled.h"
#include "lib/sysdep/smbios.h"
#include "lib/bits.h"
#include "lib/alignment.h"
#include "lib/byte_order.h"
#include "lib/module_init.h"
#include <cstring>
#include <sstream>
#include <vector>
Include dependency graph for smbios.cpp:

Classes

class  SMBIOS::FieldInitializer
 
class  SMBIOS::FieldStringizer
 

Namespaces

namespace  SMBIOS
 

Macros

#define STRUCTURE(name, id)
 
#define FIELD(flags, type, name, units)   visitor(flags, p.name, #name, units);
 
#define STRUCTURE(name, id)   template<class Visitor> void VisitFields(name& p, Visitor& visitor) { name##_FIELDS }
 
#define STRUCTURE(name, id)   case id: AddStructure(header, strings, g_Structures.name##_); break;
 
#define ENUM(enumerator, VALUE)
 
#define ENUMERATION(name, type)
 
#define STRUCTURE(name, id)   StringizeStructure(#name, structures->name##_, ss);
 

Typedefs

typedef std::vector< const char * > SMBIOS::Strings
 

Functions

static Strings SMBIOS::ExtractStrings (const Header *header, const char *end, const Header *&next)
 
static void SMBIOS::Cleanup ()
 
template<class Structure >
void SMBIOS::Fixup (Structure &structure)
 
template<>
void SMBIOS::Fixup< Bios > (Bios &p)
 
template<>
void SMBIOS::Fixup< Processor > (Processor &p)
 
template<>
void SMBIOS::Fixup< Cache > (Cache &p)
 
template<>
void SMBIOS::Fixup< SystemSlot > (SystemSlot &p)
 
template<>
void SMBIOS::Fixup< OnBoardDevices > (OnBoardDevices &p)
 
template<>
void SMBIOS::Fixup< MemoryArray > (MemoryArray &p)
 
template<>
void SMBIOS::Fixup< MemoryDevice > (MemoryDevice &p)
 
template<>
void SMBIOS::Fixup< MemoryArrayMappedAddress > (MemoryArrayMappedAddress &p)
 
template<>
void SMBIOS::Fixup< MemoryDeviceMappedAddress > (MemoryDeviceMappedAddress &p)
 
template<>
void SMBIOS::Fixup< VoltageProbe > (VoltageProbe &p)
 
template<>
void SMBIOS::Fixup< CoolingDevice > (CoolingDevice &p)
 
template<>
void SMBIOS::Fixup< TemperatureProbe > (TemperatureProbe &p)
 
template<>
void SMBIOS::Fixup< SystemPowerSupply > (SystemPowerSupply &p)
 
template<>
void SMBIOS::Fixup< OnboardDevices2 > (OnboardDevices2 &p)
 
template<class Structure >
void SMBIOS::AddStructure (const Header *header, const Strings &strings, Structure *&listHead)
 
static Status SMBIOS::InitStructures ()
 
template<class Enum >
std::string SMBIOS::StringFromEnum (Enum field)
 
const Structures * SMBIOS::GetStructures ()
 
template<class Structure >
void SMBIOS::StringizeStructure (const char *name, Structure *p, std::stringstream &ss)
 
std::string SMBIOS::StringizeStructures (const Structures *structures)
 

Variables

static char * SMBIOS::stringStorage
 
static char * SMBIOS::stringStoragePos
 
static Structures SMBIOS::g_Structures
 

Macro Definition Documentation

◆ ENUM

#define ENUM (   enumerator,
  VALUE 
)
Value:
if(field.value == VALUE) /* single bit flag or matching enumerator */\
return #enumerator;\
if(!is_pow2(VALUE)) /* these aren't bit flags */\
{\
allowFlags = false;\
string.clear();\
}\
if(allowFlags && (field.value & (VALUE)))\
{\
if(!string.empty())\
string += "|";\
string += #enumerator;\
}
bool is_pow2(T n)
Definition: bits.h:164

◆ ENUMERATION

#define ENUMERATION (   name,
  type 
)
Value:
template<>\
std::string StringFromEnum<name>(name field)\
{\
std::string string;\
bool allowFlags = true;\
name##_ENUMERATORS\
/* (don't warn about the value 0, e.g. optional fields) */\
if(string.empty() && field != 0)\
{\
std::stringstream ss;\
ss << "(unknown " << #name << " " << field.value << ")";\
return ss.str();\
}\
return string;\
}

◆ FIELD

#define FIELD (   flags,
  type,
  name,
  units 
)    visitor(flags, p.name, #name, units);

◆ STRUCTURE [1/4]

#define STRUCTURE (   name,
  id 
)
Value:
while(g_Structures.name##_)\
{\
name* next = g_Structures.name##_->next;\
SAFE_FREE(g_Structures.name##_);\
g_Structures.name##_ = next;\
}
static Structures g_Structures
Definition: smbios.cpp:123

◆ STRUCTURE [2/4]

#define STRUCTURE (   name,
  id 
)    template<class Visitor> void VisitFields(name& p, Visitor& visitor) { name##_FIELDS }

◆ STRUCTURE [3/4]

#define STRUCTURE (   name,
  id 
)    case id: AddStructure(header, strings, g_Structures.name##_); break;

◆ STRUCTURE [4/4]

#define STRUCTURE (   name,
  id 
)    StringizeStructure(#name, structures->name##_, ss);