27 #include <blackboard/local.h> 28 #include <blackboard/exceptions.h> 29 #include <blackboard/bbconfig.h> 31 #include <interfaces/TestInterface.h> 33 #include <core/exceptions/system.h> 49 signal_handler(
int signum)
56 main(
int argc,
char **argv)
59 signal(SIGINT, signal_handler);
69 cout <<
"Opening interfaces.. " << flush;
72 cout <<
"success, " <<
76 cout <<
"failed! Aborting" << endl;
82 <<
"Running data tests ==================================================" 85 cout <<
"Writing initial value (" 86 << TestInterface::TEST_CONSTANT <<
") into interface as TestInt" << endl;
91 cout <<
"BUG: caught write denied exception" << endl;
95 cout <<
"Reading value from reader interface.. " << flush;
98 if ( val == TestInterface::TEST_CONSTANT ) {
99 cout <<
" success, value is " << ti_reader->
test_int() <<
" as expected" << endl;
101 cout <<
" failure, value is " << ti_reader->
test_int() <<
", expected " 102 << TestInterface::TEST_CONSTANT << endl;
105 cout <<
"Resizing buffer.. " << flush;
110 cout <<
"ERROR: Resizing failed, exception follows" << endl;
116 cout <<
"Testing buffers, use Ctrl-C to interrupt" << endl
117 <<
"If you do not see any output everything is fine" << endl;
126 cout <<
"BUG: caught write denied exception" << endl;
138 if ( rval != wval ) {
139 cout <<
" failure, reader value is " << rval <<
", writer has " 143 if ( rval != bval + 1 ) {
144 cout <<
" failure, reader value is " << rval <<
", buffer has " 157 cout <<
"Tests done" << endl;
159 bb->
close(ti_reader);
160 bb->
close(ti_writer);
void copy_private_to_buffer(unsigned int buffer)
Copy data from private memory to buffer.
Fawkes library namespace.
void write()
Write from local copy into BlackBoard memory.
void set_test_int(const int32_t new_test_int)
Set test_int value.
void read_from_buffer(unsigned int buffer)
Copy data from buffer to private memory.
Base class for exceptions in Fawkes.
void read()
Read from BlackBoard into local copy.
void print_trace()
Prints trace to stderr.
void resize_buffers(unsigned int num_buffers)
Resize buffer array.
int32_t test_int() const
Get test_int value.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
The BlackBoard abstract class.
This exception is thrown if a write has been attempted on a read-only interface.
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.
const char * hash_printable() const
Get printable interface hash.
virtual void close(Interface *interface)=0
Close interface.