SMBIOS Library
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
SmbiosTable Class Reference

#include <SmbiosImpl.h>

Inheritance diagram for SmbiosTable:
Inheritance graph
Collaboration diagram for SmbiosTable:
Collaboration graph

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 &)
virtual const_iterator operator[] (const std::string &) const
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.
ISmbiosItemgetSmbiosItem (const u8 *)
const ISmbiosItemgetSmbiosItem (const u8 *) const
const u8nextSmbiosStruct (const u8 *current=0) const

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

 SmbiosTable (const SmbiosTable &source)
virtual void reReadTable ()

Private Attributes

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

Detailed Description

Definition at line 108 of file SmbiosImpl.h.

Member Typedef Documentation

Definition at line 123 of file ISmbios.h.

typedef SmbiosTableIterator iterator
inherited

Definition at line 122 of file ISmbios.h.

Constructor & Destructor Documentation

SmbiosTable ( std::vector< SmbiosStrategy * >  initStrategyList,
bool  strictValidation = 0 
)
explicit

Definition at line 64 of file SmbiosTable.cpp.

References SmbiosTable::reReadTable().

Here is the call graph for this function:

~SmbiosTable ( )
virtual

Definition at line 72 of file SmbiosTable.cpp.

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

Here is the call graph for this function:

SmbiosTable ( )
protected

Definition at line 53 of file SmbiosTable.cpp.

References SmbiosTable::table_header.

SmbiosTable ( const SmbiosTable source)
private

Member Function Documentation

SmbiosTable::iterator begin ( )
virtual

Standard iterator interface. Points to first table item.

       \returns iterator or const_iterator
       Example Iterator Usage:
while( item != table->end() )
{
cout << "Type of Item: " << item->getType();
++item;
}

Implements ISmbiosTable.

Definition at line 123 of file SmbiosTable.cpp.

Referenced by SmbiosTable::streamify().

SmbiosTable::const_iterator begin ( ) const
virtual

Standard iterator interface. Points to first table item.

Standard iterator interface. Points to first table item.

       \returns iterator or const_iterator
       Example Iterator Usage:
while( item != table->end() )
{
cout << "Type of Item: " << item->getType();
++item;
}

Implements ISmbiosTable.

Definition at line 128 of file SmbiosTable.cpp.

void cacheItem ( const void *  ptr,
ISmbiosItem newitem 
) const
virtual

Definition at line 114 of file SmbiosTable.cpp.

References SmbiosTable::itemList.

Referenced by SmbiosTable::getSmbiosItem().

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 243 of file SmbiosTable.cpp.

References SmbiosTable::itemList.

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

SmbiosTable::iterator end ( )
virtual

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

Standard iterator interface. Points to first table item.

       \returns iterator or const_iterator
       Example Iterator Usage:
while( item != table->end() )
{
cout << "Type of Item: " << item->getType();
++item;
}

Implements ISmbiosTable.

Definition at line 133 of file SmbiosTable.cpp.

Referenced by SmbiosTable::streamify().

SmbiosTable::const_iterator end ( ) const
virtual

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

Used by const_iterator. Standard iterator interface. Points to first table item.

       \returns iterator or const_iterator
       Example Iterator Usage:
while( item != table->end() )
{
cout << "Type of Item: " << item->getType();
++item;
}

Implements ISmbiosTable.

Definition at line 138 of file SmbiosTable.cpp.

ISmbiosItem * getCachedItem ( const void *  itemPtr) const
virtual

Definition at line 96 of file SmbiosTable.cpp.

References _, and SmbiosTable::itemList.

Referenced by SmbiosTable::getSmbiosItem().

int getNumberOfEntries ( ) const
virtual

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

Implements ISmbiosTable.

Definition at line 353 of file SmbiosTable.cpp.

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

ISmbiosItem & getSmbiosItem ( const u8 current)
virtual

Implements ISmbiosTable.

Definition at line 286 of file SmbiosTable.cpp.

References SmbiosTable::cacheItem(), SmbiosTable::getCachedItem(), and SmbiosTable::makeItem().

Referenced by SmbiosTable::getSmbiosItem().

Here is the call graph for this function:

const ISmbiosItem & getSmbiosItem ( const u8 current) const
virtual

Implements ISmbiosTable.

Definition at line 281 of file SmbiosTable.cpp.

References SmbiosTable::getSmbiosItem().

Here is the call graph for this function:

bool getStrictValidationMode ( ) const
virtual

Definition at line 262 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 358 of file SmbiosTable.cpp.

References SmbiosTable::table_header.

void initializeWorkaround ( ) const
virtual

Definition at line 209 of file SmbiosTable.cpp.

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

Referenced by SmbiosFactoryImpl::makeNew().

Here is the call graph for this function:

ISmbiosItem & makeItem ( const void *  header = 0) const
protectedvirtual

Definition at line 268 of file SmbiosTable.cpp.

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

Referenced by SmbiosTable::getSmbiosItem().

const u8 * nextSmbiosStruct ( const u8 current = 0) const
virtual
SmbiosTable::iterator operator[] ( const int  )
virtual

Standard indexed access by integer item type.

        The operator[] method returns an \a iterator that can be used to
       iterator over all items in the table of the supplied \a 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::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;
See Also
operator[]( const std::string & ) const

Implements ISmbiosTable.

Definition at line 143 of file SmbiosTable.cpp.

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

Standard indexed access by integer item type.

Standard indexed access by integer item type.

        The operator[] method returns an \a iterator that can be used to
       iterator over all items in the table of the supplied \a 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::iterator item1 = (*table)[0];
cout << "The BIOS Version is: " << item1->getString(0x05) << endl;
See Also
operator[]( const std::string & ) const

Implements ISmbiosTable.

Definition at line 148 of file SmbiosTable.cpp.

virtual iterator operator[] ( const std::string &  )
virtual
virtual const_iterator operator[] ( const std::string &  ) const
virtual
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
mpass in a bool value to turn raw mode on or off.

Implements ISmbiosTable.

Definition at line 238 of file SmbiosTable.cpp.

References SmbiosTable::initializing.

void reReadTable ( )
privatevirtual
void setStrictValidationMode ( bool  mode) const
virtual

Definition at line 257 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.

Definition at line 363 of file SmbiosTable.cpp.

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

Here is the call graph for this function:

Member Data Documentation

bool initializing
mutableprotected
std::map< const void *, ISmbiosItem *> itemList
mutableprotected
unsigned long offset
mutableprivate

Definition at line 174 of file SmbiosImpl.h.

const u8* smbiosBuffer
protected
std::vector<SmbiosStrategy *> strategyList
private

Definition at line 175 of file SmbiosImpl.h.

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

bool strictValidationMode
mutableprotected
std::auto_ptr<SmbiosWorkaroundTable> workaround
mutableprotected

Definition at line 166 of file SmbiosImpl.h.

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


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