00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2005 by all Contributors. 00005 All Rights reserved. 00006 00007 The contents of this file are subject to the restrictions and limitations 00008 set forth in the SystemC Open Source License Version 2.4 (the "License"); 00009 You may not use this file except in compliance with such restrictions and 00010 limitations. You may obtain instructions on how to receive a copy of the 00011 License at http://www.systemc.org/. Software distributed by Contributors 00012 under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 00013 ANY KIND, either express or implied. See the License for the specific 00014 language governing rights and limitations under the License. 00015 00016 *****************************************************************************/ 00017 00018 /***************************************************************************** 00019 00020 sc_semaphore_if.h -- The sc_semaphore_if interface class. 00021 00022 Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21 00023 00024 *****************************************************************************/ 00025 00026 /***************************************************************************** 00027 00028 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 00029 changes you are making here. 00030 00031 Name, Affiliation, Date: 00032 Description of Modification: 00033 00034 *****************************************************************************/ 00035 00036 #ifndef SC_SEMAPHORE_IF_H 00037 #define SC_SEMAPHORE_IF_H 00038 00039 #include "sysc/communication/sc_interface.h" 00040 00041 namespace sc_core { 00042 00043 // ---------------------------------------------------------------------------- 00044 // CLASS : sc_semaphore_if 00045 // 00046 // The sc_semaphore_if interface class. 00047 // ---------------------------------------------------------------------------- 00048 00049 class sc_semaphore_if 00050 : virtual public sc_interface 00051 { 00052 public: 00053 00054 // the classical operations: wait(), trywait(), and post() 00055 00056 // lock (take) the semaphore, block if not available 00057 virtual int wait() = 0; 00058 00059 // lock (take) the semaphore, return -1 if not available 00060 virtual int trywait() = 0; 00061 00062 // unlock (give) the semaphore 00063 virtual int post() = 0; 00064 00065 // get the value of the semphore 00066 virtual int get_value() const = 0; 00067 00068 protected: 00069 00070 // constructor 00071 00072 sc_semaphore_if() 00073 {} 00074 00075 private: 00076 00077 // disabled 00078 sc_semaphore_if( const sc_semaphore_if& ); 00079 sc_semaphore_if& operator = ( const sc_semaphore_if& ); 00080 }; 00081 00082 } // namespace sc_core 00083 00084 #endif 00085 00086 // Taf!