Project: finder, src: NGram.cc


N-Gram をキーとして unordered_map を構成するためのクラス
#include "NGram.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

/**
 * NGram オブジェクトを file descriptor に書き込む
 */
void NGram::writeObject(int fd) const {
  write(fd, &key, sizeof(key));
}

/**
 * NGram オブジェクトを file descriptor から読み込む
 */
void NGram::readObject(int fd) {
  read(fd, &key, sizeof(key));
}