Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SmbiosTable Class Reference

#include <SmbiosImpl.h>

Inheritance diagram for SmbiosTable:

ISmbiosTable SmbiosTableXml SmbiosTableXml List of all members.

Public Types

typedef SmbiosTableIterator iterator
typedef ConstSmbiosTableIterator const_iterator

Public Member Functions

 SmbiosTable (std::vector< SmbiosStrategy * > initStrategyList, bool strictValidation=0)
virtual ~SmbiosTable ()
virtual iterator begin ()
 Standard iterator interface. Points to first table item.

virtual const_iterator begin () const
 Standard iterator interface. Points to first table item.

virtual iterator end ()
 Standard iterator interface. Points to one-past-the-last table item.

virtual const_iterator end () const
 Standard iterator interface. Points to one-past-the-last table item.

virtual iterator operator[] (const int)
 Standard indexed access by integer item type.

virtual const_iterator operator[] (const int) const
 Standard indexed access by integer item type.

virtual iterator operator[] (const std::string &)
 Standard indexed access by string description. XML ENHANCED.

virtual const_iterator operator[] (const std::string &) const
 Standard indexed access by string description. XML ENHANCED.

virtual void rawMode (bool m) const
 Disables all workarounds for _new_ items created by the table.

virtual int getNumberOfEntries () const
 Returns the number of table items, per SMBIOS table header.

virtual smbiosLowlevel::smbios_table_entry_point getTableEPS () const
 Returns the table entry point structure.

virtual std::ostream & streamify (std::ostream &cout) const
 Used by operator << (std::ostream & cout, const ISmbiosTable & ) to.

virtual void initializeWorkaround () const
virtual void setStrictValidationMode (bool mode) const
virtual bool getStrictValidationMode () const
virtual ISmbiosItemgetCachedItem (const void *) const
virtual void cacheItem (const void *, ISmbiosItem &newitem) const
virtual void clearItemCache () const
 Clears out any cached SmbiosItem entries in the cache.


Protected Member Functions

 SmbiosTable ()
virtual ISmbiosItemmakeItem (const void *header=0) const
const void * nextSmbiosStruct (const void *current=0) const

Protected Attributes

std::map< const void *, ISmbiosItem * > itemList
bool initializing
bool strictValidationMode
std::auto_ptr< SmbiosWorkaroundTableworkaround
const u8smbiosBuffer
smbiosLowlevel::smbios_table_entry_point table_header

Private Member Functions

 SmbiosTable (const SmbiosTable &source)
virtual void reReadTable ()
 Re-Read the table from memory. Invalidates all existing ISmbiosItems.


Private Attributes

unsigned long offset
std::vector< SmbiosStrategy * > strategyList

Friends

class SmbiosTableIteratorBase

Member Typedef Documentation

typedef ConstSmbiosTableIterator const_iterator [inherited]
 

Definition at line 123 of file ISmbios.h.

Referenced by TokenTable::addChecksumObserverForD4Struct(), TokenTable::addD4Structures(), TokenTable::addD5Structures(), TokenTable::addD6Structures(), TokenTable::addDAStructures(), TokenTable::getD4TokensFromStruct(), TokenTable::getDATokensFromStruct(), testStandalone::testConstIterator(), and testStandalone::testNonXml().

typedef SmbiosTableIterator iterator [inherited]
 

Definition at line 122 of file ISmbios.h.

Referenced by couldBeBayonet(), getIdByteFromOEMItem(), getIdByteFromRevItem(), testPlatform::testConstructionOffset1(), testStandalone::testEachItemAccessors(), testStandalone::testEntryCount(), testStandalone::testGetBoundaries(), testStandalone::testItem_GetBiosInfo(), testStandalone::testItem_GetSystemInfo(), testStandalone::testItemIdentity(), testStandalone::testNonXml(), testPlatform::testOutOfBounds(), testStandalone::testSmbiosXml(), testStandalone::testStreamify(), testStandalone::testSubscriptOperator1(), testStandalone::testSubscriptOperator3(), testStandalone::testTable_Subscript(), testStandalone::testTypeMismatch(), and testPlatform::testVariousAccessors().


Constructor & Destructor Documentation

SmbiosTable std::vector< SmbiosStrategy * >  initStrategyList,
bool  strictValidation = 0
[explicit]
 

Definition at line 63 of file SmbiosTable.cpp.

References SmbiosTable::reReadTable().

~SmbiosTable  )  [virtual]
 

Definition at line 71 of file SmbiosTable.cpp.

References SmbiosTable::clearItemCache(), SmbiosTable::smbiosBuffer, SmbiosTable::strategyList, and SmbiosTable::table_header.

SmbiosTable  )  [protected]
 

