[Groonga-commit] groonga/grnxx [master] Add grnxx::alpha::Map::next_key_id/num_keys/get_next().

Back to archive index

susumu.yata null+****@clear*****
Tue Apr 16 17:58:35 JST 2013


susumu.yata	2013-04-16 17:58:35 +0900 (Tue, 16 Apr 2013)

  New Revision: d9894b3173356249c9b192283fa2533e03296ddd
  https://github.com/groonga/grnxx/commit/d9894b3173356249c9b192283fa2533e03296ddd

  Message:
    Add grnxx::alpha::Map::next_key_id/num_keys/get_next().

  Modified files:
    lib/grnxx/alpha/map.cpp
    lib/grnxx/alpha/map.hpp

  Modified: lib/grnxx/alpha/map.cpp (+17 -0)
===================================================================
--- lib/grnxx/alpha/map.cpp    2013-04-16 16:40:58 +0900 (a1ea4e7)
+++ lib/grnxx/alpha/map.cpp    2013-04-16 17:58:35 +0900 (8c5cc7f)
@@ -164,12 +164,29 @@ int64_t Map<T>::max_key_id() const {
 }
 
 template <typename T>
+int64_t Map<T>::next_key_id() const {
+  // Not supported.
+  return -1;
+}
+
+template <typename T>
+uint64_t Map<T>::num_keys() const {
+  // Not supported.
+  return 0;
+}
+
+template <typename T>
 bool Map<T>::get(int64_t, T *) {
   // Not supported.
   return false;
 }
 
 template <typename T>
+bool Map<T>::get_next(int64_t, int64_t *, T *) {
+  return false;
+}
+
+template <typename T>
 bool Map<T>::unset(int64_t) {
   // Not supported.
   return false;

  Modified: lib/grnxx/alpha/map.hpp (+10 -0)
===================================================================
--- lib/grnxx/alpha/map.hpp    2013-04-16 16:40:58 +0900 (dd26661)
+++ lib/grnxx/alpha/map.hpp    2013-04-16 17:58:35 +0900 (fa26524)
@@ -129,10 +129,20 @@ class Map {
   // Return the maximum key ID ever used.
   // If the map is empty, the return value can be -1.
   virtual int64_t max_key_id() const;
+  // Return the ID of the expected next inserted ID.
+  virtual int64_t next_key_id() const;
+  // Return the number of keys.
+  virtual uint64_t num_keys() const;
 
   // Get a key associated with "key_id" and return true on success.
   // Assign the found key to "*key" iff "key" != nullptr.
   virtual bool get(int64_t key_id, T *key = nullptr);
+  // Find the next key and return true on success. The next key means the key
+  // associated with the smallest valid ID that is greater than "key_id".
+  // Assign the ID to "*next_key_id" iff "next_key_id" != nullptr.
+  // Assign the key to "*next_key" iff "next_key" != nullptr.
+  virtual bool get_next(int64_t key_id, int64_t *next_key_id = nullptr,
+                        T *next_key = nullptr);
   // Remove a key associated with "key_id" and return true on success.
   virtual bool unset(int64_t key_id);
   // Replace a key associated with "key_id" with "dest_key" and return true
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index