本文整理汇总了C++中boost::scoped_ptr::join方法的典型用法代码示例。如果您正苦于以下问题:C++ scoped_ptr::join方法的具体用法?C++ scoped_ptr::join怎么用?C++ scoped_ptr::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::scoped_ptr
的用法示例。
在下文中一共展示了scoped_ptr::join方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stop
/** component stop method, stops thread */
virtual void stop()
{
if ( m_running )
{
m_bStop = true;
m_running = false;
if ( m_pThread )
m_pThread->join();
}
}
示例2: main
int main( int ac, char** av )
{
try
{
#ifdef WIN32
_setmode( _fileno( stdout ), _O_BINARY );
#endif
comma::command_line_options options( ac, av );
if( options.exists( "--help,-h" ) ) { usage(); }
csv = comma::csv::options( options, "r,b,e" );
foreground_threshold = options.value( "--foreground-threshold", 1.0 );
min_points_per_partition = options.value( "--min-points-per-partition", 1u );
verbose = options.exists( "--verbose,-v" );
discard = options.exists( "--discard,-d" );
output_all = options.exists( "--output-all" );
::tbb::filter_t< block_t*, block_t* > partition_filter( ::tbb::filter::serial_in_order, &partition_ );
::tbb::filter_t< block_t*, void > write_filter( ::tbb::filter::serial_in_order, &write_block_ );
#ifdef PROFILE
ProfilerStart( "points-foreground-partitions.prof" ); {
#endif
if( discard )
{
bursty_reader.reset( new snark::tbb::bursty_reader< block_t* >( &read_block_bursty_ ) );
::tbb::filter_t< void, void > filters = bursty_reader->filter() & partition_filter & write_filter;
::tbb::parallel_pipeline( 3, filters ); // while( bursty_reader->wait() ) { ::tbb::parallel_pipeline( 3, filters ); }
bursty_reader->join();
}
else
{
::tbb::filter_t< void, block_t* > read_filter( ::tbb::filter::serial_in_order, &read_block_ );
::tbb::filter_t< void, void > filters = read_filter & partition_filter & write_filter;
::tbb::parallel_pipeline( 3, filters );
}
#ifdef PROFILE
ProfilerStop(); }
#endif
if( is_shutdown ) { std::cerr << "points-foreground-partitions: caught signal" << std::endl; }
else { std::cerr << "points-foreground-partitions: end of stream" << std::endl; }
return 0;
}
catch( std::exception& ex ) { std::cerr << "points-foreground-partitions: " << ex.what() << std::endl; }
catch( ... ) { std::cerr << "points-foreground-partitions: unknown exception" << std::endl; }
return 1;
}
示例4: main
int main( int ac, char** av )
{
int result = 0;
try
{
comma::command_line_options options( ac, av );
if( options.exists( "--help,-h" ) ) { usage(); }
verbose = options.exists( "--verbose,-v" );
csv = comma::csv::options( options, "values" );
csv.full_xpath = true;
row_number_offset = options.value( "--row-number-offset,--offset", 0 );
polar = options.exists( "--polar" );
as_radians = !options.exists( "--degrees" );
clockwise = options.exists( "--clockwise" );
offset_from_center = options.value( "--offset-from-center", 0 ); // quick and dirty
z_up = options.value< std::string >( "--z", "up" ) == "up";
sign = ( z_up && !clockwise ) || ( !z_up && clockwise ) ? 1 : -1;
if( options.exists( "--fps" ) ) { dial_size = options.value( "--dial-size,--dial", 0 ); }
std::string s = options.value< std::string >( "--size" );
std::vector< std::string > v = comma::split( s, ',' );
if( v.size() != 2 && v.size() != 3 ) { std::cerr << "image-accumulate: expected --size=<value>; got \"" << s << "\"" << std::endl; return 1; }
block_size = boost::lexical_cast< unsigned int >( v[0] );
row_size = boost::lexical_cast< unsigned int >( v[1] );
scale = comma::csv::ascii< std::pair< double, double > >().get( options.value< std::string >( "--scale", "0,255" ) );
scaled< unsigned char > scaled( scale );
fps = options.optional< double >( "--fps" );
sin_cos = precomputed_sin_cos_();
channel::options default_channel_options( options );
std::vector< channel::options > channel_options;
if( csv.has_field( "id" ) )
{
const std::vector< std::string >& v = options.values< std::string >( "--id" );
if( v.empty() ) { std::cerr << "image-accumulate: 'id' field given, please specify at least one --id" << std::endl; return 1; }
for( unsigned int i = 0; i < v.size(); ++i )
{
channel_options.push_back( comma::name_value::parser( ';', '=' ).get< channel::options >( v[i], default_channel_options ) );
ids[ boost::lexical_cast< unsigned int >( comma::split( v[i], ';' )[0] ) ] = i;
}
}
else
{
ids[0] = 0;
channel_options.push_back( default_channel_options );
}
in.values.resize( row_size );
has_block = csv.has_field( "block" );
has_row = csv.has_field( "row" );
has_angle = csv.has_field( "angle" );
if( has_row && has_angle ) { std::cerr << "image-accumulate: in input fields, expected either 'row' or 'angle'; got both" << std::endl; return 1; }
comma::csv::input_stream< input > istream( std::cin, csv, in ); // todo: watch performance!
std::string default_output_options = "no-header;rows=" + boost::lexical_cast< std::string >( polar ? row_size * 2 + 1 : block_size ) + ";cols=" + boost::lexical_cast< std::string >( polar ? ( row_size * 2 + 1 ) * ids.size() : row_size * ids.size() ) + ";type=3ub";
std::string output_options_string = options.value( "--output", default_output_options );
output_options = comma::name_value::parser( ';', '=' ).get< snark::cv_mat::serialization::options >( output_options_string );
if( options.exists( "--output-options" ) ) { std::cout << comma::name_value::parser( ';', '=' ).put< snark::cv_mat::serialization::options >( output_options ) << std::endl; return 0; }
serialization.reset( new snark::cv_mat::serialization( output_options ) );
image = cv::Mat::zeros( block_size, row_size * ids.size(), output_options.get_header().type );
pixel_size = output_options.get_header().type == CV_8UC3 ? 3 : 1; // quick and dirty
boost::ptr_vector< channel > channels;
for( unsigned int i = 0; i < ids.size(); ++i ) { channels.push_back( new channel( i, channel_options[i] ) ); }
if( fps ) { output_thread.reset( new boost::thread( &output_ ) ); }
while( !is_shutdown && std::cin.good() && !std::cin.eof() )
{
const input* p = istream.read();
if( p )
{
Ids::const_iterator it = ids.find( p->id );
if( it == ids.end() ) { continue; }
if( !channels[ it->second ].draw( p ) ) { break; }
}
else
{
for( Ids::const_iterator it = ids.begin(); it != ids.end(); ++it )
{
channels[ it->second ].draw( p );
}
break;
}
}
}
catch( std::exception& ex )
{
std::cerr << "image-accumulate: " << ex.what() << std::endl;
result = 1;
}
catch( ... )
{
std::cerr << "image-accumulate: unknown exception" << std::endl;
result = 1;
}
done = true;
if( fps ) { output_thread->join(); }
return result;
}