Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,49 @@ void OAGGraphStartTracing2(_Nullable OAGGraphRef graph, OAGGraphTraceOptions opt
void OAGGraphStopTracing(_Nullable OAGGraphRef graph) {
// TODO
}

void OAGGraphSyncTracing(_Nullable OAGGraphRef graph) {
// TODO
}

CFStringRef OAGGraphCopyTracePath(_Nullable OAGGraphRef graph) {
// TODO
return nullptr;
}

OAGUniqueID OAGGraphAddTrace(OAGGraphRef graph, const OAGTraceRef trace, void *context) {
// TODO
return 0;
}

void OAGGraphRemoveTrace(OAGGraphRef graph, OAGUniqueID trace_id) {
// TODO
}

void OAGGraphSetTrace(OAGGraphRef graph, const OAGTraceRef trace, void *context) {
// TODO
}

void OAGGraphResetTrace(OAGGraphRef graph) {
// TODO
}

bool OAGGraphIsTracingActive(OAGGraphRef graph) {
// TODO
return false;
}

const char *OAGGraphGetTraceEventName(uint32_t event_id) {
// TODO
return nullptr;
}

const char *OAGGraphGetTraceEventSubsystem(uint32_t event_id) {
// TODO
return nullptr;
}

uint32_t OAGGraphRegisterNamedTraceEvent(const char *event_name, const char *event_subsystem) {
// TODO
return 0;
}
5 changes: 5 additions & 0 deletions Sources/OpenAttributeGraphCxx/Graph/OAGSubgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,8 @@ void OAGSubgraphEndTreeElement(OAGAttribute attribute) {
subgraph->end_tree(attribute);
}
}

