add logging

This commit is contained in:
Mathieu Lacage
2008-05-28 08:51:27 -07:00
parent 20b1d65d07
commit 16018e8d7e
2 changed files with 28 additions and 0 deletions

View File

@@ -236,6 +236,7 @@ Buffer::CheckInternalState (void) const
void
Buffer::Initialize (uint32_t zeroSize)
{
NS_LOG_FUNCTION (this << zeroSize);
m_data = Buffer::Create (0);
#ifdef BUFFER_HEURISTICS
m_start = std::min (m_data->m_size, g_recommendedStart);
@@ -336,6 +337,7 @@ Buffer::GetInternalEnd (void) const
bool
Buffer::AddAtStart (uint32_t start)
{
NS_LOG_FUNCTION (this << start);
bool dirty;
NS_ASSERT (CheckInternalState ());
bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart;
@@ -385,6 +387,7 @@ Buffer::AddAtStart (uint32_t start)
bool
Buffer::AddAtEnd (uint32_t end)
{
NS_LOG_FUNCTION (this << end);
bool dirty;
NS_ASSERT (CheckInternalState ());
bool isDirty = m_data->m_count > 1 && m_end < m_data->m_dirtyEnd;
@@ -438,6 +441,7 @@ Buffer::AddAtEnd (uint32_t end)
void
Buffer::AddAtEnd (const Buffer &o)
{
NS_LOG_FUNCTION (this << &o);
if (m_data->m_count == 1 &&
m_end == m_zeroAreaEnd &&
m_end == m_data->m_dirtyEnd &&
@@ -460,6 +464,7 @@ Buffer::AddAtEnd (const Buffer &o)
Buffer::Iterator src = o.End ();
src.Prev (endData);
dst.Write (src, o.End ());
NS_ASSERT (CheckInternalState ());
return;
}
@@ -471,11 +476,13 @@ Buffer::AddAtEnd (const Buffer &o)
destStart.Prev (src.GetSize ());
destStart.Write (src.Begin (), src.End ());
*this = dst;
NS_ASSERT (CheckInternalState ());
}
void
Buffer::RemoveAtStart (uint32_t start)
{
NS_LOG_FUNCTION (this << start);
NS_ASSERT (CheckInternalState ());
uint32_t newStart = m_start + start;
if (newStart <= m_zeroAreaStart)
@@ -520,6 +527,7 @@ Buffer::RemoveAtStart (uint32_t start)
void
Buffer::RemoveAtEnd (uint32_t end)
{
NS_LOG_FUNCTION (this << end);
NS_ASSERT (CheckInternalState ());
uint32_t newEnd = m_end - std::min (end, m_end - m_start);
if (newEnd > m_zeroAreaEnd)
@@ -555,6 +563,7 @@ Buffer::RemoveAtEnd (uint32_t end)
Buffer
Buffer::CreateFragment (uint32_t start, uint32_t length) const
{
NS_LOG_FUNCTION (this << start << length);
NS_ASSERT (CheckInternalState ());
Buffer tmp = *this;
tmp.RemoveAtStart (start);
@@ -566,6 +575,7 @@ Buffer::CreateFragment (uint32_t start, uint32_t length) const
Buffer
Buffer::CreateFullCopy (void) const
{
NS_LOG_FUNCTION (this);
NS_ASSERT (CheckInternalState ());
if (m_zeroAreaEnd - m_zeroAreaStart != 0)
{
@@ -580,6 +590,7 @@ Buffer::CreateFullCopy (void) const
Buffer::Iterator i = tmp.End ();
i.Prev (dataEnd);
i.Write (m_data->m_data+m_zeroAreaStart,dataEnd);
NS_ASSERT (tmp.CheckInternalState ());
return tmp;
}
NS_ASSERT (CheckInternalState ());