Definition at line 52 of file SmbiosTable.cpp.

References SmbiosTable::table_header.

SmbiosTable const SmbiosTable source  )  [private]
 


Member Function Documentation

SmbiosTable::const_iterator begin  )  const [virtual]
 

Standard iterator interface. Points to first table item.

Returns:
iterator or const_iterator Example Iterator Usage:
    smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
    smbios::ISmbiosTable::iterator item = table->begin();
    while( item != table->end() )
    {
        cout << "Type of Item: " << item->getType();
        ++item;
    }

Implements ISmbiosTable.

Definition at line 127 of file SmbiosTable.cpp.

SmbiosTable::iterator begin  )  [virtual]
 

Standard iterator interface. Points to first table item.

Returns:
iterator or const_iterator Example Iterator Usage:
    smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
    smbios::ISmbiosTable::iterator item = table->begin();
    while( item != table->end() )
    {
        cout << "Type of Item: " << item->getType();
        ++item;
    }

Implements ISmbiosTable.

Definition at line 122 of file SmbiosTable.cpp.

Referenced by SmbiosTableXml::streamify(), and SmbiosTable::streamify().

void cacheItem const void *  ,
ISmbiosItem newitem
const [virtual]
 

Definition at line 113 of file SmbiosTable.cpp.

References SmbiosTable::itemList.

Referenced by SmbiosTableIteratorBase::dereference().

void clearItemCache  )  const [virtual]
 

Clears out any cached SmbiosItem entries in the cache.

This API is useful for two instances. First, you can use this to reduce memory usage if you know that you do not need any ISmbiosItem(s) out of the table for a while. The cached ISmbiosItem(s) will be deleted and then re-populated on demand when queries are made for them.

Next, this API is used internally when reReadTable() is called to clear out all old ISmbiosItems.

Warning:
All previous references or pointers to ISmbiosItem objects created from this table become invalid and attempts to access them will cause undefined behaviour (most likely your code will crash.)

Todo:
clearItemCache() needs to be made an abstract function and the definition needs to be moved to the SmbiosItem class. This needs to happen at the same time that itemList is moved.

Implements ISmbiosTable.

Definition at line 242 of file SmbiosTable.cpp.

References SmbiosTable::itemList.

Referenced by SmbiosTable::initializeWorkaround(), SmbiosTable::reReadTable(), and SmbiosTable::~SmbiosTable().

SmbiosTable::const_iterator end  )  const [virtual]
 

Standard iterator interface. Points to one-past-the-last table item.

Used by const_iterator.

Returns:
iterator or const_iterator Example Iterator Usage:
    smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
    smbios::ISmbiosTable::iterator item = table->begin();
    while( item != table->end() )
    {
        cout << "Type of Item: " << item->getType();
        ++item;
    }

Implements ISmbiosTable.

Definition at line 137 of file SmbiosTable.cpp.

SmbiosTable::iterator end  )  [virtual]
 

Standard iterator interface. Points to one-past-the-last table item.

Returns:
iterator or const_iterator Example Iterator Usage:
    smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
    smbios::ISmbiosTable::iterator item = table->begin();
    while( item != table->end() )
    {
        cout << "Type of Item: " << item->getType();
        ++item;
    }

Implements ISmbiosTable.

Definition at line 132 of file SmbiosTable.cpp.

Referenced by SmbiosTableXml::streamify(), and SmbiosTable::streamify().

ISmbiosItem * getCachedItem const void *   )  const [virtual]
 

Definition at line 95 of file SmbiosTable.cpp.

References _, and SmbiosTable::itemList.

Referenced by SmbiosTableIteratorBase::dereference().

int getNumberOfEntries  )  const [virtual]
 

Returns the number of table items, per SMBIOS table header.

Implements ISmbiosTable.

Definition at line 337 of file SmbiosTable.cpp.

References SmbiosTable::table_header, and smbios_table_entry_point::table_num_structs.

bool getStrictValidationMode  )  const [virtual]
 

Definition at line 261 of file SmbiosTable.cpp.

References SmbiosTable::strictValidationMode.

Referenced by SmbiosTable::reReadTable().

smbiosLowlevel::smbios_table_entry_point getTableEPS  )  const [virtual]
 

Returns the table entry point structure.

Implements ISmbiosTable.

Definition at line 342 of file SmbiosTable.cpp.

References SmbiosTable::table_header.

void initializeWorkaround  )  const [virtual]
 

Definition at line 208 of file SmbiosTable.cpp.

References SmbiosTable::clearItemCache(), SmbiosTable::initializing, and SmbiosTable::workaround.

Referenced by SmbiosXmlFactoryImpl::makeNew(), and SmbiosFactoryImpl::makeNew().

