SMBIOS Library
SmbiosWorkaroundImpl.h
Go to the documentation of this file.
1 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2 /*
3  * Copyright (C) 2005 Dell Inc.
4  * by Michael Brown <Michael_E_Brown@dell.com>
5  * Licensed under the Open Software License version 2.1
6  *
7  * Alternatively, you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License,
10  * or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  */
17 
18 //
19 #ifndef ISMBIOSWORKAROUND_H_
20 #define ISMBIOSWORKAROUND_H_
21 
22 // types.h should be first user-defined header.
23 #include "smbios/types.h"
24 #include "smbios/ISmbios.h"
25 #include "FactoryImpl2.h"
26 
27 namespace smbios
28 {
29 
30  // forward decls
31  class SmbiosWorkaroundTable;
32  struct Workaround;
33 
52  class SmbiosWorkaroundFactory : public factory::TFactory<factory::IFactory>
53  {
54  public:
57 
59 
66  virtual ~SmbiosWorkaroundFactory() throw();
67 
69 
76  virtual SmbiosWorkaroundTable *makeNew( const ISmbiosTable *table );
77 
78  protected:
80  };
81 
83  {
84  public:
85  SmbiosWorkaroundTable( const ISmbiosTable * table, const Workaround **initWorkarounds);
86  virtual ~SmbiosWorkaroundTable();
87  void fixupItem( const ISmbiosItem *item, u8 *buffer, size_t bufsize ) const;
88 
89  private:
90  SmbiosWorkaroundTable(); //< not implmented (or legal)
91  void operator =( const SmbiosWorkaroundTable & ); //< not implmented (or legal)
92 
93  int systemId;
94  std::string biosVersion;
96  };
97 
98  enum { TYPE_U8=1, TYPE_U16=2, TYPE_U32=4, TYPE_U64=8 } ;
99 
101  {
102  int systemId;
103  const char * biosMinVersion;
104  const char * biosMaxVersion;
105  };
106 
107  // give data[8] at the beginning to provide the most flexibility for
108  // people trying to initialize static members.
109  union datatron
110  {
111  u8 data[8]; // can only initialize the first member of a union (ansi)
112  u64 dataU64;
116  };
117 
119  {
120  int type;
121  unsigned int fieldOffset;
124  };
125 
126  struct Workaround
127  {
128  const char *name;
131  };
132 
134  {
137  };
138 
139 }
140 
141 #endif /* ISMBIOSWORKAROUND_H_ */