timebuf.hh (10200:1ab8753de4d8) | timebuf.hh (11320:42ecb523c64a) |
---|---|
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 124 unchanged lines hidden (view full) --- 133 } 134 T &operator*() const { return *buffer->access(index); } 135 T *operator->() const { return buffer->access(index); } 136 }; 137 138 139 public: 140 TimeBuffer(int p, int f) | 1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 124 unchanged lines hidden (view full) --- 133 } 134 T &operator*() const { return *buffer->access(index); } 135 T *operator->() const { return buffer->access(index); } 136 }; 137 138 139 public: 140 TimeBuffer(int p, int f) |
141 : past(p), future(f), size(past + future + 1), | 141 : past(p), future(f), size(past + future + 1), |
142 data(new char[size * sizeof(T)]), index(size), base(0) 143 { 144 assert(past >= 0 && future >= 0); 145 char *ptr = data; 146 for (unsigned i = 0; i < size; i++) { 147 index[i] = ptr; 148 std::memset(ptr, 0, sizeof(T)); 149 new (ptr) T; --- 102 unchanged lines hidden --- | 142 data(new char[size * sizeof(T)]), index(size), base(0) 143 { 144 assert(past >= 0 && future >= 0); 145 char *ptr = data; 146 for (unsigned i = 0; i < size; i++) { 147 index[i] = ptr; 148 std::memset(ptr, 0, sizeof(T)); 149 new (ptr) T; --- 102 unchanged lines hidden --- |