forked from hyrise/hyrise-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hyrise#266 from bastih/master
A small batch of improvements
- Loading branch information
Showing
12 changed files
with
108 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "storage/DictionaryFactory.h" | ||
#include "storage/OrderPreservingDictionary.h" | ||
#include "storage/OrderIndifferentDictionary.h" | ||
|
||
namespace hyrise { namespace storage { | ||
|
||
TEST(factory, creation) { | ||
auto d = makeDictionary<OrderIndifferentDictionary>(IntegerType, 10); | ||
} | ||
|
||
}} |
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
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,36 @@ | ||
#ifndef STORAGE_DICTIONARYFACTORY_H_ | ||
#define STORAGE_DICTIONARYFACTORY_H_ | ||
|
||
#include <memory> | ||
|
||
#include "storage/AbstractDictionary.h" | ||
#include "storage/meta_storage.h" | ||
|
||
namespace hyrise { namespace storage { namespace detail { | ||
|
||
template <template <typename T> class D> | ||
struct DictionaryCreator { | ||
using value_type = std::shared_ptr<AbstractDictionary>; | ||
std::size_t size; | ||
|
||
template <typename R> | ||
std::shared_ptr<AbstractDictionary> operator()() { | ||
return std::make_shared<D<R>>(size); | ||
} | ||
}; | ||
|
||
} // ns detail | ||
|
||
// Create dictionary for type and size, | ||
// Usage: makeDictionary<OrderIndifferentDictionary>(IntegerType, 10), | ||
// which returns shared_ptr<OrderIndifferentDictionary<hyrise_int_t>> (init-ed | ||
// for 10 elements) | ||
template <template <typename T> class D> | ||
std::shared_ptr<AbstractDictionary> makeDictionary(DataType type, size_t size=0) { | ||
detail::DictionaryCreator<D> dc {size}; | ||
return type_switch<hyrise_basic_types>()(type, dc); | ||
} | ||
|
||
}} | ||
|
||
#endif |
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