Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1386 - in branches/persistent: . Core/Reflection Interface
- Date: Sun, 13 May 2007 04:19:25 -0600 (MDT)
Author: sparker
Date: Sun May 13 04:19:23 2007
New Revision: 1386
Modified:
branches/persistent/Core/Reflection/ClassInfo.h
branches/persistent/Core/Reflection/stdClassInfo.h
branches/persistent/Interface/InterfaceClassInfo.cc
branches/persistent/Interface/InterfaceClassInfo.h
branches/persistent/Interface/Scene.cc
branches/persistent/TODO
Log:
Fix a few bugs
Modified: branches/persistent/Core/Reflection/ClassInfo.h
==============================================================================
--- branches/persistent/Core/Reflection/ClassInfo.h (original)
+++ branches/persistent/Core/Reflection/ClassInfo.h Sun May 13 04:19:23
2007
@@ -175,8 +175,10 @@
class ClassInfo_BaseClass {
public:
static std::string getPublicClassname() {
- if(!classname)
+ if(!classname){
+ std::cerr << "T: " << typeid(T).name() << '\n';
throw SCIRun::InternalError(std::string("Class: ") +
typeid(T).name() + " is not registered", __FILE__, __LINE__);
+ }
return *classname;
}
static bool registerClass(const std::string& _classname);
Modified: branches/persistent/Core/Reflection/stdClassInfo.h
==============================================================================
--- branches/persistent/Core/Reflection/stdClassInfo.h (original)
+++ branches/persistent/Core/Reflection/stdClassInfo.h Sun May 13 04:19:23
2007
@@ -11,15 +11,17 @@
class ClassInfo<std::vector<T> > {
public:
static std::string getPublicClassname() {
+ init.forceinit();
if(!classname)
throw SCIRun::InternalError(std::string("vector<") +
typeid(T).name() + "> is not registered", __FILE__, __LINE__);
return *classname;
}
- static bool registerClass(const std::string& _classname);
- static T* createInstance() {
+ static std::vector<T>* createInstance() {
+ init.forceinit();
return new std::vector<T>();
}
static void readwrite(Archive* archive, std::vector<T>& data) {
+ init.forceinit();
NOT_FINISHED("vector readwrite");
}
private:
@@ -29,7 +31,9 @@
std::string name = "std::vector<" +
ClassInfo<T>::getPublicClassname() + ">";
std::cerr << "Registering vector: " << name << '\n';
classname = new std::string(name);
- ClassDatabase<T>::template registerClass<std::vector<T> >(name);
+ ClassDatabase<std::vector<T> >::template
registerClass<std::vector<T> >(name);
+ }
+ void forceinit() {
}
};
static Initializer init;
@@ -38,7 +42,49 @@
template<class T>
std::string* ClassInfo<std::vector<T> >::classname;
template<class T>
- ClassInfo<std::vector<T> >::Initializer ClassInfo<std::vector<T> >::init;
+ typename ClassInfo<std::vector<T> >::Initializer ClassInfo<std::vector<T>
>
::init;
+
+ template<class T>
+ class ClassInfo<std::vector<T*> > {
+ public:
+ static std::string getPublicClassname() {
+ init.forceinit();
+ if(!classname)
+ throw SCIRun::InternalError(std::string("vector<") +
typeid(T).name() + "*> is not registered", __FILE__, __LINE__);
+ return *classname;
+ }
+ static std::vector<T*>* createInstance() {
+ init.forceinit();
+ return new std::vector<T*>();
+ }
+ static void readwrite(Archive* archive, std::vector<T*>& data) {
+ init.forceinit();
+ NOT_FINISHED("vector readwrite");
+ }
+ private:
+ class Initializer {
+ public:
+ Initializer();
+ void forceinit() {
+ }
+ };
+ static Initializer init;
+ static std::string* classname;
+ };
+ template<class T>
+ ClassInfo<std::vector<T*> >::Initializer::Initializer()
+ {
+ std::cerr << "Initializing vector<" << typeid(T).name() << "*>\n";
+ std::string name = "std::vector<" + ClassInfo<T>::getPublicClassname() +
"*>";
+ std::cerr << "Registering vector: " << name << '\n';
+ classname = new std::string(name);
+ ClassDatabase<std::vector<T*> >::template registerClass<std::vector<T*>
>
(name);
+ }
+ template<class T>
+ std::string* ClassInfo<std::vector<T*> >::classname;
+ template<class T>
+ typename ClassInfo<std::vector<T*> >::Initializer
ClassInfo<std::vector<T*> >::init;
+
}
#endif
Modified: branches/persistent/Interface/InterfaceClassInfo.cc
==============================================================================
--- branches/persistent/Interface/InterfaceClassInfo.cc (original)
+++ branches/persistent/Interface/InterfaceClassInfo.cc Sun May 13 04:19:23
2007
@@ -1,10 +1,14 @@
#include <Interface/InterfaceClassInfo.h>
+#include <Interface/Background.h>
#include <Interface/Interpolable.h>
+#include <Interface/Light.h>
#include <Interface/Object.h>
using namespace std;
using namespace Manta;
+bool ClassInfo<Background>::force_initialize =
ClassInfo<Background>::registerClass("Background");
bool ClassInfo<Interpolable>::force_initialize =
ClassInfo<Interpolable>::registerClass("Interpolable");
+bool ClassInfo<Light>::force_initialize =
ClassInfo<Light>::registerClass("Light");
bool ClassInfo<Object>::force_initialize =
ClassInfo<Object>::registerClass("Object");
Modified: branches/persistent/Interface/InterfaceClassInfo.h
==============================================================================
--- branches/persistent/Interface/InterfaceClassInfo.h (original)
+++ branches/persistent/Interface/InterfaceClassInfo.h Sun May 13 04:19:23
2007
@@ -24,7 +24,7 @@
};
template<>
- class ClassInfo<Light> : public ClassInfo_BaseClass<Light>, public
ClassInfo_AbstractClass<AmbientLight>, public ClassInfo_readwriteNone<Light> {
+ class ClassInfo<Light> : public ClassInfo_BaseClass<Light>, public
ClassInfo_AbstractClass<Light>, public ClassInfo_readwriteNone<Light> {
static bool force_initialize;
};
Modified: branches/persistent/Interface/Scene.cc
==============================================================================
--- branches/persistent/Interface/Scene.cc (original)
+++ branches/persistent/Interface/Scene.cc Sun May 13 04:19:23 2007
@@ -51,6 +51,7 @@
archive->readwrite("bg", bg);
archive->readwrite("lights", lights);
archive->readwrite("renderParameters", renderParameters);
- archive->readwrite("bookmarks", bookmarks);
+ NOT_FINISHED("readwrite bookmarks");
+ //archive->readwrite("bookmarks", bookmarks);
archive->readwrite("currentBookmark", currentBookmark);
}
Modified: branches/persistent/TODO
==============================================================================
--- branches/persistent/TODO (original)
+++ branches/persistent/TODO Sun May 13 04:19:23 2007
@@ -1,4 +1,7 @@
+make registration less error prone?
+specialize classinfo for pointers? Then remove specialization from vector
specialization for vector<T*>
+figure out initialization order issues
SError checking in xmlarchive
Set class for top level object
why is maxdepth attached to top object
- [MANTA] r1386 - in branches/persistent: . Core/Reflection Interface, sparker, 05/13/2007
Archive powered by MHonArc 2.6.16.