00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 }
00096
00097 #endif // RC_SEMAPHORE_ACCESSOR_H_
00098
00099
00100
00101
00102