Skip to content

Instantly share code, notes, and snippets.

@Fahrni
Created November 20, 2016 19:34
Show Gist options
  • Save Fahrni/ed5c386bec659985b439306ac67cabd3 to your computer and use it in GitHub Desktop.
Save Fahrni/ed5c386bec659985b439306ac67cabd3 to your computer and use it in GitHub Desktop.
Objective-C++ bridge to C++ Creatinine Clearance calculation
#import "PKMCreatinineClearance.h"
#import "PKMConvert.h"
#import "CreatinineClearance.h"
@interface PKMCreatinineClearance ()
@property (nonatomic, assign) PKMath::CreatinineClearance* ccInstance;
@end
@implementation PKMCreatinineClearance
- (nullable instancetype)initWith:(double)age
height:(double)height
weight:(double)weight
scr:(double)scr
gender:(PKMGender)gender
{
if (self = [super init]) {
Gender pkGender = [PKMConvert genderFromPKMGender:gender];
_ccInstance = new PKMath::CreatinineClearance(age, height, weight, scr, pkGender);
}
return self;
}
- (void)dealloc
{
delete _ccInstance;
}
- (double)calculate
{
return self.ccInstance->Calculate();
}
- (BOOL)clampedClcr
{
return self.ccInstance->ClampedClcr();
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment