aboutsummaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-06-02 11:35:21 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-06-06 09:12:37 +0200
commit8e0c48091d4c944bec4a4c56ae49f25125262c82 (patch)
treef6d0d31e88b7db3f88fb11dc71437ea35db8e112 /document
parentf54e69173d5bea16c9ee898246bc894260035631 (diff)
Forward declare ByteBuffer and FastOS_Thread
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/testxml.cpp2
-rw-r--r--document/src/vespa/document/annotation/spantree.cpp2
-rw-r--r--document/src/vespa/document/annotation/spantree.h1
-rw-r--r--document/src/vespa/document/base/forcelink.cpp2
-rw-r--r--document/src/vespa/document/datatype/annotationreferencedatatype.cpp1
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp17
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.h18
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.cpp11
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.h9
-rw-r--r--document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp2
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.cpp2
-rw-r--r--document/src/vespa/document/select/branch.cpp1
-rw-r--r--document/src/vespa/document/select/constant.cpp7
-rw-r--r--document/src/vespa/document/select/doctype.cpp7
-rw-r--r--document/src/vespa/document/select/operator.cpp7
-rw-r--r--document/src/vespa/document/select/valuenode.cpp1
-rw-r--r--document/src/vespa/document/update/documentupdate.cpp28
-rw-r--r--document/src/vespa/document/update/documentupdate.h18
18 files changed, 81 insertions, 55 deletions
diff --git a/document/src/tests/testxml.cpp b/document/src/tests/testxml.cpp
index da328c7a63f..a9abae531fa 100644
--- a/document/src/tests/testxml.cpp
+++ b/document/src/tests/testxml.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/* $Id$*/
#include <vespa/document/base/testdocrepo.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -8,6 +7,7 @@
#include <vespa/document/update/addvalueupdate.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/removevalueupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/testkit/test_kit.h>
diff --git a/document/src/vespa/document/annotation/spantree.cpp b/document/src/vespa/document/annotation/spantree.cpp
index 199040ea8f6..61c7ac48817 100644
--- a/document/src/vespa/document/annotation/spantree.cpp
+++ b/document/src/vespa/document/annotation/spantree.cpp
@@ -1,9 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "spantree.h"
-#include "annotation.h"
#include "spannode.h"
-#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/stllike/asciistream.h>
using std::unique_ptr;
diff --git a/document/src/vespa/document/annotation/spantree.h b/document/src/vespa/document/annotation/spantree.h
index d53e9002598..06558cf6887 100644
--- a/document/src/vespa/document/annotation/spantree.h
+++ b/document/src/vespa/document/annotation/spantree.h
@@ -4,6 +4,7 @@
#include <vespa/document/annotation/annotation.h>
#include <vector>
+#include <cassert>
namespace document {
class SpanNode;
diff --git a/document/src/vespa/document/base/forcelink.cpp b/document/src/vespa/document/base/forcelink.cpp
index b03433081d6..f17c8f582b3 100644
--- a/document/src/vespa/document/base/forcelink.cpp
+++ b/document/src/vespa/document/base/forcelink.cpp
@@ -3,6 +3,8 @@
#include "forcelink.h"
#include <vespa/document/update/updates.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
+
namespace document {
diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
index 2591cdbf37c..344fc31ed33 100644
--- a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
+++ b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
@@ -3,6 +3,7 @@
#include "annotationreferencedatatype.h"
#include <vespa/document/fieldvalue/annotationreferencefieldvalue.h>
#include <ostream>
+#include <cassert>
using std::unique_ptr;
using std::ostream;
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index fd3093488ea..3279eb77a64 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -10,7 +10,7 @@
#include "doublefieldvalue.h"
#include "bytefieldvalue.h"
#include "predicatefieldvalue.h"
-
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/document/serialization/vespadocumentserializer.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -51,6 +51,21 @@ FieldValue::hash() const
return vespalib::hashValue(os.c_str(), os.size()) ;
}
+bool
+FieldValue::isA(const FieldValue& other) const {
+ return (getDataType()->isA(*other.getDataType()));
+}
+int
+FieldValue::compare(const FieldValue& other) const {
+ const DataType & a = *getDataType();
+ const DataType & b = *other.getDataType();
+ return (a < b)
+ ? -1
+ : (b < a)
+ ? 1
+ : 0;
+}
+
FieldValue&
FieldValue::assign(const FieldValue& value)
{
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h
index bb2a10a3f53..81e207bc31a 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.h
@@ -15,7 +15,6 @@
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/util/xmlserializable.h>
#include <vespa/vespalib/util/polymorphicarrays.h>
-#include <vespa/document/util/bytebuffer.h>
#include <vespa/vespalib/objects/cloneable.h>
#include <map>
@@ -25,6 +24,8 @@ namespace vespalib {
namespace document {
+class ByteBuffer;
+
class FieldValue : public vespalib::Identifiable
{
protected:
@@ -168,27 +169,18 @@ public:
virtual const DataType *getDataType() const = 0;
/** Wrapper for datatypes isA() function. See DataType. */
- virtual bool isA(const FieldValue& other) const
- { return (getDataType()->isA(*other.getDataType())); }
+ virtual bool isA(const FieldValue& other) const;
void serialize(vespalib::nbostream &stream) const;
void serialize(ByteBuffer& buffer) const;
- ByteBuffer::UP serialize() const;
+ std::unique_ptr<ByteBuffer> serialize() const;
/**
* Compares this fieldvalue with another fieldvalue.
* Should return 0 if the two are equal, <0 if this object is "less" than
* the other, and >0 if this object is more than the other.
*/
- virtual int compare(const FieldValue& other) const {
- const DataType & a = *getDataType();
- const DataType & b = *other.getDataType();
- return (a < b)
- ? -1
- : (b < a)
- ? 1
- : 0;
- }
+ virtual int compare(const FieldValue& other) const;
/**
* Returns true if this object have been altered since last
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
index 079b730c8cc..d3cbcb77ba2 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
@@ -8,7 +8,6 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/crc.h>
#include <vespa/document/datatype/positiondatatype.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/base/exceptions.h>
@@ -53,6 +52,16 @@ StructFieldValue::swap(StructFieldValue & rhs)
std::swap(_version, _version);
}
+const StructDataType &
+StructFieldValue::getStructType() const {
+ return static_cast<const StructDataType &>(getType());
+}
+
+const CompressionConfig &
+StructFieldValue::getCompressionConfig() const {
+ return getStructType().getCompressionConfig();
+}
+
void
StructFieldValue::lazyDeserialize(const FixedTypeRepo &repo,
uint16_t version,
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h
index a46a36c477d..d57c8b965f7 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h
@@ -12,16 +12,17 @@
#include "structuredfieldvalue.h"
#include "serializablearray.h"
#include <vespa/document/util/compressionconfig.h>
-#include <vespa/document/datatype/structdatatype.h>
#include <vector>
namespace document {
+
class Document;
class DocumentType;
class DocumentTypeRepo;
class FieldValueWriter;
class FixedTypeRepo;
class FieldSet;
+class StructDataType;
class StructFieldValue : public StructuredFieldValue
{
@@ -73,7 +74,7 @@ public:
const DocumentTypeRepo * getRepo() const { return _repo; }
void setDocumentType(const DocumentType & docType) { _doc_type = & docType; }
- const StructDataType & getStructType() const { return static_cast<const StructDataType &>(getType()); }
+ const StructDataType & getStructType() const;
void lazyDeserialize(const FixedTypeRepo &repo,
uint16_t version,
@@ -99,8 +100,7 @@ public:
const Field& getField(const vespalib::stringref & name) const override;
void clear() override;
- const CompressionConfig &getCompressionConfig() const
- { return getStructType().getCompressionConfig(); }
+ const CompressionConfig &getCompressionConfig() const;
// FieldValue implementation.
FieldValue& assign(const FieldValue&) override;
@@ -146,4 +146,3 @@ private:
};
} // document
-
diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
index d6396c43a46..03b7d50c1c1 100644
--- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
@@ -3,6 +3,7 @@
#include "tensorfieldvalue.h"
#include <vespa/eval/tensor/tensor.h>
#include <ostream>
+#include <cassert>
using vespalib::tensor::Tensor;
@@ -164,7 +165,6 @@ TensorFieldValue::compare(const FieldValue &other) const
return ((_tensor.get() < rhs._tensor.get()) ? -1 : 1);
}
-
IMPLEMENT_IDENTIFIABLE(TensorFieldValue, FieldValue);
} // document
diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp
index b555e25c4cc..93adce76efd 100644
--- a/document/src/vespa/document/repo/documenttyperepo.cpp
+++ b/document/src/vespa/document/repo/documenttyperepo.cpp
@@ -14,8 +14,6 @@
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/document/config/config-documenttypes.h>
#include <fstream>
-#include <memory>
-#include <utility>
#include <vespa/log/log.h>
LOG_SETUP(".documenttyperepo");
diff --git a/document/src/vespa/document/select/branch.cpp b/document/src/vespa/document/select/branch.cpp
index ddbad69b14d..85e42dd74b5 100644
--- a/document/src/vespa/document/select/branch.cpp
+++ b/document/src/vespa/document/select/branch.cpp
@@ -2,6 +2,7 @@
#include "branch.h"
#include "visitor.h"
+#include <cassert>
namespace document {
namespace select {
diff --git a/document/src/vespa/document/select/constant.cpp b/document/src/vespa/document/select/constant.cpp
index 686ab05055c..a48492685f3 100644
--- a/document/src/vespa/document/select/constant.cpp
+++ b/document/src/vespa/document/select/constant.cpp
@@ -2,9 +2,9 @@
#include "constant.h"
#include "visitor.h"
+#include <cassert>
-namespace document {
-namespace select {
+namespace document::select {
Constant::Constant(const vespalib::stringref & value)
: Node(value),
@@ -54,5 +54,4 @@ Constant::print(std::ostream& out, bool,
if (_parentheses) out << ')';
}
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/doctype.cpp b/document/src/vespa/document/select/doctype.cpp
index 3c23b2e5ba1..117f97ea1bc 100644
--- a/document/src/vespa/document/select/doctype.cpp
+++ b/document/src/vespa/document/select/doctype.cpp
@@ -5,9 +5,9 @@
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
-namespace document {
-namespace select {
+namespace document::select {
namespace {
bool documentTypeEqualsName(const DocumentType& type,
@@ -88,5 +88,4 @@ DocType::print(std::ostream& out, bool verbose,
if (_parentheses) out << ')';
}
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp
index b127e29c1ad..3c09a482cf0 100644
--- a/document/src/vespa/document/select/operator.cpp
+++ b/document/src/vespa/document/select/operator.cpp
@@ -4,9 +4,9 @@
#include <vespa/vespalib/util/regexp.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <cassert>
-namespace document {
-namespace select {
+namespace document::select {
Operator::OperatorMap Operator::_operators;
@@ -228,5 +228,4 @@ GlobOperator::containsVariables(const vespalib::stringref & expression)
const GlobOperator GlobOperator::GLOB("=");
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp
index ebf0a466ad9..49eab9d75ff 100644
--- a/document/src/vespa/document/select/valuenode.cpp
+++ b/document/src/vespa/document/select/valuenode.cpp
@@ -4,6 +4,7 @@
#include "parser.h"
#include <vespa/document/base/exceptions.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/util/md5.h>
#include <vespa/document/util/stringutil.h>
#include <vespa/vespalib/text/lowercase.h>
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp
index 866a215505c..d91b33650d4 100644
--- a/document/src/vespa/document/update/documentupdate.cpp
+++ b/document/src/vespa/document/update/documentupdate.cpp
@@ -1,4 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include "documentupdate.h"
#include "documentupdateflags.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
@@ -7,6 +8,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/document/util/bufferexceptions.h>
#include <vespa/document/base/exceptions.h>
+#include <vespa/document/datatype/documenttype.h>
using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
@@ -103,7 +105,28 @@ DocumentUpdate::affectsDocumentBody() const
return false;
}
-// Print the content of this document update.
+const DocumentType&
+DocumentUpdate::getType() const {
+ return static_cast<const DocumentType &> (*_type);
+}
+
+DocumentUpdate&
+DocumentUpdate::addUpdate(const FieldUpdate& update) {
+ _updates.push_back(update);
+ return *this;
+}
+
+DocumentUpdate&
+DocumentUpdate::addFieldPathUpdate(const FieldPathUpdate::CP& update) {
+ _fieldPathUpdates.push_back(update);
+ return *this;
+}
+
+DocumentUpdate*
+DocumentUpdate::clone() const {
+ return new DocumentUpdate(*this);
+}
+
void
DocumentUpdate::print(std::ostream& out, bool verbose,
const std::string& indent) const
@@ -230,8 +253,7 @@ DocumentUpdate::deserialize42(const DocumentTypeRepo& repo, ByteBuffer& buffer)
try{
buffer.getShortNetwork(_version);
- std::pair<const DocumentType *, DocumentId> typeAndId(
- deserializeTypeAndId(repo, buffer));
+ std::pair<const DocumentType *, DocumentId> typeAndId(deserializeTypeAndId(repo, buffer));
_type = typeAndId.first;
_documentId = typeAndId.second;
// Read field updates, if any.
diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h
index 5d09bd36816..ce00d00088b 100644
--- a/document/src/vespa/document/update/documentupdate.h
+++ b/document/src/vespa/document/update/documentupdate.h
@@ -29,7 +29,6 @@
#include "fieldpathupdate.h"
#include <vespa/document/base/documentid.h>
#include <vespa/document/base/field.h>
-#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/document/util/bytebuffer.h>
@@ -118,19 +117,13 @@ public:
* Add a field update to this document update.
* @return A reference to this.
*/
- DocumentUpdate& addUpdate(const FieldUpdate& update) {
- _updates.push_back(update);
- return *this;
- }
+ DocumentUpdate& addUpdate(const FieldUpdate& update);
/**
* Add a fieldpath update to this document update.
* @return A reference to this.
*/
- DocumentUpdate& addFieldPathUpdate(const FieldPathUpdate::CP& update) {
- _fieldPathUpdates.push_back(update);
- return *this;
- }
+ DocumentUpdate& addFieldPathUpdate(const FieldPathUpdate::CP& update);
/** @return The list of updates. */
const FieldUpdateV & getUpdates() const { return _updates; }
@@ -141,7 +134,7 @@ public:
bool affectsDocumentBody() const;
/** @return The type of document this update is for. */
- const DocumentType& getType() const { return static_cast<const DocumentType &> (*_type); }
+ const DocumentType& getType() const;
// Printable implementation
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
@@ -159,9 +152,7 @@ public:
void printXml(XmlOutputStream&) const override;
// Cloneable implementation
- virtual DocumentUpdate* clone() const {
- return new DocumentUpdate(*this);
- }
+ virtual DocumentUpdate* clone() const;
/**
* Sets whether this update should create the document it updates if that document does not exist.
@@ -199,7 +190,6 @@ private:
DocumentUpdate();
int deserializeFlags(int sizeAndFlags);
-
};
} // document