Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1378 - in branches/persistent: . Core Core/Exceptions Core/Geometry Core/Reflection Engine/Factory Interface Model/Primitives StandAlone


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1378 - in branches/persistent: . Core Core/Exceptions Core/Geometry Core/Reflection Engine/Factory Interface Model/Primitives StandAlone
  • Date: Tue, 8 May 2007 21:21:35 -0600 (MDT)

Author: sparker
Date: Tue May  8 21:21:25 2007
New Revision: 1378

Added:
   branches/persistent/Core/Exceptions/SerializationError.cc
   branches/persistent/Core/Exceptions/SerializationError.h
   branches/persistent/Core/Reflection/
   branches/persistent/Core/Reflection/Reflection.cc
   branches/persistent/Core/Reflection/Reflection.h
   branches/persistent/Core/Reflection/XMLArchive.cc
   branches/persistent/Core/Reflection/XMLArchive.h
   branches/persistent/Core/Reflection/stdRefl.h
   branches/persistent/Interface/InterfaceRefl.h
   branches/persistent/Interface/RenderParameters.cc
   branches/persistent/StandAlone/savescene.cc
Modified:
   branches/persistent/CMakeLists.txt
   branches/persistent/Core/CMakeLists.txt
   branches/persistent/Core/Geometry/Vector.cc
   branches/persistent/Core/Geometry/Vector.h
   branches/persistent/Engine/Factory/Factory.cc
   branches/persistent/Engine/Factory/Factory.h
   branches/persistent/Interface/CMakeLists.txt
   branches/persistent/Interface/Light.h
   branches/persistent/Interface/LightSet.cc
   branches/persistent/Interface/LightSet.h
   branches/persistent/Interface/RenderParameters.h
   branches/persistent/Interface/Scene.cc
   branches/persistent/Interface/Scene.h
   branches/persistent/Interface/TexCoordMapper.h
   branches/persistent/Model/Primitives/PrimitiveCommon.cc
   branches/persistent/Model/Primitives/PrimitiveCommon.h
   branches/persistent/Model/Primitives/Sphere.cc
   branches/persistent/Model/Primitives/Sphere.h
   branches/persistent/StandAlone/CMakeLists.txt
   branches/persistent/TODO
Log:
First cut at basic functionality for persistent I/O.  Not done yet.


Modified: branches/persistent/CMakeLists.txt
==============================================================================
--- branches/persistent/CMakeLists.txt  (original)
+++ branches/persistent/CMakeLists.txt  Tue May  8 21:21:25 2007
@@ -48,7 +48,8 @@
 
 # Search for common dependencies.
 INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindX11andGL.cmake) # Find X11 
and GL, specialized on OSX and Cygwin
-INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindTeem.cmake)     # Locate Teem.
+INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindTeem.cmake)     # Locate Teem
+INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindLibXML2.cmake)  # Locate 
libxml2
 INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindPabst.cmake)    # Locate pabst
 
 # Check for specific machine/compiler options.

Modified: branches/persistent/Core/CMakeLists.txt
==============================================================================
--- branches/persistent/Core/CMakeLists.txt     (original)
+++ branches/persistent/Core/CMakeLists.txt     Tue May  8 21:21:25 2007
@@ -25,6 +25,8 @@
      Exceptions/InputError.cc
      Exceptions/OutputError.h
      Exceptions/OutputError.cc
+     Exceptions/SerializationError.h
+     Exceptions/SerializationError.cc
      )
 SET (CORE_SOURCES ${CORE_SOURCES}
      Geometry/AffineTransform.h
@@ -54,6 +56,19 @@
      Math/SSEDefs.cc
      )
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Reflection/Reflection.h
+     Reflection/Reflection.cc
+     )
+
+IF (LIBXML2_INCLUDE)
+     SET (CORE_SOURCES ${CORE_SOURCES}
+          Reflection/XMLArchive.h
+          Reflection/XMLArchive.cc
+         )
+     INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE})
+ENDIF (LIBXML2_INCLUDE)
+
+SET (CORE_SOURCES ${CORE_SOURCES}
      Util/AlignedAllocator.h
      Util/AlignedAllocator.cc
      Util/Args.h
@@ -71,9 +86,9 @@
 ADD_LIBRARY (Manta_Core ${CORE_SOURCES})
 
 TARGET_LINK_LIBRARIES(Manta_Core SCIRun_Core)
+TARGET_LINK_LIBRARIES(Manta_Core ${LIBXML2_LIBRARY})
 
 # The Manta_Core_XUtils library
 ADD_LIBRARY (Manta_Core_XUtils XUtils/XHelper.cc)
 TARGET_LINK_LIBRARIES(Manta_Core_XUtils Manta_Core SCIRun_Core)
 TARGET_LINK_LIBRARIES(Manta_Core_XUtils ${OPENGL_LIBRARIES} ${X11_LIBRARIES})
-

Added: branches/persistent/Core/Exceptions/SerializationError.cc
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Exceptions/SerializationError.cc   Tue May  8 
21:21:25 2007
@@ -0,0 +1,58 @@
+
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005
+  Scientific Computing and Imaging Institue, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Core/Exceptions/SerializationError.h>
+
+using namespace Manta;
+using namespace std;
+
+SerializationError::SerializationError(const std::string& msg)
+  : message_(msg)
+{
+}
+
+SerializationError::SerializationError(const SerializationError& copy)
+    : message_(copy.message_)
+{
+}
+
+SerializationError::~SerializationError()
+{
+}
+
+const char* SerializationError::message() const
+{
+    return message_.c_str();
+}
+
+const char* SerializationError::type() const
+{
+    return "SerializationError";
+}
+

Added: branches/persistent/Core/Exceptions/SerializationError.h
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Exceptions/SerializationError.h    Tue May  8 
21:21:25 2007
@@ -0,0 +1,57 @@
+
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005
+  Scientific Computing and Imaging Institue, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef Manta_Core_SerializationError_h
+#define Manta_Core_SerializationError_h
+
+#include <Core/Exceptions/Exception.h>
+#include <sgi_stl_warnings_off.h>
+#include <string>
+#include <sgi_stl_warnings_on.h>
+
+namespace Manta {
+  using namespace std;
+
+  // Serialization Errors are thrown when a problem occurs reading or 
parsing some type
+  // of input, such as a texture is encountered.
+  class SerializationError : public SCIRun::Exception {
+  public:
+    SerializationError(const std::string&);
+    SerializationError(const SerializationError&);
+    virtual ~SerializationError();
+    virtual const char* message() const;
+    virtual const char* type() const;
+  protected:
+  private:
+    std::string message_;
+    SerializationError& operator=(const SerializationError&);
+  };
+}
+
+#endif

Modified: branches/persistent/Core/Geometry/Vector.cc
==============================================================================
--- branches/persistent/Core/Geometry/Vector.cc (original)
+++ branches/persistent/Core/Geometry/Vector.cc Tue May  8 21:21:25 2007
@@ -47,4 +47,9 @@
     is >> v[2];
     return is;
   }
