diff options
author | Geir Storli <geirstorli@yahoo.no> | 2018-04-04 14:44:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 14:44:13 +0200 |
commit | a3d2dad8b01377a87754b714f54ff05c87bf1f8c (patch) | |
tree | 870e326f7d7f25b3caf4d029638c977f0c1712f3 /document | |
parent | f86708b7b67e38289384d03079f461f532b8763c (diff) | |
parent | 8cfeaeba255ccea54f8345724e72adf53280e33d (diff) |
Merge pull request #5455 from vespa-engine/toregge/use-shared-ptr-to-const-document-type-repo
Use shared pointer to const DocumentTypeRepo.
Diffstat (limited to 'document')
10 files changed, 16 insertions, 13 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp index 410ac539ff4..05ec2ce99d0 100644 --- a/document/src/tests/documentselectparsertest.cpp +++ b/document/src/tests/documentselectparsertest.cpp @@ -118,7 +118,7 @@ public: CPPUNIT_TEST_SUITE_REGISTRATION(DocumentSelectParserTest); namespace { - DocumentTypeRepo::SP _repo; + std::shared_ptr<const DocumentTypeRepo> _repo; } void DocumentSelectParserTest::setUp() diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index 70f16eccfe1..cade696e06c 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -23,7 +23,7 @@ namespace document { using namespace fieldvalue; struct FieldPathUpdateTestCase : public CppUnit::TestFixture { - DocumentTypeRepo::SP _repo; + std::shared_ptr<const DocumentTypeRepo> _repo; DocumentType _foobar_type; void setUp() override; diff --git a/document/src/vespa/document/base/testdocman.cpp b/document/src/vespa/document/base/testdocman.cpp index 830b36ef926..206ac018248 100644 --- a/document/src/vespa/document/base/testdocman.cpp +++ b/document/src/vespa/document/base/testdocman.cpp @@ -63,7 +63,7 @@ TestDocMan::TestDocMan() TestDocMan::~TestDocMan() { } void -TestDocMan::setTypeRepo(const DocumentTypeRepo::SP &repo) +TestDocMan::setTypeRepo(const std::shared_ptr<const DocumentTypeRepo> &repo) { _repo = repo; _typeCfg = NULL; diff --git a/document/src/vespa/document/base/testdocman.h b/document/src/vespa/document/base/testdocman.h index 7d2e949c6c3..98398d5569b 100644 --- a/document/src/vespa/document/base/testdocman.h +++ b/document/src/vespa/document/base/testdocman.h @@ -21,7 +21,6 @@ #include "testdocrepo.h" #include <vespa/document/datatype/datatypes.h> #include <vespa/document/fieldvalue/fieldvalues.h> -#include <vespa/document/repo/documenttyperepo.h> #include <memory> #include <vector> @@ -29,17 +28,17 @@ namespace document { class TestDocMan { static std::vector<char> _buffer; TestDocRepo _test_repo; - DocumentTypeRepo::SP _repo; + std::shared_ptr<const DocumentTypeRepo> _repo; const DocumenttypesConfig *_typeCfg; public: TestDocMan(); ~TestDocMan(); - void setTypeRepo(const DocumentTypeRepo::SP &repo); + void setTypeRepo(const std::shared_ptr<const DocumentTypeRepo> &repo); const DocumentTypeRepo& getTypeRepo() const { return *_repo; } - const DocumentTypeRepo::SP getTypeRepoSP() const { return _repo; } + std::shared_ptr<const DocumentTypeRepo> getTypeRepoSP() const { return _repo; } const DocumenttypesConfig *getTypeConfig() const { return _typeCfg; } /** Create test document. */ diff --git a/document/src/vespa/document/base/testdocrepo.cpp b/document/src/vespa/document/base/testdocrepo.cpp index 39181f5e5b3..026d29ed3b0 100644 --- a/document/src/vespa/document/base/testdocrepo.cpp +++ b/document/src/vespa/document/base/testdocrepo.cpp @@ -2,6 +2,7 @@ #include "testdocrepo.h" #include <vespa/document/datatype/documenttype.h> +#include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/repo/configbuilder.h> #include <vespa/config/print/fileconfigreader.h> diff --git a/document/src/vespa/document/base/testdocrepo.h b/document/src/vespa/document/base/testdocrepo.h index 5c37d54e707..e6d7fc788fb 100644 --- a/document/src/vespa/document/base/testdocrepo.h +++ b/document/src/vespa/document/base/testdocrepo.h @@ -4,13 +4,14 @@ #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/datatype/datatype.h> -#include <vespa/document/repo/documenttyperepo.h> namespace document { +class DocumentTypeRepo; + class TestDocRepo { DocumenttypesConfig _cfg; - DocumentTypeRepo::SP _repo; + std::shared_ptr<const DocumentTypeRepo> _repo; public: TestDocRepo(); @@ -19,7 +20,7 @@ public: static DocumenttypesConfig getDefaultConfig(); const DocumentTypeRepo& getTypeRepo() const { return *_repo; } - const DocumentTypeRepo::SP getTypeRepoSp() const { return _repo; } + std::shared_ptr<const DocumentTypeRepo> getTypeRepoSp() const { return _repo; } const DocumenttypesConfig& getTypeConfig() const { return _cfg; } const DataType* getDocumentType(const vespalib::string &name) const; }; diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.cpp b/document/src/vespa/document/fieldset/fieldsetrepo.cpp index 5402a7113cb..e1e2ed35ca6 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.cpp +++ b/document/src/vespa/document/fieldset/fieldsetrepo.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/document/repo/documenttyperepo.h> using vespalib::StringTokenizer; diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.h b/document/src/vespa/document/fieldset/fieldsetrepo.h index f48b57f63d8..d0bff0d60c8 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.h +++ b/document/src/vespa/document/fieldset/fieldsetrepo.h @@ -4,10 +4,11 @@ #include <vespa/document/fieldset/fieldset.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/datatype/documenttype.h> -#include <vespa/document/repo/documenttyperepo.h> namespace document { +class DocumentTypeRepo; + /** * Class that has configuration for all document field sets. * Responsible for parsing field set strings using a documenttype. diff --git a/document/src/vespa/document/repo/documenttyperepo.h b/document/src/vespa/document/repo/documenttyperepo.h index 3e0f2564819..ce54effe068 100644 --- a/document/src/vespa/document/repo/documenttyperepo.h +++ b/document/src/vespa/document/repo/documenttyperepo.h @@ -23,7 +23,6 @@ class DocumentTypeRepo { public: using DocumenttypesConfig = const internal::InternalDocumenttypesType; - typedef std::shared_ptr<DocumentTypeRepo> SP; typedef std::unique_ptr<DocumentTypeRepo> UP; // This one should only be used for testing. If you do not have any config. diff --git a/document/src/vespa/document/select/parser.h b/document/src/vespa/document/select/parser.h index 35d710298c3..c4e686a120e 100644 --- a/document/src/vespa/document/select/parser.h +++ b/document/src/vespa/document/select/parser.h @@ -4,10 +4,11 @@ #include "node.h" #include "parsing_failed_exception.h" #include <vespa/document/bucket/bucketidfactory.h> -#include <vespa/document/repo/documenttyperepo.h> #include <memory> #include <string> +namespace document { class DocumentTypeRepo; } + namespace document::select { /** |