00001 /* 00002 * anvil 00003 * Copyright (C) 2007 Karl W. Pfalzer 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the 00017 * Free Software Foundation, Inc. 00018 * 51 Franklin Street, Fifth Floor 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 #if !defined(_anvil_tbmgr_hxx_) 00022 # define _anvil_tbmgr_hxx_ 00023 00024 #include <iostream> 00025 #include "xyzzy/fixedpt.hxx" 00026 #include "xyzzy/refcnt.hxx" 00027 00028 namespace anvil 00029 { 00030 00031 namespace tb 00032 { 00033 00034 using namespace xyzzy; 00035 00036 class IManager; 00037 class IObject; 00038 00039 typedef PTRcObjPtr<IManager> TRcIManager; 00040 typedef PTRcObjPtr<IObject> TRcIObject; 00041 00042 // Manager interface. 00043 class IManager : public TRcObj 00044 { 00045 public: 00046 // Return an object which references dut. 00047 virtual TRcIObject factory(const char *nm) = 0; 00048 00049 // If assignDelay == ~0, do not assign; thus same as runDut. 00050 virtual void assignAndRunDut(TUint32 assignDelay, TUint32 runFor) = 0; 00051 00052 virtual void runDut(TUint32 runFor); 00053 00054 virtual void waitOnDut() = 0; 00055 00056 virtual void setExceptionOnX(bool v) = 0; 00057 00058 virtual bool getExceptionOnX() const = 0; 00059 00060 virtual ~IManager() = 0; 00061 00062 static IManager* theOne() {return m_stpTheOne;} 00063 00064 protected: 00065 explicit IManager(); 00066 00067 private: 00068 static IManager* m_stpTheOne; 00069 }; 00070 00071 class IObject : public TRcObj 00072 { 00073 public: 00074 virtual const char *getName() const = 0; 00075 00076 virtual bool operator==(bool b) const = 0; 00077 00078 virtual bool operator!=(bool b) const {return !this->operator==(b);} 00079 00080 virtual bool operator==(TInt32 v) const = 0; 00081 00082 virtual bool operator!=(TInt32 v) const 00083 { 00084 return !this->operator==(v); 00085 } 00086 00087 virtual bool operator==(const PTFixedPtBase<TInt32> &r) const = 0; 00088 00089 virtual bool operator!=(const PTFixedPtBase<TInt32> &r) const 00090 { 00091 return !this->operator==(r); 00092 } 00093 00094 virtual const IObject& operator=(bool b); 00095 00096 virtual const IObject& operator=(TInt32 v); 00097 00098 virtual const IObject& operator=(const PTFixedPtBase<TInt32> &r); 00099 00100 virtual int getNumBits() const = 0; 00101 00102 virtual operator bool() const = 0; 00103 00104 virtual operator TInt32() const = 0; 00105 00106 virtual ~IObject() = 0; 00107 00108 protected: 00109 explicit IObject(); 00110 }; 00111 00112 std::ostream& 00113 operator<<(std::ostream &os, const IObject &r); 00114 00115 std::ostream& 00116 operator<<(std::ostream &os, const TRcIObject obj); 00117 00118 }; //namespace tb 00119 00120 }; //namespace anvil 00121 00122 #endif //_anvil_tbmgr_hxx_