クラス sc_core::sc_semaphore

#include <sc_semaphore.h>

sc_core::sc_semaphoreに対する継承グラフ

Inheritance graph
[凡例]

すべてのメンバ一覧

Public メソッド

 sc_semaphore (int init_value_)
 sc_semaphore (const char *name_, int init_value_)
virtual int wait ()
virtual int trywait ()
virtual int post ()
virtual int get_value () const
virtual const char * kind () const

Protected メソッド

bool in_use () const
void report_error (const char *id, const char *add_msg=0) const

Protected 変数

sc_event m_free
int m_value

Private メソッド

 sc_semaphore (const sc_semaphore &)
sc_semaphoreoperator= (const sc_semaphore &)


説明

sc_semaphore.h65 行で定義されています。


コンストラクタとデストラクタ

sc_core::sc_semaphore::sc_semaphore ( int  init_value_  )  [explicit]

sc_semaphore.cpp74 行で定義されています。

00075 : sc_prim_channel( sc_gen_unique_name( "semaphore" ) ),
00076   m_value( init_value_ )
00077 {
00078     if( m_value < 0 ) {
00079         report_error( SC_ID_INVALID_SEMAPHORE_VALUE_ );
00080     }
00081 }

sc_core::sc_semaphore::sc_semaphore ( const char *  name_,
int  init_value_ 
)

sc_semaphore.cpp83 行で定義されています。

00084 : sc_prim_channel( name_ ), m_value( init_value_ )
00085 {
00086     if( m_value < 0 ) {
00087         report_error( SC_ID_INVALID_SEMAPHORE_VALUE_ );
00088     }
00089 }

sc_core::sc_semaphore::sc_semaphore ( const sc_semaphore  )  [private]


関数

int sc_core::sc_semaphore::wait (  )  [virtual]

sc_core::sc_prim_channelを再定義しています。

sc_semaphore.cpp97 行で定義されています。

00098 {
00099     while( in_use() ) {
00100         sc_prim_channel::wait( m_free );
00101     }
00102     -- m_value;
00103     return 0;
00104 }

int sc_core::sc_semaphore::trywait (  )  [virtual]

sc_core::sc_semaphore_ifを実装しています。

sc_semaphore.cpp110 行で定義されています。

00111 {
00112     if( in_use() ) {
00113         return -1;
00114     }
00115     -- m_value;
00116     return 0;
00117 }

int sc_core::sc_semaphore::post (  )  [virtual]

sc_core::sc_semaphore_ifを実装しています。

sc_semaphore.cpp123 行で定義されています。

00124 {
00125     ++m_value;
00126     m_free.notify();
00127     return 0;
00128 }

virtual int sc_core::sc_semaphore::get_value (  )  const [inline, virtual]

sc_core::sc_semaphore_ifを実装しています。

sc_semaphore.h89 行で定義されています。

00090         { return m_value; }

virtual const char* sc_core::sc_semaphore::kind (  )  const [inline, virtual]

sc_core::sc_prim_channelを再定義しています。

sc_semaphore.h92 行で定義されています。

00093         { return "sc_semaphore"; }

bool sc_core::sc_semaphore::in_use (  )  const [inline, protected]

sc_semaphore.h99 行で定義されています。

00100         { return ( m_value <= 0 ); }

void sc_core::sc_semaphore::report_error ( const char *  id,
const char *  add_msg = 0 
) const [protected]

sc_semaphore.cpp60 行で定義されています。

00061 {
00062     char msg[BUFSIZ];
00063     if( add_msg != 0 ) {
00064         std::sprintf( msg, "%s: semaphore '%s'", add_msg, name() );
00065     } else {
00066         std::sprintf( msg, "semaphore '%s'", name() );
00067     }
00068     SC_REPORT_ERROR( id, msg );
00069 }

sc_semaphore& sc_core::sc_semaphore::operator= ( const sc_semaphore  )  [private]


変数

sc_semaphore.h108 行で定義されています。

sc_semaphore.h109 行で定義されています。


このクラスの説明は次のファイルから生成されました:

SystemCに対してFri Jun 6 20:11:48 2008に生成されました。  doxygen 1.5.6