refactor relation of BuffHandle and BufferDescriptor

they are now tightly coupled and assumed to
work together; there is no need to relay half
of BuffHandle's interface through BufferDescriptor
This commit is contained in:
Fischlurch 2011-11-25 18:20:01 +01:00
parent d6b069fbbd
commit ce25be6fa3
3 changed files with 17 additions and 27 deletions

View file

@ -211,18 +211,23 @@ namespace engine {
void
BufferDescriptor::emit (BuffHandle const& handle) const
BuffHandle::emit()
{
REQUIRE (verifyValidity());
provider_->emitBuffer(handle);
REQUIRE (isValid());
descriptor_.provider_->emitBuffer(*this);
}
void
BufferDescriptor::release (BuffHandle const& handle) const
BuffHandle::release()
{
REQUIRE (verifyValidity());
provider_->releaseBuffer(handle);
if (pBuffer_)
{
REQUIRE (isValid());
descriptor_.provider_->releaseBuffer(*this);
pBuffer_ = 0;
}
ENSURE (!isValid());
}

View file

@ -81,6 +81,7 @@ namespace engine {
*/
class BufferDescriptor
{
protected:
BufferProvider* provider_;
HashVal subClassification_;
@ -90,6 +91,7 @@ namespace engine {
{ }
friend class BufferProvider;
friend class BuffHandle;
public:
// using standard copy operations
@ -97,9 +99,6 @@ namespace engine {
bool verifyValidity() const;
size_t determineBufferSize() const;
void emit (BuffHandle const&) const;
void release (BuffHandle const&) const;
operator HashVal() const { return subClassification_; }
};
@ -136,23 +135,8 @@ namespace engine {
void
emit()
{
REQUIRE (pBuffer_);
descriptor_.emit (*this);
}
void release()
{
if (pBuffer_)
{
REQUIRE (isValid());
descriptor_.release (*this);
pBuffer_ = 0;
}
ENSURE (!isValid());
}
void emit();
void release();
template<typename BU>
@ -181,7 +165,7 @@ namespace engine {
HashVal
entryID() const
{
return descriptor_;
return HashVal(descriptor_);
}
size_t

View file

@ -70,6 +70,7 @@ namespace engine {
PBu inBuff;
};
class BufferDescriptor;
/** Obsolete, to be rewritten /////TICKET #826 */
class BuffTableStorage