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 
25 /// @cond QA
26 
27 #include <blackboard/remote.h>
28 #include <interfaces/TestInterface.h>
29 
30 #include <signal.h>
31 #include <unistd.h>
32 
33 using namespace fawkes;
34 
35 bool quit = false;
36 
37 void
38 signal_handler(int signum)
39 {
40  quit = true;
41 }
42 
43 
44 int
45 main(int argc, char **argv)
46 {
47  signal(SIGINT, signal_handler);
48 
49  BlackBoard *rbb = new RemoteBlackBoard("localhost", 1910);
50  TestInterface *ti = rbb->open_for_writing<TestInterface>("BBLoggerTest");
51 
52  int i = 0;
53  while (! quit) {
54  ti->set_test_int(++i);
55  ti->write();
56  usleep(100000);
57  }
58 
59  rbb->close(ti);
60  sleep(2);
61  delete rbb;
62 }
63 
64 
65 /// @endcond
Fawkes library namespace.
void write()
Write from local copy into BlackBoard memory.
Definition: interface.cpp:500
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:48
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.