Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder template function declarations #177

Open
wants to merge 1 commit into
base: CrossComponentInheritance
Choose a base branch
from
Open
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
20 changes: 11 additions & 9 deletions Source/buildbindingclientimplccpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ namespace {{.NameSpace}} {
namespace Binding {
namespace ClientImpl {



// Create a wrapped instance of a client implementation class. This means
// constructing a client implementation class instance, forwarding arguments
// passed to the function, which is then wrapped in a new binding instance of
Expand All @@ -242,13 +244,12 @@ static typename tCLASS::tBINDING_PTR CreateWrappedInstance(tARGS&&... args)
);
}

// Given a pointer to a binding object, cast the wrapped handle to a client
// implementation instance. The caller is responsible for ensuring that the
// binding object really does wrap a client implementation.
// Cast a handle to a client implementation instance. The caller is responsible for
// ensuring that the binding object really does wrap a client implementation.
template <typename tCLASS>
static tCLASS* UnsafeGetWrappedInstance(typename tCLASS::tBINDING_PTR pBindingPtr)
static tCLASS* UnsafeGetWrappedInstance({{.NameSpace}}Handle handle)
{
return UnsafeGetWrappedInstance<tCLASS>(pBindingPtr->GetHandle());
return (tCLASS*) handle;
}

// Cast a handle to a client implementation instance. The caller is responsible for
Expand All @@ -259,12 +260,13 @@ static tCLASS* UnsafeGetWrappedInstance({{.NameSpace}}ExtendedHandle extendedHan
return UnsafeGetWrappedInstance<tCLASS>(extendedHandle.m_hHandle);
}

// Cast a handle to a client implementation instance. The caller is responsible for
// ensuring that the binding object really does wrap a client implementation.
// Given a pointer to a binding object, cast the wrapped handle to a client
// implementation instance. The caller is responsible for ensuring that the
// binding object really does wrap a client implementation.
template <typename tCLASS>
static tCLASS* UnsafeGetWrappedInstance({{.NameSpace}}Handle handle)
static tCLASS* UnsafeGetWrappedInstance(typename tCLASS::tBINDING_PTR pBindingPtr)
{
return (tCLASS*) handle;
return UnsafeGetWrappedInstance<tCLASS>(pBindingPtr->GetHandle());
}

// Static handler for E{{.NameSpace}}Exception from client impl abi wrapper function.
Expand Down