diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 11:29:32 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 11:29:32 +0000 |
commit | 7902239839a6f34e12ed7aa0f2b7a65114f8ee68 (patch) | |
tree | dd4acdb69101c6eb844d3d09a033aa54e8b4a402 /document | |
parent | 4af2908b7854cbec1ee8173cc4a821d0482a978e (diff) |
Use shared pointer to const DocumentTypeRepo.
Diffstat (limited to 'document')
10 files changed, 17 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..3d4caee15c6 100644 --- a/document/src/vespa/document/repo/documenttyperepo.h +++ b/document/src/vespa/document/repo/documenttyperepo.h @@ -23,7 +23,7 @@ class DocumentTypeRepo { public: using DocumenttypesConfig = const internal::InternalDocumenttypesType; - typedef std::shared_ptr<DocumentTypeRepo> SP; + typedef std::shared_ptr<const 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 { /** |