Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1482 - in trunk: Interface Model/Groups Model/Primitives SwigInterface
- Date: Tue, 17 Jul 2007 14:49:34 -0600 (MDT)
Author: bigler
Date: Tue Jul 17 14:49:32 2007
New Revision: 1482
Modified:
trunk/Interface/TValue.h
trunk/Model/Groups/KDTreeDyn.h
trunk/Model/Primitives/PrimitiveCommon.h
trunk/SwigInterface/CMakeLists.txt
trunk/SwigInterface/manta.i
trunk/SwigInterface/mantainterface.i
Log:
Interface/TValue.h
Remove #ifdef SWIG stuff. I got it to ignore these in the interface
file.
Model/Groups/KDTreeDyn.h
These nested unions, I couldn't get it to ignore or stop printing
out the warning.
Model/Primitives/PrimitiveCommon.h
Adding the pure virtual method from Primitive. This fixes some swig
warnings.
SwigInterface/CMakeLists.txt
Centralized swig arguments.
SwigInterface/manta.i
SwigInterface/mantainterface.i
Fix a bunch of warnings. Some of the fixes involved changing the
interface, others invoved ignoring warnings that are just plain
stupid (what do I care if you pick the non const version of the
const version of a function, that's why I made two). Warning
suppression works my patched version of SWIG, but unfortunately
didn't work on version 1.3.29 I found on hex.sci. Perhaps some day
the good people at swig land will incorporate it.
Added better wrapping of Array1.
Moved thread code to mantainterface.i.
Added IdleMode, SCIRun::Runnable, and SCIRun::Semaphore.
Modified: trunk/Interface/TValue.h
==============================================================================
--- trunk/Interface/TValue.h (original)
+++ trunk/Interface/TValue.h Tue Jul 17 14:49:32 2007
@@ -15,12 +15,10 @@
{
}
-#ifndef SWIG
void operator=(const T& newvalue)
{
value = newvalue;
}
-#endif
operator T() const
{
Modified: trunk/Model/Groups/KDTreeDyn.h
==============================================================================
--- trunk/Model/Groups/KDTreeDyn.h (original)
+++ trunk/Model/Groups/KDTreeDyn.h Tue Jul 17 14:49:32 2007
@@ -74,6 +74,7 @@
};
struct KDTreeDyn_Node {
+#ifndef SWIG
union {
NodeOffset leftOffset; // Always even. Right child offset is
leftOffset+1;
IndexOffset listBegin;
@@ -82,6 +83,7 @@
float split; // internal
Integer listLen; // leaf
};
+#endif
unsigned char type; // 0=x,1=y,z=2,leaf=3
int size; // DEBUG ONLY!!!
Modified: trunk/Model/Primitives/PrimitiveCommon.h
==============================================================================
--- trunk/Model/Primitives/PrimitiveCommon.h (original)
+++ trunk/Model/Primitives/PrimitiveCommon.h Tue Jul 17 14:49:32 2007
@@ -17,6 +17,8 @@
// Note that this preprocess method sets up the activeLights for the
associated
// material (not sure what happens for shared materials)
virtual void preprocess(const PreprocessContext&);
+ virtual void intersect(const RenderContext& context,
+ RayPacket& rays) const = 0;
// Accessors.
void setTexCoordMapper(const TexCoordMapper* new_tex);
Modified: trunk/SwigInterface/CMakeLists.txt
==============================================================================
--- trunk/SwigInterface/CMakeLists.txt (original)
+++ trunk/SwigInterface/CMakeLists.txt Tue Jul 17 14:49:32 2007
@@ -36,10 +36,15 @@
# SWIG_ADD_MODULE(example python example.i example.cc)
# SWIG_LINK_LIBRARIES(example ${PYTHON_LIBRARIES})
+# -Wall : Turn on all the warnings.
+# -w512 : Turn off warning 512. Overloaded declaration const ignored.
Non-const method at file:line used.
+# -DSCI_NOPERSISTENT : Flag for SCIRun headers.
+SET(MANTA_SWIG_FLAGS -Wall -w512 -DSCI_NOPERSISTENT) # Don't put quotes
around it. It needs to be a list.
+
############################################################
# Manta Interface.
SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES SWIG_FLAGS
"-Wall;-DSCI_NOPERSISTENT")
+SET_SOURCE_FILES_PROPERTIES(mantainterface.i PROPERTIES SWIG_FLAGS
"${MANTA_SWIG_FLAGS}")
SWIG_ADD_MODULE(mantainterface python mantainterface.i manta.cc manta.h)
SWIG_LINK_LIBRARIES(mantainterface
@@ -54,7 +59,7 @@
############################################################
# Manta Runtime.
SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS
"-Wall;-DSCI_NOPERSISTENT")
+SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS
"${MANTA_SWIG_FLAGS}")
SWIG_ADD_MODULE(manta python manta.i manta.cc manta.h)
SWIG_LINK_LIBRARIES(manta
@@ -83,7 +88,7 @@
############################################################
# Python callback code
SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES SWIG_FLAGS "-Wall")
+SET_SOURCE_FILES_PROPERTIES(pycallback.i PROPERTIES SWIG_FLAGS
"${MANTA_SWIG_FLAGS}")
SWIG_ADD_MODULE(pycallback python pycallback.i pycallback.cc pycallback.h)
SWIG_LINK_LIBRARIES(pycallback ${PYTHON_LIBRARIES})
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Tue Jul 17 14:49:32 2007
@@ -28,6 +28,8 @@
*/
%module manta
+// Supress stupid warning about wrapping the non const versions of functions.
+#pragma SWIG nowarn=512
%include "std_string.i"
%include "std_vector.i"
@@ -181,6 +183,12 @@
// Textures. If you add a new texture like FunkyTexture<MagicType>,
// you also need to add a template for Texture<MagicType> to reduce
// warnings.
+
+ // Turn off warning on previosly wrapped templates. This affects
+ // things when you have Manta::Real == Manta::ColorComponent.
+ %warnfilter(404) Texture<Manta::ColorComponent>;
+ %warnfilter(404) CheckerTexture<Manta::ColorComponent>;
+
%template(Texture_Color) Texture<Color>;
%template(Texture_Real) Texture<Manta::Real>;
%template(Texture_ColorComponent) Texture<Manta::ColorComponent>;
@@ -284,7 +292,26 @@
%{
#include <SCIRun/Core/Containers/Array1.h>
%}
-%include <SCIRun/Core/Containers/Array1.h>
+
+// Wrap the class here to get a customized interface to the class.
+namespace SCIRun {
+ template<class T>
+ class Array1 {
+ public:
+ Array1();
+ void add(const T&);
+ T* get_objs();
+ int size();
+ %extend {
+ T __getitem__( int i ) {
+ return self->operator[](i);
+ }
+ void __setitem__(int i,T val) {
+ self->operator[](i) = val;
+ }
+ }
+ };
+}
%template(Array1_ObjectP) SCIRun::Array1<Manta::Object*>;
@@ -332,25 +359,3 @@
}
};
} // end namespace Manta
-
-////////////////////////////////////////////////
-// Thread stuff
-%{
-#include <SCIRun/Core/Thread/Thread.h>
-%}
-
-// yield is a "future" reserved word for some versions of python.
-// This renames it to be something else.
-%rename(yieldProcess) yield;
-
-%include <SCIRun/Core/Thread/Thread.h>
-
-%rename(yield) yield;
-
-// namespace SCIRun {
-// struct Thread {
-// public:
-// static int numProcessors();
-// };
-// }
-
Modified: trunk/SwigInterface/mantainterface.i
==============================================================================
--- trunk/SwigInterface/mantainterface.i (original)
+++ trunk/SwigInterface/mantainterface.i Tue Jul 17 14:49:32 2007
@@ -28,6 +28,8 @@
*/
%module mantainterface
+// Supress stupid warning about wrapping the non const versions of functions.
+#pragma SWIG nowarn=512
%include "std_string.i"
%include "std_vector.i"
@@ -147,6 +149,7 @@
#include <Core/Geometry/Ray.h>
#include <Interface/CallbackHandle.h>
#include <Interface/Context.h>
+#include <Interface/IdleMode.h>
#include <Interface/Clonable.h>
#include <Interface/Interpolable.h>
#include <Interface/Object.h>
@@ -162,6 +165,7 @@
%include <Core/Geometry/Ray.h>
%include <Interface/CallbackHandle.h>
%include <Interface/Context.h>
+%include <Interface/IdleMode.h>
%include <Interface/Clonable.h>
%include <Interface/Interpolable.h>
%include <Interface/Object.h>
@@ -185,6 +189,7 @@
#include <Interface/Callback.h>
#include <SwigInterface/manta.h>
#include <Interface/MantaInterface.h>
+#include <Interface/TValue.h>
%}
namespace std {
@@ -210,6 +215,10 @@
%include <Interface/CallbackHelpers.h>
%include <Interface/Callback.h>
%include <Interface/Transaction.h>
+
+// Ignore some operators that swig doesn't like
+%ignore Manta::TValue::operator=;
+%ignore Manta::TValue::operator T; // This needs to be 'operator T', so it
matches the function header.
%include <Interface/TValue.h>
%include <SwigInterface/manta.h>
@@ -221,8 +230,6 @@
class Camera;
%template(TValueInt) TValue<int>;
-
- // %template(CallbackBase_2Data_int_int) CallbackBase_2Data<int, int>;
}
extern Manta::Scene* createDefaultScene();
@@ -426,6 +433,34 @@
////////////////////////////////////////////////
// Thread stuff
+%{
+#include <SCIRun/Core/Thread/Thread.h>
+#include <SCIRun/Core/Thread/Runnable.h>
+#include <SCIRun/Core/Thread/Semaphore.h>
+%}
+
+// yield is a "future" reserved word for some versions of python.
+// This renames it to be something else.
+%rename(yieldProcess) yield;
+
+%include <SCIRun/Core/Thread/Thread.h>
+
+%rename(yield) yield;
+
+%manta_Release_PythonGIL(SCIRun::Semaphore::down);
+%include <SCIRun/Core/Thread/Semaphore.h>
+
+namespace SCIRun {
+ // We are going to wrap these classes here to avoid having to wrap
+ // anything more related to Runnable.
+ class Runnable
+ {
+ protected:
+ virtual void run()=0; // pure virtual means no constructor
+ virtual ~Runnable(); // protected virtual destructor, means no calls to
destroy it.
+ };
+} // end namespace SCIRun
+
////////////////////////////////////////////////
// Python specific code
- [MANTA] r1482 - in trunk: Interface Model/Groups Model/Primitives SwigInterface, bigler, 07/17/2007
Archive powered by MHonArc 2.6.16.