-
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.
Switch to pinned versions of all C++ libraries.
- Loading branch information
Showing
16 changed files
with
164 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: alabaster.base | ||
Title: Save Bioconductor Objects To File | ||
Version: 1.3.15 | ||
Date: 2024-01-02 | ||
Version: 1.3.16 | ||
Date: 2024-01-05 | ||
Authors@R: person("Aaron", "Lun", role=c("aut", "cre"), email="[email protected]") | ||
License: MIT + file LICENSE | ||
Description: | ||
|
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,85 @@ | ||
#ifndef TAKANE_DERIVED_FROM_HPP | ||
#define TAKANE_DERIVED_FROM_HPP | ||
|
||
#include <unordered_set> | ||
#include <unordered_map> | ||
#include <string> | ||
|
||
namespace takane { | ||
|
||
/** | ||
* @cond | ||
*/ | ||
namespace internal_derived_from { | ||
|
||
inline void fill(const std::unordered_map<std::string, std::unordered_set<std::string> >& registry, std::unordered_set<std::string>& host, const std::string& derived) { | ||
auto it = registry.find(derived); | ||
if (it != registry.end()) { | ||
for (auto d : it->second) { | ||
host.insert(d); | ||
fill(registry, host, d); | ||
} | ||
} | ||
} | ||
|
||
inline auto default_registry() { | ||
std::unordered_map<std::string, std::unordered_set<std::string> > registry; | ||
registry["summarized_experiment"] = { "ranged_summarized_experiment" }; | ||
registry["ranged_summarized_experiment"] = { "single_cell_experiment" }; | ||
registry["single_cell_experiment"] = { "spatial_experiment" }; | ||
|
||
// Recursively fill the registry to expand the children. | ||
for (auto& p : registry) { | ||
auto& host = p.second; | ||
std::vector<std::string> copy(host.begin(), host.end()); | ||
for (const auto& d : copy) { | ||
host.insert(d); | ||
fill(registry, host, d); | ||
} | ||
} | ||
|
||
return registry; | ||
} | ||
|
||
} | ||
/** | ||
* @endcond | ||
*/ | ||
|
||
/** | ||
* Registry of derived object types and their base types. | ||
* Each key is the base object type and each value is the set of all of its derived types. | ||
* Derived types satisfy the same file requirements of the base type, but usually add more files to represent additional functionality. | ||
* | ||
* Applications can extend the **takane** framework by adding custom derived types to each set. | ||
* Note that derived types must be manually included in every base type's set, | ||
* e.g., if B is derived from A and C is derived from B, C must be added to the sets for both A and B. | ||
*/ | ||
inline std::unordered_map<std::string, std::unordered_set<std::string> > derived_from_registry = internal_derived_from::default_registry(); | ||
|
||
/** | ||
* Check whether a particular object type is derived from a base objct type. | ||
* This can be used by specifications to check that child components satisfy certain expectations. | ||
* | ||
* @param type Object type. | ||
* @param base Base object type. | ||
* @returns Whether `type` is derived from `base` or is equal to `base`. | ||
*/ | ||
inline bool derived_from(const std::string& type, const std::string& base) { | ||
if (type == base) { | ||
return true; | ||
} | ||
|
||
auto it = derived_from_registry.find(base); | ||
if (it == derived_from_registry.end()) { | ||
return false; | ||
} | ||
|
||
const auto& listing = it->second; | ||
return (listing.find(type) != listing.end()); | ||
} | ||
|
||
} | ||
|
||
#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
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
Oops, something went wrong.