SmbiosTableXml Class Reference

#include <SmbiosXmlImpl_xerces.h>

Inheritance diagram for SmbiosTableXml:

SmbiosTable ISmbiosTable List of all members.

Public Types

typedef SmbiosTableIterator iterator
typedef ConstSmbiosTableIterator const_iterator

Public Member Functions

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 std::ostream & streamify (std::ostream &cout) const
 Used by operator << (std::ostream & cout, const ISmbiosTable & ) to.
virtual ~SmbiosTableXml ()
 SmbiosTableXml (std::vector< SmbiosStrategy * > initStrategyList, bool strictValidation=0)
void setXmlFilePath (std::string)
int getTypeForString (const std::string) const
const std::string getStringForType (const int) const
const XERCES_CPP_NAMESPACE_QUALIFIER
DOMDocument * 
getXmlDoc () const
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 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 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

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

Protected Attributes

std::string xmlFile
XERCES_CPP_NAMESPACE_QUALIFIER
DOMBuilder * 
parser
XERCES_CPP_NAMESPACE_QUALIFIER
DOMDocument * 
doc
bool xmlInitialized
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

 SmbiosTableXml (const SmbiosTableXml &source)
SmbiosTableXmloperator= (const SmbiosTableXml &source)

Friends

class SmbiosTableIteratorBase

Detailed Description

Definition at line 69 of file SmbiosXmlImpl_xerces.h.


Member Typedef Documentation

typedef ConstSmbiosTableIterator const_iterator [inherited]
 

Definition at line 123 of file ISmbios.h.

typedef SmbiosTableIterator iterator [inherited]
 

Definition at line 122 of file ISmbios.h.


Constructor & Destructor Documentation

~SmbiosTableXml  )  [virtual]
 

Definition at line 247 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::doc, SmbiosTableXml::parser, and SmbiosTableXml::xmlInitialized.

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

Definition at line 240 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::xmlFile.

SmbiosTableXml  )  [protected]
 

Definition at line 234 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::xmlFile.

SmbiosTableXml const SmbiosTableXml source  )  [private]
 


Member Function Documentation

SmbiosTable::const_iterator begin  )  const [virtual, inherited]
 

Standard iterator interface. Points to first table item.

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

SmbiosTable::iterator begin  )  [virtual, inherited]
 

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

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

Definition at line 114 of file SmbiosTable.cpp.

References SmbiosTable::itemList.

Referenced by SmbiosTableIteratorBase::dereference().

void clearItemCache  )  const [virtual, inherited]
 

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::const_iterator end  )  const [virtual, inherited]
 

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

SmbiosTable::iterator end  )  [virtual, inherited]
 

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

ISmbiosItem * getCachedItem const void *   )  const [virtual, inherited]
 

Definition at line 96 of file SmbiosTable.cpp.

References _, and SmbiosTable::itemList.

Referenced by SmbiosTableIteratorBase::dereference().

int getNumberOfEntries  )  const [virtual, inherited]
 

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

Implements ISmbiosTable.

Definition at line 338 of file SmbiosTable.cpp.

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

bool getStrictValidationMode  )  const [virtual, inherited]
 

Definition at line 262 of file SmbiosTable.cpp.

References SmbiosTable::strictValidationMode.

Referenced by SmbiosTable::reReadTable().

const string getStringForType const   int  )  const
 

Definition at line 329 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::doc, and smbios::getStringForType().

smbiosLowlevel::smbios_table_entry_point getTableEPS  )  const [virtual, inherited]
 

Returns the table entry point structure.

Implements ISmbiosTable.

Definition at line 343 of file SmbiosTable.cpp.

References SmbiosTable::table_header.

int getTypeForString const std::string   )  const
 

const DOMDocument * getXmlDoc  )  const
 

Definition at line 318 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::doc.

void initializeWorkaround  )  const [virtual, inherited]
 

Definition at line 209 of file SmbiosTable.cpp.

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

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

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

Reimplemented from SmbiosTable.

Definition at line 260 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::doc, SmbiosTable::initializing, SmbiosTable::workaround, and SmbiosTableXml::xmlFile.

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

Definition at line 281 of file SmbiosTable.cpp.

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

SmbiosTableXml& operator= const SmbiosTableXml source  )  [private]
 

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

Standard indexed access by integer item type.

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

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

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

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

Standard indexed access by string description. XML ENHANCED.

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.

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
See also:
operator[]( const int )

Reimplemented from SmbiosTable.

virtual 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.

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
See also:
operator[]( const int )

Reimplemented from SmbiosTable.

void rawMode bool  m  )  const [virtual, inherited]
 

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

References SmbiosTable::initializing.

void setStrictValidationMode bool  mode  )  const [virtual, inherited]
 

Definition at line 257 of file SmbiosTable.cpp.

References SmbiosTable::strictValidationMode.

void setXmlFilePath std::string   ) 
 

Definition at line 279 of file SmbiosXml_xerces.cpp.

References SmbiosTableXml::doc, xmlutils::getParser(), smbios::getSmbiosXmlDoc(), SmbiosTableXml::parser, smbios::validateSmbiosXmlDoc(), SmbiosTableXml::xmlFile, and SmbiosTableXml::xmlInitialized.

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

virtual std::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.

Reimplemented from SmbiosTable.


Friends And Related Function Documentation

friend class SmbiosTableIteratorBase [friend, inherited]
 

Definition at line 142 of file SmbiosImpl.h.


Member Data Documentation

XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc [protected]
 

Definition at line 105 of file SmbiosXmlImpl_xerces.h.

Referenced by SmbiosTableXml::getStringForType(), SmbiosTableXml::getXmlDoc(), SmbiosTableXml::makeItem(), SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::~SmbiosTableXml().

bool initializing [mutable, protected, inherited]
 

Definition at line 156 of file SmbiosImpl.h.

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

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

Definition at line 155 of file SmbiosImpl.h.

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

XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder* parser [protected]
 

Definition at line 100 of file SmbiosXmlImpl_xerces.h.

Referenced by SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::~SmbiosTableXml().

const u8* smbiosBuffer [protected, inherited]
 

Definition at line 159 of file SmbiosImpl.h.

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

bool strictValidationMode [mutable, protected, inherited]
 

Definition at line 157 of file SmbiosImpl.h.

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

smbiosLowlevel::smbios_table_entry_point table_header [protected, inherited]
 

Definition at line 160 of file SmbiosImpl.h.

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

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

Definition at line 158 of file SmbiosImpl.h.

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

std::string xmlFile [protected]
 

Definition at line 96 of file SmbiosXmlImpl_xerces.h.

Referenced by SmbiosTableXml::makeItem(), SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::SmbiosTableXml().

bool xmlInitialized [protected]
 

Definition at line 109 of file SmbiosXmlImpl_xerces.h.

Referenced by SmbiosTableXml::setXmlFilePath(), and SmbiosTableXml::~SmbiosTableXml().


The documentation for this class was generated from the following files:
Generated on Tue Jan 17 02:59:09 2006 for SMBIOS Library by  doxygen 1.4.6