+
+  void Vector::readwrite(Archive* archive)
+  {
+    archive->readwrite("data", data, 3);
+  }
 }

Modified: branches/persistent/Core/Geometry/Vector.h
==============================================================================
--- branches/persistent/Core/Geometry/Vector.h  (original)
+++ branches/persistent/Core/Geometry/Vector.h  Tue May  8 21:21:25 2007
@@ -42,6 +42,7 @@
 #include <Core/Math/Expon.h>
 #include <Core/Math/MinMax.h>
 #include <Core/Math/MiscMath.h>
+#include <Core/Reflection/Reflection.h>
 
 #include <sgi_stl_warnings_off.h>
 #include <iosfwd>
@@ -458,8 +459,10 @@
     friend Vector Min(const Vector& v1, const Vector& v2);
     friend Vector Max(const Vector& v1, const Vector& v2);
     friend Vector Interpolate(const Vector& v1, const Vector& v2, Real 
weight);
+    friend Vector Interpolate(const Vector& v1, const Vector& v2, const 
Vector& weight);
 #endif
     
+    void readwrite(Archive*);
     //private:
     Real data[3];
 
@@ -552,6 +555,10 @@
                   Interpolate(v1.data[2], v2.data[2], weight[2]));
     return result;
   }
+
+  template<>
+  class ReflectionInfo<Vector> : public ReflectionInfo_BaseClass<Vector>, 
public ReflectionInfo_readwriteMethod<Vector> {
+  };
   
   std::ostream& operator<< (std::ostream& os, const Vector& v);
   std::istream& operator>> (std::istream& is,       Vector& v);

Added: branches/persistent/Core/Reflection/Reflection.cc
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Reflection/Reflection.cc   Tue May  8 21:21:25 
2007
@@ -0,0 +1,74 @@
+
+#include <Core/Reflection/Reflection.h>
+#include <Core/Exceptions/InputError.h>
+#include <Core/Exceptions/OutputError.h>
+#include <Core/Exceptions/InternalError.h>
+#include <string>
+
+using namespace Manta;
+using namespace std;
+using namespace SCIRun;
+
+struct ArchiveType {
+  string name;
+  Archive* (*readopener)(const std::string&);
+  Archive* (*writeopener)(const std::string&);
+};
+
+static ArchiveType archiveTypes[10];
+static int numArchiveTypes = 0;
+
+bool Archive::registerArchiveType(const std::string& name,
+                                  Archive* (*readopener)(const std::string&),
+                                  Archive* (*writeopener)(const 
std::string&))
+{
+  int maxArchiveTypes = sizeof(archiveTypes)/sizeof(ArchiveType);
+  if(numArchiveTypes >= maxArchiveTypes)
+    throw InternalError("Maximum number of archive types exceeded", 
__FILE__, __LINE__);
+  archiveTypes[numArchiveTypes].name = name;
+  archiveTypes[numArchiveTypes].readopener = readopener;
+  archiveTypes[numArchiveTypes].writeopener = writeopener;
+  numArchiveTypes++;
+  return true;
+}
+
+Archive* Archive::openForReading(const std::string& filename)
+{
+  for(int i=0;i<numArchiveTypes;i++){
+    Archive* (*readopener)(const std::string&) = archiveTypes[i].readopener;
+    if(readopener){
+      Archive* archive = (*readopener)(filename);
+      if(archive)
+        return archive;
+    }
+  }
+  throw InputError("Cannot determine type of file for scene: " + filename);
+}
+
+Archive* Archive::openForWriting(const std::string& filename)
+{
+  Archive* result = 0;
+  for(int i=0;i<numArchiveTypes;i++){
+    Archive* (*writeopener)(const std::string&) = 
archiveTypes[i].writeopener;
+    if(writeopener){
+      Archive* archive = (*writeopener)(filename);
+      if(archive){
+        if(result)
+          throw OutputError("Multiple archive writers support filename: " + 
filename);
+        result = archive;
+      }
+    }
+  }
+  if(!result)
+    throw OutputError("Cannot determine archive writer for filename: " + 
filename);
+  return result;
+}
+
+Archive::Archive(bool isreading)
+  : isreading(isreading)
+{
+}
+
+Archive::~Archive()
+{
+}

