Skip to content

Commit

Permalink
Remove/address TODOs.
Browse files Browse the repository at this point in the history
  • Loading branch information
poletti-marco committed Nov 1, 2014
1 parent 5a2a5c1 commit 4b8744f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
10 changes: 5 additions & 5 deletions include/fruit/impl/data_structures/semistatic_graph.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include <unordered_set>

#ifndef NDEBUG
#include <iostream>
#endif

namespace fruit {
namespace impl {

Expand Down Expand Up @@ -123,17 +127,13 @@ SemistaticGraph<NodeId, Node>::SemistaticGraph(NodeIter first, NodeIter last) {
}
}

// TODO: This requires NodeId==const TypeInfo*, it breaks the abstraction. Needs refactoring.
#ifndef NDEBUG

#include <iostream>

template <typename NodeId, typename Node>
void SemistaticGraph<NodeId, Node>::checkFullyConstructed() {
for (std::size_t i = 0; i < nodes.size(); ++i) {
NodeData& data = nodes[i];
if (data.edgesBeginOffset == invalidEdgesBeginOffset) {
std::cerr << "Fruit bug: the node for the following type was not fully constructed in the dependency graph: " << data.key->name() << std::endl;
std::cerr << "Fruit bug: the dependency graph was not fully constructed." << std::endl;
abort();
}
}
Expand Down
1 change: 0 additions & 1 deletion include/fruit/impl/metaprogramming/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ListOfSetsUnion<L> : returns the union of all sets in the list L.
Other operations provided by list.h that can be used for sets:
// TODO: Provide aliases in this file, List is an implementation detail of Set.
List<Ts...> : constructs a set with the specified elements. The elements must be distinct (except None, that can
appear any number of times).
IsInList<S, T> : true if T appears at least once in S.
Expand Down
1 change: 0 additions & 1 deletion include/fruit/impl/storage/component_storage.defn.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ struct RegisterConstructorHelper<IntList<indexes...>, C, Args...> {
FruitStaticAssert(!std::is_pointer<C>::value, "C should not be a pointer");
auto create = [](InjectorStorage& m, NormalizedComponentStorage::Graph::edge_iterator deps) {
// To avoid an `unused variable' warning if there are no Args.
// TODO: Check if really needed.
(void) deps;
C* cPtr = m.constructSingleton<C, Args...>(m.get<Args>(deps, indexes - NumProvidersBefore<indexes, List<Args...>>::value)...);
return std::make_pair(reinterpret_cast<BindingData::object_t>(cPtr),
Expand Down
2 changes: 0 additions & 2 deletions include/fruit/impl/storage/injector_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class InjectorStorage {
// These must be called in reverse order.
std::vector<BindingData::destroy_t> onDestruction;

public:
// TODO: Make this private again.
NormalizedComponentStorage storage;

private:
Expand Down
4 changes: 1 addition & 3 deletions include/fruit/impl/storage/normalized_component_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ class NormalizedComponentStorage {
std::vector<std::pair<TypeId, MultibindingData>>>;
using Graph = SemistaticGraph<TypeId, NormalizedBindingData>;

public:
// TODO: Make this private again.
private:
// A graph with types as nodes (each node stores the BindingData for the type) and dependencies as edges.
// For types that have a constructed object already, the corresponding node is stored as terminal node.
SemistaticGraph<TypeId, NormalizedBindingData> typeRegistry;

private:
// Maps the type index of a type T to a set of the corresponding BindingData objects (for multibindings).
std::unordered_map<TypeId, NormalizedMultibindingData> typeRegistryForMultibindings;

Expand Down

0 comments on commit 4b8744f

Please sign in to comment.