-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// $Id$
+//
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
/** \file
\brief PacketImpl non-inline non-template implementation */
-#include "PacketImpl.hh"
//#include "PacketImpl.ih"
// Custom includes
#include <iterator>
-#include "PacketInterpreter.hh"
+#include "Packets.hh"
//#include "PacketImpl.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
+unsigned senf::detail::AnnotationIndexerBase::maxAnnotations (0);
+
///////////////////////////////////////////////////////////////////////////
// senf::detail::PacketImpl
+prefix_ senf::detail::PacketImpl::~PacketImpl()
+{
+ // We increment refcount_ to ensure, release() won't call delete again
+ ++refcount_;
+ eraseInterpreters(interpreters_.begin(), interpreters_.end());
+ Annotations::const_iterator i (annotations_.begin());
+ Annotations::const_iterator const i_end (annotations_.end());
+ std::vector<bool>::iterator small (AnnotationIndexerBase::small().begin());
+ for (; i != i_end; ++i, ++small)
+ if (! *small && i->p)
+ delete i->p;
+}
+
// interpreter chain
prefix_ void senf::detail::PacketImpl::appendInterpreter(PacketInterpreterBase * p)
truncateInterpreters(n);
iterator first (boost::next(begin(),self->begin_));
data_.erase(first, boost::next(begin(),self->end_));
- updateIterators(self,first,-self->size());
+ updateIterators(self,self->begin_,-self->size());
}
// private members
}
}
-prefix_ void senf::detail::PacketImpl::updateIterators(PacketData * self, iterator pos,
+prefix_ void senf::detail::PacketImpl::updateIterators(PacketData * self, difference_type pos,
difference_type n)
{
// I hate to change the PacketData representation from here, I would have preferred to let
// c)
interpreter_list::iterator const i_end (interpreters_.end());
if (++i != i_end)
- if (std::distance(begin(), pos) < difference_type(i->begin_))
+ if (pos <= difference_type(i->begin_))
// pos is before the packet, it must then be before all futher packets ...
for (; i != i_end; ++i) {
i->begin_ += n;