Added: branches/persistent/Core/Reflection/Reflection.h
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Reflection/Reflection.h    Tue May  8 21:21:25 
2007
@@ -0,0 +1,203 @@
+
+#ifndef Manta_Reflection_h
+#define Manta_Reflection_h
+
+#include <Core/Exceptions/SerializationError.h>
+#include <Core/Util/NotFinished.h>
+#include <iostream>
+#include <map>
+#include <string>
+#include <typeinfo>
+
+namespace Manta {
+
+  class Archive;
+  template<class T>
+  class  NewFactory {
+    //static void registerClass();
+  public:
+    static NewFactory<T>* singleton() {
+      if(!singleton_instance)
+        singleton_instance = new NewFactory<T>();
+      return singleton_instance;
+    }
+
+    T* createInstance(const std::string& classname) {
+      typename std::map<std::string, CreatorBase<T>*>::iterator iter = 
creators.find(classname);
+      if(iter == creators.end())
+        return 0;
+      return iter->second->create();
+    }
+
+  private:
+    template<class Base>
+    struct CreatorBase {
+    public:
+      virtual Base* create() const;
+    };
+    template<class Sub, class Base>
+    struct Creator : public CreatorBase<Base> {
+    public:
+      virtual Sub* create() const;
+    };
+    
+    static NewFactory<T>* singleton_instance;
+    std::map<std::string, CreatorBase<T>*> creators;
+  };
+
+  template<class T>
+  NewFactory<T>* NewFactory<T>::singleton_instance;
+
+  // This class should always be specialized.  If you see an error
+  // here, you need to define the specialization for the class
+  template<class T>
+  class ReflectionInfo {
+    char force_error[0];
+  };
+
+  template<class T>
+  class ReflectionInfo_readwriteMethod {
+  public:
+    static void readwrite(Archive* archive, T& data) {
+      data.readwrite(archive);
+    }
+  };
+
+  template<class T>
+  class ReflectionInfo_readwriteNone {
+  public:
+    static void readwrite(Archive* archive, T& data) {
+    }
+  };
+
+  template<class T>
+  class ReflectionInfo_BaseClass {
+  public:
+    char force_initialize;
+
+    ReflectionInfo_BaseClass() {
+      //Factory<T>::register_class(typeName, this);
+    }
+    static std::string getPublicClassname() {
+      return "publicclass";
+    }
+  };
+  template<class T, class Parent>
+  class ReflectionInfo_DerivedClass {
+  public:
+    char force_initialize;
+
+    ReflectionInfo_DerivedClass() {
+      //Factory<T>::register_class(typeName, this);
+    }
+    static std::string getPublicClassname() {
+      return "publicclass";
+    }
+  };
+
+  class Archive {
+  public:
+    template<class T>
+    void readwrite(const char* fieldname, T& data) {
+      Archive* subArchive;
+      if(reading()){
+        subArchive = findField(fieldname);
+        if(!subArchive)
+          throw SerializationError("Cannot find field: " + 
string(fieldname));
+      } else {
+        std::string classname = ReflectionInfo<T>::getPublicClassname();
+        subArchive = createField(fieldname, classname);
+      }
+
+      if(typeid(T) == typeid(data)){
+        ReflectionInfo<T>::readwrite(subArchive, data);
+      } else {
+        NOT_FINISHED("readwritewrite derived class - this should break");
+      }
+      delete subArchive;
+    }
+    template<class T>
+    void readwriteObject(T*& data) {
+      if(reading()){
+        if(isNullPointer()){
+          data = 0;
+        } else {
+          std::string classname = getClassname();
+          data = NewFactory<T>::singleton()->createInstance(classname);
+          if(!data)
+            throw SerializationError("Cannot create class: " + classname + 
", possibly missing ReflectionInfo");
+        }
+      } else {
+        if(!data)
+          writeNullPointer();
+      }
+
+      if(data){
+        T* datatmp = const_cast<T*>(data);
+        if(typeid(T) == typeid(*data)){
+          ReflectionInfo<T>::readwrite(this, *datatmp);
+        } else {
+          NOT_FINISHED("readwritewrite derived class");
+          // Find derived class...
+          //??? = Factory<T>::findClassByRTTI(typeid(T).name);
+          //???->readwrite(archive, fieldname, data);
+        }
+      }
+    }
+    template<class T>
+    void readwrite(const char* fieldname, T*& data) {
+      Archive* subArchive;
+      if(reading()){
+        subArchive = findField(fieldname);
+        if(!subArchive)
+          throw SerializationError("Cannot find field: " + 
string(fieldname));
+      } else {
+        std::string classname = ReflectionInfo<T>::getPublicClassname();
+        subArchive = createField(fieldname, classname);
+      }
+      subArchive->readwriteObject(data);
+      delete subArchive;
+    }
+    template<class T>
+    void readwrite(const char* fieldname, const T*& data) {
+      if(reading()){
+        T* tmpdata;
+        readwrite(fieldname, tmpdata);
+        data = tmpdata;
+      } else {
+        T* tmpdata = const_cast<T*>(data);
+        readwrite(fieldname, tmpdata);
+      }
+    }
+
+    virtual void readwrite(const char* fieldname, int& data) = 0;
+    virtual void readwrite(const char* fieldname, float& data) = 0;
+    virtual void readwrite(const char* fieldname, float* data, int 
numElements) = 0;
+    virtual void readwrite(const char* fieldname, double& data) = 0;
+
+    bool reading() const {
+      return isreading;
+    }
+    bool writing() const {
+      return !isreading;
+    }
+    static Archive* openForReading(const std::string& filename);
+    static Archive* openForWriting(const std::string& filename);
+    virtual std::string getClassname() const = 0;
+
+    virtual Archive* findField(const std::string& fieldname) const = 0;
+    virtual Archive* createField(const std::string& fieldname, const 
std::string& classname) = 0;
+    virtual Archive* addSequence(const std::string& sequencename);
+    virtual bool isNullPointer() const = 0;
+    virtual void writeNullPointer() = 0;
+
+    virtual ~Archive();
+  protected:
+    static bool registerArchiveType(const std::string& name, Archive* 
(*readopener)(const std::string&), Archive* (*writeopener)(const 
std::string&));
+    Archive(bool isreading);
+    bool isreading;
+  };
+
+}
+
+#endif

