18 m_DataValid(false), m_IGTTimeStamp(0), m_Name()
39 this->
SetName(message->GetDeviceName());
48 msg =
dynamic_cast<const Self *
>(data);
52 itkExceptionMacro( <<
"mitk::IGTLMessage::Graft cannot cast " 53 <<
typeid(data).name() <<
" to " 54 <<
typeid(
const Self *).name() );
60 itkExceptionMacro( <<
"mitk::IGTLMessage::Graft cannot cast " 61 <<
typeid(data).name() <<
" to " 62 <<
typeid(
const Self *).name() );
68 this->SetIGTTimeStamp(msg->GetIGTTimeStamp());
76 unsigned int frac = 0;
79 double timestamp = ts * 1000.0 + frac;
80 this->SetIGTTimeStamp(timestamp);
92 os << indent <<
"name: " << this->
GetName() << std::endl;
94 os << indent <<
"valid: " << this->
IsDataValid() << std::endl;
96 os << indent <<
"OpenIGTLinkMessage: " << std::endl;
98 this->Superclass::PrintSelf(os, indent);
103 std::stringstream output;
111 this->Superclass::CopyInformation( data );
113 const Self * nd =
nullptr;
116 nd =
dynamic_cast<const Self*
>(data);
121 itkExceptionMacro(<<
"mitk::IGTLMessage::CopyInformation() cannot cast " 122 <<
typeid(data).name() <<
" to " 123 <<
typeid(Self*).name() );
128 itkExceptionMacro(<<
"mitk::IGTLMessage::CopyInformation() cannot cast " 129 <<
typeid(data).name() <<
" to " 130 <<
typeid(Self*).name() );
139 bool returnValue =
true;
141 if( std::string(rightHandSide.
GetName()) != std::string(leftHandSide.
GetName()) )
145 MITK_INFO <<
"[( IGTLMessage )] Name differs.";
147 <<
"rightHandSide is " << rightHandSide.
GetName();
156 MITK_INFO <<
"[( IGTLMessage )] IGTTimeStamp differs.";
171 template <
typename IGTLMessageType >
174 return dynamic_cast<IGTLMessageType*
>(this->
m_Message);
void SetMessage(igtl::MessageBase::Pointer msg)
Sets the OpenIGTLink message.
bool m_DataValid
defines if the object contains valid values
virtual void SetName(const char *_arg)
set the name of the IGTLMessage object
virtual bool IsDataValid() const
returns true if the object contains valid data
A wrapper for the OpenIGTLink message type.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Prints the object information to the given stream os.
const char * GetIGTLMessageType() const
std::string ToString() const
virtual igtl::MessageBase::Pointer GetMessage() const
returns the OpenIGTLink message
virtual void SetDataValid(bool _arg)
sets the dataValid flag of the IGTLMessage object indicating if the object contains valid data ...
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
virtual const char * GetName() const
returns the name of the IGTLMessage object
virtual TimeStampType GetIGTTimeStamp() const
gets the IGT timestamp of the IGTLMessage object
igtl::MessageBase::Pointer m_Message
holds the actual OpenIGTLink message
void Graft(const DataObject *data) override
Graft the data and information from one IGTLMessage to another.
void CopyInformation(const DataObject *data) override
copy meta data of a IGTLMessage object