Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SMBIOSIMPL_H
00020 #define SMBIOSIMPL_H
00021
00022 #include "smbios/IMemory.h"
00023 #include "FactoryImpl2.h"
00024 #include "ExceptionImpl.h"
00025
00026 namespace memory
00027 {
00028 DEFINE_EXCEPTION_EX( AccessErrorImpl, memory, AccessError );
00029 DEFINE_EXCEPTION_EX( OutOfBoundsImpl, memory, OutOfBounds );
00030
00031 class MemoryFactoryImpl : public factory::TFactory<MemoryFactory>
00032 {
00033 public:
00034 MemoryFactoryImpl();
00035 virtual ~MemoryFactoryImpl() throw ();
00036 virtual IMemory *getSingleton();
00037 virtual IMemory *makeNew();
00038 protected:
00039 static IMemory *_mem_instance;
00040 };
00041
00042
00043
00044 class MemoryFile : public IMemory
00045 {
00046 public:
00047
00048 explicit MemoryFile (const std::string file);
00049 virtual ~MemoryFile ();
00050
00051 virtual void fillBuffer(u8 *buffer, u64 offset, unsigned int length) const;
00052 virtual u8 getByte(u64 offset) const;
00053 virtual void putByte(u64 offset, u8 value) const;
00054 virtual int incReopenHint() {return ++reopenHint;};
00055 virtual int decReopenHint() {return --reopenHint;};
00056
00057 private:
00058 const std::string filename;
00059 mutable FILE *fd;
00060 bool rw;
00061 int reopenHint;
00062
00063 MemoryFile ();
00064 MemoryFile (const MemoryFile & source);
00065 MemoryFile& operator = (const MemoryFile & source);
00066 };
00067
00068
00069 class MemoryOsSpecific : public IMemory
00070 {
00071 public:
00072
00073 explicit MemoryOsSpecific (const std::string file);
00074 virtual ~MemoryOsSpecific ();
00075
00076 virtual void fillBuffer(u8 *buffer, u64 offset, unsigned int length) const;
00077 virtual u8 getByte(u64 offset) const;
00078 virtual void putByte(u64 offset, u8 value) const;
00079 virtual int incReopenHint();
00080 virtual int decReopenHint();
00081
00082 private:
00083 void *osData;
00084
00085 MemoryOsSpecific ();
00086 MemoryOsSpecific (const MemoryOsSpecific & source);
00087 MemoryOsSpecific& operator = (const MemoryOsSpecific & source);
00088 };
00089 }
00090
00091
00092 #endif