Added: branches/persistent/Core/Reflection/XMLArchive.cc
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Reflection/XMLArchive.cc   Tue May  8 21:21:25 
2007
@@ -0,0 +1,161 @@
+
+#include <Core/Reflection/XMLArchive.h>
+#include <Core/Exceptions/InputError.h>
+#include <Core/Exceptions/SerializationError.h>
+#include <Core/Util/NotFinished.h>
+#include <libxml/parser.h>
+#include <sstream>
+
+using namespace Manta;
+using namespace std;
+
+inline
+const char* to_char_ptr(const xmlChar *t) {
+  return (const char*)t;
+}
+
+inline
+const xmlChar* to_xml_ch_ptr(const char *t) {
+  return (xmlChar*)t;
+}
+
+static Archive* readopener(const std::string& filename)
+{
+  LIBXML_TEST_VERSION;
+  
+  xmlDocPtr doc = xmlReadFile(filename.c_str(), 0, 
XML_PARSE_PEDANTIC|XML_PARSE_XINCLUDE);
+  
+  /* check if parsing suceeded */
+  if (doc == 0)
+    throw InputError("Error reading file: "+filename);
+
+  return new XMLArchive(doc, xmlDocGetRootElement(doc), true);
+}
+
+static Archive* writeopener(const std::string& filename)
+{
+  // Pull off the suffix...
+  string::size_type dot = filename.rfind('.');
+  string suffix;
+  if(dot == string::npos){
+    suffix="";
+  } else {
+    suffix = filename.substr(dot+1);
+  }
+  if(suffix == "xml" || suffix == "rtml"){
+    LIBXML_TEST_VERSION;
+  
+    xmlDocPtr doc = xmlNewDoc(to_xml_ch_ptr("1.0"));
+    xmlNodePtr node = xmlNewNode(0, to_xml_ch_ptr("Instance"));
+    xmlDocSetRootElement(doc, node);
+    return new XMLArchive(doc, node, strdup(filename.c_str()));
+  } else {
+    return 0;
+  }
+}
+
+bool XMLArchive::force_initialize = Archive::registerArchiveType("xml", 
readopener, writeopener);
+
+XMLArchive::XMLArchive(xmlDocPtr doc, xmlNodePtr node, bool ownsDoc)
+  : Archive(true), doc(doc), node(node), filename(0), ownsDoc(ownsDoc)
+{
+}
+
+XMLArchive::XMLArchive(xmlDocPtr doc, xmlNodePtr node, char* filename)
+  : Archive(false), doc(doc), node(node), filename(filename), ownsDoc(0)
+{
+}
+
+XMLArchive::XMLArchive(XMLArchive* copy, xmlNodePtr node)
+  : Archive(copy->isreading), doc(copy->doc), node(node), filename(0), 
ownsDoc(0)
+{
+}
+
+XMLArchive::~XMLArchive()
+{
+  if(filename){
+    xmlKeepBlanksDefault(0);
+    xmlSaveFormatFileEnc(filename, doc, "UTF-8", 1);
+    free(filename);
+  }
+
+  if(ownsDoc)
+    xmlFreeDoc(doc);
+}
+
+void XMLArchive::writeProperty(const char* fieldname, const std::string& 
value)
+{
+  if(xmlHasProp(node, to_xml_ch_ptr(fieldname))){
+    ostringstream msg;
+    msg << "Writing duplicate field (" << fieldname << ")";
+    const char* cl = to_char_ptr(xmlGetProp(node, to_xml_ch_ptr("class")));
+    if(cl)
+      msg << " in writing class " << cl << '\n';
+    throw SerializationError(msg.str());
+  }
+  xmlSetProp(node, to_xml_ch_ptr(fieldname), to_xml_ch_ptr(value.c_str()));
+}
+
+void XMLArchive::readwrite(const char* fieldname, int& data)
+{
+  if(reading()){
+    NOT_FINISHED("XMLArchive::readwrite");
+  } else {
+    ostringstream datastring;
+    datastring << data;
+    writeProperty(fieldname, datastring.str());
+  }
+}
+
+void XMLArchive::readwrite(const char* fieldname, float& data)
+{
+  if(reading()){
+    NOT_FINISHED("XMLArchive::readwrite");
+  } else {
+    ostringstream datastring;
+    datastring.precision(8);
+    datastring << data;
+    writeProperty(fieldname, datastring.str());
+  }
+}
+
+void XMLArchive::readwrite(const char* fieldname, float* data, int 
numelements)
+{
+  NOT_FINISHED("XMLArchive::readwrite");
+}
+
+void XMLArchive::readwrite(const char* fieldname, double& data)
+{
+  NOT_FINISHED("XMLArchive::readwrite");
+}
+    
+std::string XMLArchive::getClassname() const
+{
+  return to_char_ptr(node->name);
+}
+
+Archive* XMLArchive::findField(const std::string& fieldname) const
+{
+  NOT_FINISHED("XMLArchive::findField");
+  return 0;
+}
+
+Archive* XMLArchive::createField(const std::string& fieldname, const 
std::string& classname)
+{
+  xmlNodePtr child = xmlNewNode(0, to_xml_ch_ptr("Instance"));
+  xmlSetProp(child, to_xml_ch_ptr("field"), 
to_xml_ch_ptr(fieldname.c_str()));
+  xmlSetProp(child, to_xml_ch_ptr("class"), 
to_xml_ch_ptr(classname.c_str()));
+  xmlAddChild(node, child);
+  return new XMLArchive(this, child);
+}
+
+bool XMLArchive::isNullPointer() const
+{
+  NOT_FINISHED("XMLArchive::isNullPointer");
+  return false;
+}
+
+void XMLArchive::writeNullPointer()
+{
+  NOT_FINISHED("XMLArchive::writeNullPointer");
+}

