示例#1
0
void Log::Close() {
  AdvanceTail();
  for(vector<LogSection*>::iterator i = sections.begin(); i != sections.end(); ++i) {
    delete *i;
  }
  sections.clear();
}
示例#2
0
    /// \brief  Reads entries from the buffer. 
    ///
    /// \param [out] pTarget The target of the read operation - the values read from the buffer will be stored there.
    /// \param uiCount The maximum number of elements to read.
    ///
    /// \return The number of elements actually read.
    ///
    unsigned int Read(T* pTarget, unsigned int uiCount = 1)
    {
      if (uiCount > 0)
      {
        // Don't read past the end of the array or past the amount of available bytes
        unsigned int uiElementsToRead = hkvMath::Min(hkvMath::Min(uiCount, Size - m_uiTail), m_uiAvailable);

        memcpy(pTarget, m_Buffer + m_uiTail, uiElementsToRead * sizeof(T));

        AdvanceTail(uiElementsToRead);

        // Continue reading in case we need to wrap around the end of the buffer
        return uiElementsToRead + Read(pTarget + uiElementsToRead, uiCount - uiElementsToRead);
      }
      else
      {
        return 0;
      }
    }