diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-21 13:58:31 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-22 00:27:05 +0000 |
commit | 84b04793f98cd6af2a7ca48e344bb48bbcf79727 (patch) | |
tree | ef0d4f3ee2d43eefe03e07f666ca5693a2123716 | |
parent | efd711cc8836a4748fc7a8184d51c0371cd98774 (diff) |
Avoid creating many instances of rather large methods.
8 files changed, 27 insertions, 10 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index 3215a25e55f..673d78fbc89 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -164,6 +164,8 @@ Schema::Field::Field(const std::vector<vespalib::string> & lines) { } +Schema::Field::~Field() { } + void Schema::Field::write(vespalib::asciistream & os, const vespalib::stringref & prefix) const { @@ -268,6 +270,7 @@ Schema::FieldSet::FieldSet(const std::vector<vespalib::string> & lines) : } } +Schema::FieldSet::~FieldSet() { } bool Schema::FieldSet::operator==(const FieldSet &rhs) const @@ -304,6 +307,8 @@ Schema::Schema() { } +Schema::~Schema() { } + bool Schema::loadFromFile(const vespalib::stringref & fileName) { diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index 5f5b7dd3656..dcc559f6293 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -72,7 +72,7 @@ public: **/ Field(const std::vector<vespalib::string> & lines); - virtual ~Field() {} + virtual ~Field(); void setTimestamp(fastos::TimeStamp ts) { _timestamp = ts; } @@ -85,8 +85,7 @@ public: CollectionType getCollectionType() const { return _collectionType; } fastos::TimeStamp getTimestamp() const { return _timestamp; } - bool matchingTypes(const Field &rhs) const - { + bool matchingTypes(const Field &rhs) const { return getDataType() == rhs.getDataType() && getCollectionType() == rhs.getCollectionType(); } @@ -155,6 +154,8 @@ public: **/ FieldSet(const std::vector<vespalib::string> & lines); + ~FieldSet(); + FieldSet &addField(const vespalib::stringref &fieldName) { _fields.push_back(fieldName); return *this; @@ -188,6 +189,7 @@ public: * Create an initially empty schema **/ Schema(); + ~Schema(); /** * Load this schema from the file with the given name. diff --git a/staging_vespalib/src/vespa/vespalib/data/fileheader.cpp b/staging_vespalib/src/vespa/vespalib/data/fileheader.cpp index 2cbde3da04c..de3ca9eb1c1 100644 --- a/staging_vespalib/src/vespa/vespalib/data/fileheader.cpp +++ b/staging_vespalib/src/vespa/vespalib/data/fileheader.cpp @@ -257,6 +257,8 @@ GenericHeader::GenericHeader() : // empty } +GenericHeader::~GenericHeader() { } + const GenericHeader::Tag & GenericHeader::getTag(size_t idx) const { diff --git a/staging_vespalib/src/vespa/vespalib/data/fileheader.h b/staging_vespalib/src/vespa/vespalib/data/fileheader.h index 89b63949a35..b43af5c5a90 100644 --- a/staging_vespalib/src/vespa/vespalib/data/fileheader.h +++ b/staging_vespalib/src/vespa/vespalib/data/fileheader.h @@ -39,10 +39,10 @@ public: }; private: - Type _type; + Type _type; vespalib::string _name; - double _fVal; - int64_t _iVal; + double _fVal; + int64_t _iVal; vespalib::string _sVal; public: @@ -128,8 +128,7 @@ public: public: MMapReader(const char *buf, size_t sz); - size_t - getData(char *buf, size_t len); + size_t getData(char *buf, size_t len); }; private: @@ -147,7 +146,7 @@ public: /** * Virtual destructor required for inheritance. */ - virtual ~GenericHeader() { /* empty */ } + virtual ~GenericHeader(); /** * Returns the number of tags contained in this header. diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp index 72fcfb66578..c084106a3ab 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp @@ -332,5 +332,10 @@ void StorageMessage::setNewMsgId() _lastMsgId &= ((Id(-1) << 8) >> 8); } +vespalib::string +StorageMessage::getSummary() const { + return toString(); +} + } // api } // storage diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index b07c75cca8b..4b16b78a796 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -447,7 +447,7 @@ public: /** * Cheap version of tostring(). */ - virtual vespalib::string getSummary() const { return toString(); }; + virtual vespalib::string getSummary() const; virtual document::BucketId getBucketId() const { return document::BucketId(); } virtual bool hasSingleBucketId() const { return false; } diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.cpp b/vespalib/src/vespa/vespalib/trace/tracenode.cpp index 2a98a14882a..39c138bb875 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.cpp +++ b/vespalib/src/vespa/vespalib/trace/tracenode.cpp @@ -63,6 +63,8 @@ TraceNode::TraceNode(const TraceNode &rhs) : addChildren(rhs._children); } +TraceNode::~TraceNode() { } + TraceNode::TraceNode(const string ¬e, int64_t timestamp) : _parent(NULL), _strict(true), diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.h b/vespalib/src/vespa/vespalib/trace/tracenode.h index d3b193b0c9f..4f78a718df7 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.h +++ b/vespalib/src/vespa/vespalib/trace/tracenode.h @@ -48,6 +48,8 @@ public: */ explicit TraceNode(int64_t timestamp); + ~TraceNode(); + /** * Create a trace tree which is a copy of another. * |