Instantly share code, notes, and snippets.

Embed
What would you like to do?
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