MMIO: Pass pointers to the complex method lambdas when visiting.

This commit is contained in:
Pierre Bourdon 2014-02-27 22:52:36 +01:00
parent 6b645f5cac
commit 71962ee0eb
2 changed files with 8 additions and 8 deletions

View File

@ -148,12 +148,12 @@ public:
virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const
{
v.VisitComplex(read_lambda_);
v.VisitComplex(&read_lambda_);
}
virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const
{
v.VisitComplex(write_lambda_);
v.VisitComplex(&write_lambda_);
}
private:
@ -313,9 +313,9 @@ void ReadHandler<T>::ResetMethod(ReadHandlingMethod<T>* method)
ret = [addr, mask](u32) { return *addr & mask; };
}
virtual void VisitComplex(std::function<T(u32)> lambda)
virtual void VisitComplex(const std::function<T(u32)>* lambda)
{
ret = lambda;
ret = *lambda;
}
};
@ -367,9 +367,9 @@ void WriteHandler<T>::ResetMethod(WriteHandlingMethod<T>* method)
ret = [ptr, mask](u32, T val) { *ptr = val & mask; };
}
virtual void VisitComplex(std::function<void(u32, T)> lambda)
virtual void VisitComplex(const std::function<void(u32, T)>* lambda)
{
ret = lambda;
ret = *lambda;
}
};

View File

@ -88,7 +88,7 @@ class ReadHandlingMethodVisitor
public:
virtual void VisitConstant(T value) = 0;
virtual void VisitDirect(const T* addr, u32 mask) = 0;
virtual void VisitComplex(std::function<T(u32)> lambda) = 0;
virtual void VisitComplex(const std::function<T(u32)>* lambda) = 0;
};
template <typename T>
class WriteHandlingMethodVisitor
@ -96,7 +96,7 @@ class WriteHandlingMethodVisitor
public:
virtual void VisitNop() = 0;
virtual void VisitDirect(T* addr, u32 mask) = 0;
virtual void VisitComplex(std::function<void(u32, T)> lambda) = 0;
virtual void VisitComplex(const std::function<void(u32, T)>* lambda) = 0;
};
// These classes are INTERNAL. Do not use outside of the MMIO implementation