-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Get old data_graph source/tests to (mostly) compile. * Remove state code/tests. * WIP * Fix lambda captures in data_graph tests. * Clean up data graph unit tests. * Fix a Visual C++ warning. * Add tests for custom contexts. * Add unit tests for alia_if and alia_switch on non-signal values. * Update Catch and fix a memory leak. * Fix Linux build. * Add test for scoped_cache_clearing_disabler. * Add tests for pass-depdendent ifs and nested cached data. * Test keyed data value ID. * Add tests for low-level get_keyed_data. * Add a test for mobile named blocks. * Fix a bug where named block references aren't deactivated when destructed. * Add tests for named block caching.
- Loading branch information
Showing
8 changed files
with
1,289 additions
and
768 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#ifndef ALIA_CONTEXT_HPP | ||
#define ALIA_CONTEXT_HPP | ||
|
||
#include <alia/component_collection.hpp> | ||
|
||
namespace alia { | ||
|
||
struct data_traversal_tag | ||
{ | ||
}; | ||
|
||
struct data_traversal; | ||
|
||
// The structure we use to store components. It provides direct storage of the | ||
// commonly-used components in the core of alia. | ||
struct component_storage | ||
{ | ||
data_traversal* data; | ||
}; | ||
|
||
// All component access is done through the following 'manipulator' structure. | ||
// Specializations can be defined for tags that have direct storage. | ||
|
||
template<class Tag> | ||
struct component_manipulator | ||
{ | ||
}; | ||
|
||
template<> | ||
struct component_manipulator<data_traversal_tag> | ||
{ | ||
static void | ||
add(component_storage& storage, data_traversal* data) | ||
{ | ||
storage.data = data; | ||
} | ||
static void | ||
remove(component_storage& storage) | ||
{ | ||
storage.data = 0; | ||
} | ||
static data_traversal* | ||
get(component_storage& storage) | ||
{ | ||
return storage.data; | ||
} | ||
}; | ||
|
||
// The following is the implementation of the interface expected of component | ||
// storage objects. It simply forwards the requests along to the appropriate | ||
// manipulator. | ||
|
||
template<class Tag, class Data> | ||
void | ||
add_component(component_storage& storage, Data&& data) | ||
{ | ||
component_manipulator<Tag>::add(storage, std::forward<Data&&>(data)); | ||
} | ||
|
||
template<class Tag> | ||
void | ||
remove_component(component_storage& storage) | ||
{ | ||
component_manipulator<Tag>::remove(storage); | ||
} | ||
|
||
template<class Tag> | ||
auto | ||
get_component(component_storage& storage) | ||
{ | ||
return component_manipulator<Tag>::get(storage); | ||
} | ||
|
||
// Finally, the typedef for the context... | ||
|
||
typedef add_component_type_t< | ||
empty_component_collection<component_storage>, | ||
data_traversal_tag, | ||
data_traversal*> | ||
context; | ||
|
||
} // namespace alia | ||
|
||
#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
Oops, something went wrong.