Pyrogenesis  trunk
Classes | Namespaces | Macros | Typedefs | Functions | Variables
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 <sstream>
Include dependency graph for smbios.cpp:

Classes

class  SMBIOS::FieldInitializer
 
class  SMBIOS::FieldStringizer
 

Namespaces

 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, 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 *)
 

Variables

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

Macro Definition Documentation

#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
#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;\
}
#define FIELD (   flags,
  type,
  name,
  units 
)    visitor(flags, p.name, #name, units);
#define STRUCTURE (   name,
  id 
)
Value:
while(structures.name##_)\
{\
name* next = structures.name##_->next;\
structures.name##_ = next;\
}
#define SAFE_FREE(p)
free memory ensuing from malloc and set the pointer to zero (thus making double-frees safe / a no-op)...
Definition: code_generation.h:131
static Structures structures
Definition: smbios.cpp:121
#define STRUCTURE (   name,
  id 
)    template<class Visitor> void VisitFields(name& p, Visitor& visitor) { name##_FIELDS }
#define STRUCTURE (   name,
  id 
)    case id: AddStructure(header, strings, structures.name##_); break;
#define STRUCTURE (   name,
  id 
)    StringizeStructure(#name, structures->name##_, ss);