Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CmosRWImpl.h

Go to the documentation of this file.
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
00002 /*
00003  * Copyright (C) 2005 Dell Inc.
00004  *  by Michael Brown <Michael_E_Brown@dell.com>
00005  * Licensed under the Open Software License version 2.1
00006  *
00007  * Alternatively, you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation; either version 2 of the License,
00010  * or (at your option) any later version.
00011 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00015  * See the GNU General Public License for more details.
00016  */
00017 
00018 #ifndef CMOSRWIMPL_H
00019 #define CMOSRWIMPL_H
00020 
00021 #include "smbios/IObserver.h"
00022 #include "smbios/ICmosRW.h"
00023 #include "ExceptionImpl.h"
00024 
00025 namespace cmos
00026 {
00027     // define our exceptions
00028     DEFINE_EXCEPTION_EX( InvalidCmosRWModeImpl, cmos, InvalidCmosRWMode );
00029 
00030     class Suppressable : public observer::IObservable
00031     {
00032     public:
00033         Suppressable();
00034         void suppressNotification(bool sup = true) const;
00035         void resumeNotification(bool doNotify = true) const;
00036         bool isNotifySuppressed() const;
00037         virtual ~Suppressable();
00038 
00039     protected:
00040         mutable bool suppressNotify;
00041     };
00042 
00043     class CmosRWFile : public ICmosRW, public Suppressable
00044     {
00045     public:
00046         // CONSTRUCTORS, DESTRUCTOR, and ASSIGNMENT
00047         explicit CmosRWFile (const std::string &File);
00048         CmosRWFile& operator = (const CmosRWFile & source);
00049         virtual ~CmosRWFile();
00050 
00051         u8 readByte( u32 indexPort, u32 dataPort, u32 offset ) const;
00052         void writeByte( u32 indexPort, u32 dataPort, u32 offset, u8 byte ) const;
00053 
00054     protected:
00055         std::string fileName;
00056 
00057     private:
00058         CmosRWFile (const CmosRWFile & source); //copy constructor
00059     };
00060 
00061 
00062     class CmosRWIo : public ICmosRW, public Suppressable
00063     {
00064     public:
00065         // CONSTRUCTORS, DESTRUCTOR, and ASSIGNMENT
00066         explicit CmosRWIo ();
00067         CmosRWIo& operator = (const CmosRWIo & source);
00068         virtual ~CmosRWIo();
00069 
00070         u8 readByte( u32 indexPort, u32 dataPort, u32 offset ) const;
00071         void writeByte( u32 indexPort, u32 dataPort, u32 offset, u8 byte ) const;
00072     private:
00073         CmosRWIo (const CmosRWIo & source); //copy constructor
00074     };
00075 
00076 }
00077 
00078 
00079 #endif  /* CMOSRWIMPL_H */

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5