Fixed template expansion of classes
parent
a4fe404d82
commit
8ef78db9d8
|
@ -248,7 +248,6 @@ Class Class::expandTemplate(const TemplateSubstitution& ts) const {
|
|||
inst.static_methods = expandMethodTemplate(static_methods, ts);
|
||||
inst.constructor = constructor.expandTemplate(ts);
|
||||
inst.deconstructor.name = inst.name;
|
||||
cout << inst << endl;
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
@ -256,12 +255,10 @@ Class Class::expandTemplate(const TemplateSubstitution& ts) const {
|
|||
vector<Class> Class::expandTemplate(Str templateArg,
|
||||
const vector<Qualified>& instantiations) const {
|
||||
vector<Class> result;
|
||||
cout << *this << endl;
|
||||
BOOST_FOREACH(const Qualified& instName, instantiations) {
|
||||
Qualified expandedClass = (Qualified) (*this);
|
||||
expandedClass.name += instName.name;
|
||||
const TemplateSubstitution ts(templateArg, instName, expandedClass);
|
||||
cout << ts << endl;
|
||||
Class inst = expandTemplate(ts);
|
||||
inst.name = expandedClass.name;
|
||||
inst.templateArgs.clear();
|
||||
|
|
|
@ -187,13 +187,6 @@ public:
|
|||
// Templated checking functions
|
||||
// TODO: do this via polymorphism ?
|
||||
|
||||
template<class F>
|
||||
F expandMethodTemplate(F& method, const TemplateSubstitution& ts) {
|
||||
F instMethod = method;
|
||||
method.expandTemplate(ts);
|
||||
return instMethod;
|
||||
}
|
||||
|
||||
// TODO use transform
|
||||
template<class F>
|
||||
static std::map<std::string, F> expandMethodTemplate(
|
||||
|
@ -201,7 +194,9 @@ static std::map<std::string, F> expandMethodTemplate(
|
|||
std::map<std::string, F> result;
|
||||
typedef std::pair<const std::string, F> NamedMethod;
|
||||
BOOST_FOREACH(NamedMethod namedMethod, methods) {
|
||||
namedMethod.second = expandMethodTemplate(namedMethod.second, ts);
|
||||
F instMethod = namedMethod.second;
|
||||
instMethod.expandTemplate(ts);
|
||||
namedMethod.second = instMethod;
|
||||
result.insert(namedMethod);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -672,6 +672,7 @@ void MyTemplatePoint2_templatedMethod_54(int nargout, mxArray *out[], int nargin
|
|||
gtsam::Point2& t = *unwrap_shared_ptr< gtsam::Point2 >(in[1], "ptr_gtsamPoint2");
|
||||
obj->templatedMethod<gtsam::Point2>(t);
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_templatedMethod_55(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyTemplatePoint2> Shared;
|
||||
|
@ -815,6 +816,7 @@ void MyTemplatePoint3_templatedMethod_67(int nargout, mxArray *out[], int nargin
|
|||
gtsam::Point2& t = *unwrap_shared_ptr< gtsam::Point2 >(in[1], "ptr_gtsamPoint2");
|
||||
obj->templatedMethod<gtsam::Point2>(t);
|
||||
}
|
||||
|
||||
void MyTemplatePoint3_templatedMethod_68(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyTemplatePoint3> Shared;
|
||||
|
|
Loading…
Reference in New Issue