Fawkes API
Fawkes Development Version
|
26 #include <blackboard/bbconfig.h>
27 #include <blackboard/exceptions.h>
28 #include <blackboard/local.h>
29 #include <core/exceptions/system.h>
30 #include <interfaces/TestInterface.h>
44 signal_handler(
int signum)
50 main(
int argc,
char **argv)
52 signal(SIGINT, signal_handler);
62 cout <<
"Opening interfaces.. " << flush;
69 cout <<
"failed! Aborting" << endl;
76 <<
"Running data tests ==================================================" << endl;
78 cout <<
"Writing initial value (" << TestInterface::TEST_CONSTANT <<
") into interface as TestInt"
84 cout <<
"BUG: caught write denied exception" << endl;
88 cout <<
"Reading value from reader interface.. " << flush;
91 if (val == TestInterface::TEST_CONSTANT) {
92 cout <<
" success, value is " << ti_reader->
test_int() <<
" as expected" << endl;
94 cout <<
" failure, value is " << ti_reader->
test_int() <<
", expected "
95 << TestInterface::TEST_CONSTANT << endl;
98 cout <<
"Resizing buffer.. " << flush;
103 cout <<
"ERROR: Resizing failed, exception follows" << endl;
108 cout <<
"Testing buffers, use Ctrl-C to interrupt" << endl
109 <<
"If you do not see any output everything is fine" << endl;
117 cout <<
"BUG: caught write denied exception" << endl;
130 cout <<
" failure, reader value is " << rval <<
", writer has " << wval << endl;
133 if (rval != bval + 1) {
134 cout <<
" failure, reader value is " << rval <<
", buffer has " << bval << endl;
146 cout <<
"Tests done" << endl;
148 bb->
close(ti_reader);
149 bb->
close(ti_writer);
const char * hash_printable() const
Get printable interface hash.
void read()
Read from BlackBoard into local copy.
void read_from_buffer(unsigned int buffer)
Copy data from buffer to private memory.
void set_test_int(const int32_t new_test_int)
Set test_int value.
virtual void close(Interface *interface)=0
int32_t test_int() const
Get test_int value.
void resize_buffers(unsigned int num_buffers)
Resize buffer array.
void print_trace()
Prints trace to stderr.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
void copy_private_to_buffer(unsigned int buffer)
Copy data from private memory to buffer.
void write()
Write from local copy into BlackBoard memory.
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)=0