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

ISmbiosItem Class Reference

Interface definition for Smbios Item operations. More...

#include <ISmbios.h>

Inheritance diagram for ISmbiosItem:

SmbiosItem List of all members.

Public Types


Public Member Functions

virtual ~ISmbiosItem ()
 ISmbiosItem ()
virtual std::auto_ptr< const
clone () const=0
virtual std::auto_ptr< ISmbiosItemclone ()=0
virtual std::ostream & streamify (std::ostream &cout) const=0
virtual u8 getType () const=0
virtual u8 getLength () const=0
virtual u16 getHandle () const=0
virtual void getData (unsigned int offset, void *out, size_t size) const=0
virtual const u8getBufferCopy (size_t &length) const=0
virtual const size_t getBufferSize () const=0
 Returns the buffer size of the item.

virtual const char * getStringByStringNumber (u8) const=0

Detailed Description

Interface definition for Smbios Item operations.

Theory of Operation

The ISmbiosItem class models access to individual items in the SMBIOS table. It does this by providing a set of accessor functions that allow structured data to be pulled out of the item.

There are two modes of operation, depending on how the ISmbiosTable is set up. First, normal mode allows clients to access any information in the Item by offset and length. This access mode imposes no checks or typing requirements on the data being accessed aside from bounds checking that no buffer overruns occur. The drawback of this mode is that the client code must always know the exact data length and offset of any data that they want to extract.

The next mode of operation is XML enhanced operation. In this mode, the client can pass in strings representing what data is requested. The item will use an XML file to look up the exact offset of this data using the string passed as a referenced. Then the item returns the data to the client. The advantage of this access mode is that data is strongly typed, and the client is prevented from invalid access modes. For example, they may not access half of a u16 data item using the getU8() function call.

Class Hierarchy

The class heirarchy for ISmbiosItem is simple. The abstract interface class is ISmbiosItem. The full implementation of normal-mode access is in SmbiosItem, and the XML enhanced mode access is implemented in SmbiosItemXml (formerly SmbiosItemAccess).


The SmbiosItem is implemented with its own data buffer for item data. This is reasonable as the max size for any single item is 256 bytes of data. Upon construction, the Item copies the relevant item data out of the containing table and from then maintains its own memory buffer.

Lifetime and Ownership

The SmbiosItem is destroyed when the containing table is destroyed. There is no method to allow the table to release an item. The copy constructor is purposefully made 'private' to the Item to disallow third parties from taking bad references to individual items.

Definition at line 275 of file ISmbios.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:

Definition at line 355 of file ISmbios.h.

Constructor & Destructor Documentation

~ISmbiosItem  )  [virtual]


Definition at line 34 of file SmbiosItem.cpp.

ISmbiosItem  ) 

Definition at line 37 of file SmbiosItem.cpp.

Member Function Documentation

virtual std::auto_ptr<ISmbiosItem> clone  )  [pure virtual]

Implemented in SmbiosItem.

virtual std::auto_ptr<const ISmbiosItem> clone  )  const [pure virtual]

Implemented in SmbiosItem.

virtual const u8* getBufferCopy size_t &  length  )  const [pure virtual]

Implemented in SmbiosItem.

virtual const size_t getBufferSize  )  const [pure virtual]

Returns the buffer size of the item.

Implemented in SmbiosItem.

virtual void getData unsigned int  offset,
void *  out,
size_t  size
const [pure virtual]

Set of accessor functions: getU8(), getU16(), getU32(), and getU64() Returns a (byte|word|dword|qword) field from the Item.

The offset specified is an int representing the a valid offset within the table. Method will return a u8/u16/u32/u64 (depending on function called).

These methods all check the offset parameter for out of bounds conditions. They will throw exceptions on attempts to access data outside the length of the present item.

offset The offset to the field within the Item.
out void pointer to where to store output data
size size of data to return
The (byte|word|dword|qword) at offset. Throws smbios::SmbiosItemDataOutOfBounds or smbios::SmbiosParseException on error.
These methods are unchecked access. There is no verification that (for example) when you use getU8() that the location you are trying to access is actually a U8.

Implemented in SmbiosItem.

Referenced by smbios::compare(), smbios::getBits_FromItem(), smbios::getData(), smbios::getData_UsingXml(), smbios::getU16_FromItem(), smbios::getU32_FromItem(), smbios::getU64_FromItem(), and smbios::getU8_FromItem().

virtual u16 getHandle  )  const [pure virtual]

Returns the Handle field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.

The Handle value.

Implemented in SmbiosItem.

virtual u8 getLength  )  const [pure virtual]

Returns the Length field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.

The Length value.

Implemented in SmbiosItem.

virtual const char* getStringByStringNumber u8   )  const [pure virtual]

Not likely to be useful to regular client code. It is public mainly to help in writing Unit Tests. Clients should normally use getString().

Implemented in SmbiosItem.

Referenced by smbios::getString_FromItem().

virtual u8 getType  )  const [pure virtual]

Returns the Type field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.

The Type value.

Implemented in SmbiosItem.

Referenced by SmbiosWorkaroundTable::fixupItem(), smbios::getBits_FromItem(), smbios::getData_UsingXml(), smbios::getString_FromItem(), and testStandalone::testItemIdentity().

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

Used by 'std::ostream &smbios::operator <<( std::ostream &, ISmbiosItem&)' to print out the item info.

Not particularly useful for clients. Use operator<< instead.

Implemented in SmbiosItem.

Referenced by smbios::operator<<().

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