+template<typename Timestamp>
+const Event<Timestamp>&
+Event<Timestamp>::operator=(const Event& copy)
+{
+ _id = next_event_id ();
+ _type = copy._type;
+ _original_time = copy._original_time;
+ _nominal_time = copy._nominal_time;
+ _owns_buf = copy._owns_buf;
+ if (_owns_buf) {
+ if (copy._buf) {
+ if (copy._size > _size) {
+ _buf = (uint8_t*)::realloc(_buf, copy._size);
+ }
+ memcpy(_buf, copy._buf, copy._size);
+ } else {
+ free(_buf);
+ _buf = NULL;
+ }
+ } else {
+ _buf = copy._buf;
+ }
+
+ _size = copy._size;
+ return *this;
+}
+
+template<typename Timestamp>
+void
+Event<Timestamp>::set (const uint8_t* buf, uint32_t size, Timestamp t)
+{
+ if (_owns_buf) {
+ if (_size < size) {
+ _buf = (uint8_t*) ::realloc(_buf, size);
+ }
+ memcpy (_buf, buf, size);
+ } else {
+ /* XXX this is really dangerous given the
+ const-ness of buf. The API should really
+ intervene here.
+ */
+ _buf = const_cast<uint8_t*> (buf);
+ }
+
+ _original_time = t;
+ _nominal_time = t;
+ _size = size;
+}
+
+template<typename Timestamp>
+void
+Event<Timestamp>::set_time (Timestamp t)
+{
+ _nominal_time = t;
+}
+
+template<typename Timestamp>
+void
+Event<Timestamp>::set_original_time (Timestamp t)
+{
+ _original_time = t;
+}
+