Merge with head.
[gem5.git] / src / base / timebuf.hh
index f6b5b2781cbf4d710318d09443c4e0986b75f0cc..348f7a673d410dcfbd4c69322f570809ad496b13 100644 (file)
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
+ *          Kevin Lim
  */
 
 #ifndef __BASE_TIMEBUF_HH__
 #define __BASE_TIMEBUF_HH__
 
+#include <cassert>
+#include <cstring>
 #include <vector>
 
 template <class T>
@@ -139,7 +144,7 @@ class TimeBuffer
         char *ptr = data;
         for (int i = 0; i < size; i++) {
             index[i] = ptr;
-            memset(ptr, 0, sizeof(T));
+            std::memset(ptr, 0, sizeof(T));
             new (ptr) T;
             ptr += sizeof(T);
         }
@@ -167,7 +172,7 @@ class TimeBuffer
         if (ptr >= size)
             ptr -= size;
         (reinterpret_cast<T *>(index[ptr]))->~T();
-        memset(index[ptr], 0, sizeof(T));
+        std::memset(index[ptr], 0, sizeof(T));
         new (index[ptr]) T;
     }
 
@@ -212,6 +217,11 @@ class TimeBuffer
     {
         return wire(this, 0);
     }
+
+    int getSize()
+    {
+        return size;
+    }
 };
 
 #endif // __BASE_TIMEBUF_HH__