From fb3a0fa827098b9c2f8885e1e55e761deccdac1d Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 21 Apr 2015 11:13:50 +0800 Subject: add copy parameter to single gram constructor --- src/storage/ngram.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/storage/ngram.cpp') diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp index 4f4e787..1c99948 100644 --- a/src/storage/ngram.cpp +++ b/src/storage/ngram.cpp @@ -39,8 +39,11 @@ SingleGram::SingleGram(){ memset(m_chunk.begin(), 0, sizeof(guint32)); } -SingleGram::SingleGram(void * buffer, size_t length){ - m_chunk.set_chunk(buffer, length, NULL); +SingleGram::SingleGram(void * buffer, size_t length, bool copy){ + if (copy) + m_chunk.set_content(0, buffer, length); + else + m_chunk.set_chunk(buffer, length, NULL); } bool SingleGram::get_total_freq(guint32 & total) const{ -- cgit