ISmbiosItem & makeItem const void *  header = 0  )  const [protected, virtual]
 

Definition at line 267 of file SmbiosTable.cpp.

References SmbiosTable::initializing, and SmbiosTable::workaround.

Referenced by SmbiosTableIteratorBase::dereference().

const void * nextSmbiosStruct const void *  current = 0  )  const [protected]
 

Definition at line 280 of file SmbiosTable.cpp.

References smbios_structure_header::length, SmbiosTable::smbiosBuffer, SmbiosTable::table_header, smbios_table_entry_point::table_length, smbios_structure_header::type, and u8.

Referenced by SmbiosTableIteratorBase::incrementIterator().

SmbiosTable::const_iterator operator[] const std::string &   )  const [virtual]
 

Standard indexed access by string description. XML ENHANCED.

XML Enhanced indexing operator. You can pass in a string description of the table and the SmbiosTable class will look up the string in an XML description file to find out the item number that corresponds with that text.

The nice extension that is supplied by the XML interface is that all Item access to the item returned are type checked against the XML, so you cannot, for example, access an 8-bit number as a 16-bit number.

The operator[] method returns an iterator that can be used to iterator over all items in the table of the supplied type. So, for example, if you want to perform an operation on all SMBIOS type 0x01 (System Information Block) structures, just index the table object using the [] operator.

Returns:
iterator or const_iterator Sample usage:
// Integer indexing example
smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;

// XML string indexing example
smbios::ISmbiosTable *table = smbios::SmbiosXmlFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)["BIOS Information"];
cout << "The BIOS Version is: " << item1->getString("BIOS Version") << endl;
See also:
operator[]( const std::string & ) const
See also:
operator[]( const int )

Implements ISmbiosTable.

Reimplemented in SmbiosTableXml, and SmbiosTableXml.

Definition at line 157 of file SmbiosTable.cpp.

References _.

SmbiosTable::iterator operator[] const std::string &   )  [virtual]
 

Standard indexed access by string description. XML ENHANCED.

XML Enhanced indexing operator. You can pass in a string description of the table and the SmbiosTable class will look up the string in an XML description file to find out the item number that corresponds with that text.

The nice extension that is supplied by the XML interface is that all Item access to the item returned are type checked against the XML, so you cannot, for example, access an 8-bit number as a 16-bit number.

The operator[] method returns an iterator that can be used to iterator over all items in the table of the supplied type. So, for example, if you want to perform an operation on all SMBIOS type 0x01 (System Information Block) structures, just index the table object using the [] operator.

Returns:
iterator or const_iterator Sample usage:
// Integer indexing example
smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;

// XML string indexing example
smbios::ISmbiosTable *table = smbios::SmbiosXmlFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)["BIOS Information"];
cout << "The BIOS Version is: " << item1->getString("BIOS Version") << endl;
See also:
operator[]( const std::string & ) const
See also:
operator[]( const int )

Implements ISmbiosTable.

Reimplemented in SmbiosTableXml, and SmbiosTableXml.

Definition at line 152 of file SmbiosTable.cpp.

References _.

SmbiosTable::const_iterator operator[] const  int  )  const [virtual]
 

Standard indexed access by integer item type.

The operator[] method returns an iterator that can be used to iterator over all items in the table of the supplied type. So, for example, if you want to perform an operation on all SMBIOS type 0x01 (System Information Block) structures, just index the table object using the [] operator.

Returns:
iterator or const_iterator Sample usage:
// Integer indexing example
smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;

// XML string indexing example
smbios::ISmbiosTable *table = smbios::SmbiosXmlFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)["BIOS Information"];
cout << "The BIOS Version is: " << item1->getString("BIOS Version") << endl;
See also:
operator[]( const std::string & ) const

Implements ISmbiosTable.

Definition at line 147 of file SmbiosTable.cpp.

SmbiosTable::iterator operator[] const  int  )  [virtual]
 

Standard indexed access by integer item type.

The operator[] method returns an iterator that can be used to iterator over all items in the table of the supplied type. So, for example, if you want to perform an operation on all SMBIOS type 0x01 (System Information Block) structures, just index the table object using the [] operator.

Returns:
iterator or const_iterator Sample usage:
// Integer indexing example
smbios::ISmbiosTable *table = smbios::SmbiosFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;

// XML string indexing example
smbios::ISmbiosTable *table = smbios::SmbiosXmlFactory::getFactory()->getSingleton();
smbios::ISmbiosTable::iterator item1 = (*table)["BIOS Information"];
cout << "The BIOS Version is: " << item1->getString("BIOS Version") << endl;
See also:
operator[]( const std::string & ) const

Implements ISmbiosTable.

