diff --git a/gtsam.h b/gtsam.h index 04d6b7e9b..35975f710 100644 --- a/gtsam.h +++ b/gtsam.h @@ -41,9 +41,6 @@ * Namespace usage * - Namespaces can be specified for classes in arguments and return values * - In each case, the namespace must be fully specified, e.g., "namespace1::namespace2::ClassName" - * Using namespace: FIXME: this functionality is currently broken - * - To use a namespace (e.g., generate a "using namespace x" line in cpp files), add "using namespace x;" - * - This declaration applies to all classes *after* the declaration, regardless of brackets * Includes in C++ wrappers * - All includes will be collected and added in a single file * - All namespaces must have angle brackets: diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 5110ab6cd..00fdba011 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -79,7 +79,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName, const int id = (int)functionNames.size(); constructor.proxy_fragment(proxyFile, wrapperName, !qualifiedParent.empty(), id, a); const string wrapFunctionName = constructor.wrapper_fragment(wrapperFile, - cppName, matlabUniqueName, cppBaseName, id, using_namespaces, a); + cppName, matlabUniqueName, cppBaseName, id, a); wrapperFile.oss << "\n"; functionNames.push_back(wrapFunctionName); } @@ -96,7 +96,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName, const int id = (int)functionNames.size(); deconstructor.proxy_fragment(proxyFile, wrapperName, matlabUniqueName, id); proxyFile.oss << "\n"; - const string functionName = deconstructor.wrapper_fragment(wrapperFile, cppName, matlabUniqueName, id, using_namespaces); + const string functionName = deconstructor.wrapper_fragment(wrapperFile, cppName, matlabUniqueName, id); wrapperFile.oss << "\n"; functionNames.push_back(functionName); } @@ -106,7 +106,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName, // Methods BOOST_FOREACH(const Methods::value_type& name_m, methods) { const Method& m = name_m.second; - m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, using_namespaces, typeAttributes, functionNames); + m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, typeAttributes, functionNames); proxyFile.oss << "\n"; wrapperFile.oss << "\n"; } @@ -118,7 +118,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName, // Static methods BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) { const StaticMethod& m = name_m.second; - m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, using_namespaces, typeAttributes, functionNames); + m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, typeAttributes, functionNames); proxyFile.oss << "\n"; wrapperFile.oss << "\n"; } @@ -183,7 +183,6 @@ void Class::pointer_constructor_fragments(FileWriter& proxyFile, FileWriter& wra wrapperFile.oss << "void " << collectorInsertFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl; wrapperFile.oss << "{\n"; wrapperFile.oss << " mexAtExit(&_deleteAllObjects);\n"; - generateUsingNamespace(wrapperFile, using_namespaces); // Typedef boost::shared_ptr wrapperFile.oss << " typedef boost::shared_ptr<" << cppName << "> Shared;\n"; wrapperFile.oss << "\n"; @@ -273,7 +272,6 @@ Class expandClassTemplate(const Class& cls, const string& templateArg, const vec inst.methods = expandMethodTemplate(cls.methods, templateArg, instName); inst.static_methods = expandMethodTemplate(cls.static_methods, templateArg, instName); inst.namespaces = cls.namespaces; - inst.using_namespaces = cls.using_namespaces; inst.constructor = cls.constructor; inst.constructor.args_list = expandArgumentListsTemplate(cls.constructor.args_list, templateArg, instName); inst.constructor.name = inst.name; diff --git a/wrap/Class.h b/wrap/Class.h index c41cbb470..2d10d691a 100644 --- a/wrap/Class.h +++ b/wrap/Class.h @@ -47,7 +47,6 @@ struct Class { Methods methods; ///< Class methods StaticMethods static_methods; ///< Static methods std::vector namespaces; ///< Stack of namespaces - std::vector using_namespaces;///< default namespaces Constructor constructor; ///< Class constructors Deconstructor deconstructor; ///< Deconstructor to deallocate C++ object bool verbose_; ///< verbose flag diff --git a/wrap/Constructor.cpp b/wrap/Constructor.cpp index 274180e08..7d18cb8db 100644 --- a/wrap/Constructor.cpp +++ b/wrap/Constructor.cpp @@ -70,7 +70,6 @@ string Constructor::wrapper_fragment(FileWriter& file, const string& matlabUniqueName, const string& cppBaseClassName, int id, - const vector& using_namespaces, const ArgumentList& al) const { const string wrapFunctionName = matlabUniqueName + "_constructor_" + boost::lexical_cast(id); @@ -78,7 +77,6 @@ string Constructor::wrapper_fragment(FileWriter& file, file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl; file.oss << "{\n"; file.oss << " mexAtExit(&_deleteAllObjects);\n"; - generateUsingNamespace(file, using_namespaces); //Typedef boost::shared_ptr file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;\n"; file.oss << "\n"; diff --git a/wrap/Constructor.h b/wrap/Constructor.h index e2eca1291..fe8a96ccd 100644 --- a/wrap/Constructor.h +++ b/wrap/Constructor.h @@ -58,7 +58,6 @@ struct Constructor { const std::string& matlabUniqueName, const std::string& cppBaseClassName, int id, - const std::vector& using_namespaces, const ArgumentList& al) const; /// constructor function diff --git a/wrap/Deconstructor.cpp b/wrap/Deconstructor.cpp index c9239ee74..b2355f20e 100644 --- a/wrap/Deconstructor.cpp +++ b/wrap/Deconstructor.cpp @@ -48,8 +48,7 @@ void Deconstructor::proxy_fragment(FileWriter& file, string Deconstructor::wrapper_fragment(FileWriter& file, const string& cppClassName, const string& matlabUniqueName, - int id, - const vector& using_namespaces) const { + int id) const { const string matlabName = matlab_wrapper_name(matlabUniqueName); @@ -57,7 +56,6 @@ string Deconstructor::wrapper_fragment(FileWriter& file, file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl; file.oss << "{" << endl; - generateUsingNamespace(file, using_namespaces); file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl; //Deconstructor takes 1 arg, the mxArray obj file.oss << " checkArguments(\"" << matlabName << "\",nargout,nargin," << "1" << ");" << endl; diff --git a/wrap/Deconstructor.h b/wrap/Deconstructor.h index 0d7dadaad..a3b71b04e 100644 --- a/wrap/Deconstructor.h +++ b/wrap/Deconstructor.h @@ -54,8 +54,7 @@ struct Deconstructor { std::string wrapper_fragment(FileWriter& file, const std::string& cppClassName, const std::string& matlabUniqueName, - int id, - const std::vector& using_namespaces) const; + int id) const; }; } // \namespace wrap diff --git a/wrap/Method.cpp b/wrap/Method.cpp index eb143b4dc..cc7c5a865 100644 --- a/wrap/Method.cpp +++ b/wrap/Method.cpp @@ -42,7 +42,6 @@ void Method::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperF const std::string& matlabQualName, const std::string& matlabUniqueName, const string& wrapperName, - const vector& using_namespaces, const TypeAttributesTable& typeAttributes, vector& functionNames) const { @@ -82,7 +81,7 @@ void Method::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperF // Output C++ wrapper code const string wrapFunctionName = wrapper_fragment( - wrapperFile, cppClassName, matlabUniqueName, overload, id, using_namespaces, typeAttributes); + wrapperFile, cppClassName, matlabUniqueName, overload, id, typeAttributes); // Add to function list functionNames.push_back(wrapFunctionName); @@ -103,7 +102,6 @@ string Method::wrapper_fragment(FileWriter& file, const string& matlabUniqueName, int overload, int id, - const vector& using_namespaces, const TypeAttributesTable& typeAttributes) const { // generate code @@ -117,7 +115,6 @@ string Method::wrapper_fragment(FileWriter& file, file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n"; // start file.oss << "{\n"; - generateUsingNamespace(file, using_namespaces); if(returnVal.isPair) { diff --git a/wrap/Method.h b/wrap/Method.h index e23a24186..4185732cf 100644 --- a/wrap/Method.h +++ b/wrap/Method.h @@ -51,8 +51,7 @@ struct Method { // classPath is class directory, e.g., ../matlab/@Point2 void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const std::string& cppClassName, const std::string& matlabQualName, const std::string& matlabUniqueName, - const std::string& wrapperName, const std::vector& using_namespaces, - const TypeAttributesTable& typeAttributes, + const std::string& wrapperName, const TypeAttributesTable& typeAttributes, std::vector& functionNames) const; private: @@ -61,7 +60,6 @@ private: const std::string& matlabUniqueName, int overload, int id, - const std::vector& using_namespaces, const TypeAttributesTable& typeAttributes) const; ///< cpp wrapper }; diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 35b0d2ff8..8c564e92f 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -84,8 +84,7 @@ Module::Module(const string& interfacePath, GlobalFunction globalFunc0(enable_verbose), globalFunc(enable_verbose); ForwardDeclaration fwDec0, fwDec; vector namespaces, /// current namespace tag - namespaces_return, /// namespace for current return type - using_namespace_current; /// All namespaces from "using" declarations + namespaces_return; /// namespace for current return type string templateArgument; vector templateInstantiationNamespace; vector > templateInstantiations; @@ -264,7 +263,6 @@ Module::Module(const string& interfacePath, [assign_a(constructor.name, cls.name)] [assign_a(cls.constructor, constructor)] [assign_a(cls.namespaces, namespaces)] - [assign_a(cls.using_namespaces, using_namespace_current)] [assign_a(deconstructor.name,cls.name)] [assign_a(cls.deconstructor, deconstructor)] [bl::bind(&handle_possible_template, bl::var(classes), bl::var(cls), bl::var(templateArgument), bl::var(templateInstantiations))] @@ -298,10 +296,6 @@ Module::Module(const string& interfacePath, >> ch_p('}')) [pop_a(namespaces)]; - Rule using_namespace_p = - str_p("using") >> str_p("namespace") - >> namespace_name_p[push_back_a(using_namespace_current)] >> ch_p(';'); - Rule forward_declaration_p = !(str_p("virtual")[assign_a(fwDec.isVirtual, true)]) >> str_p("class") @@ -310,7 +304,7 @@ Module::Module(const string& interfacePath, [push_back_a(forward_declarations, fwDec)] [assign_a(fwDec, fwDec0)]; - Rule module_content_p = comments_p | using_namespace_p | include_p | class_p | templateSingleInstantiation_p | forward_declaration_p | global_function_p | namespace_def_p; + Rule module_content_p = comments_p | include_p | class_p | templateSingleInstantiation_p | forward_declaration_p | global_function_p | namespace_def_p; Rule module_p = *module_content_p >> !end_p; diff --git a/wrap/StaticMethod.cpp b/wrap/StaticMethod.cpp index ed80d7890..3def66b0f 100644 --- a/wrap/StaticMethod.cpp +++ b/wrap/StaticMethod.cpp @@ -44,7 +44,6 @@ void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wr const std::string& matlabQualName, const std::string& matlabUniqueName, const string& wrapperName, - const vector& using_namespaces, const TypeAttributesTable& typeAttributes, vector& functionNames) const { @@ -86,7 +85,7 @@ void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wr // Output C++ wrapper code const string wrapFunctionName = wrapper_fragment( - wrapperFile, cppClassName, matlabUniqueName, overload, id, using_namespaces, typeAttributes); + wrapperFile, cppClassName, matlabUniqueName, overload, id, typeAttributes); // Add to function list functionNames.push_back(wrapFunctionName); @@ -107,7 +106,6 @@ string StaticMethod::wrapper_fragment(FileWriter& file, const string& matlabUniqueName, int overload, int id, - const vector& using_namespaces, const TypeAttributesTable& typeAttributes) const { // generate code @@ -121,7 +119,6 @@ string StaticMethod::wrapper_fragment(FileWriter& file, file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n"; // start file.oss << "{\n"; - generateUsingNamespace(file, using_namespaces); returnVal.wrapTypeUnwrap(file); diff --git a/wrap/StaticMethod.h b/wrap/StaticMethod.h index 55d9f3e99..fc82105f0 100644 --- a/wrap/StaticMethod.h +++ b/wrap/StaticMethod.h @@ -51,8 +51,7 @@ struct StaticMethod { // classPath is class directory, e.g., ../matlab/@Point2 void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const std::string& cppClassName, const std::string& matlabQualName, const std::string& matlabUniqueName, - const std::string& wrapperName, const std::vector& using_namespaces, - const TypeAttributesTable& typeAttributes, + const std::string& wrapperName, const TypeAttributesTable& typeAttributes, std::vector& functionNames) const; private: @@ -61,7 +60,6 @@ private: const std::string& matlabUniqueName, int overload, int id, - const std::vector& using_namespaces, const TypeAttributesTable& typeAttributes) const; ///< cpp wrapper }; diff --git a/wrap/tests/expected/geometry_wrapper.cpp b/wrap/tests/expected/geometry_wrapper.cpp index d403073d4..93fde1ca4 100644 --- a/wrap/tests/expected/geometry_wrapper.cpp +++ b/wrap/tests/expected/geometry_wrapper.cpp @@ -180,7 +180,6 @@ void Point2_y_10(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void Point3_collectorInsertAndMakeBase_11(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); -using namespace geometry; typedef boost::shared_ptr Shared; Shared *self = *reinterpret_cast (mxGetData(in[0])); @@ -190,7 +189,6 @@ using namespace geometry; void Point3_constructor_12(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); -using namespace geometry; typedef boost::shared_ptr Shared; double x = unwrap< double >(in[0]); @@ -204,7 +202,6 @@ using namespace geometry; void Point3_deconstructor_13(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("delete_Point3",nargout,nargin,1); Shared *self = *reinterpret_cast(mxGetData(in[0])); @@ -218,7 +215,6 @@ using namespace geometry; void Point3_norm_14(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("norm",nargout,nargin-1,0); Shared obj = unwrap_shared_ptr(in[0], "ptr_Point3"); @@ -227,7 +223,6 @@ using namespace geometry; void Point3_StaticFunctionRet_15(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedPoint3; typedef boost::shared_ptr Shared; checkArguments("Point3.StaticFunctionRet",nargout,nargin,1); @@ -237,7 +232,6 @@ using namespace geometry; void Point3_staticFunction_16(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("Point3.staticFunction",nargout,nargin,0); out[0] = wrap< double >(Point3::staticFunction()); @@ -246,7 +240,6 @@ using namespace geometry; void Test_collectorInsertAndMakeBase_17(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); -using namespace geometry; typedef boost::shared_ptr Shared; Shared *self = *reinterpret_cast (mxGetData(in[0])); @@ -256,7 +249,6 @@ using namespace geometry; void Test_constructor_18(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); -using namespace geometry; typedef boost::shared_ptr Shared; Shared *self = new Shared(new Test()); @@ -268,7 +260,6 @@ using namespace geometry; void Test_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { mexAtExit(&_deleteAllObjects); -using namespace geometry; typedef boost::shared_ptr Shared; double a = unwrap< double >(in[0]); @@ -281,7 +272,6 @@ using namespace geometry; void Test_deconstructor_20(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("delete_Test",nargout,nargin,1); Shared *self = *reinterpret_cast(mxGetData(in[0])); @@ -295,7 +285,6 @@ using namespace geometry; void Test_arg_EigenConstRef_21(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("arg_EigenConstRef",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -305,7 +294,6 @@ using namespace geometry; void Test_create_MixedPtrs_22(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr Shared; @@ -317,7 +305,6 @@ using namespace geometry; void Test_create_ptrs_23(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr Shared; @@ -329,7 +316,6 @@ using namespace geometry; void Test_print_24(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("print",nargout,nargin-1,0); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -338,7 +324,6 @@ using namespace geometry; void Test_return_Point2Ptr_25(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedPoint2; typedef boost::shared_ptr Shared; checkArguments("return_Point2Ptr",nargout,nargin-1,1); @@ -349,7 +334,6 @@ using namespace geometry; void Test_return_Test_26(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr Shared; checkArguments("return_Test",nargout,nargin-1,1); @@ -360,7 +344,6 @@ using namespace geometry; void Test_return_TestPtr_27(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr Shared; checkArguments("return_TestPtr",nargout,nargin-1,1); @@ -371,7 +354,6 @@ using namespace geometry; void Test_return_bool_28(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_bool",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -381,7 +363,6 @@ using namespace geometry; void Test_return_double_29(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_double",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -391,7 +372,6 @@ using namespace geometry; void Test_return_field_30(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_field",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -401,7 +381,6 @@ using namespace geometry; void Test_return_int_31(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_int",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -411,7 +390,6 @@ using namespace geometry; void Test_return_matrix1_32(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_matrix1",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -421,7 +399,6 @@ using namespace geometry; void Test_return_matrix2_33(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_matrix2",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -431,7 +408,6 @@ using namespace geometry; void Test_return_pair_34(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_pair",nargout,nargin-1,2); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -443,7 +419,6 @@ using namespace geometry; void Test_return_ptrs_35(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr SharedTest; typedef boost::shared_ptr Shared; @@ -457,7 +432,6 @@ using namespace geometry; void Test_return_size_t_36(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_size_t",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -467,7 +441,6 @@ using namespace geometry; void Test_return_string_37(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_string",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -477,7 +450,6 @@ using namespace geometry; void Test_return_vector1_38(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_vector1",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); @@ -487,7 +459,6 @@ using namespace geometry; void Test_return_vector2_39(int nargout, mxArray *out[], int nargin, const mxArray *in[]) { -using namespace geometry; typedef boost::shared_ptr Shared; checkArguments("return_vector2",nargout,nargin-1,1); Shared obj = unwrap_shared_ptr(in[0], "ptr_Test"); diff --git a/wrap/tests/geometry.h b/wrap/tests/geometry.h index 2e92043b2..54694a1cf 100644 --- a/wrap/tests/geometry.h +++ b/wrap/tests/geometry.h @@ -15,9 +15,6 @@ class Point2 { VectorNotEigen vectorConfusion(); }; -// flag a namespace as in use - only applies *after* the declaration -using namespace geometry; - class Point3 { Point3(double x, double y, double z); double norm() const; diff --git a/wrap/tests/testWrap.cpp b/wrap/tests/testWrap.cpp index 29fc1891a..844281775 100644 --- a/wrap/tests/testWrap.cpp +++ b/wrap/tests/testWrap.cpp @@ -76,9 +76,6 @@ TEST( wrap, parse_geometry ) { Module module(markup_header_path.c_str(), "geometry",enable_verbose); EXPECT_LONGS_EQUAL(3, module.classes.size()); - // check using declarations - strvec exp_using1, exp_using2; exp_using2 += "geometry"; - // forward declarations LONGS_EQUAL(2, module.forward_declarations.size()); EXPECT(assert_equal("VectorNotEigen", module.forward_declarations[0].name)); @@ -98,7 +95,6 @@ TEST( wrap, parse_geometry ) { EXPECT_LONGS_EQUAL(7, cls.methods.size()); EXPECT_LONGS_EQUAL(0, cls.static_methods.size()); EXPECT_LONGS_EQUAL(0, cls.namespaces.size()); - EXPECT(assert_equal(exp_using1, cls.using_namespaces)); } // check second class, Point3 @@ -109,7 +105,6 @@ TEST( wrap, parse_geometry ) { EXPECT_LONGS_EQUAL(1, cls.methods.size()); EXPECT_LONGS_EQUAL(2, cls.static_methods.size()); EXPECT_LONGS_EQUAL(0, cls.namespaces.size()); - EXPECT(assert_equal(exp_using2, cls.using_namespaces)); // first constructor takes 3 doubles ArgumentList c1 = cls.constructor.args_list.front(); @@ -140,7 +135,6 @@ TEST( wrap, parse_geometry ) { EXPECT_LONGS_EQUAL(19, testCls.methods.size()); EXPECT_LONGS_EQUAL( 0, testCls.static_methods.size()); EXPECT_LONGS_EQUAL( 0, testCls.namespaces.size()); - EXPECT(assert_equal(exp_using2, testCls.using_namespaces)); // function to parse: pair return_pair (Vector v, Matrix A) const; CHECK(testCls.methods.find("return_pair") != testCls.methods.end()); diff --git a/wrap/utilities.cpp b/wrap/utilities.cpp index 6b6e57094..52ed3c750 100644 --- a/wrap/utilities.cpp +++ b/wrap/utilities.cpp @@ -115,13 +115,6 @@ string maybe_shared_ptr(bool add, const string& qtype, const string& type) { return str; } -/* ************************************************************************* */ -void generateUsingNamespace(FileWriter& file, const vector& using_namespaces) { - if (using_namespaces.empty()) return; - BOOST_FOREACH(const string& s, using_namespaces) - file.oss << "using namespace " << s << ";" << endl; -} - /* ************************************************************************* */ string qualifiedName(const string& separator, const vector& names, const string& finalName) { string result; diff --git a/wrap/utilities.h b/wrap/utilities.h index 2eaf5397a..85a2246a2 100644 --- a/wrap/utilities.h +++ b/wrap/utilities.h @@ -122,11 +122,6 @@ bool assert_equal(const std::vector& expected, const std::vector& using_namespaces); - /** * Return a qualified name, if finalName is empty, only the names vector will * be used (i.e. there won't be a trailing separator on the qualified name).