20 #define LIBSMBIOS_SOURCE
35 memcpy( const_cast<indexed_io_token *>(&
token), initToken,
sizeof(
token) );
38 const u8 *ptr =
item->getBufferCopy(size) ;
39 memcpy( const_cast<indexed_io_access_structure*>(&
structure), ptr,
sizeof(
structure) );
40 delete []
const_cast<u8 *
>(ptr);
65 throw InvalidAccessModeImpl(
"tried to call isActive() on a string token." );
84 throw InvalidAccessModeImpl(
"tried to activate() a string token." );
119 throw InvalidAccessModeImpl(
"tried to call getString() on a bit token.");
121 bool allocatedMem =
false;
128 byteArray =
new u8[size];
132 if( size < strSize + 1 )
133 throw ParameterErrorImpl(
"called getString() with too small of a buffer.");
135 for(
unsigned int i=0; i<strSize; ++i )
148 string retval(reinterpret_cast<const char *>(byteArray));
153 allocatedMem =
false;
158 catch (
const std::exception & )
170 throw InvalidAccessModeImpl(
"tried to setString() on non-string.");
174 u8 *targetBuffer =
new u8[strSize];
175 memset(targetBuffer, 0, strSize);
176 memcpy( targetBuffer, byteArray, size < strSize ? size : strSize );
187 delete[](targetBuffer);
193 throw InvalidAccessModeImpl(
"tried to getStringLength on non-string.");
210 std::ios::fmtflags old_opts = cout.flags ();
212 cout <<
"DMI type 0x" << hex << setfill ('0') << setw (2) << static_cast<int>(
structure.
type);
213 cout <<
" Handle 0x" << hex << setfill ('0') << setw (4) << static_cast<int>(
structure.
handle);
216 cout <<
" Type 0x" << hex << setw(4) << static_cast<int>(
getType());
217 cout <<
" Location 0x" << hex << setw(2) << static_cast<int>(
token.
location);
220 cout <<
" STRING Length " << dec << setfill(
'0') << setw(2) <<
getStringLength() ;
225 cout <<
" AND(" << setw(1) <<
static_cast<int>(
token.
andMask) <<
") ";
226 cout <<
"OR(" << setw(1) <<
static_cast<int>(
token.
orValue) <<
") ";
227 cout <<
" BITFIELD: " <<
isActive();
230 cout.flags (old_opts);