Added: branches/persistent/Core/Reflection/XMLArchive.h
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Reflection/XMLArchive.h    Tue May  8 21:21:25 
2007
@@ -0,0 +1,38 @@
+
+#ifndef Manta_XMLArchive_h
+#define Manta_XMLArchive_h
+
+#include <Core/Reflection/Reflection.h>
+#include <libxml/tree.h>
+
+namespace Manta {
+  class XMLArchive : public Archive {
+  public:
+    XMLArchive(xmlDocPtr doc, xmlNodePtr node, bool ownsDoc);
+    XMLArchive(xmlDocPtr doc, xmlNodePtr node, char* filename);
+    XMLArchive(XMLArchive* archive, xmlNodePtr node);
+    virtual ~XMLArchive();
+
+    virtual void readwrite(const char* fieldname, int& data);
+    virtual void readwrite(const char* fieldname, float& data);
+    virtual void readwrite(const char* fieldname, float* data, int 
numElements);
+    virtual void readwrite(const char* fieldname, double& data);
+    
+    virtual std::string getClassname() const;
+
+    virtual Archive* findField(const std::string& fieldname) const;
+    virtual Archive* createField(const std::string& fieldname, const 
std::string& classname);
+    virtual bool isNullPointer() const;
+    virtual void writeNullPointer();
+  private:
+    xmlDocPtr doc;
+    xmlNodePtr node;
+    char* filename;
+    bool ownsDoc;
+
+    static bool force_initialize;
+    void writeProperty(const char* fieldname, const std::string& value);
+  };
+}
+
+#endif

Added: branches/persistent/Core/Reflection/stdRefl.h
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Reflection/stdRefl.h       Tue May  8 21:21:25 
2007
@@ -0,0 +1,20 @@
+
+#ifndef Manta_stdRefl_h
+#define Manta_stdRefl_h
+
+#include <Core/Reflection/Reflection.h>
+#include <Core/Util/NotFinished.h>
+#include <vector>
+
+namespace Manta {
+  template<class T>
+  class ReflectionInfo<std::vector<T> > : public 
ReflectionInfo_BaseClass<std::vector<T> > {
+  public:
+    static void readwrite(Archive* archive, std::vector<T>& data) {
+      archive->
+      NOT_FINISHED("vector readwrite");
+    }
+  };
+}
+
+#endif

Modified: branches/persistent/Engine/Factory/Factory.cc
==============================================================================
--- branches/persistent/Engine/Factory/Factory.cc       (original)
+++ branches/persistent/Engine/Factory/Factory.cc       Tue May  8 21:21:25 
2007
@@ -27,17 +27,19 @@
 */
 
 #include <Engine/Factory/Factory.h>
-#include <Engine/Factory/RegisterKnownComponents.h>
 
-#include <Interface/MantaInterface.h>
-#include <Interface/Context.h>
-
-#include <Core/Util/Args.h>
+#include <Core/Containers/StringUtil.h>
 #include <Core/Exceptions/UnknownComponent.h>
 #include <Core/Exceptions/IllegalValue.h>
 #include <Core/Exceptions/InputError.h>
-
-#include <Core/Containers/StringUtil.h>
+#include <Core/Exceptions/InternalError.h>
+#include <Core/Reflection/Reflection.h>
+#include <Core/Util/Args.h>
+#include <Engine/Factory/RegisterKnownComponents.h>
+#include <Interface/Context.h>
+#include <Interface/MantaInterface.h>
+#include <Interface/InterfaceRefl.h>
+#include <Interface/Scene.h>
 
 #include <errno.h>
 #include <sys/types.h>
@@ -372,7 +374,9 @@
   system_suffix = "so";
 #endif
 
-  if((suffix == "mo") || (suffix == "so") || (suffix == "dylib") ||
+  if(suffix == "rtml" || suffix == "xml"){
+    newScene = readArchiveScene(name, args);
+  } else if((suffix == "mo") || (suffix == "so") || (suffix == "dylib") ||
      (suffix == "dll")) {
     // Do this twice - once silently and once printing errors
     newScene = readMOScene(name, args, true);
@@ -429,8 +433,42 @@
   return list;
 }
 
+Scene* Factory::readArchiveScene(const string& name, const vector<string>& 
args) const
+{
+  using SCIRun::split_string;
+
+  // Determine which directories to search for the scene library.
+  string fullname = name;
+  vector<string> dirs = split_string(scenePath, ':');
+  for(vector<string>::iterator dir = dirs.begin(); dir != dirs.end(); dir++){
+
+    fullname = *dir + "/" + name;
+    
+    // Check to see if the file exists.
+    struct stat statbuf;
+    if(stat(fullname.c_str(), &statbuf) == 0){
+      break;
+    }
+  }
+
+  Archive* archive = Archive::openForReading(fullname);
+  if(!archive)
+    throw InputError("Could not open Archive: " + fullname);
+  
+  string root = archive->getClassname();
+  if(root == "Scene"){
+    Scene* scene = 0;
+    archive->readwriteObject(scene);
+    if(!scene)
+      throw InternalError("Error reading file: " + fullname, __FILE__, 
__LINE__);
+    return scene;
+  } else {
+    throw InputError("Unknown root object (" + root + ") in file: " + 
fullname + ", file should contain a Scene");
+  }
+}  
+
 Scene* Factory::readMOScene(const string& name, const vector<string>& args,
-                         bool printErrors) const
+                            bool printErrors) const
 {
   using SCIRun::split_string;
 
@@ -550,5 +588,3 @@
     list.push_back(iter->first);
   return list;
 }
-
-

Modified: branches/persistent/Engine/Factory/Factory.h
==============================================================================
--- branches/persistent/Engine/Factory/Factory.h        (original)
+++ branches/persistent/Engine/Factory/Factory.h        Tue May  8 21:21:25 
2007
@@ -198,6 +198,7 @@
   
     string scenePath;
     
+    Scene* Factory::readArchiveScene(const string& name, const 
vector<string>& args) const;
     Scene* readMOScene(const string& name, const vector<string>& args, bool 
printErrors) const;
     void readMOStack(const string& name, const vector<string>& args, bool 
printErrors ) const;
 

Modified: branches/persistent/Interface/CMakeLists.txt
==============================================================================
--- branches/persistent/Interface/CMakeLists.txt        (original)
+++ branches/persistent/Interface/CMakeLists.txt        Tue May  8 21:21:25 
2007
@@ -42,6 +42,7 @@
         Renderer.h
         Renderer.cc
         RenderParameters.h
+        RenderParameters.cc
         SetupCallback.h
         SetupCallback.cc
         Scene.h

