rc_semaphore.h

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00037 #ifndef RC_SEMAPHORE_H_
00038 #define RC_SEMAPHORE_H_
00039 
00040 #include "ReChannel/components/rc_prim_channel.h"
00041 #include "ReChannel/components/rc_report_ids.h"
00042 
00043 namespace ReChannel {
00044 
00048 class rc_semaphore
00049     : public sc_semaphore_if,
00050       public rc_prim_channel
00051 {
00052 public:
00053 
00054     explicit rc_semaphore(int value_);
00055 
00056     rc_semaphore(const char* name_, int value_);
00057 
00058     inline virtual const char* kind() const
00059         { return "rc_semaphore"; }
00060 
00061     virtual int wait();
00062 
00063     virtual int trywait();
00064 
00065     virtual int post();
00066 
00067     inline virtual int get_value() const
00068         { return m_value; }
00069 
00070 protected:
00071 
00072     virtual void rc_on_reset();    
00073 
00074 protected:
00075 
00076     int      m_value;
00077     int      m_reset_value;
00078     sc_event m_free;
00079 
00080 private:
00081     // disabled
00082     rc_semaphore(const rc_semaphore& other);
00083     rc_semaphore& operator=(const rc_semaphore& other);
00084 };
00085 
00086 } // namespace ReChannel
00087 
00088 #endif //RC_SEMAPHORE_H_
00089 
00090 //
00091 // $Id: rc_semaphore.h,v 1.4 2007/11/23 13:25:45 felke Exp $
00092 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/components/rc_semaphore.h,v $
00093 //
00094 

Generated on Tue Jan 1 23:13:55 2008 for ReChannel by  doxygen 1.5.3