From 1ea022503004d613bf64ca5fc04450efc9c90c58 Mon Sep 17 00:00:00 2001 From: dellaert Date: Wed, 12 Nov 2014 23:22:59 +0100 Subject: [PATCH] Big refactor because methods now private member of Class --- wrap/Argument.h | 17 ++++++ wrap/Class.cpp | 70 +++++++++++++++++++++++ wrap/Class.h | 82 ++++++++++++++++++--------- wrap/Method.cpp | 7 ++- wrap/Module.cpp | 111 ++++--------------------------------- wrap/Module.h | 3 - wrap/ReturnValue.h | 14 +++++ wrap/TypeAttributesTable.h | 4 +- wrap/tests/testClass.cpp | 51 +++++++++++++++++ wrap/tests/testWrap.cpp | 38 ++++++------- wrap/utilities.h | 11 ++-- 11 files changed, 250 insertions(+), 158 deletions(-) create mode 100644 wrap/tests/testClass.cpp diff --git a/wrap/Argument.h b/wrap/Argument.h index 8c0bb9a33..5a14d1295 100644 --- a/wrap/Argument.h +++ b/wrap/Argument.h @@ -97,5 +97,22 @@ struct ArgumentList: public std::vector { const std::string& wrapperName, int id, bool staticMethod = false) const; }; +template +inline void verifyArguments(const std::vector& validArgs, + const std::map& vt) { + typedef typename std::map::value_type NamedMethod; + BOOST_FOREACH(const NamedMethod& namedMethod, vt) { + const T& t = namedMethod.second; + BOOST_FOREACH(const ArgumentList& argList, t.argLists) { + BOOST_FOREACH(Argument arg, argList) { + std::string fullType = arg.type.qualifiedName("::"); + if (find(validArgs.begin(), validArgs.end(), fullType) + == validArgs.end()) + throw DependencyMissing(fullType, t.name); + } + } + } +} + } // \namespace wrap diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 4574e050f..59e5da88e 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -324,6 +324,76 @@ vector Class::expandTemplate(const string& templateArg, return result; } +/* ************************************************************************* */ +void Class::addMethod(bool verbose, bool is_const, const string& name, + const ArgumentList& args, const ReturnValue& retVal, + const string& templateArgName, const vector& templateArgValues) { + methods[name].addOverload(verbose, is_const, name, args, retVal); +} + +/* ************************************************************************* */ +void Class::erase_serialization() { + Methods::iterator it = methods.find("serializable"); + if (it != methods.end()) { +#ifndef WRAP_DISABLE_SERIALIZE + isSerializable = true; +#else + // cout << "Ignoring serializable() flag in class " << name << endl; +#endif + methods.erase(it); + } + + it = methods.find("serialize"); + if (it != methods.end()) { +#ifndef WRAP_DISABLE_SERIALIZE + isSerializable = true; + hasSerialization = true; +#else + // cout << "Ignoring serialize() flag in class " << name << endl; +#endif + methods.erase(it); + } +} + +/* ************************************************************************* */ +void Class::verifyAll(vector& validTypes, bool& hasSerialiable) const { + + hasSerialiable |= isSerializable; + + // verify all of the function arguments + //TODO:verifyArguments(validTypes, constructor.args_list); + verifyArguments(validTypes, static_methods); + verifyArguments(validTypes, methods); + + // verify function return types + verifyReturnTypes(validTypes, static_methods); + verifyReturnTypes(validTypes, methods); + + // verify parents + if (!qualifiedParent.empty() + && find(validTypes.begin(), validTypes.end(), + qualifiedParent.qualifiedName("::")) == validTypes.end()) + throw DependencyMissing(qualifiedParent.qualifiedName("::"), + qualifiedName("::")); +} + +/* ************************************************************************* */ +void Class::appendInheritedMethods(const Class& cls, + const vector& classes) { + + if (!cls.qualifiedParent.empty()) { + + // Find parent + BOOST_FOREACH(const Class& parent, classes) { + // We found a parent class for our parent, TODO improve ! + if (parent.name == cls.qualifiedParent.name) { + methods.insert(parent.methods.begin(), parent.methods.end()); + appendInheritedMethods(parent, classes); + } + } + } +} + /* ************************************************************************* */ string Class::getTypedef() const { string result; diff --git a/wrap/Class.h b/wrap/Class.h index 895707ed3..9422482b4 100644 --- a/wrap/Class.h +++ b/wrap/Class.h @@ -31,57 +31,87 @@ namespace wrap { /// Class has name, constructors, methods -struct Class : public Qualified { +class Class: public Qualified { + typedef std::map Methods; + Methods methods; ///< Class methods + +public: + typedef std::map StaticMethods; + // Then the instance variables are set directly by the Module constructor + std::vector templateArgs; ///< Template arguments + std::string typedefName; ///< The name to typedef *from*, if this class is actually a typedef, i.e. typedef [typedefName] [name] + bool isVirtual; ///< Whether the class is part of a virtual inheritance chain + bool isSerializable; ///< Whether we can use boost.serialization to serialize the class - creates exports + bool hasSerialization; ///< Whether we should create the serialization functions + Qualified qualifiedParent; ///< The *single* parent + StaticMethods static_methods; ///< Static methods + Constructor constructor; ///< Class constructors + Deconstructor deconstructor; ///< Deconstructor to deallocate C++ object + bool verbose_; ///< verbose flag + /// Constructor creates an empty class Class(bool verbose = true) : isVirtual(false), isSerializable(false), hasSerialization(false), deconstructor( verbose), verbose_(verbose) { } - // Then the instance variables are set directly by the Module constructor - std::vector templateArgs; ///< Template arguments - std::string typedefName; ///< The name to typedef *from*, if this class is actually a typedef, i.e. typedef [typedefName] [name] - bool isVirtual; ///< Whether the class is part of a virtual inheritance chain - bool isSerializable; ///< Whether we can use boost.serialization to serialize the class - creates exports - bool hasSerialization; ///< Whether we should create the serialization functions - Qualified qualifiedParent; ///< The *single* parent - Methods methods; ///< Class methods - StaticMethods static_methods; ///< Static methods - Constructor constructor; ///< Class constructors - Deconstructor deconstructor; ///< Deconstructor to deallocate C++ object - bool verbose_; ///< verbose flag + size_t nrMethods() const { return methods.size(); } + Method& method(const std::string& name) { return methods.at(name); } + bool exists(const std::string& name) const { return methods.find(name) != methods.end(); } // And finally MATLAB code is emitted, methods below called by Module::matlab_code - void matlab_proxy(const std::string& toolboxPath, const std::string& wrapperName, const TypeAttributesTable& typeAttributes, - FileWriter& wrapperFile, std::vector& functionNames) const; ///< emit proxy class + void matlab_proxy(const std::string& toolboxPath, + const std::string& wrapperName, const TypeAttributesTable& typeAttributes, + FileWriter& wrapperFile, std::vector& functionNames) const; ///< emit proxy class Class expandTemplate(const std::string& templateArg, - const Qualified& instantiation, - const Qualified& expandedClass) const; + const Qualified& instantiation, const Qualified& expandedClass) const; std::vector expandTemplate(const std::string& templateArg, - const std::vector& instantiations) const; + const std::vector& instantiations) const; - // The typedef line for this class, if this class is a typedef, otherwise returns an empty string. + /// Add potentially overloaded, potentially templated method + void addMethod(bool verbose, bool is_const, const std::string& name, + const ArgumentList& args, const ReturnValue& retVal, + const std::string& templateArgName, + const std::vector& templateArgValues); + + /// Post-process classes for serialization markers + void erase_serialization(); // non-const ! + + /// verify all of the function arguments + void verifyAll(std::vector& functionNames, + bool& hasSerialiable) const; + + void appendInheritedMethods(const Class& cls, + const std::vector& classes); + + /// The typedef line for this class, if this class is a typedef, otherwise returns an empty string. std::string getTypedef() const; - // Returns the string for an export flag + /// Returns the string for an export flag std::string getSerializationExport() const; - // Creates a member function that performs serialization + /// Creates a member function that performs serialization void serialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, - const std::string& wrapperName, std::vector& functionNames) const; + const std::string& wrapperName, + std::vector& functionNames) const; - // Creates a static member function that performs deserialization + /// Creates a static member function that performs deserialization void deserialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, - const std::string& wrapperName, std::vector& functionNames) const; + const std::string& wrapperName, + std::vector& functionNames) const; private: - void pointer_constructor_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const std::string& wrapperName, std::vector& functionNames) const; - void comment_fragment(FileWriter& proxyFile) const; + + void pointer_constructor_fragments(FileWriter& proxyFile, + FileWriter& wrapperFile, const std::string& wrapperName, + std::vector& functionNames) const; + + void comment_fragment(FileWriter& proxyFile) const; }; } // \namespace wrap diff --git a/wrap/Method.cpp b/wrap/Method.cpp index 3aaee7be9..2751135dd 100644 --- a/wrap/Method.cpp +++ b/wrap/Method.cpp @@ -31,12 +31,13 @@ using namespace wrap; /* ************************************************************************* */ void Method::addOverload(bool verbose, bool is_const, const std::string& name, const ArgumentList& args, const ReturnValue& retVal) { - if (name.empty()) - this->name = name; - else if (this->name != name) +#ifdef ADD_OVERLOAD_CHECK_NAME + if (!name.empty() && this->name != name) throw std::runtime_error( "Method::addOverload: tried to add overload with name " + name + " instead of expected " + this->name); +#endif + this->name = name; this->verbose_ = verbose; this->is_const_ = is_const; this->name = name; diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 3464b1911..498048ee7 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -254,18 +254,17 @@ void Module::parseMarkup(const std::string& data) { // gtsam::Values retract(const gtsam::VectorValues& delta) const; string methodName; bool isConst, isConst0 = false; - vector methodInstantiations; Rule method_p = - !templateArgValues_p - [assign_a(methodInstantiations,templateArgValues)][clear_a(templateArgValues)] >> + !templateArgValues_p >> (returnValue_p >> methodName_p[assign_a(methodName)] >> '(' >> argumentList_p >> ')' >> !str_p("const")[assign_a(isConst,true)] >> ';' >> *comments_p) - [bl::bind(&Method::addOverload, - bl::var(cls.methods)[bl::var(methodName)], verbose, - bl::var(isConst), bl::var(methodName), bl::var(args), bl::var(retVal))] + [bl::bind(&Class::addMethod, bl::var(cls), verbose, bl::var(isConst), + bl::var(methodName), bl::var(args), bl::var(retVal), + bl::var(templateArgName), bl::var(templateArgValues))] [assign_a(retVal,retVal0)] [clear_a(args)] + [clear_a(templateArgValues)] [assign_a(isConst,isConst0)]; Rule staticMethodName_p = lexeme_d[(upper_p | lower_p) >> *(alnum_p | '_')]; @@ -388,69 +387,14 @@ void Module::parseMarkup(const std::string& data) { } // Post-process classes for serialization markers - BOOST_FOREACH(Class& cls, classes) { - Class::Methods::iterator serializable_it = cls.methods.find("serializable"); - if (serializable_it != cls.methods.end()) { -#ifndef WRAP_DISABLE_SERIALIZE - cls.isSerializable = true; -#else - // cout << "Ignoring serializable() flag in class " << cls.name << endl; -#endif - cls.methods.erase(serializable_it); - } - - Class::Methods::iterator serialize_it = cls.methods.find("serialize"); - if (serialize_it != cls.methods.end()) { -#ifndef WRAP_DISABLE_SERIALIZE - cls.isSerializable = true; - cls.hasSerialization= true; -#else - // cout << "Ignoring serialize() flag in class " << cls.name << endl; -#endif - cls.methods.erase(serialize_it); - } - } + BOOST_FOREACH(Class& cls, classes) + cls.erase_serialization(); // Explicitly add methods to the classes from parents so it shows in documentation BOOST_FOREACH(Class& cls, classes) - { - map inhereted = appendInheretedMethods(cls, classes); - cls.methods.insert(inhereted.begin(), inhereted.end()); - } + cls.appendInheritedMethods(cls, classes); } -/* ************************************************************************* */ -template -void verifyArguments(const vector& validArgs, const map& vt) { - typedef typename map::value_type Name_Method; - BOOST_FOREACH(const Name_Method& name_method, vt) { - const T& t = name_method.second; - BOOST_FOREACH(const ArgumentList& argList, t.argLists) { - BOOST_FOREACH(Argument arg, argList) { - string fullType = arg.type.qualifiedName("::"); - if(find(validArgs.begin(), validArgs.end(), fullType) - == validArgs.end()) - throw DependencyMissing(fullType, t.name); - } - } - } -} - -/* ************************************************************************* */ -template -void verifyReturnTypes(const vector& validtypes, - const map& vt) { - typedef typename map::value_type Name_Method; - BOOST_FOREACH(const Name_Method& name_method, vt) { - const T& t = name_method.second; - BOOST_FOREACH(const ReturnValue& retval, t.returnVals) { - retval.type1.verify(validtypes, t.name); - if (retval.isPair) - retval.type2.verify(validtypes, t.name); - } - } -} - /* ************************************************************************* */ void Module::generateIncludes(FileWriter& file) const { @@ -486,22 +430,8 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co verifyReturnTypes(validTypes, global_functions); bool hasSerialiable = false; - BOOST_FOREACH(const Class& cls, expandedClasses) { - hasSerialiable |= cls.isSerializable; - // verify all of the function arguments - //TODO:verifyArguments(validTypes, cls.constructor.args_list); - verifyArguments(validTypes, cls.static_methods); - verifyArguments(validTypes, cls.methods); - - // verify function return types - verifyReturnTypes(validTypes, cls.static_methods); - verifyReturnTypes(validTypes, cls.methods); - - // verify parents - Qualified parent = cls.qualifiedParent; - if(!parent.empty() && std::find(validTypes.begin(), validTypes.end(), parent.qualifiedName("::")) == validTypes.end()) - throw DependencyMissing(parent.qualifiedName("::"), cls.qualifiedName("::")); - } + BOOST_FOREACH(const Class& cls, expandedClasses) + cls.verifyAll(validTypes,hasSerialiable); // Create type attributes table and check validity TypeAttributesTable typeAttributes; @@ -568,28 +498,7 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co wrapperFile.emit(true); } -/* ************************************************************************* */ -map Module::appendInheretedMethods(const Class& cls, const vector& classes) -{ - map methods; - if(!cls.qualifiedParent.empty()) - { - //Find Class - BOOST_FOREACH(const Class& parent, classes) { - //We found the class for our parent - if(parent.name == cls.qualifiedParent.name) - { - Methods inhereted = appendInheretedMethods(parent, classes); - methods.insert(inhereted.begin(), inhereted.end()); - } - } - } else { - methods.insert(cls.methods.begin(), cls.methods.end()); - } - return methods; -} - /* ************************************************************************* */ void Module::finish_wrapper(FileWriter& file, const std::vector& functionNames) const { file.oss << "void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n"; diff --git a/wrap/Module.h b/wrap/Module.h index 93f699e14..8ef2bc4fd 100644 --- a/wrap/Module.h +++ b/wrap/Module.h @@ -53,9 +53,6 @@ struct Module { /// Dummy constructor that does no parsing - use only for testing Module(const std::string& moduleName, bool enable_verbose=true); - //Recursive method to append all methods inhereted from parent classes - std::map appendInheretedMethods(const Class& cls, const std::vector& classes); - /// MATLAB code generation: void matlab_code( const std::string& path, diff --git a/wrap/ReturnValue.h b/wrap/ReturnValue.h index 83a860638..1a0caf8f3 100644 --- a/wrap/ReturnValue.h +++ b/wrap/ReturnValue.h @@ -97,4 +97,18 @@ struct ReturnValue { void emit_matlab(FileWriter& proxyFile) const; }; +template +inline void verifyReturnTypes(const std::vector& validtypes, + const std::map& vt) { + typedef typename std::map::value_type NamedMethod; + BOOST_FOREACH(const NamedMethod& namedMethod, vt) { + const T& t = namedMethod.second; + BOOST_FOREACH(const ReturnValue& retval, t.returnVals) { + retval.type1.verify(validtypes, t.name); + if (retval.isPair) + retval.type2.verify(validtypes, t.name); + } + } +} + } // \namespace wrap diff --git a/wrap/TypeAttributesTable.h b/wrap/TypeAttributesTable.h index 1ff6c121c..d2a346bfc 100644 --- a/wrap/TypeAttributesTable.h +++ b/wrap/TypeAttributesTable.h @@ -28,7 +28,7 @@ namespace wrap { // Forward declarations - struct Class; + class Class; /** Attributes about valid classes, both for classes defined in this module and * also those forward-declared from others. At the moment this only contains @@ -52,4 +52,4 @@ public: void checkValidity(const std::vector& classes) const; }; -} \ No newline at end of file +} diff --git a/wrap/tests/testClass.cpp b/wrap/tests/testClass.cpp new file mode 100644 index 000000000..627f3a9ff --- /dev/null +++ b/wrap/tests/testClass.cpp @@ -0,0 +1,51 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file testClass.cpp + * @brief Unit test for Class class + * @author Frank Dellaert + * @date Nov 12, 2014 + **/ + +#include +#include +#include + +using namespace std; +using namespace wrap; + +/* ************************************************************************* */ +// Constructor +TEST( Class, Constructor ) { + Class cls; +} + +/* ************************************************************************* */ +// addMethodOverloads +TEST( Class, addMethod ) { + Class cls; + bool verbose=true, is_const=true; + const string name; + ArgumentList args; + const ReturnValue retVal; + const string templateArgName; + vector templateArgValues; + cls.addMethod(verbose, is_const, name, args, retVal, templateArgName, + templateArgValues); +} + +/* ************************************************************************* */ +int main() { + TestResult tr; + return TestRegistry::runAllTests(tr); +} +/* ************************************************************************* */ diff --git a/wrap/tests/testWrap.cpp b/wrap/tests/testWrap.cpp index a08886e51..08c1881c7 100644 --- a/wrap/tests/testWrap.cpp +++ b/wrap/tests/testWrap.cpp @@ -73,7 +73,7 @@ TEST( wrap, check_exception ) { } /* ************************************************************************* */ -TEST( wrap, small_parse ) { +TEST( wrap, Small ) { string moduleName("gtsam"); Module module(moduleName, true); @@ -92,11 +92,11 @@ TEST( wrap, small_parse ) { EXPECT(assert_equal("Point2", cls.name)); EXPECT(!cls.isVirtual); EXPECT(cls.namespaces.empty()); - LONGS_EQUAL(3, cls.methods.size()); + LONGS_EQUAL(3, cls.nrMethods()); LONGS_EQUAL(1, cls.static_methods.size()); // Method 1 - Method m1 = cls.methods.at("x"); + Method m1 = cls.method("x"); EXPECT(assert_equal("x", m1.name)); EXPECT(m1.is_const_); LONGS_EQUAL(1, m1.argLists.size()); @@ -109,7 +109,7 @@ TEST( wrap, small_parse ) { EXPECT_LONGS_EQUAL(ReturnType::BASIS, rv1.type1.category); // Method 2 - Method m2 = cls.methods.at("returnMatrix"); + Method m2 = cls.method("returnMatrix"); EXPECT(assert_equal("returnMatrix", m2.name)); EXPECT(m2.is_const_); LONGS_EQUAL(1, m2.argLists.size()); @@ -122,7 +122,7 @@ TEST( wrap, small_parse ) { EXPECT_LONGS_EQUAL(ReturnType::EIGEN, rv2.type1.category); // Method 3 - Method m3 = cls.methods.at("returnPoint2"); + Method m3 = cls.method("returnPoint2"); EXPECT(assert_equal("returnPoint2", m3.name)); EXPECT(m3.is_const_); LONGS_EQUAL(1, m3.argLists.size()); @@ -150,7 +150,7 @@ TEST( wrap, small_parse ) { } /* ************************************************************************* */ -TEST( wrap, parse_geometry ) { +TEST( wrap, Geometry ) { string markup_header_path = topdir + "/wrap/tests"; Module module(markup_header_path.c_str(), "geometry",enable_verbose); EXPECT_LONGS_EQUAL(7, module.classes.size()); @@ -189,12 +189,12 @@ TEST( wrap, parse_geometry ) { Class cls = module.classes.at(0); EXPECT(assert_equal("Point2", cls.name)); EXPECT_LONGS_EQUAL(2, cls.constructor.args_list.size()); - EXPECT_LONGS_EQUAL(7, cls.methods.size()); + EXPECT_LONGS_EQUAL(7, cls.nrMethods()); { // char returnChar() const; - CHECK(cls.methods.find("returnChar") != cls.methods.end()); - Method m1 = cls.methods.find("returnChar")->second; + CHECK(cls.exists("returnChar")); + Method m1 = cls.method("returnChar"); LONGS_EQUAL(1, m1.returnVals.size()); EXPECT(assert_equal("char", m1.returnVals.front().type1.name)); EXPECT_LONGS_EQUAL(ReturnType::BASIS, m1.returnVals.front().type1.category); @@ -207,8 +207,8 @@ TEST( wrap, parse_geometry ) { { // VectorNotEigen vectorConfusion(); - CHECK(cls.methods.find("vectorConfusion") != cls.methods.end()); - Method m1 = cls.methods.find("vectorConfusion")->second; + CHECK(cls.exists("vectorConfusion")); + Method m1 = cls.method("vectorConfusion"); LONGS_EQUAL(1, m1.returnVals.size()); EXPECT(assert_equal("VectorNotEigen", m1.returnVals.front().type1.name)); EXPECT_LONGS_EQUAL(ReturnType::CLASS, m1.returnVals.front().type1.category); @@ -234,7 +234,7 @@ TEST( wrap, parse_geometry ) { Class cls = module.classes.at(1); EXPECT(assert_equal("Point3", cls.name)); EXPECT_LONGS_EQUAL(1, cls.constructor.args_list.size()); - EXPECT_LONGS_EQUAL(1, cls.methods.size()); + EXPECT_LONGS_EQUAL(1, cls.nrMethods()); EXPECT_LONGS_EQUAL(2, cls.static_methods.size()); EXPECT_LONGS_EQUAL(0, cls.namespaces.size()); @@ -250,8 +250,8 @@ TEST( wrap, parse_geometry ) { EXPECT(assert_equal("x", a1.name)); // check method - CHECK(cls.methods.find("norm") != cls.methods.end()); - Method m1 = cls.methods.find("norm")->second; + CHECK(cls.exists("norm")); + Method m1 = cls.method("norm"); LONGS_EQUAL(1, m1.returnVals.size()); EXPECT(assert_equal("double", m1.returnVals.front().type1.name)); EXPECT_LONGS_EQUAL(ReturnType::BASIS, m1.returnVals.front().type1.category); @@ -271,13 +271,13 @@ TEST( wrap, parse_geometry ) { { Class testCls = module.classes.at(2); EXPECT_LONGS_EQUAL( 2, testCls.constructor.args_list.size()); - EXPECT_LONGS_EQUAL(19, testCls.methods.size()); + EXPECT_LONGS_EQUAL(19, testCls.nrMethods()); EXPECT_LONGS_EQUAL( 0, testCls.static_methods.size()); EXPECT_LONGS_EQUAL( 0, testCls.namespaces.size()); // function to parse: pair return_pair (Vector v, Matrix A) const; - CHECK(testCls.methods.find("return_pair") != testCls.methods.end()); - Method m2 = testCls.methods.find("return_pair")->second; + CHECK(testCls.exists("return_pair")); + Method m2 = testCls.method("return_pair"); LONGS_EQUAL(1, m2.returnVals.size()); EXPECT(m2.returnVals.front().isPair); EXPECT_LONGS_EQUAL(ReturnType::EIGEN, m2.returnVals.front().type1.category); @@ -287,8 +287,8 @@ TEST( wrap, parse_geometry ) { // checking pointer args and return values // pair return_ptrs (Test* p1, Test* p2) const; - CHECK(testCls.methods.find("return_ptrs") != testCls.methods.end()); - Method m3 = testCls.methods.find("return_ptrs")->second; + CHECK(testCls.exists("return_ptrs")); + Method m3 = testCls.method("return_ptrs"); LONGS_EQUAL(1, m3.argLists.size()); ArgumentList args = m3.argLists.front(); LONGS_EQUAL(2, args.size()); diff --git a/wrap/utilities.h b/wrap/utilities.h index fe146dd04..a4f71b6ad 100644 --- a/wrap/utilities.h +++ b/wrap/utilities.h @@ -18,17 +18,20 @@ #pragma once +#include "FileWriter.h" + +#include +#include + +#include #include #include #include #include + //#include // on Linux GCC: fails with error regarding needing C++0x std flags //#include // same failure as above #include // works on Linux GCC -#include -#include - -#include "FileWriter.h" namespace wrap {