| Index: third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/ver4_dict_buffers.h
|
| diff --git a/third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/ver4_dict_buffers.h b/third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/ver4_dict_buffers.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f9c83ba0e5f52e832efa58476de839c7315c6821
|
| --- /dev/null
|
| +++ b/third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/ver4_dict_buffers.h
|
| @@ -0,0 +1,152 @@
|
| +/*
|
| + * Copyright (C) 2013, The Android Open Source Project
|
| + *
|
| + * Licensed under the Apache License, Version 2.0 (the "License");
|
| + * you may not use this file except in compliance with the License.
|
| + * You may obtain a copy of the License at
|
| + *
|
| + * http://www.apache.org/licenses/LICENSE-2.0
|
| + *
|
| + * Unless required by applicable law or agreed to in writing, software
|
| + * distributed under the License is distributed on an "AS IS" BASIS,
|
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| + * See the License for the specific language governing permissions and
|
| + * limitations under the License.
|
| + */
|
| +
|
| +/*
|
| + * !!!!! DO NOT EDIT THIS FILE !!!!!
|
| + *
|
| + * This file was generated from
|
| + * suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h
|
| + */
|
| +
|
| +#ifndef LATINIME_BACKWARD_V402_VER4_DICT_BUFFER_H
|
| +#define LATINIME_BACKWARD_V402_VER4_DICT_BUFFER_H
|
| +
|
| +#include <memory>
|
| +
|
| +#include "third_party/android_prediction/defines.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/header/header_policy.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/content/bigram_dict_content.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/content/probability_dict_content.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/content/shortcut_dict_content.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/content/terminal_position_lookup_table.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/structure/backward/v402/ver4_dict_constants.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h"
|
| +#include "third_party/android_prediction/suggest/policyimpl/dictionary/utils/mmapped_buffer.h"
|
| +
|
| +namespace latinime {
|
| +namespace backward {
|
| +namespace v402 {
|
| +
|
| +class Ver4DictBuffers {
|
| + public:
|
| + typedef std::unique_ptr<Ver4DictBuffers> Ver4DictBuffersPtr;
|
| +
|
| + static Ver4DictBuffersPtr openVer4DictBuffers(const char *const dictDirPath,
|
| + MmappedBuffer::MmappedBufferPtr headerBuffer,
|
| + const FormatUtils::FORMAT_VERSION formatVersion);
|
| +
|
| + static AK_FORCE_INLINE Ver4DictBuffersPtr createVer4DictBuffers(
|
| + const HeaderPolicy *const headerPolicy, const int maxTrieSize) {
|
| + return Ver4DictBuffersPtr(new Ver4DictBuffers(headerPolicy, maxTrieSize));
|
| + }
|
| +
|
| + AK_FORCE_INLINE bool isValid() const {
|
| + return mHeaderBuffer && mDictBuffer && mHeaderPolicy.isValid()
|
| + && mProbabilityDictContent.isValid() && mTerminalPositionLookupTable.isValid()
|
| + && mBigramDictContent.isValid() && mShortcutDictContent.isValid();
|
| + }
|
| +
|
| + AK_FORCE_INLINE bool isNearSizeLimit() const {
|
| + return mExpandableTrieBuffer.isNearSizeLimit()
|
| + || mTerminalPositionLookupTable.isNearSizeLimit()
|
| + || mProbabilityDictContent.isNearSizeLimit()
|
| + || mBigramDictContent.isNearSizeLimit()
|
| + || mShortcutDictContent.isNearSizeLimit();
|
| + }
|
| +
|
| + AK_FORCE_INLINE const HeaderPolicy *getHeaderPolicy() const {
|
| + return &mHeaderPolicy;
|
| + }
|
| +
|
| + AK_FORCE_INLINE BufferWithExtendableBuffer *getWritableHeaderBuffer() {
|
| + return &mExpandableHeaderBuffer;
|
| + }
|
| +
|
| + AK_FORCE_INLINE BufferWithExtendableBuffer *getWritableTrieBuffer() {
|
| + return &mExpandableTrieBuffer;
|
| + }
|
| +
|
| + AK_FORCE_INLINE const BufferWithExtendableBuffer *getTrieBuffer() const {
|
| + return &mExpandableTrieBuffer;
|
| + }
|
| +
|
| + AK_FORCE_INLINE TerminalPositionLookupTable *getMutableTerminalPositionLookupTable() {
|
| + return &mTerminalPositionLookupTable;
|
| + }
|
| +
|
| + AK_FORCE_INLINE const TerminalPositionLookupTable *getTerminalPositionLookupTable() const {
|
| + return &mTerminalPositionLookupTable;
|
| + }
|
| +
|
| + AK_FORCE_INLINE ProbabilityDictContent *getMutableProbabilityDictContent() {
|
| + return &mProbabilityDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE const ProbabilityDictContent *getProbabilityDictContent() const {
|
| + return &mProbabilityDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE BigramDictContent *getMutableBigramDictContent() {
|
| + return &mBigramDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE const BigramDictContent *getBigramDictContent() const {
|
| + return &mBigramDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE ShortcutDictContent *getMutableShortcutDictContent() {
|
| + return &mShortcutDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE const ShortcutDictContent *getShortcutDictContent() const {
|
| + return &mShortcutDictContent;
|
| + }
|
| +
|
| + AK_FORCE_INLINE bool isUpdatable() const {
|
| + return mIsUpdatable;
|
| + }
|
| +
|
| + bool flush(const char *const dictDirPath) const {
|
| + return flushHeaderAndDictBuffers(dictDirPath, &mExpandableHeaderBuffer);
|
| + }
|
| +
|
| + bool flushHeaderAndDictBuffers(const char *const dictDirPath,
|
| + const BufferWithExtendableBuffer *const headerBuffer) const;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(Ver4DictBuffers);
|
| +
|
| + Ver4DictBuffers(const char *const dictDirPath,
|
| + const MmappedBuffer::MmappedBufferPtr headerBuffer, const bool isUpdatable,
|
| + const FormatUtils::FORMAT_VERSION formatVersion);
|
| +
|
| + Ver4DictBuffers(const HeaderPolicy *const headerPolicy, const int maxTrieSize);
|
| +
|
| + const MmappedBuffer::MmappedBufferPtr mHeaderBuffer;
|
| + const MmappedBuffer::MmappedBufferPtr mDictBuffer;
|
| + const HeaderPolicy mHeaderPolicy;
|
| + BufferWithExtendableBuffer mExpandableHeaderBuffer;
|
| + BufferWithExtendableBuffer mExpandableTrieBuffer;
|
| + TerminalPositionLookupTable mTerminalPositionLookupTable;
|
| + ProbabilityDictContent mProbabilityDictContent;
|
| + BigramDictContent mBigramDictContent;
|
| + ShortcutDictContent mShortcutDictContent;
|
| + const int mIsUpdatable;
|
| +};
|
| +} // namespace v402
|
| +} // namespace backward
|
| +} // namespace latinime
|
| +#endif /* LATINIME_BACKWARD_V402_VER4_DICT_BUFFER_H */
|
|
|