qa_bblogger_produce.cpp

00001 
00002 /***************************************************************************
00003  *  qa_bb_remote.cpp - BlackBoard remote access QA
00004  *
00005  *  Created: Mon Mar 03 17:31:18 2008
00006  *  Copyright  2006-2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 
00025 /// @cond QA
00026 
00027 #include <blackboard/remote.h>
00028 #include <interfaces/TestInterface.h>
00029 
00030 #include <signal.h>
00031 #include <unistd.h>
00032 
00033 using namespace fawkes;
00034 
00035 bool quit = false;
00036 
00037 void
00038 signal_handler(int signum)
00039 {
00040   quit = true;
00041 }
00042 
00043 
00044 int
00045 main(int argc, char **argv)
00046 {
00047   signal(SIGINT, signal_handler);
00048 
00049   BlackBoard *rbb = new RemoteBlackBoard("localhost", 1910);
00050   TestInterface *ti = rbb->open_for_writing<TestInterface>("BBLoggerTest");
00051 
00052   int i = 0;
00053   while (! quit) {
00054     ti->set_test_int(++i);
00055     ti->write();
00056     usleep(100000);
00057   }
00058 
00059   rbb->close(ti);
00060   sleep(2);
00061   delete rbb;
00062 }
00063 
00064 
00065 /// @endcond