Skip to content

Commit a8028a7

Browse files
committed
Add attribute and resetSource() to IndirectAttribute
# Conflicts: # Sources/OpenGraphCxx/Attribute/OGAttribute.cpp # Sources/OpenGraphCxx/include/OpenGraph/OGAttribute.h
1 parent 6de55f4 commit a8028a7

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Sources/OpenAttributeGraph/Attribute/Indirect/IndirectAttribute.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@ public struct IndirectAttribute<Value> {
1515
identifier = source.identifier.createIndirect(size: UInt64(MemoryLayout<Value>.size))
1616
}
1717

18+
public var attribute: Attribute<Value> {
19+
Attribute(identifier: identifier)
20+
}
21+
1822
public var source: Attribute<Value> {
1923
get { Attribute(identifier: identifier.source) }
2024
nonmutating set { identifier.source = newValue.identifier }
2125
}
2226

27+
public func resetSource() {
28+
__OAGGraphResetIndirectAttribute(identifier, false)
29+
}
30+
2331
public var dependency: AnyAttribute? {
2432
get {
2533
let dependency = identifier._indirectDependency

Sources/OpenAttributeGraphCxx/Attribute/OAGAttribute.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ void OAGGraphSetIndirectAttribute(OAGAttribute attribute1, OAGAttribute attribut
103103
// TODO
104104
}
105105

106+
void OAGGraphResetIndirectAttribute(OAGAttribute attribute, bool non_nil) {
107+
// TODO
108+
}
109+
106110
OAGAttribute OAGGraphCreateAttribute(long index, const void *body, const void * value) {
107111
// TODO
108112
return OAGAttributeNil;

Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ OAG_EXPORT
8989
OAG_REFINED_FOR_SWIFT
9090
void OAGGraphSetIndirectAttribute(OAGAttribute attribute1, OAGAttribute attribute2) OAG_SWIFT_NAME(setter:OAGAttribute.source(self:_:));
9191

92+
OAG_EXPORT
93+
OAG_REFINED_FOR_SWIFT
94+
void OAGGraphResetIndirectAttribute(OAGAttribute attribute, bool non_nil);
95+
9296
OAG_EXPORT
9397
OAG_REFINED_FOR_SWIFT
9498
OAGAttribute OAGGraphCreateAttribute(long index, const void *body, const void * _Nullable value);

0 commit comments

Comments
 (0)