Skip to content

Commit 2afd256

Browse files
committed
Fix circular types
1 parent e08c599 commit 2afd256

4 files changed

Lines changed: 29 additions & 28 deletions

File tree

Sources/ComputeCxx/Graph/AGGraph.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -202,27 +202,6 @@ AGGraphRef AGGraphGetAttributeGraph(AGAttribute attribute) {
202202
AG::precondition_failure("no graph: %u", attribute);
203203
}
204204

205-
// AGSubgraphRef AGGraphGetAttributeSubgraph(AGAttribute attribute) {
206-
// auto subgraph = AGGraphGetAttributeSubgraph2(attribute);
207-
// if (subgraph == nullptr) {
208-
// AG::precondition_failure("no subgraph");
209-
// }
210-
//
211-
// return subgraph;
212-
// }
213-
//
214-
// AGSubgraphRef AGGraphGetAttributeSubgraph2(AGAttribute attribute) {
215-
// auto attribute_id = AG::AttributeID(attribute);
216-
// attribute_id.to_node_ptr().assert_valid();
217-
//
218-
// auto subgraph = attribute_id.subgraph();
219-
// if (subgraph == nullptr) {
220-
// AG::precondition_failure("internal error");
221-
// }
222-
//
223-
// return subgraph->to_cf();
224-
// }
225-
226205
AGAttributeInfo AGGraphGetAttributeInfo(AGAttribute attribute) {
227206
auto attribute_id = AG::AttributeID(attribute);
228207
if (!attribute_id.is_direct()) {

Sources/ComputeCxx/Graph/AGGraph.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,8 @@ CF_EXPORT
104104
CF_REFINED_FOR_SWIFT
105105
AGGraphRef AGGraphGetAttributeGraph(AGAttribute attribute);
106106

107-
// TODO: fix circular types
108107

109-
// CF_EXPORT
110-
// CF_REFINED_FOR_SWIFT
111-
// AGSubgraphRef AGGraphGetAttributeSubgraph(AGAttribute attribute);
112108

113-
// CF_EXPORT
114-
// CF_REFINED_FOR_SWIFT
115-
// AGSubgraphRef AGGraphGetAttributeSubgraph2(AGAttribute attribute);
116109

117110
// TODO: need this?
118111
// typedef struct AGAttributeType {

Sources/ComputeCxx/Subgraph/AGSubgraph.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ AGUnownedGraphContextRef AGSubgraphGetCurrentGraphContext() {
111111
return (AGUnownedGraphContextRef)current->graph();
112112
}
113113

114+
AGSubgraphRef AGGraphGetAttributeSubgraph(AGAttribute attribute) {
115+
auto subgraph = AGGraphGetAttributeSubgraph2(attribute);
116+
if (subgraph == nullptr) {
117+
AG::precondition_failure("no subgraph");
118+
}
119+
120+
return subgraph;
121+
}
122+
123+
AGSubgraphRef AGGraphGetAttributeSubgraph2(AGAttribute attribute) {
124+
auto attribute_id = AG::AttributeID(attribute);
125+
attribute_id.to_node_ptr().assert_valid();
126+
127+
auto subgraph = attribute_id.subgraph();
128+
if (subgraph == nullptr) {
129+
AG::precondition_failure("internal error");
130+
}
131+
132+
return subgraph->to_cf();
133+
}
134+
114135
#pragma mark - Children
115136

116137
void AGSubgraphAddChild(AGSubgraphRef subgraph, AGSubgraphRef child) { AGSubgraphAddChild2(subgraph, child, 0); }

Sources/ComputeCxx/Subgraph/AGSubgraph.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ CF_EXPORT
4343
CF_REFINED_FOR_SWIFT
4444
AGUnownedGraphContextRef AGSubgraphGetCurrentGraphContext(AGSubgraphRef subgraph);
4545

46+
CF_EXPORT
47+
CF_REFINED_FOR_SWIFT
48+
AGSubgraphRef AGGraphGetAttributeSubgraph(AGAttribute attribute);
49+
50+
CF_EXPORT
51+
CF_REFINED_FOR_SWIFT
52+
AGSubgraphRef AGGraphGetAttributeSubgraph2(AGAttribute attribute);
53+
4654
// MARK: Children
4755

4856
CF_EXPORT

0 commit comments

Comments
 (0)