Fawkes API  Fawkes Development Version
qa_bblogger_produce.cpp
1 
2 /***************************************************************************
3  * qa_bb_remote.cpp - BlackBoard remote access QA
4  *
5  * Created: Mon Mar 03 17:31:18 2008
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 /// @cond QA
25 
26 #include <blackboard/remote.h>
27 #include <interfaces/TestInterface.h>
28 
29 #include <signal.h>
30 #include <unistd.h>
31 
32 using namespace fawkes;
33 
34 bool quit = false;
35 
36 void
37 signal_handler(int signum)
38 {
39  quit = true;
40 }
41 
42 int
43 main(int argc, char **argv)
44 {
45  signal(SIGINT, signal_handler);
46 
47  BlackBoard * rbb = new RemoteBlackBoard("localhost", 1910);
48  TestInterface *ti = rbb->open_for_writing<TestInterface>("BBLoggerTest");
49 
50  int i = 0;
51  while (!quit) {
52  ti->set_test_int(++i);
53  ti->write();
54  usleep(100000);
55  }
56 
57  rbb->close(ti);
58  sleep(2);
59  delete rbb;
60 }
61 
62 /// @endcond
Fawkes library namespace.
void write()
Write from local copy into BlackBoard memory.
Definition: interface.cpp:494
void set_test_int(const int32_t new_test_int)
Set test_int value.
Remote BlackBoard.
Definition: remote.h:48
The BlackBoard abstract class.
Definition: blackboard.h:45
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for writing.
TestInterface Fawkes BlackBoard Interface.
Definition: TestInterface.h:33
virtual void close(Interface *interface)=0
Close interface.