00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #define LIBSMBIOS_SOURCE
00020 #include "SmbiosImpl.h"
00021
00022
00023 #include "smbios/message.h"
00024
00025 using namespace smbiosLowlevel;
00026 using namespace std;
00027
00028 namespace smbios
00029 {
00030 ISmbiosItem & SmbiosTableIteratorBase::dereference () const
00031 {
00032 if (0 == current)
00033 {
00034 throw ParameterExceptionImpl (_("Programmer error: attempt to dereference a Null iterator."));
00035 }
00036
00037 const SmbiosTable *t = dynamic_cast<const SmbiosTable *>(table);
00038
00039 if( 0 == t )
00040 {
00041 throw InternalErrorImpl(_("Smbios table not found or not initialized"));
00042 }
00043
00044 ISmbiosItem *item = t->getCachedItem( current );
00045 if ( 0 != item )
00046 return *(item);
00047
00048 ISmbiosItem &newitem = t->makeItem( current );
00049
00050 t->cacheItem( current, newitem );
00051
00052 return newitem;
00053 }
00054
00055 void SmbiosTableIteratorBase::incrementIterator ()
00056 {
00057 const SmbiosTable *t = dynamic_cast<const SmbiosTable *>(table);
00058
00059 while ((0 != t))
00060 {
00061 current = t->nextSmbiosStruct (current);
00062 if ((-1 == matchType) || (0 == current)
00063 || ( reinterpret_cast<const smbios_structure_header *>(current)->type == matchType))
00064 break;
00065 }
00066 }
00067
00068 }