// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from constants.djinni

#import "DBConstantsInterface+Private.h"
#import "DBConstantsInterface.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>

static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");

@interface DBConstantsInterface ()

- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantsInterface>&)cppRef;

@end

@implementation DBConstantsInterface {
    ::djinni::DbxCppWrapperCache<::testsuite::ConstantsInterface>::Handle _cppRefHandle;
}

- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantsInterface>&)cppRef
{
    if (self = [super init]) {
        _cppRefHandle.assign(cppRef);
    }
    return self;
}

- (void)dummy {
    try {
        _cppRefHandle.get()->dummy();
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

namespace djinni_generated {

auto ConstantsInterface::toCpp(ObjcType objc) -> CppType
{
    if (!objc) {
        return nullptr;
    }
    return objc->_cppRefHandle.get();
}

auto ConstantsInterface::fromCpp(const CppType& cpp) -> ObjcType
{
    if (!cpp) {
        return nil;
    }
    return ::djinni::DbxCppWrapperCache<::testsuite::ConstantsInterface>::getInstance()->get(cpp, [] (const CppType& p) {
        return [[DBConstantsInterface alloc] initWithCpp:p];
    });
}

}  // namespace djinni_generated

@end