Added: branches/persistent/Interface/InterfaceRefl.h
==============================================================================
--- (empty file)
+++ branches/persistent/Interface/InterfaceRefl.h       Tue May  8 21:21:25 
2007
@@ -0,0 +1,57 @@
+
+#ifndef Manta_InterfaceRefl_h
+#define Manta_InterfaceRefl_h
+
+#include <Core/Reflection/Reflection.h>
+
+namespace Manta {
+  class AmbientLight;
+  class Background;
+  class Interpolable;
+  class Light;
+  class LightSet;
+  class Material;
+  class Object;
+  class RenderParameters;
+  class TexCoordMapper;
+  class Scene;
+
+  template<>
+  class ReflectionInfo<AmbientLight> : public 
ReflectionInfo_BaseClass<AmbientLight>, public 
ReflectionInfo_readwriteNone<AmbientLight> {
+  };
+
+  template<>
+  class ReflectionInfo<Light> : public ReflectionInfo_BaseClass<Light>, 
public ReflectionInfo_readwriteNone<Light> {
+  };
+
+  template<>
+  class ReflectionInfo<Material> : public 
ReflectionInfo_DerivedClass<Material, Interpolable>, public 
ReflectionInfo_readwriteNone<Material> {
+  };
+
+  template<>
+  class ReflectionInfo<TexCoordMapper> : public 
ReflectionInfo_DerivedClass<TexCoordMapper, Interpolable>, public 
ReflectionInfo_readwriteNone<TexCoordMapper> {
+  };
+
+  template<>
+  class ReflectionInfo<Scene> : public ReflectionInfo_BaseClass<Scene>, 
public ReflectionInfo_readwriteMethod<Scene> {
+  };
+
+  template<>
+  class ReflectionInfo<Background> : public 
ReflectionInfo_BaseClass<Background>, public 
ReflectionInfo_readwriteNone<Background> {
+  };
+
+  template<>
+  class ReflectionInfo<Object> : public ReflectionInfo_DerivedClass<Object, 
Interpolable>, public ReflectionInfo_readwriteNone<Object> {
+  };
+
+  template<>
+  class ReflectionInfo<LightSet> : public 
ReflectionInfo_BaseClass<LightSet>, public 
ReflectionInfo_readwriteMethod<LightSet> {
+  };
+
+  template<>
+  class ReflectionInfo<RenderParameters> : public 
ReflectionInfo_BaseClass<RenderParameters>, public 
ReflectionInfo_readwriteMethod<RenderParameters> {
+  };
+
+}
+
+#endif

Modified: branches/persistent/Interface/Light.h
==============================================================================
--- branches/persistent/Interface/Light.h       (original)
+++ branches/persistent/Interface/Light.h       Tue May  8 21:21:25 2007
@@ -8,6 +8,7 @@
 
 namespace Manta {
 
+  class Archive;
   class PreprocessContext;
   class RenderContext;
        
@@ -25,6 +26,7 @@
                               const RenderContext &context,
                               RayPacket& sourceRays) const = 0;
 
+    void readwrite(Archive* archive);
   private:
     // Lights may not be copied.
     Light( const Light & );

Modified: branches/persistent/Interface/LightSet.cc
==============================================================================
--- branches/persistent/Interface/LightSet.cc   (original)
+++ branches/persistent/Interface/LightSet.cc   Tue May  8 21:21:25 2007
@@ -2,6 +2,8 @@
 #include <Interface/LightSet.h>
 #include <Interface/AmbientLight.h>
 #include <Interface/Light.h>
+#include <Interface/InterfaceRefl.h>
+#include <Core/Reflection/stdRefl.h>
 #include <Core/Util/Assert.h>
 
 #include <sgi_stl_warnings_off.h>
@@ -49,4 +51,10 @@
     out << "lights["<<i<<"] = "<<lights[i]<<"\n";
   }
   return out.str();
+}
+
+void LightSet::readwrite(Archive* archive)
+{
+  archive->readwrite("lights", lights);
+  archive->readwrite("ambientLight", ambientLight);
 }

Modified: branches/persistent/Interface/LightSet.h
==============================================================================
--- branches/persistent/Interface/LightSet.h    (original)
+++ branches/persistent/Interface/LightSet.h    Tue May  8 21:21:25 2007
@@ -43,6 +43,7 @@
 
     string toString() const;
 
+    void readwrite(Archive* archive);
   private:
     LightSet(const LightSet&);
     LightSet& operator=(const LightSet&);

Added: branches/persistent/Interface/RenderParameters.cc
==============================================================================
--- (empty file)
+++ branches/persistent/Interface/RenderParameters.cc   Tue May  8 21:21:25 
2007
@@ -0,0 +1,11 @@
+
+#include <Interface/RenderParameters.h>
+#include <Core/Reflection/Reflection.h>
+
+using namespace Manta;
+
+void RenderParameters::readwrite(Archive* archive)
+{
+  archive->readwrite("maxDepth", maxDepth);
+  archive->readwrite("importanceCutoff", importanceCutoff);
+}

Modified: branches/persistent/Interface/RenderParameters.h
==============================================================================
--- branches/persistent/Interface/RenderParameters.h    (original)
+++ branches/persistent/Interface/RenderParameters.h    Tue May  8 21:21:25 
2007
@@ -5,6 +5,7 @@
 #include <MantaTypes.h>
 
 namespace Manta {
+  class Archive;
   class RenderParameters {
   public:
     RenderParameters() {
@@ -28,6 +29,8 @@
       if (new_importanceCutoff >= 0)
         importanceCutoff = new_importanceCutoff;
     }
+
+    void readwrite(Archive* archive);
   private:
   };
 }

Modified: branches/persistent/Interface/Scene.cc
==============================================================================
--- branches/persistent/Interface/Scene.cc      (original)
+++ branches/persistent/Interface/Scene.cc      Tue May  8 21:21:25 2007
@@ -1,5 +1,10 @@
 
 #include <Interface/Scene.h>
