Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the implementation of grnxx::map::ArrayMap.
- Loading branch information
Showing
11 changed files
with
180 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| noinst_LTLIBRARIES = libgrnxx_map_array_map.la | ||
|
|
||
| libgrnxx_map_array_map_la_LDFLAGS = @AM_LTLDFLAGS@ | ||
|
|
||
| libgrnxx_map_array_map_la_SOURCES = \ | ||
| dummy.cpp | ||
|
|
||
| libgrnxx_map_array_map_includedir = ${includedir}/grnxx/map/array_map | ||
| libgrnxx_map_array_map_include_HEADERS = \ | ||
| bit_array.hpp \ | ||
| key_array.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| Copyright (C) 2013 Brazil, Inc. | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
| #ifndef GRNXX_MAP_ARRAY_MAP_BIT_ARRAY_HPP | ||
| #define GRNXX_MAP_ARRAY_MAP_BIT_ARRAY_HPP | ||
|
|
||
| #include "grnxx/features.hpp" | ||
|
|
||
| #include "grnxx/array.hpp" | ||
| #include "grnxx/types.hpp" | ||
|
|
||
| namespace grnxx { | ||
| namespace map { | ||
| namespace array_map { | ||
|
|
||
| // Change the array size based on the size of "T". | ||
| template <typename T, size_t T_SIZE = sizeof(T)> | ||
| struct BitArray; | ||
|
|
||
| // Map<T> has at most 2^40 different keys. | ||
| template <typename T, size_t T_SIZE> | ||
| struct BitArray { | ||
| using Type = Array<bool, 65536, 4096, 4096>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^8 different keys. | ||
| template <typename T> | ||
| struct BitArray<T, 1> { | ||
| using Type = Array<bool, 256, 1, 1>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^16 different keys. | ||
| template <typename T> | ||
| struct BitArray<T, 2> { | ||
| using Type = Array<bool, 256, 256, 1>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^32 different keys. | ||
| template <typename T> | ||
| struct BitArray<T, 4> { | ||
| using Type = Array<bool, 16384, 512, 512>; | ||
| }; | ||
|
|
||
| } // namespace array_map | ||
| } // namespace map | ||
| } // namespace grnxx | ||
|
|
||
| #endif // GRNXX_MAP_ARRAY_MAP_BIT_ARRAY_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| Copyright (C) 2013 Brazil, Inc. | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
| #include "grnxx/map/array_map/bit_array.hpp" | ||
| #include "grnxx/map/array_map/key_array.hpp" | ||
|
|
||
| namespace grnxx { | ||
| namespace map { | ||
| namespace array_map { | ||
|
|
||
| } // namespace array_map | ||
| } // namespace map | ||
| } // namespace grnxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| Copyright (C) 2013 Brazil, Inc. | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
| #ifndef GRNXX_MAP_ARRAY_MAP_KEY_ARRAY_HPP | ||
| #define GRNXX_MAP_ARRAY_MAP_KEY_ARRAY_HPP | ||
|
|
||
| #include "grnxx/features.hpp" | ||
|
|
||
| #include "grnxx/array.hpp" | ||
| #include "grnxx/bytes.hpp" | ||
| #include "grnxx/map/bytes_array.hpp" | ||
| #include "grnxx/types.hpp" | ||
|
|
||
| namespace grnxx { | ||
| namespace map { | ||
| namespace array_map { | ||
|
|
||
| // Change the array size based on "T". | ||
| template <typename T, size_t T_SIZE = sizeof(T)> | ||
| struct KeyArray; | ||
|
|
||
| // Map<T> has at most 2^40 different keys. | ||
| template <typename T, size_t T_SIZE> | ||
| struct KeyArray { | ||
| using Type = Array<T, 65536, 4096, 4096>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^8 different keys. | ||
| template <typename T> | ||
| struct KeyArray<T, 1> { | ||
| using Type = Array<T, 256, 1, 1>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^16 different keys. | ||
| template <typename T> | ||
| struct KeyArray<T, 2> { | ||
| using Type = Array<T, 256, 256, 1>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^32 different keys. | ||
| template <typename T> | ||
| struct KeyArray<T, 4> { | ||
| using Type = Array<T, 65536, 256, 256>; | ||
| }; | ||
|
|
||
| // Map<T> has at most 2^40 different keys. | ||
| template <> | ||
| struct KeyArray<Bytes> { | ||
| using Type = BytesArray; | ||
| }; | ||
|
|
||
| } // namespace array_map | ||
| } // namespace map | ||
| } // namespace grnxx | ||
|
|
||
| #endif // GRNXX_MAP_ARRAY_MAP_KEY_ARRAY_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters