diff options
Diffstat (limited to 'staging_vespalib/src')
-rw-r--r-- | staging_vespalib/src/tests/stllike/lrucache.cpp | 5 | ||||
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/objects/identifiable.hpp | 38 | ||||
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/objects/visit.hpp | 14 |
3 files changed, 2 insertions, 55 deletions
diff --git a/staging_vespalib/src/tests/stllike/lrucache.cpp b/staging_vespalib/src/tests/stllike/lrucache.cpp index 4047f43237c..7dff35ae842 100644 --- a/staging_vespalib/src/tests/stllike/lrucache.cpp +++ b/staging_vespalib/src/tests/stllike/lrucache.cpp @@ -3,7 +3,6 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/stllike/lrucache_map.hpp> -#include <vespa/vespalib/util/linkedptr.h> using namespace vespalib; @@ -103,8 +102,8 @@ struct SharedHash { TEST("testCacheInsertOverResize") { - typedef vespalib::LinkedPtr<std::string> LS; - typedef lrucache_map< LruParam<int, LS> > Cache; + using LS = std::shared_ptr<std::string>; + using Cache = lrucache_map< LruParam<int, LS> >; Cache cache(100); size_t sum(0); diff --git a/staging_vespalib/src/vespa/vespalib/objects/identifiable.hpp b/staging_vespalib/src/vespa/vespalib/objects/identifiable.hpp index 55db9406d7b..ad31712ede9 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/identifiable.hpp +++ b/staging_vespalib/src/vespa/vespalib/objects/identifiable.hpp @@ -17,7 +17,6 @@ */ #include "identifiable.h" -#include <vespa/vespalib/util/linkedptr.h> namespace vespalib { @@ -121,41 +120,4 @@ public: friend Deserializer & operator >> (Deserializer & is, IdentifiableSharedPtr<T> & agg) { return agg.deserialize(is); } }; -template <typename T> -class IdentifiableLinkedPtr : public LinkedPtr<T> -{ -public: - IdentifiableLinkedPtr(const T &t) : LinkedPtr<T>(t.clone()) {} - IdentifiableLinkedPtr(T * p=NULL) : LinkedPtr<T>(p) { } - int cmp(const IdentifiableLinkedPtr<T> &rhs) const { - const T *a = this->get(); - const T *b = rhs.get(); - if (a == 0) { - return (b == 0) ? 0 : -1; - } - return (b == 0) ? 1 : a->cmp(*b); - } - bool operator < (const IdentifiableLinkedPtr<T> &rhs) const { - return (cmp(rhs) < 0); - } - Serializer & serialize(Serializer & os) const { - if (this->get()) { - os.put(Identifiable::hasObjectField, uint8_t(1)) << *this->get(); - } else { - os.put(Identifiable::hasObjectField, uint8_t(0)); - } - return os; - } - Deserializer & deserialize(Deserializer & is) { - uint8_t hasObject; - is.get(Identifiable::hasObjectField, hasObject); - if (hasObject) { - this->reset(static_cast<T *>(Identifiable::create(is).release())); - } - return is; - } - friend Serializer & operator << (Serializer & os, const IdentifiableLinkedPtr<T> & agg) { return agg.serialize(os); } - friend Deserializer & operator >> (Deserializer & is, IdentifiableLinkedPtr<T> & agg) { return agg.deserialize(is); } -}; - } diff --git a/staging_vespalib/src/vespa/vespalib/objects/visit.hpp b/staging_vespalib/src/vespa/vespalib/objects/visit.hpp index 57d753b82f4..797e77a7244 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/visit.hpp +++ b/staging_vespalib/src/vespa/vespalib/objects/visit.hpp @@ -35,25 +35,11 @@ void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const st } template<typename T> -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const vespalib::LinkedPtr<T> &ptr) { - if (ptr.get()) { - visit(self, name, *ptr); - } else { - self.visitNull(name); - } -} - -template<typename T> void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const vespalib::IdentifiablePtr<T> &ptr) { visit(self, name, ptr.get()); } template<typename T> -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const vespalib::IdentifiableLinkedPtr<T> &ptr) { - visit(self, name, ptr.get()); -} - -template<typename T> void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const vespalib::IdentifiableSharedPtr<T> &ptr) { visit(self, name, ptr.get()); } |