OAGTreeElement OAGSubgraphGetTreeRoot(OAGSubgraphRef cf_subgraph) {
// TODO
return nullptr;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,44 @@ void OAGGraphStopTracing(_Nullable OAGGraphRef graph) OAG_SWIFT_NAME(OAGGraphRef

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGUniqueID OAGGraphAddTrace(OAGGraphRef graph, const OAGTraceRef trace, void *_Nullable context)
OAG_SWIFT_NAME(OAGGraphRef.addTrace(self:_:context:));
void OAGGraphSyncTracing(_Nullable OAGGraphRef graph) OAG_SWIFT_NAME(OAGGraphRef.syncTracing(_:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
CFStringRef OAGGraphCopyTracePath(_Nullable OAGGraphRef graph) OAG_SWIFT_NAME(OAGGraphRef.tracePath(_:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGUniqueID OAGGraphAddTrace(OAGGraphRef graph, const OAGTraceRef trace, void *_Nullable context) OAG_SWIFT_NAME(OAGGraphRef.addTrace(self:_:context:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
void OAGGraphRemoveTrace(OAGGraphRef graph, OAGUniqueID trace_id) OAG_SWIFT_NAME(OAGGraphRef.removeTrace(self:traceID:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
void OAGGraphSetTrace(OAGGraphRef graph, const OAGTraceRef trace, void *_Nullable context) OAG_SWIFT_NAME(OAGGraphRef.setTrace(self:_:context:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
void OAGGraphResetTrace(OAGGraphRef graph) OAG_SWIFT_NAME(OAGGraphRef.resetTrace(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
bool OAGGraphIsTracingActive(OAGGraphRef graph) OAG_SWIFT_NAME(getter:OAGGraphRef.isTracingActive(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
const char *_Nullable OAGGraphGetTraceEventName(uint32_t event_id) OAG_SWIFT_NAME(OAGGraphRef.traceEventName(for:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
const char *_Nullable OAGGraphGetTraceEventSubsystem(uint32_t event_id) OAG_SWIFT_NAME(OAGGraphRef.traceEventSubsystem(for:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
uint32_t OAGGraphRegisterNamedTraceEvent(const char *event_name, const char *event_subsystem) OAG_SWIFT_NAME(OAGGraphRef.registerNamedTraceEvent(name:subsystem:));

OAG_EXTERN_C_END

OAG_IMPLICIT_BRIDGING_DISABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <OpenAttributeGraph/OAGAttributeFlags.h>
#include <OpenAttributeGraph/OAGBase.h>
#include <OpenAttributeGraph/OAGGraph.h>
#include <OpenAttributeGraph/OAGTreeElement.h>
#include <OpenAttributeGraph/OAGUniqueID.h>
#include <OpenAttributeGraph/Private/CFRuntime.h>

Expand Down Expand Up @@ -139,6 +140,10 @@ OAG_EXPORT
OAG_REFINED_FOR_SWIFT
void OAGSubgraphEndTreeElement(OAGAttribute attribute);

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
_Nullable OAGTreeElement OAGSubgraphGetTreeRoot(OAGSubgraphRef cf_subgraph) OAG_SWIFT_NAME(getter:OAGSubgraphRef.treeRoot(self:));

OAG_EXTERN_C_END

OAG_IMPLICIT_BRIDGING_DISABLED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// OAGTreeElement.h
// OpenAttributeGraphCxx

#ifndef OAGTreeElement_h
#define OAGTreeElement_h

#include <OpenAttributeGraph/OAGBase.h>
#include <OpenAttributeGraph/OAGTreeValue.h>

OAG_ASSUME_NONNULL_BEGIN

OAG_IMPLICIT_BRIDGING_ENABLED

OAG_EXTERN_C_BEGIN

typedef struct _OAGTreeElement *OAGTreeElement OAG_SWIFT_STRUCT OAG_SWIFT_NAME(TreeElement);

typedef struct OAGTreeElementValueIterator {
uintptr_t parent_elt;
uintptr_t next_elt;
} OAG_SWIFT_NAME(Values) OAGTreeElementValueIterator;

typedef struct OAGTreeElementNodeIterator {
uintptr_t elt;
unsigned long node_index;
} OAG_SWIFT_NAME(Nodes) OAGTreeElementNodeIterator;

typedef struct OAGTreeElementChildIterator {
uintptr_t parent_elt;
uintptr_t next_elt;
size_t subgraph_index;
} OAG_SWIFT_NAME(Children) OAGTreeElementChildIterator;

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTypeID OAGTreeElementGetType(OAGTreeElement tree_element) OAG_SWIFT_NAME(getter:OAGTreeElement.type(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGAttribute OAGTreeElementGetValue(OAGTreeElement tree_element);

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
uint32_t OAGTreeElementGetFlags(OAGTreeElement tree_element) OAG_SWIFT_NAME(getter:OAGTreeElement.flags(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeElement _Nullable OAGTreeElementGetParent(OAGTreeElement tree_element)
OAG_SWIFT_NAME(getter:OAGTreeElement.parent(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeElementValueIterator OAGTreeElementMakeValueIterator(OAGTreeElement tree_element)
OAG_SWIFT_NAME(getter:OAGTreeElement.values(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeValue _Nullable OAGTreeElementGetNextValue(OAGTreeElementValueIterator *iter)
OAG_SWIFT_NAME(OAGTreeElementValueIterator.next(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeElementNodeIterator OAGTreeElementMakeNodeIterator(OAGTreeElement tree_element)
OAG_SWIFT_NAME(getter:OAGTreeElement.nodes(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGAttribute OAGTreeElementGetNextNode(OAGTreeElementNodeIterator *iter);

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeElementChildIterator OAGTreeElementMakeChildIterator(OAGTreeElement tree_element)
OAG_SWIFT_NAME(getter:OAGTreeElement.children(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTreeElement _Nullable OAGTreeElementGetNextChild(OAGTreeElementChildIterator *iter)
OAG_SWIFT_NAME(OAGTreeElementChildIterator.next(self:));

OAG_EXTERN_C_END

OAG_IMPLICIT_BRIDGING_DISABLED

OAG_ASSUME_NONNULL_END

#endif /* OAGTreeElement_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// OAGTreeValue.h
// OpenAttributeGraphCxx

#ifndef OAGTreeValue_h
#define OAGTreeValue_h

#include <OpenAttributeGraph/OAGBase.h>
#include <OpenAttributeGraph/OAGAttribute.h>
#include <OpenAttributeGraph/OAGTypeID.h>

OAG_ASSUME_NONNULL_BEGIN

OAG_IMPLICIT_BRIDGING_ENABLED

OAG_EXTERN_C_BEGIN

typedef struct _OAGTreeValue *OAGTreeValue OAG_SWIFT_STRUCT OAG_SWIFT_NAME(TreeValue);

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGTypeID OAGTreeValueGetType(OAGTreeValue tree_value) OAG_SWIFT_NAME(getter:OAGTreeValue.type(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
OAGAttribute OAGTreeValueGetValue(OAGTreeValue tree_value) OAG_SWIFT_NAME(getter:OAGTreeValue.value(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
const char *OAGTreeValueGetKey(OAGTreeValue tree_value) OAG_SWIFT_NAME(getter:OAGTreeValue.key(self:));

OAG_EXPORT
OAG_REFINED_FOR_SWIFT
uint32_t OAGTreeValueGetFlags(OAGTreeValue tree_value) OAG_SWIFT_NAME(getter:OAGTreeValue.flags(self:));

OAG_EXTERN_C_END

OAG_IMPLICIT_BRIDGING_DISABLED

OAG_ASSUME_NONNULL_END

#endif /* OAGTreeValue_h */
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <OpenAttributeGraph/OAGSearchOptions.h>
#include <OpenAttributeGraph/OAGSubgraph.h>
#include <OpenAttributeGraph/OAGTrace.h>
#include <OpenAttributeGraph/OAGTreeElement.h>
#include <OpenAttributeGraph/OAGTreeValue.h>
#include <OpenAttributeGraph/OAGTupleType.h>
#include <OpenAttributeGraph/OAGTypeID.h>
#include <OpenAttributeGraph/OAGUniqueID.h>
Expand Down
28 changes: 28 additions & 0 deletions Sources/OpenGraph/Tree/TreeElement.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// TreeElement.swift
// OpenGraph

public import OpenGraphCxx

extension TreeElement {
public var value: AnyAttribute? {
let result = __OGTreeElementGetValue(self)
return result == .nil ? nil : result
}
}

extension Nodes: @retroactive IteratorProtocol {
public typealias Element = AnyAttribute
public mutating func next() -> AnyAttribute? {
let result = __OGTreeElementGetNextNode(&self)
return result == .nil ? nil : result
}
}

extension Children: @retroactive IteratorProtocol {
public typealias Element = TreeElement
}

extension Values: @retroactive IteratorProtocol {
public typealias Element = TreeValue
}
55 changes: 55 additions & 0 deletions Sources/OpenGraphCxx/Tree/OGTreeElement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// OGTreeElement.cpp
// OpenGraphCxx

#include <OpenGraph/OGTreeElement.h>

OGTypeID OGTreeElementGetType(OGTreeElement tree_element) {
// TODO
return nullptr;
}

OGAttribute OGTreeElementGetValue(OGTreeElement tree_element) {
// TODO
return OGAttributeNil;
}

uint32_t OGTreeElementGetFlags(OGTreeElement tree_element) {
// TODO
return 0;
}

OGTreeElement OGTreeElementGetParent(OGTreeElement tree_element) {
// TODO
return nullptr;
}

OGTreeElementValueIterator OGTreeElementMakeValueIterator(OGTreeElement tree_element) {
// TODO
return {0, 0};
}

OGTreeValue OGTreeElementGetNextValue(OGTreeElementValueIterator *iter) {
// TODO
return nullptr;
}

OGTreeElementNodeIterator OGTreeElementMakeNodeIterator(OGTreeElement tree_element) {
// TODO
return {0, 0};
}

OGAttribute OGTreeElementGetNextNode(OGTreeElementNodeIterator *iter) {
// TODO
return OGAttributeNil;
}

OGTreeElementChildIterator OGTreeElementMakeChildIterator(OGTreeElement tree_element) {
// TODO
return {0, 0, 0};
}

OGTreeElement OGTreeElementGetNextChild(OGTreeElementChildIterator *iter) {
// TODO
return 0;
}
25 changes: 25 additions & 0 deletions Sources/OpenGraphCxx/Tree/OGTreeValue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// OGTreeValue.cpp
// OpenGraphCxx

#include <OpenGraph/OGTreeValue.h>

OGTypeID OGTreeValueGetType(OGTreeValue tree_value) {
// TODO
return nullptr;
}

OGAttribute OGTreeValueGetValue(OGTreeValue tree_value) {
// TODO
return OGAttributeNil;
}

const char *OGTreeValueGetKey(OGTreeValue tree_value) {
// TODO
return nullptr;
}

uint32_t OGTreeValueGetFlags(OGTreeValue tree_value) {
// TODO
return 0;
}
Loading
Loading