Deserializes a mitk::PropertyList. More...
#include <mitkPropertyListDeserializer.h>

Public Types | |
| typedef PropertyListDeserializer | Self |
| typedef itk::Object | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| virtual void | SetFilename (const char *_arg) |
| virtual const char * | GetFilename () const |
| virtual bool | Deserialize () |
| Reads a propertylist from file. | |
| virtual PropertyList::Pointer | GetOutput () |
Static Public Member Functions | |
| static Pointer | New () |
Protected Member Functions | |
| PropertyListDeserializer () | |
| virtual | ~PropertyListDeserializer () |
Protected Attributes | |
| std::string | m_Filename |
| PropertyList::Pointer | m_PropertyList |
Deserializes a mitk::PropertyList.
Definition at line 31 of file mitkPropertyListDeserializer.h.
| typedef itk::SmartPointer<const Self> mitk::PropertyListDeserializer::ConstPointer |
Reimplemented in mitk::PropertyListDeserializerV1.
Definition at line 35 of file mitkPropertyListDeserializer.h.
| typedef itk::SmartPointer<Self> mitk::PropertyListDeserializer::Pointer |
Reimplemented in mitk::PropertyListDeserializerV1.
Definition at line 35 of file mitkPropertyListDeserializer.h.
Reimplemented in mitk::PropertyListDeserializerV1.
Definition at line 35 of file mitkPropertyListDeserializer.h.
| typedef itk::Object mitk::PropertyListDeserializer::Superclass |
Reimplemented in mitk::PropertyListDeserializerV1.
Definition at line 35 of file mitkPropertyListDeserializer.h.
| mitk::PropertyListDeserializer::PropertyListDeserializer | ( | ) | [protected] |
Definition at line 22 of file mitkPropertyListDeserializer.cpp.
{
}
| mitk::PropertyListDeserializer::~PropertyListDeserializer | ( | ) | [protected, virtual] |
Definition at line 26 of file mitkPropertyListDeserializer.cpp.
{
}
| bool mitk::PropertyListDeserializer::Deserialize | ( | ) | [virtual] |
Reads a propertylist from file.
Reimplemented in mitk::PropertyListDeserializerV1.
Definition at line 31 of file mitkPropertyListDeserializer.cpp.
References TiXmlDocument::ErrorDesc(), TiXmlNode::FirstChildElement(), TiXmlDocument::LoadFile(), MITK_ERROR, MITK_WARN, TiXmlElement::QueryIntAttribute(), and TIXML_SUCCESS.
{
bool error(false);
TiXmlDocument document( m_Filename );
if (!document.LoadFile())
{
MITK_ERROR << "Could not open/read/parse " << m_Filename << "\nTinyXML reports: " << document.ErrorDesc() << std::endl;
return false;
}
// find version node --> note version in some variable
int fileVersion = 1;
TiXmlElement* versionObject = document.FirstChildElement("Version");
if (versionObject)
{
if ( versionObject->QueryIntAttribute( "FileVersion", &fileVersion ) != TIXML_SUCCESS )
{
MITK_ERROR << "Property file " << m_Filename << " does not contain version information! Trying version 1 format." << std::endl;
}
}
std::stringstream propertyListDeserializerClassName;
propertyListDeserializerClassName << "PropertyListDeserializerV" << fileVersion;
std::list<itk::LightObject::Pointer> readers = itk::ObjectFactoryBase::CreateAllInstance(propertyListDeserializerClassName.str().c_str());
if (readers.size() < 1)
{
MITK_ERROR << "No property list reader found for file version " << fileVersion;
}
if (readers.size() > 1)
{
MITK_WARN << "Multiple property list readers found for file version " << fileVersion << ". Using arbitrary first one.";
}
for ( std::list<itk::LightObject::Pointer>::iterator iter = readers.begin();
iter != readers.end();
++iter )
{
if (PropertyListDeserializer* reader = dynamic_cast<PropertyListDeserializer*>( iter->GetPointer() ) )
{
reader->SetFilename( m_Filename );
bool success = reader->Deserialize();
error |= !success;
m_PropertyList = reader->GetOutput();
if ( error )
{
MITK_ERROR << "There were errors while loding property list file " << m_Filename << ". Your data may be corrupted";
}
break;
}
}
return !error;
}
| virtual const char* mitk::PropertyListDeserializer::GetClassName | ( | ) | const [virtual] |
Reimplemented in mitk::PropertyListDeserializerV1.
| virtual const char* mitk::PropertyListDeserializer::GetFilename | ( | ) | const [virtual] |
| mitk::PropertyList::Pointer mitk::PropertyListDeserializer::GetOutput | ( | void | ) | [virtual] |
Definition at line 89 of file mitkPropertyListDeserializer.cpp.
{
return m_PropertyList;
}
| static Pointer mitk::PropertyListDeserializer::New | ( | ) | [static] |
Reimplemented in mitk::PropertyListDeserializerV1.
Referenced by mitk::SceneReaderV1::DecorateNodeWithProperties().
| virtual void mitk::PropertyListDeserializer::SetFilename | ( | const char * | _arg ) | [virtual] |
std::string mitk::PropertyListDeserializer::m_Filename [protected] |
Definition at line 54 of file mitkPropertyListDeserializer.h.
Definition at line 55 of file mitkPropertyListDeserializer.h.
1.7.2