+#include <Core/Reflection/stdRefl.h>
+#include <Interface/Background.h>
+#include <Interface/InterfaceRefl.h>
+#include <Interface/LightSet.h>
+
 using namespace Manta;
 
 int Scene::addBookmark(const std::string& name, const Vector& eye, const 
Vector& lookat,
@@ -37,4 +42,14 @@
     currentBookmark = 0;
 
   return &bookmarks[currentBookmark]->cameradata;
+}
+
+void Scene::readwrite(Archive* archive)
+{
+  archive->readwrite("object", object);
+  archive->readwrite("bg", bg);
+  archive->readwrite("lights", lights);
+  archive->readwrite("renderParameters", renderParameters);
+  archive->readwrite("bookmarks", bookmarks);
+  archive->readwrite("currentBookmark", currentBookmark);
 }

Modified: branches/persistent/Interface/Scene.h
==============================================================================
--- branches/persistent/Interface/Scene.h       (original)
+++ branches/persistent/Interface/Scene.h       Tue May  8 21:21:25 2007
@@ -8,6 +8,7 @@
 #include <vector>
 
 namespace Manta {
+  class Archive;
   class Background;
   class LightSet;
   class Object;
@@ -73,6 +74,7 @@
     void selectBookmark(int bookmark);
     const BasicCameraData* nextBookmark();
 
+    void readwrite(Archive*);
   private:
     Object* object;
     Background* bg;

Modified: branches/persistent/Interface/TexCoordMapper.h
==============================================================================
--- branches/persistent/Interface/TexCoordMapper.h      (original)
+++ branches/persistent/Interface/TexCoordMapper.h      Tue May  8 21:21:25 
2007
@@ -5,6 +5,7 @@
 #include <Interface/Interpolable.h>
 
 namespace Manta {
+  class Archive;
   class RayPacket;
   class RenderContext;
 
@@ -17,6 +18,8 @@
                                   RayPacket& rays) const = 0;
     virtual void computeTexCoords3(const RenderContext& context,
                                   RayPacket& rays) const = 0;
+
+    void readwrite(Archive* archive);
   private:
     TexCoordMapper(const TexCoordMapper&);
     TexCoordMapper& operator=(const TexCoordMapper&);

Modified: branches/persistent/Model/Primitives/PrimitiveCommon.cc
==============================================================================
--- branches/persistent/Model/Primitives/PrimitiveCommon.cc     (original)
+++ branches/persistent/Model/Primitives/PrimitiveCommon.cc     Tue May  8 
21:21:25 2007
@@ -1,6 +1,8 @@
 
 #include <Model/Primitives/PrimitiveCommon.h>
+#include <Core/Reflection/Reflection.h>
 #include <Interface/Material.h>
+#include <Interface/InterfaceRefl.h>
 #include <Model/TexCoordMappers/UniformMapper.h>
 #include <assert.h>
 
@@ -67,4 +69,25 @@
   tex = pc->tex;
 
   return success;
+}
+
+namespace Manta {
+  template<>
+  class ReflectionInfo<PrimitiveCommon> : public 
ReflectionInfo_DerivedClass<PrimitiveCommon, Primitive>
+  {
+    char force_initialize;
+  };
+
+#if 0
+  template<>
+  ReflectionInfo<PrimitiveCommon>::force_initialize = 
ReflectionInfo<PrimitiveCommon>::register_class("Manta::PrimitiveCommon");
+#endif
+}
+
+void PrimitiveCommon::readwrite(Archive* archive)
+{
+  //Primitive::readwrite(archive);
+  NOT_FINISHED("readwrite parent");
+  archive->readwrite("material", material);
+  archive->readwrite("tex", tex);
 }

Modified: branches/persistent/Model/Primitives/PrimitiveCommon.h
==============================================================================
--- branches/persistent/Model/Primitives/PrimitiveCommon.h      (original)
+++ branches/persistent/Model/Primitives/PrimitiveCommon.h      Tue May  8 
21:21:25 2007
@@ -6,6 +6,7 @@
 #include <Interface/Primitive.h>
 
 namespace Manta {
+  class Archive;
   class Material;
   class PrimitiveCommon : public Primitive {
   public:
@@ -29,6 +30,9 @@
     virtual PrimitiveCommon* clone(CloneDepth depth, Clonable* 
incoming=NULL);
     virtual InterpErr interpolate(const std::vector<keyframe_t> &keyframes);
 #endif
+
+  protected:
+    void readwrite(Archive* archive);
 
   private:
     Material* material;

Modified: branches/persistent/Model/Primitives/Sphere.cc
==============================================================================
--- branches/persistent/Model/Primitives/Sphere.cc      (original)
+++ branches/persistent/Model/Primitives/Sphere.cc      Tue May  8 21:21:25 
2007
@@ -7,6 +7,7 @@
 #include <Core/Math/Expon.h>
 #include <MantaSSE.h>
 #include <Core/Math/SSEDefs.h>
+#include <Core/Reflection/Reflection.h>
 
 using namespace Manta;
 using namespace SCIRun;
@@ -407,4 +408,26 @@
   inv_radius = 1/radius;
 
   return success;
+}
+
+namespace Manta {
+template<>
+class ReflectionInfo<Sphere> : public ReflectionInfo_DerivedClass<Sphere, 
PrimitiveCommon>
+{
+  char force_initialize;
+};
+
+#if 0
+template<>
+bool ReflectionInfo<Sphere>::force_initialize = 
ReflectionInfo<Sphere>::register_class("Manta::Sphere");
+#endif
+}
+
+void Sphere::readwrite(Archive* archive)
+{
+  PrimitiveCommon::readwrite(archive);
+  archive->readwrite("center", center);
+  archive->readwrite("radius", radius);
+  if(archive->reading())
+    inv_radius = 1./radius;
 }

Modified: branches/persistent/Model/Primitives/Sphere.h
==============================================================================
--- branches/persistent/Model/Primitives/Sphere.h       (original)
+++ branches/persistent/Model/Primitives/Sphere.h       Tue May  8 21:21:25 
2007
@@ -7,6 +7,8 @@
 #include <Core/Geometry/Vector.h>
 
 namespace Manta {
+  class Archive;
+
   class Sphere : public PrimitiveCommon {
   public:
     Sphere(Material* material, const Vector& center, Real radius);
@@ -41,6 +43,8 @@
     Vector center;
     Real radius;
     Real inv_radius;
+
+    void readwrite(Archive* archive);
   };
 }
 

Modified: branches/persistent/StandAlone/CMakeLists.txt
==============================================================================
--- branches/persistent/StandAlone/CMakeLists.txt       (original)
+++ branches/persistent/StandAlone/CMakeLists.txt       Tue May  8 21:21:25 
2007
@@ -8,6 +8,15 @@
                              -lm)
 
 
