aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--v0_1_5/lib/marisa_alpha/key.h~68
-rw-r--r--v0_1_5/lib/marisa_alpha/reader.h~60
-rw-r--r--v0_1_5/lib/marisa_alpha/tail.h~73
3 files changed, 0 insertions, 201 deletions
diff --git a/v0_1_5/lib/marisa_alpha/key.h~ b/v0_1_5/lib/marisa_alpha/key.h~
deleted file mode 100644
index 51d1601..0000000
--- a/v0_1_5/lib/marisa_alpha/key.h~
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef MARISA_ALPHA_KEY_H_
-#define MARISA_ALPHA_KEY_H_
-
-#include "string.h"
-
-namespace marisa_alpha {
-
-template <typename T>
-class Key {
- public:
- Key() : str_(), weight_(0.0), id_(0), terminal_(0) {}
-
- void set_str(const T &str) {
- str_ = str;
- }
- void set_weight(double weight) {
- weight_ = weight;
- }
- void set_id(UInt32 id) {
- id_ = id;
- }
- void set_terminal(UInt32 terminal) {
- terminal_ = terminal;
- }
-
- const T &str() const {
- return str_;
- }
- double weight() const {
- return weight_;
- }
- UInt32 id() const {
- return id_;
- }
- UInt32 terminal() const {
- return terminal_;
- }
-
- private:
- T str_;
- double weight_;
- UInt32 id_;
- UInt32 terminal_;
-};
-
-template <typename T>
-inline bool operator<(const Key<T> &lhs, const T &rhs) {
- return lhs.str() < rhs;
-}
-
-template <typename T>
-inline bool operator<(const T &lhs, const Key<T> &rhs) {
- return lhs < rhs.str();
-}
-
-template <typename T>
-inline bool operator<(const Key<T> &lhs, const Key<T> &rhs) {
- return lhs.str() < rhs.str();
-}
-
-template <typename T>
-inline bool operator==(const Key<T> &lhs, const Key<T> &rhs) {
- return lhs.str() == rhs.str();
-}
-
-} // namespace marisa_alpha
-
-#endif // MARISA_ALPHA_KEY_H_
diff --git a/v0_1_5/lib/marisa_alpha/reader.h~ b/v0_1_5/lib/marisa_alpha/reader.h~
deleted file mode 100644
index ee7de76..0000000
--- a/v0_1_5/lib/marisa_alpha/reader.h~
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef MARISA_ALPHA_READER_H_
-#define MARISA_ALPHA_READER_H_
-
-#include <cstdio>
-#include <iostream>
-
-#include "base.h"
-
-namespace marisa_alpha {
-
-class Reader {
- public:
- Reader();
- explicit Reader(std::FILE *file);
- explicit Reader(int fd);
- explicit Reader(std::istream *stream);
- ~Reader();
-
- void open(const char *filename, long offset = 0, int whence = SEEK_SET);
-
- template <typename T>
- void read(T *obj) {
- MARISA_ALPHA_THROW_IF(obj == NULL, MARISA_ALPHA_PARAM_ERROR);
- read_data(obj, sizeof(T));
- }
-
- template <typename T>
- void read(T *objs, std::size_t num_objs) {
- MARISA_ALPHA_THROW_IF((objs == NULL) && (num_objs != 0),
- MARISA_ALPHA_PARAM_ERROR);
- MARISA_ALPHA_THROW_IF(num_objs > (MARISA_ALPHA_UINT32_MAX / sizeof(T)),
- MARISA_ALPHA_SIZE_ERROR);
- if (num_objs != 0) {
- read_data(objs, sizeof(T) * num_objs);
- }
- }
-
- bool is_open() const {
- return (file_ != NULL) || (fd_ != -1) || (stream_ != NULL);
- }
-
- void clear();
- void swap(Reader *rhs);
-
- private:
- std::FILE *file_;
- int fd_;
- std::istream *stream_;
- bool needs_fclose_;
-
- void read_data(void *buf, std::size_t size);
-
- // Disallows copy and assignment.
- Reader(const Reader &);
- Reader &operator=(const Reader &);
-};
-
-} // namespace marisa_alpha
-
-#endif // MARISA_ALPHA_READER_H_
diff --git a/v0_1_5/lib/marisa_alpha/tail.h~ b/v0_1_5/lib/marisa_alpha/tail.h~
deleted file mode 100644
index c7b3235..0000000
--- a/v0_1_5/lib/marisa_alpha/tail.h~
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef MARISA_ALPHA_TAIL_H_
-#define MARISA_ALPHA_TAIL_H_
-
-#include "string.h"
-#include "vector.h"
-
-namespace marisa_alpha {
-
-class Tail {
- public:
- Tail();
-
- void build(const Vector<String> &keys,
- Vector<UInt32> *offsets, int mode);
-
- void mmap(Mapper *mapper, const char *filename,
- long offset = 0, int whence = SEEK_SET);
- void map(const void *ptr, std::size_t size);
- void map(Mapper &mapper);
-
- void load(const char *filename,
- long offset = 0, int whence = SEEK_SET);
- void fread(::FILE *file);
- void read(int fd);
- void read(std::istream &stream);
- void read(Reader &reader);
-
- void save(const char *filename, bool trunc_flag = true,
- long offset = 0, int whence = SEEK_SET) const;
- void fwrite(::FILE *file) const;
- void write(int fd) const;
- void write(std::ostream &stream) const;
- void write(Writer &writer) const;
-
- const UInt8 *operator[](std::size_t offset) const {
- MARISA_ALPHA_DEBUG_IF(offset >= buf_.size(), MARISA_ALPHA_PARAM_ERROR);
- return &buf_[offset];
- }
-
- int mode() const {
- return (buf_.front() == '\0') ?
- MARISA_ALPHA_BINARY_TAIL : MARISA_ALPHA_TEXT_TAIL;
- }
- bool empty() const {
- return buf_.empty();
- }
- std::size_t size() const {
- return buf_.size();
- }
- std::size_t total_size() const {
- return buf_.total_size();
- }
-
- void clear();
- void swap(Tail *rhs);
-
- private:
- Vector<UInt8> buf_;
-
- void build_binary_tail(const Vector<String> &keys,
- Vector<UInt32> *offsets);
- bool build_text_tail(const Vector<String> &keys,
- Vector<UInt32> *offsets);
- void build_empty_tail(Vector<UInt32> *offsets);
-
- // Disallows copy and assignment.
- Tail(const Tail &);
- Tail &operator=(const Tail &);
-};
-
-} // namespace marisa_alpha
-
-#endif // MARISA_ALPHA_TAIL_H_