Definition at line 142 of file SmbiosTable.cpp.

void rawMode bool  m  )  const [virtual]
 

Disables all workarounds for _new_ items created by the table.

Any new item generated by the table will not have workarounds applied to them. However, any previously-existing items that have had workarounds applied still exist. If this is not what you want, recommend calling clearItemCache() prior to calling rawMode().

Parameters:
m pass in a bool value to turn raw mode on or off.

Implements ISmbiosTable.

Definition at line 237 of file SmbiosTable.cpp.

References SmbiosTable::initializing.

void reReadTable  )  [private, virtual]
 

Re-Read the table from memory. Invalidates all existing ISmbiosItems.

Not yet implemented This API is intended to be used in the instance where SMBIOS data is not static, ie. BIOS updates SMBIOS information while the system is running.

Most systems have static tables that do not change after the system boots. Systems have been proposed to update this information at runtime inside system SMI calls. This API is put into place to prepare for this possibility.

Warning:
All previous references or pointers to ISmbiosItem objects created from this table become invalid and attempts to access them will cause undefined behaviour (most likely your code will crash.)

Implements ISmbiosTable.

Definition at line 162 of file SmbiosTable.cpp.

References _, SmbiosTable::clearItemCache(), DCERR, SmbiosTable::getStrictValidationMode(), SmbiosTable::initializing, SmbiosTable::smbiosBuffer, SmbiosTable::strategyList, and SmbiosTable::table_header.

Referenced by SmbiosTable::SmbiosTable().

void setStrictValidationMode bool  mode  )  const [virtual]
 

Definition at line 256 of file SmbiosTable.cpp.

References SmbiosTable::strictValidationMode.

ostream & streamify std::ostream &  cout  )  const [virtual]
 

Used by operator << (std::ostream & cout, const ISmbiosTable & ) to.

Users normally would not need or want to call this API. The normal operator<<() has been overloaded to call this function internally.

Implements ISmbiosTable.

Reimplemented in SmbiosTableXml, and SmbiosTableXml.

Definition at line 347 of file SmbiosTable.cpp.

References SmbiosTable::begin(), SmbiosTable::end(), smbios_table_entry_point::major_ver, smbios_table_entry_point::minor_ver, smbios_table_entry_point::table_address, SmbiosTable::table_header, smbios_table_entry_point::table_length, and smbios_table_entry_point::table_num_structs.


Friends And Related Function Documentation

friend class SmbiosTableIteratorBase [friend]
 

Definition at line 152 of file SmbiosImpl.h.


Member Data Documentation

bool initializing [mutable, protected]
 

Definition at line 166 of file SmbiosImpl.h.

Referenced by SmbiosTable::initializeWorkaround(), SmbiosTable::makeItem(), SmbiosTable::rawMode(), and SmbiosTable::reReadTable().

std::map< const void *, ISmbiosItem *> itemList [mutable, protected]
 

Definition at line 165 of file SmbiosImpl.h.

Referenced by SmbiosTable::cacheItem(), SmbiosTable::clearItemCache(), and SmbiosTable::getCachedItem().

unsigned long offset [mutable, private]
 

Definition at line 176 of file SmbiosImpl.h.

const u8* smbiosBuffer [protected]
 

Definition at line 169 of file SmbiosImpl.h.

Referenced by SmbiosTable::nextSmbiosStruct(), SmbiosTable::reReadTable(), and SmbiosTable::~SmbiosTable().

std::vector<SmbiosStrategy *> strategyList [private]
 

Definition at line 177 of file SmbiosImpl.h.

Referenced by SmbiosTable::reReadTable(), and SmbiosTable::~SmbiosTable().

bool strictValidationMode [mutable, protected]
 

Definition at line 167 of file SmbiosImpl.h.

Referenced by SmbiosTable::getStrictValidationMode(), and SmbiosTable::setStrictValidationMode().

smbiosLowlevel::smbios_table_entry_point table_header [protected]
 

Definition at line 170 of file SmbiosImpl.h.

Referenced by SmbiosTable::getNumberOfEntries(), SmbiosTable::getTableEPS(), SmbiosTable::nextSmbiosStruct(), SmbiosTable::reReadTable(), SmbiosTable::SmbiosTable(), SmbiosTable::streamify(), and SmbiosTable::~SmbiosTable().

std::auto_ptr<SmbiosWorkaroundTable> workaround [mutable, protected]
 

Definition at line 168 of file SmbiosImpl.h.

Referenced by SmbiosTable::initializeWorkaround(), and SmbiosTable::makeItem().


The documentation for this class was generated from the following files:
Generated on Wed Apr 11 16:25:12 2007 for SMBIOS Library by doxygen 1.3.5