SMBIOS Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
libraries
token
TokenD6.cpp
Go to the documentation of this file.
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
* vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
3
*
4
* Copyright (C) 2005 Dell Inc.
5
* by Michael Brown <Michael_E_Brown@dell.com>
6
* Licensed under the Open Software License version 2.1
7
*
8
* Alternatively, you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published
10
* by the Free Software Foundation; either version 2 of the License,
11
* or (at your option) any later version.
12
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
* See the GNU General Public License for more details.
17
*/
18
19
// compat header should always be first header if including system headers
20
#define LIBSMBIOS_SOURCE
21
#include "
smbios/compat.h
"
22
23
#include <sstream>
24
#include <iomanip>
25
#include <string.h>
26
27
#include "
TokenImpl.h
"
28
29
using namespace
std;
30
31
namespace
smbios
32
{
33
CmosTokenD6::CmosTokenD6(
const
smbios::ISmbiosItem
&initItem, std::vector< CmosRWChecksumObserver > &initChecksumList)
34
:
CmosTokenD5
(initItem, initChecksumList)
35
{
36
size_t
size;
37
const
u8
*ptr =
item
->getBufferCopy(size) ;
// MUST DELETE[]!
38
size = size <
sizeof
(
structure
)? size :
sizeof
(
structure
);
39
memcpy( const_cast<dell_protected_value_2_structure*>(&
structure
), ptr, size );
40
41
// have to copy into parents "structure"
42
size = size <
sizeof
(
CmosTokenD5::structure
)? size :
sizeof
(
CmosTokenD5::structure
);
43
memcpy(
44
const_cast<dell_protected_value_1_structure*>(&(
CmosTokenD5::structure
)),
45
ptr,
46
sizeof
(
CmosTokenD5::structure
) );
47
48
delete
[]
const_cast<
u8
*
>
(ptr);
//const_cast to fix msvc++
49
}
50
51
string
CmosTokenD6::getTokenClass
()
const
52
{
53
return
"TokenD6"
;
54
}
55
56
void
CmosTokenD6::addChecksumObserver
()
const
57
{
58
// run superclass to get observer for value check
59
CmosTokenD5::addChecksumObserver
();
60
61
62
// add an observer for the checked range
63
ostringstream ost;
64
ost << *
item
;
65
66
CmosRWChecksumObserver
chk(
67
ost.str(),
68
cmos
,
69
structure
.
rangeCheckType
,
70
structure
.
indexPort
,
71
structure
.
dataPort
,
72
structure
.
rangeCheckStart
,
73
structure
.
rangeCheckEnd
,
74
structure
.
rangeCheckIndex
);
75
76
checksumList
.push_back( chk );
77
}
78
}
Generated on Thu Mar 27 2014 09:27:18 for SMBIOS Library by
1.8.1.2