void testMessagesEqual(igtl::MessageBase::Pointer sentMessage, igtl::MessageBase::Pointer receivedMessage)
  {
    std::string lhs(sentMessage->GetDeviceName());
    std::string rhs(receivedMessage->GetDeviceName());
    CPPUNIT_ASSERT_MESSAGE("The device names were not the same", lhs == rhs);
    igtl::StatusMessage::Pointer receivedStatusMessage = dynamic_cast<igtl::StatusMessage*>(receivedMessage.GetPointer());
    igtl::StatusMessage::Pointer sentStatusMessage = dynamic_cast<igtl::StatusMessage*>(sentMessage.GetPointer());
    CPPUNIT_ASSERT_MESSAGE("The received message was not of the appropriate type.", receivedStatusMessage != nullptr);
    CPPUNIT_ASSERT_MESSAGE("The sent message was not of the appropriate type.", sentStatusMessage != nullptr);

    lhs = receivedStatusMessage->GetStatusString();
    rhs = sentStatusMessage->GetStatusString();
    CPPUNIT_ASSERT_MESSAGE("The sent and received message did not contain the same status message.", lhs == rhs);
    CPPUNIT_ASSERT_MESSAGE("The sent message did not contain the correct status message.", lhs == m_Message);
    CPPUNIT_ASSERT_MESSAGE("The received message did not contain the correct status message.", m_Message == rhs);
  };
示例#2
0
mitk::IGTLMessage::IGTLMessage(igtl::MessageBase::Pointer message)
{
  this->SetMessage(message);
  this->SetName(message->GetDeviceName());
}