검색결과 리스트
글
/* 간단한 함수를 소개 */
boost::signal< void() > sig01;
sig01.connect( 1, Func1() );
sig01.connect( 0, Func2() );
실행결과
Func2()
Func1()
// 컨넥시 인덱스를 넣어주면 자동으로 인덱스 순으로 정렬이 된다.
//-----------------------------------
void Func1( Arg ) {
to do 1
}
void Func2( Arg ) {
to do 2
}
void Func3( Arg ) {
to do 3
}
boost::signal< void( Arg ) > sig02;
sig02.connect( &Func1 );
sig02.connect( &Func2 );
sig02.connect( &Func3 );
sig02( arg );
실행결과
to do 1
to do 2
to do 3
// 컨넥이 된 모든 함수로 arg를 보낸다. 그리고 각 함수가 실행됨.
//-----------------------------------
int Func4( Arg ) {
return 4;
}
int Func5( Arg ) {
return 5;
}
// 연결된 함수의 리턴값이 int인 것을 주의
boost::signal< int( Arg ) > sig03;
sig03.connect( &Func4 );
sig03.connect( &Func5 );
cout << sig03( Arg ) << endl;
실행결과
5
// Func4 에서 리턴 4를 하지만 Func5 에서 다시 5를 리턴하므로 결과는 5!! 빠밤!
boost::signal< void() > sig01;
sig01.connect( 1, Func1() );
sig01.connect( 0, Func2() );
실행결과
Func2()
Func1()
// 컨넥시 인덱스를 넣어주면 자동으로 인덱스 순으로 정렬이 된다.
//-----------------------------------
void Func1( Arg ) {
to do 1
}
void Func2( Arg ) {
to do 2
}
void Func3( Arg ) {
to do 3
}
boost::signal< void( Arg ) > sig02;
sig02.connect( &Func1 );
sig02.connect( &Func2 );
sig02.connect( &Func3 );
sig02( arg );
실행결과
to do 1
to do 2
to do 3
// 컨넥이 된 모든 함수로 arg를 보낸다. 그리고 각 함수가 실행됨.
//-----------------------------------
int Func4( Arg ) {
return 4;
}
int Func5( Arg ) {
return 5;
}
// 연결된 함수의 리턴값이 int인 것을 주의
boost::signal< int( Arg ) > sig03;
sig03.connect( &Func4 );
sig03.connect( &Func5 );
cout << sig03( Arg ) << endl;
실행결과
5
// Func4 에서 리턴 4를 하지만 Func5 에서 다시 5를 리턴하므로 결과는 5!! 빠밤!
'Programming > Boost' 카테고리의 다른 글
Bind 공부중인거 정리. < 01 > (0) | 2009.08.20 |
---|---|
Signal 공부중인거 정리. < 04 > (0) | 2009.08.20 |
Signal 공부중인거 정리. < 02 > - 1 (0) | 2009.08.19 |
Signal 공부중인거 정리. < 02 > (0) | 2009.08.19 |
Signal 공부중인거 정리. < 01 > (0) | 2009.08.19 |
RECENT COMMENT