rc_semaphore_accessor.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  */
00039 #ifndef RC_SEMAPHORE_ACCESSOR_H_
00040 #define RC_SEMAPHORE_ACCESSOR_H_
00041 
00042 #include "ReChannel/communication/accessors/rc_accessor.h"
00043 
00044 namespace ReChannel {
00045 
00049 template<>
00050 class rc_fallback_interface<sc_semaphore_if>
00051 : virtual public sc_semaphore_if
00052 {
00053 public:
00054     virtual int wait()
00055     {
00056         SC_REPORT_WARNING(RC_ID_UNDEFINED_BLOCKING_ACCESS_WARNING_, 0);
00057         ::sc_core::wait(p_undef);
00058         return 0;
00059     }
00060     virtual int trywait()
00061         { return -1; }
00062     virtual int post()
00063         { return 0; }
00064     virtual int get_value() const
00065         { return 0; }
00066 private:
00067     sc_event p_undef;
00068 };
00069 
00073 RC_ACCESSOR(sc_semaphore_if)
00074 {
00075     RC_ACCESSOR_CTOR(sc_semaphore_if) { }
00076 
00077     virtual int wait()
00078     {
00079         return this->rc_forward(&if_type::wait);
00080     }
00081     virtual int trywait()
00082     {
00083         return this->rc_nb_forward(&if_type::trywait);
00084     }
00085     virtual int post()
00086     {
00087         return this->rc_nb_forward(&if_type::post);
00088     }
00089     virtual int get_value() const
00090     {
00091         return this->rc_nb_forward(&if_type::get_value);
00092     }
00093 };
00094 
00095 } // namespace ReChannel
00096 
00097 #endif // RC_SEMAPHORE_ACCESSOR_H_
00098 //
00099 // $Id: rc_semaphore_accessor.h,v 1.7 2007/11/23 13:25:45 felke Exp $
00100 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/accessors/rc_semaphore_accessor.h,v $
00101 //
00102 

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