本文整理汇总了C++中Producer类的典型用法代码示例。如果您正苦于以下问题:C++ Producer类的具体用法?C++ Producer怎么用?C++ Producer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Producer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
progressDialog::progressDialog(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags){
ui.setupUi(this);
Consumer *c = new Consumer();
Producer *p = new Producer();
Thread *t1 = new Thread(0);
Thread *t2 = new Thread(0);
connect(this,SIGNAL(begin(bool)),c,SLOT(startReceiving(bool)));
connect(c,SIGNAL(initiate(bool)),p,SLOT(produce(bool)));
connect(p,SIGNAL(sendPacket(const QByteArray,bool)),c,SLOT(receiveFrame(const QByteArray,bool)));
connect(ui.pushButton,SIGNAL(clicked(bool)),this,SLOT(_begin(bool)));
connect(p,SIGNAL(halt(bool)),c,SLOT(startReceiving(bool)));
connect(c,SIGNAL(blockDone()),p,SLOT(frameData()));
connect(c,SIGNAL(measure(bool)),p,SLOT(measurement(bool)),Qt::DirectConnection);
connect(c,SIGNAL(openDialog()),this,SLOT(startDlg()));
connect(c,SIGNAL(closeDialog()),this,SLOT(closeDlg()));
connect(p,SIGNAL(setDlgMax(int)),this,SLOT(setMaxVal(int)));
connect(p,SIGNAL(setDlgVal(int)),this,SLOT(setVal(int)));
connect(p,SIGNAL(setSeconds(int)),this,SLOT(setSecondsRemaining(int)));
c->moveToThread(t1);
p->moveToThread(t2);
t1->start();
t2->start();
}
示例2: getName
void
Grammar::outputFiles( void )
{
Producer *producer = LanguageDriver::getProducer( myLanguage,
mySettings,
myOutputDir,
getName(),
mySourceFile );
if ( producer )
{
std::string arg, prefix;
producer->setDebugOutput( isDebugOutput() );
if ( producer->writeSource() )
{
if ( ! producer->writeHeader() )
Error::get()->add( "Unable to write the output header file." );
}
else
Error::get()->add( "Unable to write the output source file." );
delete producer;
}
}
示例3: main
int
main (int argc, char** argv)
{
print_highlight ("PCL OpenNI Recorder for saving buffered PCD (binary compressed to disk). See %s -h for options.\n", argv[0]);
int buff_size = BUFFER_SIZE;
if (find_switch (argc, argv, "-h") || find_switch (argc, argv, "--help"))
{
print_info ("Options are: \n"
" -xyz = save only XYZ data, even if the device is RGB capable\n"
" -shift = use OpenNI shift values rather than 12-bit depth\n"
" -buf X = use a buffer size of X frames (default: ");
print_value ("%d", buff_size); print_info (")\n");
return (0);
}
bool just_xyz = find_switch (argc, argv, "-xyz");
openni_wrapper::OpenNIDevice::DepthMode depth_mode = openni_wrapper::OpenNIDevice::OpenNI_12_bit_depth;
if (find_switch (argc, argv, "-shift"))
depth_mode = openni_wrapper::OpenNIDevice::OpenNI_shift_values;
if (parse_argument (argc, argv, "-buf", buff_size) != -1)
print_highlight ("Setting buffer size to %d frames.\n", buff_size);
else
print_highlight ("Using default buffer size of %d frames.\n", buff_size);
print_highlight ("Starting the producer and consumer threads... Press Cltr+C to end\n");
OpenNIGrabber grabber ("");
if (grabber.providesCallback<OpenNIGrabber::sig_cb_openni_point_cloud_rgba> () &&
!just_xyz)
{
print_highlight ("PointXYZRGBA enabled.\n");
PCDBuffer<PointXYZRGBA> buf;
buf.setCapacity (buff_size);
Producer<PointXYZRGBA> producer (buf, depth_mode);
boost::this_thread::sleep (boost::posix_time::seconds (2));
Consumer<PointXYZRGBA> consumer (buf);
signal (SIGINT, ctrlC);
producer.stop ();
consumer.stop ();
}
else
{
print_highlight ("PointXYZ enabled.\n");
PCDBuffer<PointXYZ> buf;
buf.setCapacity (buff_size);
Producer<PointXYZ> producer (buf, depth_mode);
boost::this_thread::sleep (boost::posix_time::seconds (2));
Consumer<PointXYZ> consumer (buf);
signal (SIGINT, ctrlC);
producer.stop ();
consumer.stop ();
}
return (0);
}
示例4: producerConsumer
void tst_QSemaphore::producerConsumer()
{
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
}
示例5: filter
void Controller::copyFilters(Producer& fromProducer, Producer& toProducer)
{
int count = fromProducer.filter_count();
for (int i = 0; i < count; i++) {
QScopedPointer<Mlt::Filter> filter(fromProducer.filter(i));
if (filter && filter->is_valid() && !filter->get_int("_loader")) {
toProducer.attach(*filter);
}
}
}
示例6: main
int main(int argc, char * argv[])
{
Consumer* consumer = new Consumer;
Producer* producer = new Producer(consumer);
producer->open(0);
consumer->open(0);
//Wait for all the tasks to exit.
ACE_Thread_Manager::instance()->wait();
return 0;
}
示例7: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Producer producer;
producer.registerCallBack(callBackFunction);
producer.start();
producer.wait();
}
示例8: main
int main()
{
try {
Producer producer;
producer.listen();
}
catch(std::exception &e) {
std::cerr << "ERROR: " << e.what() << std::endl;
}
return 0;
}
示例9: consumer
unsigned
DatabaseCodec::importGames(Producer& producer, Progress& progress, int startIndex)
{
//M_REQUIRE(isOpen());
mstl::auto_ptr<Consumer> consumer(getConsumer(producer.format()));
//M_ASSERT(consumer);
producer.setConsumer(consumer.get());
producer.consumer().setIndex(startIndex);
return producer.process(progress);
}
示例10: main
//! [5]
int main(int argc, char *argv[])
//! [5] //! [6]
{
QCoreApplication app(argc, argv);
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return 0;
}
示例11: main
int main()
{
usedSpace += BufferSize;
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return 0;
}
示例12: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return a.exec();
}
示例13:
Producer::Producer( Producer &producer ) :
Mlt::Service( producer ),
instance( producer.get_producer( ) ),
parent_( NULL )
{
inc_ref( );
}
示例14: ACE_TMAIN
// Listing 4 code/ch14
int ACE_TMAIN (int, ACE_TCHAR *[])
{
int shared_buf[Q_SIZE];
SafeUInt in = 0;
SafeUInt out = 0;
Producer producer (shared_buf, in, out);
Consumer consumer (shared_buf, in, out);
producer.activate();
consumer.activate();
producer.wait();
consumer.wait();
return 0;
}
示例15: main
int main(int argc, char *argv[])
{
//QApplication app(argc, argv);
//Window *w = new Window;
//w->resize(300, 300);
//w->show();
//return app.exec();
QApplication app(argc, argv);
Producer produer;
Consumer consumer;
produer.start();
consumer.start();
produer.wait();
consumer.wait();
return app.exec();
}