+ADD_EXECUTABLE(savescene savescene.cc)
+TARGET_LINK_LIBRARIES(savescene ${MANTA_TARGET_LINK_LIBRARIES})
+
+ TARGET_LINK_LIBRARIES(manta ${CMAKE_THREAD_LIBS_INIT}
+                             ${OPENGL_LIBRARIES}
+                             ${X11_LIBRARIES}
+                             -lm)
+
+
 ADD_EXECUTABLE(barrier_test barrier_test.cc)
 TARGET_LINK_LIBRARIES(barrier_test SCIRun_Core
                                   ${CMAKE_THREAD_LIBS_INIT})

Added: branches/persistent/StandAlone/savescene.cc
==============================================================================
--- (empty file)
+++ branches/persistent/StandAlone/savescene.cc Tue May  8 21:21:25 2007
@@ -0,0 +1,114 @@
+
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005-2006
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Core/Util/Args.h>
+#include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Exceptions/OutputError.h>
+#include <Core/Reflection/Reflection.h>
+#include <Engine/Factory/Factory.h>
+#include <Interface/MantaInterface.h>
+#include <Interface/InterfaceRefl.h>
+#include <Interface/Scene.h>
+#include <SCIRun/Core/Thread/Thread.h>
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+using namespace Manta;
+using namespace SCIRun;
+
+void usage()
+{
+  cerr << "usage: savescene scenefile outfile\n";
+  exit(1);
+}
+
+int
+main(int argc, char* argv[])
+{
+  // Copy args into a vector<string>
+  vector<string> args;
+  for(int i=1;i<argc;i++)
+    args.push_back(argv[i]);
+       
+  try {
+
+    
///////////////////////////////////////////////////////////////////////////
+    // Create Manta.
+    MantaInterface* rtrt = createManta();
+
+    // Create a Manta Factory.
+    Factory* factory = new Factory( rtrt );
+    
+    // Set the scene search path based on an env variable.
+    if(getenv("MANTA_SCENEPATH"))
+      factory->setScenePath(getenv("MANTA_SCENEPATH"));
+    else
+      factory->setScenePath("");
+    if(args.size() != 2)
+      usage();
+    int i=-1;
+    string scenename;
+    if(!getStringArg(i, args, scenename))
+      usage();
+    if(!factory->readScene(scenename)){
+      cerr << "Error reading scene: " << scenename << '\n';
+      throw IllegalArgument( "-scene", i, args );
+    }
+    string outfile;
+    if(!getStringArg(i, args, outfile))
+      usage();
+    
+    Archive* archive = Archive::openForWriting(outfile);
+    if(!archive)
+      throw OutputError("Could not open Archive for writing: " + outfile);
+    Scene* scene = rtrt->getScene();
+    archive->readwriteObject(scene);
+    delete archive;
+    delete rtrt;
+
+    
+  } catch (SCIRun::Exception& e) {
+    cerr << "savescene.cc (top level): Caught SCIRun exception: " << 
e.message() << '\n';
+    Thread::exitAll( 1 );
+               
+  } catch (std::exception e){
+    cerr << "savescene.cc (top level): Caught std exception: "
+         << e.what()
+         << '\n';
+    Thread::exitAll(1);
+               
+  } catch(...){
+    cerr << "savescene.cc (top level): Caught unknown exception\n";
+    Thread::exitAll(1);
+  }
+
+  Thread::exitAll(0);
+}

Modified: branches/persistent/TODO
==============================================================================
--- branches/persistent/TODO    (original)
+++ branches/persistent/TODO    Tue May  8 21:21:25 2007
@@ -1,36 +1,25 @@
-#ifdef MANTA_SSE
-    int b = (rays.rayBegin + 3) & (~3);
-    int e = rays.rayEnd & (~3);
-    if(b == e){
-      for(int i = rays.begin(); i < rays.end(); i++){
-      }
-    } else {
-      int i = rays.rayBegin;
-      for(;i<b;i++){
-      }
-      RayPacketData* data = rays.data;
-      for(;i<e;i+=4){
-      }
-      for(;i<rays.rayEnd;i++){
-      }
-    }
-#else
-    for(int i = rays.begin(); i < rays.end(); i++){
-    }
-#endif
-
-
-namespace std {
-  std::ostream& operator<< (std::ostream& os, __m128 d)
-  {
-    float* data = (float*)&d;
-    cerr << '[' << data[0] << ", " << data[1] << ", " << data[2] << ", " << 
data[3] << ']';;
-  }
-}
-
-
-Point/Vector:
- - double-check const-correctness
+Error checking in xmlarchive
+Set class for top level object
+why is maxdepth attached to top object
+complete reflectiondb
+Need to mark objects already emitted
+
+XML types:
+1. <object type="a">
+     <object type="b">
+     </object>
+  </object>
+
+2. <object type="b">
+   </object>
+   <object type="a">
+      <ref b/>
+   </object>
+
+3. <a>
+     <b>
+     </b>
+   </a>
 
 Cmake:
  - Class rtrt fix
@@ -45,10 +34,8 @@
 
 Color:
  - Special class for just RGB (more efficient???)
- - Class for black/white - more efficient?
 
 Code review:
- - Dielectric
  - MetalMaterial
  - Box/Cube
  - Sampling




  • [MANTA] r1378 - in branches/persistent: . Core Core/Exceptions Core/Geometry Core/Reflection Engine/Factory Interface Model/Primitives StandAlone, sparker, 05/08/2007

Archive powered by MHonArc 2.6.16.

Top of page