aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-08-28 12:18:22 -0400
committerJohn Cummings <jcummings2@users.sf.net>2013-09-24 19:19:38 +0200
commit22aa9ced0d6b167ee835b4b184511c5df3f79591 (patch)
tree907354d65004a7c4434a5ae2b0b88deb6d530370 /tests/libsample
parent8287ee801965f2fbeea573e1eb652cc851920f86 (diff)
Write inititializations in topological order
Add methods to various places in the hierarchy so that the generator can access the topologically ordered class list (in addition to the unordered class list). Modify CppGenerator::finishGeneration to use this. This fixes a failure to correctly create Python wrapper classes due to subclass wrappers being initialized before their base class (with the result that the looked-up type object for the base class is null, causing the derived class to be created without referencing the base). Also change one of the test cases to test that we correctly wrap a typedef of a template class derived from a non-template base (which was failing before this change for the aforementioned reason). Change-Id: Ib4dc2626a41cb7bb905ff4a302c2613ea12d026b Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'tests/libsample')
-rw-r--r--tests/libsample/photon.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/libsample/photon.h b/tests/libsample/photon.h
index f98d32a7e..f6c97b7c7 100644
--- a/tests/libsample/photon.h
+++ b/tests/libsample/photon.h
@@ -37,13 +37,21 @@ enum ClassType {
DuplicatorType = 2
};
-template<ClassType CLASS_TYPE>
-class LIBSAMPLE_API TemplateBase
+class LIBSAMPLE_API Base
{
public:
- explicit TemplateBase(int value) : m_value(value) {}
+ explicit Base(int value) : m_value(value) {}
inline void setValue(int value) { m_value = value; }
inline int value() const { return m_value; }
+protected:
+ int m_value;
+};
+
+template<ClassType CLASS_TYPE>
+class LIBSAMPLE_API TemplateBase : public Base
+{
+public:
+ explicit TemplateBase(int value) : Base(value) {}
inline int multiplicator() const { return (int)CLASS_TYPE; }
inline int calculate() const { return m_value * ((int)CLASS_TYPE); }
static inline ClassType classType() { return CLASS_TYPE; }
@@ -60,8 +68,6 @@ public:
}
static inline TemplateBase<CLASS_TYPE>* passPointerThrough(TemplateBase<CLASS_TYPE>* obj) { return obj; }
-private:
- int m_value;
};
#if defined _WIN32 || defined __CYGWIN__