TransformXML.cxx

Go to the documentation of this file.
00001 
00012 // for truncation warning
00013 #ifdef _MSC_VER
00014 #include "msdevstudio/MSconfig.h"
00015 #endif
00016 
00017 #include "TransformXML.h"
00018 
00019 #include "XmlElement.h"
00020 
00021 #include "transforms/TransformBase.h"
00022 #include "transforms/TransformFactory.h"
00023 
00024 #include <cassert>
00025 
00026 using std::string;
00027 
00028 namespace hippodraw {
00029 
00030 TransformXML::TransformXML ( XmlController * controller )
00031   : BaseXML ( "Transform", controller )
00032 {
00033 }
00034 
00035 XmlElement * TransformXML::createElement ( const TransformBase & transform )
00036 {
00037   XmlElement * tag = BaseXML::createElement ();
00038   const string & type = transform.name();
00039   tag->setAttribute ( m_type, type );
00040 
00041   return tag;
00042 }
00043 
00044 TransformBase * TransformXML::createObject ( const XmlElement * element )
00045 {
00046   string type;
00047   bool ok = element->attribute ( m_type, type );
00048   assert ( ok );
00049 
00050   TransformFactory * factory = TransformFactory::instance ();
00051   TransformBase * transform = factory->createTransform ( type );
00052 
00053   return transform;
00054 }
00055 
00056 } // namespace hippodraw
00057 

Generated for HippoDraw Class Library by doxygen