repo_name
stringlengths 5
122
| path
stringlengths 3
232
| text
stringlengths 6
1.05M
|
---|---|---|
skylib/SnapSnapshotBase | SnapFBSnapshotBaseExample/Pods/Target Support Files/Pods-Snapshot_tests/Pods-Snapshot_tests-umbrella.h | #ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
FOUNDATION_EXPORT double Pods_Snapshot_testsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Snapshot_testsVersionString[];
|
skylib/SnapSnapshotBase | SnapFBSnapshotBaseExample/Pods/Target Support Files/SnapFBSnapshotBase/SnapFBSnapshotBase-umbrella.h | <gh_stars>1-10
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "SnapFBSnapshotBase.h"
#import "SnapFBSnapshotSwiftTestCase.h"
FOUNDATION_EXPORT double SnapFBSnapshotBaseVersionNumber;
FOUNDATION_EXPORT const unsigned char SnapFBSnapshotBaseVersionString[];
|
skylib/SnapSnapshotBase | SnapFBSnapshotBaseExample/Pods/Target Support Files/Pods-SnapFBSnapshotBaseExample/Pods-SnapFBSnapshotBaseExample-umbrella.h | <filename>SnapFBSnapshotBaseExample/Pods/Target Support Files/Pods-SnapFBSnapshotBaseExample/Pods-SnapFBSnapshotBaseExample-umbrella.h
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
FOUNDATION_EXPORT double Pods_SnapFBSnapshotBaseExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_SnapFBSnapshotBaseExampleVersionString[];
|
skylib/SnapSnapshotBase | SnapFBSnapshotBase/SnapFBSnapshotSwiftTestCase.h | #import <FBSnapshotTestCase/FBSnapshotTestCase-umbrella.h>
@interface SnapFBSnapshotSwiftTestCase : FBSnapshotTestCase
- (void)verifyView:(UIView *)view;
@end
|
skylib/SnapSnapshotBase | SnapFBSnapshotBase/SnapFBSnapshotBase.h | #define kIphone4PortraitRect CGRectMake(0, 0, 320, 480)
#define kIphone4PortraitSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIphone5PortraitRect CGRectMake(0, 0, 320, 568)
#define kIphone5PortraitSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIphone6PortraitRect CGRectMake(0, 0, 375, 667)
#define kIphone6PortraitSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIphone6PlusPortraitRect CGRectMake(0, 0, 414, 736)
#define kIphone6PlusPortraitSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIphone4LandscapeRect CGRectMake(0, 0, 480, 320)
#define kIphone4LandscapeSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassCompact)]
#define kIphone5LandscapeRect CGRectMake(0, 0, 568, 320)
#define kIphone5LandscapeSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassCompact)]
#define kIphone6LandscapeRect CGRectMake(0, 0, 667, 375)
#define kIphone6LandscapeSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassCompact)]
#define kIphone6PlusLandscapeRect CGRectMake(0, 0, 736, 414)
#define kIphone6PlusLandscapeSizeClasses @[@(UIUserInterfaceSizeClassRegular), @(UIUserInterfaceSizeClassCompact)]
#define kIpadPortraitRect CGRectMake(0, 0, 768, 1024)
#define kIpadPortraitSizeClasses @[@(UIUserInterfaceSizeClassRegular), @(UIUserInterfaceSizeClassRegular)]
#define kIpadLandscapeRect CGRectMake(0, 0, 1024, 768)
#define kIpadLandscapeSizeClasses @[@(UIUserInterfaceSizeClassRegular), @(UIUserInterfaceSizeClassRegular)]
#define kIpadMultitaskingLandscapeTwoToOneMainRect CGRectMake(0, 0, 694, 768)
#define kIpadMultitaskingLandscapeTwoToOneMainSizeClasses @[@(UIUserInterfaceSizeClassRegular), @(UIUserInterfaceSizeClassRegular)]
#define kIpadMultitaskingLandscapeTwoToOneAltRect CGRectMake(0, 0, 320, 768)
#define kIpadMultitaskingLandscapeTwoToOneAltSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIpadMultitaskingLandscapeOneToOneMainAndAltRect CGRectMake(0, 0, 507, 768)
#define kIpadMultitaskingLandscapeOneToOneMainAndAltSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIpadMultitaskingPortraitOneToOneMainRect CGRectMake(0, 0, 438, 1024)
#define kIpadMultitaskingPortraitOneToOneMainSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
#define kIpadMultitaskingPortraitOneToOneAltRect CGRectMake(0, 0, 320, 1024)
#define kIpadMultitaskingPortraitOneToOneAltSizeClasses @[@(UIUserInterfaceSizeClassCompact), @(UIUserInterfaceSizeClassRegular)]
@import FBSnapshotTestCase;
@interface SnapFBSnapshotBase : FBSnapshotTestCase
@property (nonatomic, strong) UIViewController *sutBackingViewController;
@property (nonatomic, strong) UIView *sut;
@property (nonatomic, assign) BOOL recordAll;
- (void)snapshotVerifyView:(UIView*)view;
@end
|
graphitemaster/pds2tc | s2tc.c | #include <string.h> /* memcpy */
#include <assert.h>
#include "s2tc.h"
/* Min and max macros */
#define S2TC_MIN(A, B) (((A) < (B)) ? (A) : (B))
#define S2TC_MAX(A, B) (((A) > (B)) ? (A) : (B))
/* Right shift and round */
#define RSHIFT(A, N) (((A) + (1 << ((N) - 1))) >> (N))
/* Color subtraction */
#define CSUB(A, B, I) ((A)[(I)] - (B)[(I)])
/* Color less-than predicate */
#define CLT(A, B) \
(CSUB(A, B, 0) \
? (CSUB(A, B, 0) < 0) \
: (CSUB(A, B, 1) \
? (CSUB(A, B, 1) < 0) \
: (CSUB(A, B, 2) < 0)))
/* Bit set utility */
#define BSET(ARRAY, INDEX, OFFSET, BIT) \
((ARRAY)[(INDEX) / 8 + (OFFSET)] |= (BIT << ((INDEX) % 8)))
/* Color distance functions */
typedef signed char s2tc_color_t[3];
static int color_dist_avg(s2tc_color_t a, s2tc_color_t b) {
int dr = a[0] - b[0];
int dg = a[1] - b[1];
int db = a[2] - b[2];
return dr*dr + dg*dg + db*db;
}
static int color_dist_yuv(s2tc_color_t a, s2tc_color_t b) {
int dr = a[0] - b[0];
int dg = a[1] - b[1];
int db = a[2] - b[2];
int y = dr * 30*2 + dg * 59 + db * 11*2;
int u = dr * 202 - y;
int v = db * 202 - y;
return ((y*y) << 1) + RSHIFT(u*u, 3) + RSHIFT(v*v, 4);
}
static int color_dist_rgb(s2tc_color_t a, s2tc_color_t b) {
int dr = a[0] - b[0];
int dg = a[1] - b[1];
int db = a[2] - b[2];
int y = dr * 21*2 + dg * 72 + db * 7*2;
int u = dr * 202 - y;
int v = db * 202 - y;
return ((y*y) << 1) + RSHIFT(u*u, 3) + RSHIFT(v*v, 4);
}
static int color_dist_srgb(s2tc_color_t a, s2tc_color_t b) {
int dr = a[0] * (int)a[0] - b[0] * (int)b[0];
int dg = a[1] * (int)a[1] - b[1] * (int)b[1];
int db = a[2] * (int)a[2] - b[2] * (int)b[2];
int y = dr * 21*2*2 + dg * 72 + db * 7*2*2;
int u = dr * 409 - y;
int v = db * 409 - y;
int sy = RSHIFT(y, 3) * RSHIFT(y, 4);
int su = RSHIFT(u, 3) * RSHIFT(u, 4);
int sv = RSHIFT(v, 3) * RSHIFT(v, 4);
return RSHIFT(sy, 4) + RSHIFT(su, 8) + RSHIFT(sv, 9);
}
static int (*color_dist_functions[])(s2tc_color_t, s2tc_color_t) = {
[S2TC_RGB] = &color_dist_rgb,
[S2TC_SRGB] = &color_dist_srgb,
[S2TC_AVG] = &color_dist_avg,
[S2TC_YUV] = &color_dist_yuv
};
static int color_dist(s2tc_t *ctx, s2tc_color_t a, s2tc_color_t b) {
return color_dist_functions[ctx->dist](a, b);
}
static int alpha_dist(unsigned char a, unsigned char b) {
return (a - (int)b) * (a - (int)b);
}
/* Reduce colors inplace */
static void reduce_colors(s2tc_t *ctx, s2tc_color_t *colors, size_t n, size_t m) {
assert(n <= 16 && m <= 16);
int dists[16][16];
size_t i = 0;
for (; i < n; ++i) {
dists[i][i] = 0;
for (size_t j = i + 1; j < n; ++j) {
const int distance = color_dist(ctx, colors[i], colors[j]);
dists[i][j] = distance;
dists[j][i] = distance;
}
}
for (; i < m; ++i) {
for (size_t j = 0; j < n; ++j)
dists[i][j] = color_dist(ctx, colors[i], colors[j]);
}
size_t besti = 0;
size_t bestj = 0;
int bestsum = -1;
for (i = 0; i < m; ++i) {
for (size_t j = i + 1; j < m; ++j) {
int sum = 0;
for (size_t k = 0; k < n; ++k)
sum += S2TC_MIN(dists[i][k], dists[j][k]);
if (bestsum < 0 || sum < bestsum) {
bestsum = sum;
besti = i;
bestj = j;
}
}
}
if (besti != 0) memcpy(&colors[0], &colors[besti], sizeof(s2tc_color_t));
if (bestj != 1) memcpy(&colors[1], &colors[bestj], sizeof(s2tc_color_t));
}
static void reduce_colors_alpha(unsigned char *colors, size_t n, size_t m) {
assert(n <= 16 && m <= 16);
int dists[16][16+2];
size_t i = 0;
for (; i < n; ++i) {
dists[i][i] = 0;
for (size_t j = i + 1; j < n; ++j) {
const int distance = alpha_dist(colors[i], colors[j]);
dists[i][j] = distance;
dists[j][i] = distance;
}
}
for (; i < m; ++i)
for (size_t j = 0; j < n; ++j)
dists[i][j] = alpha_dist(colors[i], colors[j]);
for (size_t j = 0; j < n; ++j)
dists[m][j] = alpha_dist(0, colors[j]);
for (size_t j = 0; j < n; ++j)
dists[m+1][j] = alpha_dist(255, colors[j]);
size_t besti = 0;
size_t bestj = 1;
int bestsum = -1;
for (i = 0; i < m; ++i) {
for (size_t j = i + 1; j < m; ++j) {
int sum = 0;
for (size_t k = 0; k < n; ++k) {
const int di = dists[i][k];
const int dj = dists[j][k];
const int d0 = dists[m][k];
const int d1 = dists[m+1][k];
const int m0 = S2TC_MIN(di, dj);
const int m1 = S2TC_MIN(d0, d1);
sum += S2TC_MIN(m0, m1);
}
if (bestsum < 0 || sum < bestsum) {
bestsum = sum;
besti = i;
bestj = j;
}
}
}
if (besti != 0) memcpy(&colors[0], &colors[besti], sizeof(s2tc_color_t));
if (bestj != 1) memcpy(&colors[1], &colors[bestj], sizeof(s2tc_color_t));
}
void s2tc_encode_block(s2tc_t *ctx, unsigned char *out, const unsigned char *rgba, size_t iw, size_t w, size_t h) {
s2tc_color_t colors[16];
unsigned char alpha[16];
size_t n = 0;
size_t m = 0;
for (size_t x = 0; x < w; ++x) {
for (size_t y = 0; y < h; ++y, ++n) {
colors[n][0] = rgba[(x + y * iw) * 4 + 2];
colors[n][1] = rgba[(x + y * iw) * 4 + 1];
colors[n][2] = rgba[(x + y * iw) * 4 + 0];
if (ctx->dxt == S2TC_DXT5)
alpha[n] = rgba[(x + y * iw) * 4 + 3];
}
}
m = n;
reduce_colors(ctx, colors, n, m);
if (ctx->dxt == S2TC_DXT5) {
reduce_colors_alpha(alpha, n, m);
if (alpha[1] < alpha[0]) {
alpha[2] = alpha[0];
alpha[0] = alpha[1];
alpha[1] = alpha[2];
}
}
if (CLT(colors[0], colors[1])) {
memcpy(&colors[2], &colors[0], sizeof(s2tc_color_t));
memcpy(&colors[0], &colors[1], sizeof(s2tc_color_t));
memcpy(&colors[1], &colors[2], sizeof(s2tc_color_t));
}
memset(out, 0, ctx->dxt == S2TC_DXT1 ? 8 : 16);
switch (ctx->dxt) {
case S2TC_DXT5:
out[0] = alpha[0];
out[1] = alpha[1];
/* fall-through */
case S2TC_DXT3:
out[8] = ((colors[0][1] & 0x07) << 5) | colors[0][2];
out[9] = (colors[0][0] << 3) | (colors[0][1] >> 3);
out[10] = ((colors[1][1] & 0x07) << 5) | colors[1][2];
out[11] = (colors[1][0] << 3) | (colors[1][1] >> 3);
break;
case S2TC_DXT1:
out[0] = ((colors[0][1] & 0x07) << 5) | colors[0][2];
out[1] = (colors[0][0] << 3) | (colors[0][1] >> 3);
out[2] = ((colors[1][1] & 0x07) << 5) | colors[1][2];
out[3] = (colors[1][0] << 3) | (colors[1][1] >> 3);
break;
}
for (size_t x = 0; x < w; ++x) {
for (size_t y = 0; y < h; ++y) {
size_t index = x + y * 4;
colors[2][0] = rgba[(x + y * iw) * 4 + 2];
colors[2][1] = rgba[(x + y * iw) * 4 + 1];
colors[2][2] = rgba[(x + y * iw) * 4 + 0];
alpha[2] = rgba[(x + y * iw) * 4 + 3];
int alphadist[4];
switch (ctx->dxt) {
case S2TC_DXT5:
#define ALPHA_LTEQ(X, Y) (alphadist[(X)] <= alphadist[(Y)])
alphadist[0] = alpha_dist(alpha[0], alpha[2]);
alphadist[1] = alpha_dist(alpha[1], alpha[2]);
alphadist[2] = alpha_dist(0, alpha[2]);
alphadist[3] = alpha_dist(255, alpha[2]);
if (ALPHA_LTEQ(2, 0) && ALPHA_LTEQ(2, 1) && ALPHA_LTEQ(2, 3)) {
BSET(out, index * 3 + 1, 2, 1);
BSET(out, index * 3 + 2, 2, 1);
} else if (ALPHA_LTEQ(3, 0) && ALPHA_LTEQ(3, 1)) {
BSET(out, index * 3 + 0, 2, 1);
BSET(out, index * 3 + 1, 2, 1);
BSET(out, index * 3 + 2, 2, 1);
} else if (ALPHA_LTEQ(0, 1)) {
/* nothing */
} else {
BSET(out, index * 3 + 0, 2, 1);
}
if (color_dist(ctx, colors[0], colors[2]) > color_dist(ctx, colors[1], colors[2]))
BSET(out, index * 2, 12, 1);
break;
case S2TC_DXT3:
BSET(out, index * 4, 0, alpha[2]);
if (color_dist(ctx, colors[0], colors[2]) > color_dist(ctx, colors[1], colors[2]))
BSET(out, index * 2, 12, 1);
break;
case S2TC_DXT1:
if (!alpha[2])
BSET(out, index * 2, 4, 3);
else if (color_dist(ctx, colors[0], colors[2]) > color_dist(ctx, colors[1], colors[2]))
BSET(out, index * 2, 4, 1);
break;
}
}
}
}
|
graphitemaster/pds2tc | s2tc.h | #ifndef S2TC_HDR
#define S2TC_HDR
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif /*!__cplusplus*/
/**
* Type: s2tc_dxt_mode_t
* The DXT mode to use for a context
*/
typedef enum {
S2TC_DXT1,
S2TC_DXT3,
S2TC_DXT5
} s2tc_dxt_mode_t;
/**
* Type: s2tc_dist_mode_t
* The color distance mode to use for a context.
*/
typedef enum {
S2TC_RGB,
S2TC_SRGB,
S2TC_YUV,
S2TC_AVG
} s2tc_dist_mode_t;
/**
* Type: s2tc_t
* A context for S2TC.
*
* To be filled out with a DXT and color distance mode before encoding blocks.
*/
typedef struct {
s2tc_dxt_mode_t dxt; /** DXT mode */
s2tc_dist_mode_t dist; /** Color distance mode */
} s2tc_t;
/**
* Function: s2tc_encode_block
* Encode a block of RGBA5658.
*
* Parameters:
* ctx - context
* out - 16 byte storage for the block
* rgba - pointer to RGBA data for this block
* iw - image width
* w - width
* h - height
*/
void s2tc_encode_block(s2tc_t *ctx, unsigned char *out, const unsigned char *rgba, size_t iw, size_t w, size_t h);
/* Missing refinement and rgb565-ification */
#ifdef __cplusplus
}
#endif /*!__cplusplus*/
#endif
|
dariosanfilippo/bitstream_ANN_DSP | dsm.h | <gh_stars>1-10
/*
* *****************************************************************************
*
* Delta-sigma modulators.
*
* *****************************************************************************
*/
#ifndef DSM
#define DSM
void dsm1(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
void dsm2(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
void dsm3(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
#endif
|
dariosanfilippo/bitstream_ANN_DSP | osc.h | <filename>osc.h
/*
* *****************************************************************************
*
* Oscillators
*
* *****************************************************************************
*/
#ifndef OSC
#define OSC
#define TWOPI 2.0 * M_PI
void sine(size_t sr, audio amp, audio freq, audio phase, Sig* out,
size_t out_vec_id);
#endif
|
dariosanfilippo/bitstream_ANN_DSP | random.c | /* Unit-bounded floatng-point random numbers. */
#include "random.h"
audio frand(void) {
return rand() / (audio) RAND_MAX;
}
|
dariosanfilippo/bitstream_ANN_DSP | tests/fulladder_test.c | <reponame>dariosanfilippo/bitstream_ANN_DSP
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "signals.c"
#include "osc.c"
#include "dsm.c"
#include "bitmath.c"
int main(void) {
FILE *fptr;
fptr = fopen("fa.csv", "w+");
size_t len = 8;
size_t SR = 192000;
audio fa_ins[3][8] = {
{0, 0, 0, 0, 1, 1, 1, 1},
{0, 0, 1, 1, 0, 0, 1, 1},
{0, 1, 0, 1, 0, 1, 0, 1}
};
Sig* in = malloc(sizeof(Sig));
Sig* out = malloc(sizeof(Sig));
sig_alloc(in, 3, len, SR);
sig_alloc(out, 2, len, SR);
for (size_t i = 0; i < 3; i++) {
for (size_t j = 0; j < in->vec_len; j++) {
in->vec_space[i][j] = fa_ins[i][j];
}
}
fulladder(in, in, in, out, out, 0, 1, 2, 0, 1);
for (int i = 0; i < in->vec_len; i++) {
fprintf(fptr, "%f, %f\n", out->vec_space[0][i], out->vec_space[1][i]);
}
sig_free(in);
sig_free(out);
fclose(fptr);
return EXIT_SUCCESS;
}
|
dariosanfilippo/bitstream_ANN_DSP | osc.c | /*******************************************************************************
*
* Sinusoidal oscillator.
*
* Copyright (c) <NAME> 2021.
*
*******************************************************************************/
#include "osc.h"
void sine(size_t sr, audio amp, audio freq, audio phase, Sig* out,
size_t out_vec_id) {
/* calculate incremental value */
audio incr = (TWOPI * freq) / (audio) sr;
audio ph = phase;
for (size_t i = 0; i < out->vec_len; i++) {
out->vec_space[out_vec_id][i] = amp * sin(ph);
/* increment phase and wrap around */
ph += incr;
if (ph >= TWOPI)
ph -= TWOPI;
if (ph < 0.0)
ph += TWOPI;
}
}
|
dariosanfilippo/bitstream_ANN_DSP | freq_est_uni.c | /*******************************************************************************
*
* This file is used to train and test unipolar networks for the estimation
* of the frequency in DSM sinusoids with different frequency, amplitude,
* and phase values. These networks, in particular, are used with the
* ReLU and sigmoid activation functions.
*
* Copyright (c) <NAME> 2021
*
******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include <time.h>
#include "signals.c"
#include "random.c"
#include "osc.c"
#include "dsm.c"
#include "bitmath.c"
#include "data.c"
#include "kann.c"
#include "kautodiff.c"
int main(void) {
srand(time(0));
kad_node_t* t;
kann_t* ann;
size_t inputs = 1024;
size_t outputs = 1;
size_t num_layers = 4;
size_t neurons = 64;
size_t SR = 192000;
/* Create the neural network */
t = kann_layer_input(inputs);
for (size_t i = 0; i < num_layers; i++) {
t = kann_layer_dense(t, neurons);
t = kad_sigm(t);
}
t = kann_layer_cost(t, outputs, KANN_C_MSE);
ann = kann_new(t, 0);
/* Create training data set */
size_t setsize = 65536;
Sig* x = malloc(sizeof(Sig));
Sig* y = malloc(sizeof(Sig));
sig_alloc(x, setsize, inputs, SR);
sig_alloc(y, setsize, outputs, SR);
freq_est_data(x, y);
for (size_t i = 0; i < setsize; i++) {
bi2uni(x, x, i, i);
}
/* Train the net */
float lr = .001, frac_val = .1;
size_t mini_size = 32;
size_t max_epoch = 500;
size_t max_drop_streak = 20;
kann_train_fnn1(ann, lr, mini_size, max_epoch, max_drop_streak, frac_val,
setsize, x->vec_space, y->vec_space);
sig_free(x);
sig_free(y);
/* CSV file setup */
char fname[256];
sprintf(fname, "inputs%zuoutputs%zulayers%zuneurons%zuset%zulearningrate%f.csv",
inputs, outputs, num_layers, neurons, setsize, lr);
FILE* csv;
csv = fopen(fname, "w+");
/* Test the net */
size_t testsize = 100;
x = malloc(sizeof(Sig));
y = malloc(sizeof(Sig));
sig_alloc(x, testsize, inputs, SR);
sig_alloc(y, testsize, outputs, SR);
const float* output;
freq_est_data(x, y);
for (size_t i = 0; i < testsize; i++) {
bi2uni(x, x, i, i);
}
for (size_t j = 0; j < testsize; j++) {
output = kann_apply1(ann, x->vec_space[j]);
printf("Target: %.10f; prediction: %.10f; error factor: %.10f\n",
y->vec_space[j][0], *output, 1 - y->vec_space[j][0] / *output);
fprintf(csv, "%f, %f\n", y->vec_space[j][0],
1 - y->vec_space[j][0] / *output);
}
sig_free(x);
sig_free(y);
fclose(csv);
return EXIT_SUCCESS;
}
|
dariosanfilippo/bitstream_ANN_DSP | data.h | /*******************************************************************************
*
* This module contains functions for the generation of training and
* test data for frequency and amplitude estimation, and sum and
* multiplication operations.
*
* Copyright (c) <NAME> 2021.
*
*******************************************************************************/
#ifndef DATA
#define DATA
void freq_est_data(Sig* in, Sig* out);
void amp_est_data(Sig* in, Sig* out);
void adder_data(Sig* in, Sig* out);
void mul_data(Sig* in, Sig* out);
#endif
|
dariosanfilippo/bitstream_ANN_DSP | bitmath.h | <reponame>dariosanfilippo/bitstream_ANN_DSP<gh_stars>1-10
/*******************************************************************************
*
* This module contains delta-sigma arithmetic operators.
*
* Reference:
* <NAME> (2009) -- Bit-stream signal processing on FPGA.
* http://hub.hku.hk/handle/10722/54513
*
* Copyright (c) <NAME> 2021.
*
*******************************************************************************/
#ifndef BITMATH
#define BITMATH
typedef struct FullAdder FullAdder;
void fulladder(Sig* in0, Sig* in1, Sig* in2, Sig* out0, Sig* out1,
size_t in_vec_id0, size_t in_vec_id1, size_t in_vec_id2,
size_t out_vec_id0, size_t out_vec_id1);
FullAdder fulladder_samplewise(bool in0, bool in1, bool c_in);
void binaryadder(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0,
size_t in_vec_id1, size_t out_vec_id);
bool binaryadder_samplewise(bool in0, bool in1, bool* state);
void binarymultiplier(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0,
size_t in_vec_id1, size_t out_vec_id);
void bi2uni(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
void uni2bi(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
#endif
|
dariosanfilippo/bitstream_ANN_DSP | bitmath.c | /*******************************************************************************
*
* This module contains delta-sigma arithmetic operators.
*
* Reference:
* Ch<NAME> (2009) -- Bit-stream signal processing on FPGA.
* http://hub.hku.hk/handle/10722/54513
*
* Copyright (c) <NAME> 2021.
*
*******************************************************************************/
#include "bitmath.h"
struct FullAdder {
bool sum;
bool c_out;
};
/* Full adder; see https://en.wikipedia.org/wiki/Adder_(electronics) for the
* truth table */
void fulladder(Sig* in0, Sig* in1, Sig* in2, Sig* out0, Sig* out1,
size_t in_vec_id0, size_t in_vec_id1, size_t in_vec_id2, size_t out_vec_id0,
size_t out_vec_id1) {
assert((in0->vec_len == in1->vec_len) & (in1->vec_len == in2->vec_len) &
(in2->vec_len == out0->vec_len) & (out0->vec_len == out1->vec_len));
bool _in0;
bool _in1;
bool c_in;
bool sum;
bool c_out;
for (size_t i = 0; i < in0->vec_len; i++) {
_in0 = in0->vec_space[in_vec_id0][i] > 0;
_in1 = in1->vec_space[in_vec_id1][i] > 0;
c_in = in2->vec_space[in_vec_id2][i] > 0;
sum = (_in0 ^ _in1) ^ c_in;
c_out = (_in0 & _in1) | ((_in0 ^ _in1) & c_in);
out0->vec_space[out_vec_id0][i] = (audio) sum == 0 ? -1.0 : 1.0;
out1->vec_space[out_vec_id1][i] = (audio) c_out == 0 ? -1.0 : 1.0;
}
}
/* Full adder for sample-by-sample calculations */
FullAdder fulladder_samplewise(bool in0, bool in1, bool c_in) {
FullAdder fa;
fa.sum = (in0 ^ in1) ^ c_in;
fa.c_out = (in0 & in1) | ((in0 ^ in1) & c_in);
return fa;
}
/* Delta-sigma streams adder */
void binaryadder(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0, size_t in_vec_id1,
size_t out_vec_id) {
assert((in0->vec_len == in1->vec_len) & (in1->vec_len == out->vec_len));
bool state = 0;
bool _in0;
bool _in1;
bool c_in;
bool sum;
bool c_out;
for (size_t i = 0; i < in0->vec_len; i++) {
_in0 = in0->vec_space[in_vec_id0][i] > 0;
_in1 = in1->vec_space[in_vec_id1][i] > 0;
c_in = state;
sum = (_in0 ^ _in1) ^ c_in;
c_out = (_in0 & _in1) | ((_in0 ^ _in1) & c_in);
state = sum;
out->vec_space[out_vec_id][i] = (audio) c_out == 0 ? -1.0 : 1.0;
}
}
/* As above but sample-wise */
bool binaryadder_samplewise(bool in0, bool in1, bool* state) {
FullAdder fa = fulladder_samplewise(in0, in1, *state);
*state = fa.sum;
return fa.c_out;
}
/* Delta-sigma multiplication; this implements figure 2.5 of the thesis
* referenced above */
void binarymultiplier(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0,
size_t in_vec_id1, size_t out_vec_id) {
assert((in0->vec_len == in1->vec_len) & (in1->vec_len == out->vec_len));
Sig* xor = malloc(sizeof(Sig));
Sig* sum = malloc(sizeof(Sig));
sig_alloc(xor, 16, in0->vec_len, in0->sr);
sig_alloc(sum, 14, in0->vec_len, in0->sr);
bool temp;
/* the loops below compute the vectors corresponding to the
* 16 outputs of the xor operators */
for (size_t i = 0; i < 4; i++) {
for (size_t j = 0; j < 4; j++) {
for (size_t k = 3; k < in0->vec_len; k++) {
temp = (in0->vec_space[in_vec_id0][k - i] > 0) ^
(in1->vec_space[in_vec_id1][k - j] > 0);
xor->vec_space[j + i * 4][k] = temp ? 1.0 : -1.0;
}
}
}
/* the loops below sum all of the signals for the final output */
for (size_t i = 0; i < 8; i++) {
binaryadder(xor, xor, sum, i * 2, i * 2 + 1, i);
}
for (size_t i = 0; i < 4; i++) {
binaryadder(sum, sum, sum, i * 2, i * 2 + 1, i + 8);
}
for (size_t i = 0; i < 2; i++) {
binaryadder(sum, sum, sum, i * 2 + 8, i * 2 + 8 + 1, i + 12);
}
binaryadder(sum, sum, out, 12, 13, out_vec_id);
sig_free(xor);
sig_free(sum);
}
void bi2uni(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id) {
assert(in->vec_len == out->vec_len);
for (size_t i = 0; i < in->vec_len; i++) {
out->vec_space[out_vec_id][i] =
in->vec_space[in_vec_id][i] > 0 ? 1.0 : 0.0;
}
}
void uni2bi(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id) {
assert(in->vec_len == out->vec_len);
for (size_t i = 0; i < in->vec_len; i++) {
out->vec_space[out_vec_id][i] =
in->vec_space[in_vec_id][i] > 0.5 ? 1.0 : -1.0;
}
}
|
dariosanfilippo/bitstream_ANN_DSP | random.h | /* Unit-bounded floatng-point random numbers. */
audio frand(void);
|
dariosanfilippo/bitstream_ANN_DSP | signals.h | /*******************************************************************************
*
* This module implements an infrastructure to operate with signals
* based on a vector space representation.
*
* Copyright (c) <NAME> 2021.
*
******************************************************************************/
#ifndef SIGNALS
#define SIGNALS
#define RESO 32
#if RESO == 32
# define audio float
#elif RESO == 64
# define audio double
#else
#error invalid resolution: it must be 32 or 64 bits.
#endif
typedef struct Sig Sig;
void sig_alloc(Sig* sig, size_t dim, size_t len, size_t srate);
void sig_free(Sig* sig);
void sig_set_const(Sig* sig, size_t vec_id, audio val);
void sig_print_sample(Sig* sig, size_t vec_id, size_t sample_id);
void sig_print_vec(Sig* sig, size_t vec_id);
void sig_print_space(Sig* sig);
size_t sig_getdim(Sig* sig);
size_t sig_getlen(Sig* sig);
#endif
|
dariosanfilippo/bitstream_ANN_DSP | signals.c | <reponame>dariosanfilippo/bitstream_ANN_DSP
/*******************************************************************************
*
* This module implements an infrastructure to operate with signals
* based on a vector space representation.
*
* Copyright (c) <NAME> 2021.
*
******************************************************************************/
#include "signals.h"
struct Sig {
audio** vec_space;
size_t space_dim;
size_t vec_len;
size_t sr;
};
/* Allocate a space of "dim" vectors of size "len" samples initialised to 0 */
void sig_alloc(Sig* sig, size_t dim, size_t len, size_t srate) {
sig->vec_space = malloc(dim * sizeof(audio*));
for (size_t i = 0; i < dim; i++) {
sig->vec_space[i] = malloc(len * sizeof(audio));
for (size_t j = 0; j < len; j++) {
sig->vec_space[i][j] = 0.0;
}
}
sig->space_dim = dim;
sig->vec_len = len;
sig->sr = srate;
}
/* Free signals memory after use */
void sig_free(Sig* sig) {
for (size_t i = 0; i < sig->space_dim; i++) {
free(sig->vec_space[i]);
}
free(sig->vec_space);
}
/* Set a specific vector to a constant value */
void sig_set_const(Sig* sig, size_t vec_id, audio val) {
assert(vec_id < sig->space_dim);
for (size_t i = 0; i < sig->vec_len; i++) {
sig->vec_space[vec_id][i] = val;
}
}
/* Print a specific sample from a specific vector on screen */
void sig_print_sample(Sig* sig, size_t vec_id, size_t sample_id) {
assert((vec_id < sig->space_dim) & (sample_id < sig->vec_len));
printf("Vec %zu, sample %zu: %.20f\n", vec_id, sample_id,
sig->vec_space[vec_id][sample_id]);
}
/* Print a specific vector on screen */
void sig_print_vec(Sig* sig, size_t vec_id) {
assert(vec_id < sig->space_dim);
for (size_t i = 0; i < sig->vec_len; i++) {
printf("Vec %zu, sample %zu: %.20f\n", vec_id, i,
sig->vec_space[vec_id][i]);
}
}
/* Print an entire space on screen */
void sig_print_space(Sig* sig) {
for (size_t i = 0; i < sig->space_dim; i++) {
for (size_t j = 0; j < sig->vec_len; j++) {
printf("Vec %zu, sample %zu: %.20f\n", i, j,
sig->vec_space[i][j]);
}
}
}
|
dariosanfilippo/bitstream_ANN_DSP | dsm.c | /*******************************************************************************
*
* This file contains first, second, and third-order delta-sigma
* modulators for multi-bit to one-bit conversion.
*
* While the first-order modulator is stable for any signal in the
* full-scale digital amplitude, order-two and order-three modulators
* may result in distorted or unstable behaviours and should be used
* with input signals up to about 75% of the full amplitude scale.
*
* For best performance, 50% amplitude peaks should be used combined
* with oversampling to overcome the 6 dB loss in the signal-to-noise
* ratio.
*
* Copyright (C) <NAME> 2021 – <EMAIL>.
*
******************************************************************************/
#include "dsm.h"
/* First-order DSM */
void dsm1(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id) {
assert(in->vec_len == out->vec_len);
audio state = 0.0;
audio integrator = 0.0;
for (size_t i = 0; i < in->vec_len; i++) {
integrator += in->vec_space[in_vec_id][i] - state;
out->vec_space[out_vec_id][i] = state = integrator < 0.0 ? -1.0 : 1.0;
}
}
/* Second-order DSM */
void dsm2(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id) {
assert(in->vec_len == out->vec_len);
audio state = 0.0;
audio integrator1 = 0.0;
audio integrator2 = 0.0;
for (size_t i = 0; i < in->vec_len; i++) {
integrator1 += in->vec_space[in_vec_id][i] - state;
integrator2 += integrator1 - state * 2.0;
out->vec_space[out_vec_id][i] = state = integrator2 < 0.0 ? -1.0 : 1.0;
}
}
/* Third-order DSM */
void dsm3(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id) {
assert(in->vec_len == out->vec_len);
audio state = 0.0;
audio integrator1 = 0.0;
audio integrator2 = 0.0;
audio integrator3 = 0.0;
audio c1 = 1.0 / 4.0;
audio c2 = 1.0 / 3.0;
audio c3 = 1.0 / 8.0;
for (size_t i = 0; i < in->vec_len; i++) {
integrator1 += in->vec_space[in_vec_id][i] * c1 - state * c1;
integrator2 += integrator1 * c2 - state * c2;
integrator3 += integrator2 * c3 - state * c3;
out->vec_space[out_vec_id][i] = state = integrator3 < 0.0 ? -1.0 : 1.0;
}
}
|
dariosanfilippo/bitstream_ANN_DSP | tests/data_test.c | <filename>tests/data_test.c
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "signals.c"
#include "osc.c"
#include "dsm.c"
#include "bitmath.c"
#include "data.c"
int main(void) {
size_t sr = 192000;
size_t in_len = 64;
size_t out_len = 1;
size_t dim = 64;
Sig* in = malloc(sizeof(Sig));
Sig* out = malloc(sizeof(Sig));
sig_alloc(in, dim, in_len, sr);
sig_alloc(out, dim, out_len, sr);
freq_est_data(in, out);
sig_print_space(in);
sig_free(in);
sig_free(out);
in_len = 64;
out_len = in_len / 2;
in = malloc(sizeof(Sig));
out = malloc(sizeof(Sig));
sig_alloc(in, dim, in_len, sr);
sig_alloc(out, dim, out_len, sr);
adder_data(in, out);
sig_print_space(in);
sig_print_space(out);
sig_free(in);
sig_free(out);
return EXIT_SUCCESS;
}
|
dariosanfilippo/bitstream_ANN_DSP | data.c | /*******************************************************************************
*
* This module contains functions for the generation of training and
* test data for frequency and amplitude estimation, and sum and
* multiplication operations.
*
* Copyright (c) <NAME> 2021.
*
*******************************************************************************/
#include "data.h"
void freq_est_data(Sig* in, Sig* out) {
assert(in->space_dim == out->space_dim);
audio freq;
audio amp;
audio phase;
for (size_t i = 0; i < in->space_dim; i++) {
freq = frand() * 20000.0;
amp = frand() * .5 + .25;
phase = frand() * TWOPI;
out->vec_space[i][0] = freq;
sine(in->sr, amp, freq, phase, in, i);
dsm3(in, in, i, i);
}
}
void amp_est_data(Sig* in, Sig* out) {
assert(in->space_dim == out->space_dim);
audio freq;
audio amp;
audio phase;
for (size_t i = 0; i < in->space_dim; i++) {
freq = frand() * 20000.0;
amp = frand() * .5 + .25;
phase = frand() * TWOPI;
out->vec_space[i][0] = amp;
sine(in->sr, amp, freq, phase, in, i);
dsm3(in, in, i, i);
}
}
void adder_data(Sig* in, Sig* out) {
assert(in->space_dim == out->space_dim);
audio freq0;
audio freq1;
audio amp0;
audio amp1;
audio phase0;
audio phase1;
Sig* in0 = malloc(sizeof(Sig));
Sig* in1 = malloc(sizeof(Sig));
sig_alloc(in0, in->space_dim, in->vec_len / 2, in->sr);
sig_alloc(in1, in->space_dim, in->vec_len / 2, in->sr);
for (size_t i = 0; i < in->space_dim; i++) {
freq0 = frand() * 5000.0;
freq1 = frand() * 5000.0;
amp0 = frand() * .25;
amp1 = frand() * .25;
phase0 = frand() * TWOPI;
phase1 = frand() * TWOPI;
sine(in0->sr, amp0, freq0, phase0, in0, i);
sine(in1->sr, amp1, freq1, phase1, in1, i);
for (size_t j = 0; j < out->vec_len; j++) {
out->vec_space[i][j] = in0->vec_space[i][j] + in1->vec_space[i][j];
}
dsm3(in0, in0, i, i);
dsm3(in1, in1, i, i);
dsm3(out, out, i, i);
for (size_t j = 0; j < in0->vec_len; j++) {
in->vec_space[i][j] = in0->vec_space[i][j];
in->vec_space[i][j + in1->vec_len] = in1->vec_space[i][j];
}
}
sig_free(in0);
sig_free(in1);
}
void mul_data(Sig* in, Sig* out) {
assert(in->space_dim == out->space_dim);
audio freq0;
audio freq1;
audio amp0;
audio amp1;
audio phase0;
audio phase1;
Sig* in0 = malloc(sizeof(Sig));
Sig* in1 = malloc(sizeof(Sig));
sig_alloc(in0, in->space_dim, in->vec_len / 2, in->sr);
sig_alloc(in1, in->space_dim, in->vec_len / 2, in->sr);
for (size_t i = 0; i < in->space_dim; i++) {
freq0 = frand() * 5000.0;
freq1 = frand() * 5000.0;
amp0 = frand() * .5;
amp1 = frand() * .5;
phase0 = frand() * TWOPI;
phase1 = frand() * TWOPI;
sine(in0->sr, amp0, freq0, phase0, in0, i);
sine(in1->sr, amp1, freq1, phase1, in1, i);
for (size_t j = 0; j < out->vec_len; j++) {
out->vec_space[i][j] = in0->vec_space[i][j] * in1->vec_space[i][j];
}
dsm3(in0, in0, i, i);
dsm3(in1, in1, i, i);
dsm3(out, out, i, i);
for (size_t j = 0; j < in0->vec_len; j++) {
in->vec_space[i][j] = in0->vec_space[i][j];
in->vec_space[i][j + in1->vec_len] = in1->vec_space[i][j];
}
}
sig_free(in0);
sig_free(in1);
}
|
dariosanfilippo/bitstream_ANN_DSP | tests/binaryadder_test.c | <reponame>dariosanfilippo/bitstream_ANN_DSP<filename>tests/binaryadder_test.c
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "signals.c"
#include "osc.c"
#include "dsm.c"
#include "bitmath.c"
int main(void) {
FILE* fptr;
fptr = fopen("binaryadder.csv", "w+");
size_t SR = 3072000;
size_t len = 65536;
audio amp = .25;
audio freq0 = 1000.0;
audio freq1 = 3000.0;
audio phase = .0;
Sig* in = malloc(sizeof(Sig));
Sig* out = malloc(sizeof(Sig));
sig_alloc(in, 2, len, SR);
sig_alloc(out, 1, len, SR);
sine(SR, amp, freq0, phase, in, 0);
sine(SR, amp, freq1, phase, in, 1);
dsm3(in, in, 0, 0);
dsm3(in, in, 1, 1);
binaryadder(in, in, out, 0, 1, 0);
for (size_t i = 0; i < in->vec_len; i++) {
fprintf(fptr, "%f\n", out->vec_space[0][i]);
}
sig_free(in);
sig_free(out);
fclose(fptr);
return EXIT_SUCCESS;
}
|
GlitterIsMe/gogeardb | gogeardb.c | #include "gogeardb.h"
#include "_cgo_export.h"
leveldb_comparator_t* go_geardb_create_comparator() {
return leveldb_comparator_create(
NULL,
go_geardb_destructor,
(int (*)(void*, const char* a, size_t alen, const char* b, size_t blen))(go_geardb_compare),
(const char* (*)(void*))(go_geardb_name));
} |
GlitterIsMe/gogeardb | gogeardb.h | #include <stdlib.h>
#include "leveldb/c.h"
extern leveldb_comparator_t* go_geardb_create_comparator();
|
Kai-Wolf-SW-Consulting/Paramount | src/base/integral_types.h | // Copyright (c) 2017, <NAME>. All rights reserved.
// Use of this source code is governed by a personal license that can be
// found in the LICENSE file in the top directory.
#ifndef PARAMOUNT_INTEGRAL_TYPES_H
#define PARAMOUNT_INTEGRAL_TYPES_H
#include "base/macros.h"
namespace pmt {
// Following are basic integer type definitions for various platforms including
// Windows, Mac and Linux
// signed integer types with width of 8, 16, 32 or 64 bits respectively
using int8 = signed char;
using int16 = short;
using int32 = int;
#if defined(OS_WINDOWS)
typedef __int64 int64;
#else
using int64 = long long;
#endif
// unsigned integer types with with of 8, 16, 32 or 64 bits respectively
using uint8 = unsigned char;
using uint16 = unsigned short;
using uint32 = unsigned int;
#if defined(OS_WINDOWS)
typedef unsigned __int64 uint64;
#else
using uint64 = unsigned long long;
#endif
// long long macros to be used because gcc and vc++ use different suffixes and
// different size specifiers in format strings
#undef GG_LONGLONG
#undef GG_ULONGLONG
#undef GG_LL_FORMAT
#if defined(OS_WINDOWS)
// long long suffixes for MSVC
# define GG_LONGLONG(x) x##I64
# define GG_ULONGLONG(x) x##UI64
// length modifier in printf format string for int64's (e.g. within %d)
# define GG_LL_FORMAT "I64"
# define GG_LL_FORMAT_W L"I64"
#else
# define GG_LONGLONG(x) x##LL
# define GG_ULONGLONG(x) x##ULL
# define GG_LL_FORMAT "ll"
# define GG_LL_FORMAT_W L"ll"
#endif
static const uint8 kUINT8max = (static_cast<uint8>(0xFF));
static const uint16 kUINT16max = (static_cast<uint16>(0xFFFF));
static const uint32 kUINT32max = ((uint32) 0xFFFFFFFF);
static const uint64 kUINT64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
static const int8 kINT8min = (static_cast<int8>(~0x7F));
static const int8 kINT8max = (static_cast<int8>(0x7F));
static const int16 kINT16min = (static_cast<int16>(~0x7FFF));
static const int16 kINT16max = (static_cast<int16>(0x7FFF));
static const int32 kINT32min = ((int32) ~0x7FFFFFFF);
static const int32 kINT32max = ((int32) 0x7FFFFFFF);
static const int64 kINT64min = ((int64) GG_LONGLONG(~0x7FFFFFFFFFFFFFFF));
static const int64 kINT64max = ((int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
} // namespace pmt
#endif // PARAMOUNT_INTEGRAL_TYPES_H
|
Kai-Wolf-SW-Consulting/Paramount | src/base/callback_impl.h | // Copyright (c) 2017, <NAME>. All rights reserved.
// Use of this source code is governed by a personal license that can be
// found in the LICENSE file in the topdirectory.
#ifndef PARAMOUNT_CALLBACK_IMPL_H
#define PARAMOUNT_CALLBACK_IMPL_H
#include "base/callback_types.h"
#include <type_traits>
namespace pmt {
namespace internal {
template <typename T>
struct ConstRef {
typedef typename ::std::remove_reference<T>::type base_type;
typedef const base_type& type;
};
}
template <bool del, typename RetType, typename Class,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_0_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)() const;
inline ConstMemberResultCallback_0_0(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)();
} else {
RetType result = (instance_->*method_)();
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
};
template <bool del, typename Class>
class ConstMemberResultCallback_0_0<
del, void, Class,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)() const;
inline ConstMemberResultCallback_0_0(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)();
} else {
(instance_->*method_)();
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType>
inline typename ConstMemberResultCallback_0_0<true, RetType, Caller>::base*
MakeCallback(const Caller* instance, RetType (Callee::*method)() const) {
return new ConstMemberResultCallback_0_0<true, RetType, Caller>(instance,
method);
}
template <typename Caller, typename Callee, typename RetType>
inline typename ConstMemberResultCallback_0_0<false, RetType, Caller>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)() const) {
return new ConstMemberResultCallback_0_0<false, RetType, Caller>(instance,
method);
}
template <bool del, typename RetType, typename Class,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_0_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)();
inline MemberResultCallback_0_0(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)();
} else {
RetType result = (instance_->*method_)();
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
};
template <bool del, typename Class>
class MemberResultCallback_0_0<
del, void, Class,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)();
inline MemberResultCallback_0_0(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)();
} else {
(instance_->*method_)();
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType>
inline typename MemberResultCallback_0_0<true, RetType, Caller>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)()) {
return new MemberResultCallback_0_0<true, RetType, Caller>(instance,
method);
}
template <typename Caller, typename Callee, typename RetType>
inline typename MemberResultCallback_0_0<false, RetType, Caller>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)()) {
return new MemberResultCallback_0_0<false, RetType, Caller>(instance,
method);
}
template <bool del, typename RetType>
class FunctionResultCallback_0_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (*Function)();
inline FunctionResultCallback_0_0(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (*function_)();
} else {
RetType result = (*function_)();
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
};
template <bool del>
class FunctionResultCallback_0_0<del, void> : public Callback {
public:
typedef Callback base;
typedef void (*Function)();
inline FunctionResultCallback_0_0(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(*function_)();
} else {
(*function_)();
function_ = nullptr;
delete this;
}
}
private:
Function function_;
};
template <typename RetType>
inline typename FunctionResultCallback_0_0<true, RetType>::base* MakeCallback(
RetType (*function)()) {
return new FunctionResultCallback_0_0<true, RetType>(function);
}
template <typename RetType>
inline typename FunctionResultCallback_0_0<false, RetType>::base*
MakePermanentCallback(RetType (*function)()) {
return new FunctionResultCallback_0_0<false, RetType>(function);
}
template <bool del, typename RetType, typename Class, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_0_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(A1) const;
inline ConstMemberResultCallback_0_1(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(a1);
} else {
RetType result = (instance_->*method_)(a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1>
class ConstMemberResultCallback_0_1<
del, void, Class, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(A1) const;
inline ConstMemberResultCallback_0_1(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(a1);
} else {
(instance_->*method_)(a1);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1>
inline typename ConstMemberResultCallback_0_1<true, RetType, Caller, A1>::base*
MakeCallback(const Caller* instance, RetType (Callee::*method)(A1) const) {
return new ConstMemberResultCallback_0_1<true, RetType, Caller, A1>(
instance, method);
}
template <typename Caller, typename Callee, typename RetType, typename A1>
inline typename ConstMemberResultCallback_0_1<false, RetType, Caller, A1>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(A1) const) {
return new ConstMemberResultCallback_0_1<false, RetType, Caller, A1>(
instance, method);
}
template <bool del, typename RetType, typename Class, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_0_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(A1);
inline MemberResultCallback_0_1(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(a1);
} else {
RetType result = (instance_->*method_)(a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1>
class MemberResultCallback_0_1<
del, void, Class, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(A1);
inline MemberResultCallback_0_1(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(a1);
} else {
(instance_->*method_)(a1);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1>
inline typename MemberResultCallback_0_1<true, RetType, Caller, A1>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(A1)) {
return new MemberResultCallback_0_1<true, RetType, Caller, A1>(instance,
method);
}
template <typename Caller, typename Callee, typename RetType, typename A1>
inline typename MemberResultCallback_0_1<false, RetType, Caller, A1>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)(A1)) {
return new MemberResultCallback_0_1<false, RetType, Caller, A1>(instance,
method);
}
template <bool del, typename RetType, typename A1>
class FunctionResultCallback_0_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (*Function)(A1);
inline FunctionResultCallback_0_1(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (*function_)(a1);
} else {
RetType result = (*function_)(a1);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
};
template <bool del, typename A1>
class FunctionResultCallback_0_1<del, void, A1> : public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (*Function)(A1);
inline FunctionResultCallback_0_1(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(*function_)(a1);
} else {
(*function_)(a1);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
};
template <typename RetType, typename A1>
inline typename FunctionResultCallback_0_1<true, RetType, A1>::base*
MakeCallback(RetType (*function)(A1)) {
return new FunctionResultCallback_0_1<true, RetType, A1>(function);
}
template <typename RetType, typename A1>
inline typename FunctionResultCallback_0_1<false, RetType, A1>::base*
MakePermanentCallback(RetType (*function)(A1)) {
return new FunctionResultCallback_0_1<false, RetType, A1>(function);
}
template <bool del, typename RetType, typename Class, typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_0_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(A1, A2) const;
inline ConstMemberResultCallback_0_2(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(a1, a2);
} else {
RetType result = (instance_->*method_)(a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1, typename A2>
class ConstMemberResultCallback_0_2<
del, void, Class, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(A1, A2) const;
inline ConstMemberResultCallback_0_2(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(a1, a2);
} else {
(instance_->*method_)(a1, a2);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2>
inline
typename ConstMemberResultCallback_0_2<true, RetType, Caller, A1, A2>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(A1, A2) const) {
return new ConstMemberResultCallback_0_2<true, RetType, Caller, A1, A2>(
instance, method);
}
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2>
inline typename ConstMemberResultCallback_0_2<false, RetType, Caller, A1,
A2>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(A1, A2) const) {
return new ConstMemberResultCallback_0_2<false, RetType, Caller, A1, A2>(
instance, method);
}
template <bool del, typename RetType, typename Class, typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_0_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(A1, A2);
inline MemberResultCallback_0_2(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(a1, a2);
} else {
RetType result = (instance_->*method_)(a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1, typename A2>
class MemberResultCallback_0_2<
del, void, Class, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(A1, A2);
inline MemberResultCallback_0_2(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(a1, a2);
} else {
(instance_->*method_)(a1, a2);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2>
inline typename MemberResultCallback_0_2<true, RetType, Caller, A1, A2>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(A1, A2)) {
return new MemberResultCallback_0_2<true, RetType, Caller, A1, A2>(instance,
method);
}
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2>
inline typename MemberResultCallback_0_2<false, RetType, Caller, A1, A2>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)(A1, A2)) {
return new MemberResultCallback_0_2<false, RetType, Caller, A1, A2>(
instance, method);
}
template <bool del, typename RetType, typename A1, typename A2>
class FunctionResultCallback_0_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (*Function)(A1, A2);
inline FunctionResultCallback_0_2(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (*function_)(a1, a2);
} else {
RetType result = (*function_)(a1, a2);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
};
template <bool del, typename A1, typename A2>
class FunctionResultCallback_0_2<del, void, A1, A2> : public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (*Function)(A1, A2);
inline FunctionResultCallback_0_2(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(*function_)(a1, a2);
} else {
(*function_)(a1, a2);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
};
template <typename RetType, typename A1, typename A2>
inline typename FunctionResultCallback_0_2<true, RetType, A1, A2>::base*
MakeCallback(RetType (*function)(A1, A2)) {
return new FunctionResultCallback_0_2<true, RetType, A1, A2>(function);
}
template <typename RetType, typename A1, typename A2>
inline typename FunctionResultCallback_0_2<false, RetType, A1, A2>::base*
MakePermanentCallback(RetType (*function)(A1, A2)) {
return new FunctionResultCallback_0_2<false, RetType, A1, A2>(function);
}
template <bool del, typename RetType, typename Class, typename A1, typename A2,
typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_0_3
: public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(A1, A2, A3) const;
inline ConstMemberResultCallback_0_3(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(a1, a2, a3);
} else {
RetType result = (instance_->*method_)(a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1, typename A2, typename A3>
class ConstMemberResultCallback_0_3<
del, void, Class, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(A1, A2, A3) const;
inline ConstMemberResultCallback_0_3(const Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(a1, a2, a3);
} else {
(instance_->*method_)(a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2, typename A3>
inline typename ConstMemberResultCallback_0_3<true, RetType, Caller, A1, A2,
A3>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(A1, A2, A3) const) {
return new ConstMemberResultCallback_0_3<true, RetType, Caller, A1, A2, A3>(
instance, method);
}
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2, typename A3>
inline typename ConstMemberResultCallback_0_3<false, RetType, Caller, A1, A2,
A3>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(A1, A2, A3) const) {
return new ConstMemberResultCallback_0_3<false, RetType, Caller, A1, A2,
A3>(instance, method);
}
template <bool del, typename RetType, typename Class, typename A1, typename A2,
typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_0_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(A1, A2, A3);
inline MemberResultCallback_0_3(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(a1, a2, a3);
} else {
RetType result = (instance_->*method_)(a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
};
template <bool del, typename Class, typename A1, typename A2, typename A3>
class MemberResultCallback_0_3<
del, void, Class, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(A1, A2, A3);
inline MemberResultCallback_0_3(Class* instance, Method method)
: instance_(instance), method_(method) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(a1, a2, a3);
} else {
(instance_->*method_)(a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
};
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2, typename A3>
inline
typename MemberResultCallback_0_3<true, RetType, Caller, A1, A2, A3>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(A1, A2, A3)) {
return new MemberResultCallback_0_3<true, RetType, Caller, A1, A2, A3>(
instance, method);
}
template <typename Caller, typename Callee, typename RetType, typename A1,
typename A2, typename A3>
inline
typename MemberResultCallback_0_3<false, RetType, Caller, A1, A2, A3>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(A1, A2, A3)) {
return new MemberResultCallback_0_3<false, RetType, Caller, A1, A2, A3>(
instance, method);
}
template <bool del, typename RetType, typename A1, typename A2, typename A3>
class FunctionResultCallback_0_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (*Function)(A1, A2, A3);
inline FunctionResultCallback_0_3(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (*function_)(a1, a2, a3);
} else {
RetType result = (*function_)(a1, a2, a3);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
};
template <bool del, typename A1, typename A2, typename A3>
class FunctionResultCallback_0_3<del, void, A1, A2, A3>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (*Function)(A1, A2, A3);
inline FunctionResultCallback_0_3(Function function)
: function_(function) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(*function_)(a1, a2, a3);
} else {
(*function_)(a1, a2, a3);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
};
template <typename RetType, typename A1, typename A2, typename A3>
inline typename FunctionResultCallback_0_3<true, RetType, A1, A2, A3>::base*
MakeCallback(RetType (*function)(A1, A2, A3)) {
return new FunctionResultCallback_0_3<true, RetType, A1, A2, A3>(function);
}
template <typename RetType, typename A1, typename A2, typename A3>
inline typename FunctionResultCallback_0_3<false, RetType, A1, A2, A3>::base*
MakePermanentCallback(RetType (*function)(A1, A2, A3)) {
return new FunctionResultCallback_0_3<false, RetType, A1, A2, A3>(function);
}
template <bool del, typename RetType, typename Class, typename P1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_1_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1) const;
inline ConstMemberResultCallback_1_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_);
} else {
RetType result = (instance_->*method_)(p1_);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1>
class ConstMemberResultCallback_1_0<
del, void, Class, P1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1) const;
inline ConstMemberResultCallback_1_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_);
} else {
(instance_->*method_)(p1_);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1>
inline typename ConstMemberResultCallback_1_0<true, RetType, Caller, P1>::base*
MakeCallback(const Caller* instance, RetType (Callee::*method)(P1) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_0<true, RetType, Caller, P1>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1>
inline typename ConstMemberResultCallback_1_0<false, RetType, Caller, P1>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_0<false, RetType, Caller, P1>(
instance, method, p1);
}
template <bool del, typename RetType, typename Class, typename P1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_1_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1);
inline MemberResultCallback_1_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_);
} else {
RetType result = (instance_->*method_)(p1_);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1>
class MemberResultCallback_1_0<
del, void, Class, P1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1);
inline MemberResultCallback_1_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_);
} else {
(instance_->*method_)(p1_);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1>
inline typename MemberResultCallback_1_0<true, RetType, Caller, P1>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_0<true, RetType, Caller, P1>(instance,
method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1>
inline typename MemberResultCallback_1_0<false, RetType, Caller, P1>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)(P1),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_0<false, RetType, Caller, P1>(instance,
method, p1);
}
template <bool del, typename RetType, typename P1>
class FunctionResultCallback_1_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (*Function)(P1);
inline FunctionResultCallback_1_0(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (*function_)(p1_);
} else {
RetType result = (*function_)(p1_);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename P1>
class FunctionResultCallback_1_0<del, void, P1> : public Callback {
public:
typedef Callback base;
typedef void (*Function)(P1);
inline FunctionResultCallback_1_0(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(*function_)(p1_);
} else {
(*function_)(p1_);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename RetType, typename P1>
inline typename FunctionResultCallback_1_0<true, RetType, P1>::base*
MakeCallback(RetType (*function)(P1),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_0<true, RetType, P1>(function, p1);
}
template <typename RetType, typename P1>
inline typename FunctionResultCallback_1_0<false, RetType, P1>::base*
MakePermanentCallback(RetType (*function)(P1),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_0<false, RetType, P1>(function, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_1_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, A1) const;
inline ConstMemberResultCallback_1_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, a1);
} else {
RetType result = (instance_->*method_)(p1_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1>
class ConstMemberResultCallback_1_1<
del, void, Class, P1, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, A1) const;
inline ConstMemberResultCallback_1_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, a1);
} else {
(instance_->*method_)(p1_, a1);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1>
inline
typename ConstMemberResultCallback_1_1<true, RetType, Caller, P1, A1>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_1<true, RetType, Caller, P1, A1>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1>
inline typename ConstMemberResultCallback_1_1<false, RetType, Caller, P1,
A1>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_1<false, RetType, Caller, P1, A1>(
instance, method, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_1_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, A1);
inline MemberResultCallback_1_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, a1);
} else {
RetType result = (instance_->*method_)(p1_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1>
class MemberResultCallback_1_1<
del, void, Class, P1, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, A1);
inline MemberResultCallback_1_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, a1);
} else {
(instance_->*method_)(p1_, a1);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1>
inline typename MemberResultCallback_1_1<true, RetType, Caller, P1, A1>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, A1),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_1<true, RetType, Caller, P1, A1>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1>
inline typename MemberResultCallback_1_1<false, RetType, Caller, P1, A1>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)(P1, A1),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_1<false, RetType, Caller, P1, A1>(
instance, method, p1);
}
template <bool del, typename RetType, typename P1, typename A1>
class FunctionResultCallback_1_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (*Function)(P1, A1);
inline FunctionResultCallback_1_1(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (*function_)(p1_, a1);
} else {
RetType result = (*function_)(p1_, a1);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename P1, typename A1>
class FunctionResultCallback_1_1<del, void, P1, A1> : public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (*Function)(P1, A1);
inline FunctionResultCallback_1_1(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(*function_)(p1_, a1);
} else {
(*function_)(p1_, a1);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename RetType, typename P1, typename A1>
inline typename FunctionResultCallback_1_1<true, RetType, P1, A1>::base*
MakeCallback(RetType (*function)(P1, A1),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_1<true, RetType, P1, A1>(function, p1);
}
template <typename RetType, typename P1, typename A1>
inline typename FunctionResultCallback_1_1<false, RetType, P1, A1>::base*
MakePermanentCallback(RetType (*function)(P1, A1),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_1<false, RetType, P1, A1>(function, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_1_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, A1, A2) const;
inline ConstMemberResultCallback_1_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1, typename A2>
class ConstMemberResultCallback_1_2<
del, void, Class, P1, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, A1, A2) const;
inline ConstMemberResultCallback_1_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, a1, a2);
} else {
(instance_->*method_)(p1_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2>
inline typename ConstMemberResultCallback_1_2<true, RetType, Caller, P1, A1,
A2>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1, A2) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_2<true, RetType, Caller, P1, A1, A2>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2>
inline typename ConstMemberResultCallback_1_2<false, RetType, Caller, P1, A1,
A2>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1, A2) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_2<false, RetType, Caller, P1, A1,
A2>(instance, method, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_1_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, A1, A2);
inline MemberResultCallback_1_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1, typename A2>
class MemberResultCallback_1_2<
del, void, Class, P1, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, A1, A2);
inline MemberResultCallback_1_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, a1, a2);
} else {
(instance_->*method_)(p1_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2>
inline
typename MemberResultCallback_1_2<true, RetType, Caller, P1, A1, A2>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, A1, A2),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_2<true, RetType, Caller, P1, A1, A2>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2>
inline
typename MemberResultCallback_1_2<false, RetType, Caller, P1, A1, A2>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, A1, A2),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_2<false, RetType, Caller, P1, A1, A2>(
instance, method, p1);
}
template <bool del, typename RetType, typename P1, typename A1, typename A2>
class FunctionResultCallback_1_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (*Function)(P1, A1, A2);
inline FunctionResultCallback_1_2(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (*function_)(p1_, a1, a2);
} else {
RetType result = (*function_)(p1_, a1, a2);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename P1, typename A1, typename A2>
class FunctionResultCallback_1_2<del, void, P1, A1, A2>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (*Function)(P1, A1, A2);
inline FunctionResultCallback_1_2(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(*function_)(p1_, a1, a2);
} else {
(*function_)(p1_, a1, a2);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename RetType, typename P1, typename A1, typename A2>
inline typename FunctionResultCallback_1_2<true, RetType, P1, A1, A2>::base*
MakeCallback(RetType (*function)(P1, A1, A2),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_2<true, RetType, P1, A1, A2>(function,
p1);
}
template <typename RetType, typename P1, typename A1, typename A2>
inline typename FunctionResultCallback_1_2<false, RetType, P1, A1, A2>::base*
MakePermanentCallback(RetType (*function)(P1, A1, A2),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_2<false, RetType, P1, A1, A2>(function,
p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_1_3
: public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, A1, A2, A3) const;
inline ConstMemberResultCallback_1_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1, typename A2,
typename A3>
class ConstMemberResultCallback_1_3<
del, void, Class, P1, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, A1, A2, A3) const;
inline ConstMemberResultCallback_1_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_1_3<true, RetType, Caller, P1, A1, A2,
A3>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_3<true, RetType, Caller, P1, A1, A2,
A3>(instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_1_3<false, RetType, Caller, P1, A1,
A2, A3>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1) {
return new ConstMemberResultCallback_1_3<false, RetType, Caller, P1, A1, A2,
A3>(instance, method, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename A1,
typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_1_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, A1, A2, A3);
inline MemberResultCallback_1_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename Class, typename P1, typename A1, typename A2,
typename A3>
class MemberResultCallback_1_3<
del, void, Class, P1, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, A1, A2, A3);
inline MemberResultCallback_1_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1)
: instance_(instance), method_(method), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2, typename A3>
inline typename MemberResultCallback_1_3<true, RetType, Caller, P1, A1, A2,
A3>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, A1, A2, A3),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_3<true, RetType, Caller, P1, A1, A2, A3>(
instance, method, p1);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename A1, typename A2, typename A3>
inline typename MemberResultCallback_1_3<false, RetType, Caller, P1, A1, A2,
A3>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, A1, A2, A3),
typename internal::ConstRef<P1>::type p1) {
return new MemberResultCallback_1_3<false, RetType, Caller, P1, A1, A2, A3>(
instance, method, p1);
}
template <bool del, typename RetType, typename P1, typename A1, typename A2,
typename A3>
class FunctionResultCallback_1_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (*Function)(P1, A1, A2, A3);
inline FunctionResultCallback_1_3(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (*function_)(p1_, a1, a2, a3);
} else {
RetType result = (*function_)(p1_, a1, a2, a3);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <bool del, typename P1, typename A1, typename A2, typename A3>
class FunctionResultCallback_1_3<del, void, P1, A1, A2, A3>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (*Function)(P1, A1, A2, A3);
inline FunctionResultCallback_1_3(Function function,
typename internal::ConstRef<P1>::type p1)
: function_(function), p1_(p1) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(*function_)(p1_, a1, a2, a3);
} else {
(*function_)(p1_, a1, a2, a3);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
};
template <typename RetType, typename P1, typename A1, typename A2, typename A3>
inline typename FunctionResultCallback_1_3<true, RetType, P1, A1, A2, A3>::base*
MakeCallback(RetType (*function)(P1, A1, A2, A3),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_3<true, RetType, P1, A1, A2, A3>(
function, p1);
}
template <typename RetType, typename P1, typename A1, typename A2, typename A3>
inline
typename FunctionResultCallback_1_3<false, RetType, P1, A1, A2, A3>::base*
MakePermanentCallback(RetType (*function)(P1, A1, A2, A3),
typename internal::ConstRef<P1>::type p1) {
return new FunctionResultCallback_1_3<false, RetType, P1, A1, A2, A3>(
function, p1);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_2_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1, P2) const;
inline ConstMemberResultCallback_2_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_, p2_);
} else {
RetType result = (instance_->*method_)(p1_, p2_);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2>
class ConstMemberResultCallback_2_0<
del, void, Class, P1, P2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1, P2) const;
inline ConstMemberResultCallback_2_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_, p2_);
} else {
(instance_->*method_)(p1_, p2_);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2>
inline
typename ConstMemberResultCallback_2_0<true, RetType, Caller, P1, P2>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_0<true, RetType, Caller, P1, P2>(
instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2>
inline typename ConstMemberResultCallback_2_0<false, RetType, Caller, P1,
P2>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_0<false, RetType, Caller, P1, P2>(
instance, method, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_2_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1, P2);
inline MemberResultCallback_2_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_, p2_);
} else {
RetType result = (instance_->*method_)(p1_, p2_);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2>
class MemberResultCallback_2_0<
del, void, Class, P1, P2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1, P2);
inline MemberResultCallback_2_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_, p2_);
} else {
(instance_->*method_)(p1_, p2_);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2>
inline typename MemberResultCallback_2_0<true, RetType, Caller, P1, P2>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_0<true, RetType, Caller, P1, P2>(
instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2>
inline typename MemberResultCallback_2_0<false, RetType, Caller, P1, P2>::base*
MakePermanentCallback(Caller* instance, RetType (Callee::*method)(P1, P2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_0<false, RetType, Caller, P1, P2>(
instance, method, p1, p2);
}
template <bool del, typename RetType, typename P1, typename P2>
class FunctionResultCallback_2_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (*Function)(P1, P2);
inline FunctionResultCallback_2_0(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (*function_)(p1_, p2_);
} else {
RetType result = (*function_)(p1_, p2_);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename P1, typename P2>
class FunctionResultCallback_2_0<del, void, P1, P2> : public Callback {
public:
typedef Callback base;
typedef void (*Function)(P1, P2);
inline FunctionResultCallback_2_0(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(*function_)(p1_, p2_);
} else {
(*function_)(p1_, p2_);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename RetType, typename P1, typename P2>
inline typename FunctionResultCallback_2_0<true, RetType, P1, P2>::base*
MakeCallback(RetType (*function)(P1, P2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_0<true, RetType, P1, P2>(function, p1,
p2);
}
template <typename RetType, typename P1, typename P2>
inline typename FunctionResultCallback_2_0<false, RetType, P1, P2>::base*
MakePermanentCallback(RetType (*function)(P1, P2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_0<false, RetType, P1, P2>(function, p1,
p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_2_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, P2, A1) const;
inline ConstMemberResultCallback_2_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1>
class ConstMemberResultCallback_2_1<
del, void, Class, P1, P2, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, P2, A1) const;
inline ConstMemberResultCallback_2_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1);
} else {
(instance_->*method_)(p1_, p2_, a1);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1>
inline typename ConstMemberResultCallback_2_1<true, RetType, Caller, P1, P2,
A1>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_1<true, RetType, Caller, P1, P2, A1>(
instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1>
inline typename ConstMemberResultCallback_2_1<false, RetType, Caller, P1, P2,
A1>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_1<false, RetType, Caller, P1, P2,
A1>(instance, method, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_2_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, P2, A1);
inline MemberResultCallback_2_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1>
class MemberResultCallback_2_1<
del, void, Class, P1, P2, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, P2, A1);
inline MemberResultCallback_2_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1);
} else {
(instance_->*method_)(p1_, p2_, a1);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1>
inline
typename MemberResultCallback_2_1<true, RetType, Caller, P1, P2, A1>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_1<true, RetType, Caller, P1, P2, A1>(
instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1>
inline
typename MemberResultCallback_2_1<false, RetType, Caller, P1, P2, A1>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_1<false, RetType, Caller, P1, P2, A1>(
instance, method, p1, p2);
}
template <bool del, typename RetType, typename P1, typename P2, typename A1>
class FunctionResultCallback_2_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (*Function)(P1, P2, A1);
inline FunctionResultCallback_2_1(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (*function_)(p1_, p2_, a1);
} else {
RetType result = (*function_)(p1_, p2_, a1);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename P1, typename P2, typename A1>
class FunctionResultCallback_2_1<del, void, P1, P2, A1> : public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (*Function)(P1, P2, A1);
inline FunctionResultCallback_2_1(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(*function_)(p1_, p2_, a1);
} else {
(*function_)(p1_, p2_, a1);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename RetType, typename P1, typename P2, typename A1>
inline typename FunctionResultCallback_2_1<true, RetType, P1, P2, A1>::base*
MakeCallback(RetType (*function)(P1, P2, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_1<true, RetType, P1, P2, A1>(function,
p1, p2);
}
template <typename RetType, typename P1, typename P2, typename A1>
inline typename FunctionResultCallback_2_1<false, RetType, P1, P2, A1>::base*
MakePermanentCallback(RetType (*function)(P1, P2, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_1<false, RetType, P1, P2, A1>(function,
p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_2_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, P2, A1, A2) const;
inline ConstMemberResultCallback_2_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1,
typename A2>
class ConstMemberResultCallback_2_2<
del, void, Class, P1, P2, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, P2, A1, A2) const;
inline ConstMemberResultCallback_2_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1, a2);
} else {
(instance_->*method_)(p1_, p2_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2>
inline typename ConstMemberResultCallback_2_2<true, RetType, Caller, P1, P2, A1,
A2>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_2<true, RetType, Caller, P1, P2, A1,
A2>(instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2>
inline typename ConstMemberResultCallback_2_2<false, RetType, Caller, P1, P2,
A1, A2>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_2<false, RetType, Caller, P1, P2, A1,
A2>(instance, method, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_2_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, P2, A1, A2);
inline MemberResultCallback_2_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1,
typename A2>
class MemberResultCallback_2_2<
del, void, Class, P1, P2, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, P2, A1, A2);
inline MemberResultCallback_2_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1, a2);
} else {
(instance_->*method_)(p1_, p2_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2>
inline typename MemberResultCallback_2_2<true, RetType, Caller, P1, P2, A1,
A2>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_2<true, RetType, Caller, P1, P2, A1, A2>(
instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2>
inline typename MemberResultCallback_2_2<false, RetType, Caller, P1, P2, A1,
A2>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_2<false, RetType, Caller, P1, P2, A1, A2>(
instance, method, p1, p2);
}
template <bool del, typename RetType, typename P1, typename P2, typename A1,
typename A2>
class FunctionResultCallback_2_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (*Function)(P1, P2, A1, A2);
inline FunctionResultCallback_2_2(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (*function_)(p1_, p2_, a1, a2);
} else {
RetType result = (*function_)(p1_, p2_, a1, a2);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename P1, typename P2, typename A1, typename A2>
class FunctionResultCallback_2_2<del, void, P1, P2, A1, A2>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (*Function)(P1, P2, A1, A2);
inline FunctionResultCallback_2_2(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(*function_)(p1_, p2_, a1, a2);
} else {
(*function_)(p1_, p2_, a1, a2);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename RetType, typename P1, typename P2, typename A1, typename A2>
inline typename FunctionResultCallback_2_2<true, RetType, P1, P2, A1, A2>::base*
MakeCallback(RetType (*function)(P1, P2, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_2<true, RetType, P1, P2, A1, A2>(
function, p1, p2);
}
template <typename RetType, typename P1, typename P2, typename A1, typename A2>
inline
typename FunctionResultCallback_2_2<false, RetType, P1, P2, A1, A2>::base*
MakePermanentCallback(RetType (*function)(P1, P2, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_2<false, RetType, P1, P2, A1, A2>(
function, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1, typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_2_3
: public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, P2, A1, A2, A3) const;
inline ConstMemberResultCallback_2_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1,
typename A2, typename A3>
class ConstMemberResultCallback_2_3<
del, void, Class, P1, P2, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, P2, A1, A2, A3) const;
inline ConstMemberResultCallback_2_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, p2_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_2_3<true, RetType, Caller, P1, P2, A1,
A2, A3>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_3<true, RetType, Caller, P1, P2, A1,
A2, A3>(instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_2_3<false, RetType, Caller, P1, P2,
A1, A2, A3>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new ConstMemberResultCallback_2_3<false, RetType, Caller, P1, P2, A1,
A2, A3>(instance, method, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename A1, typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_2_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, P2, A1, A2, A3);
inline MemberResultCallback_2_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, p2_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename Class, typename P1, typename P2, typename A1,
typename A2, typename A3>
class MemberResultCallback_2_3<
del, void, Class, P1, P2, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, P2, A1, A2, A3);
inline MemberResultCallback_2_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: instance_(instance), method_(method), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, p2_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, p2_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2, typename A3>
inline typename MemberResultCallback_2_3<true, RetType, Caller, P1, P2, A1, A2,
A3>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_3<true, RetType, Caller, P1, P2, A1, A2,
A3>(instance, method, p1, p2);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename A1, typename A2, typename A3>
inline typename MemberResultCallback_2_3<false, RetType, Caller, P1, P2, A1, A2,
A3>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new MemberResultCallback_2_3<false, RetType, Caller, P1, P2, A1, A2,
A3>(instance, method, p1, p2);
}
template <bool del, typename RetType, typename P1, typename P2, typename A1,
typename A2, typename A3>
class FunctionResultCallback_2_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (*Function)(P1, P2, A1, A2, A3);
inline FunctionResultCallback_2_3(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (*function_)(p1_, p2_, a1, a2, a3);
} else {
RetType result = (*function_)(p1_, p2_, a1, a2, a3);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <bool del, typename P1, typename P2, typename A1, typename A2,
typename A3>
class FunctionResultCallback_2_3<del, void, P1, P2, A1, A2, A3>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (*Function)(P1, P2, A1, A2, A3);
inline FunctionResultCallback_2_3(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2)
: function_(function), p1_(p1), p2_(p2) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(*function_)(p1_, p2_, a1, a2, a3);
} else {
(*function_)(p1_, p2_, a1, a2, a3);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
};
template <typename RetType, typename P1, typename P2, typename A1, typename A2,
typename A3>
inline typename FunctionResultCallback_2_3<true, RetType, P1, P2, A1, A2,
A3>::base*
MakeCallback(RetType (*function)(P1, P2, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_3<true, RetType, P1, P2, A1, A2, A3>(
function, p1, p2);
}
template <typename RetType, typename P1, typename P2, typename A1, typename A2,
typename A3>
inline typename FunctionResultCallback_2_3<false, RetType, P1, P2, A1, A2,
A3>::base*
MakePermanentCallback(RetType (*function)(P1, P2, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2) {
return new FunctionResultCallback_2_3<false, RetType, P1, P2, A1, A2, A3>(
function, p1, p2);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_3_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1, P2, P3) const;
inline ConstMemberResultCallback_3_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3>
class ConstMemberResultCallback_3_0<
del, void, Class, P1, P2, P3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1, P2, P3) const;
inline ConstMemberResultCallback_3_0(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_);
} else {
(instance_->*method_)(p1_, p2_, p3_);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3>
inline typename ConstMemberResultCallback_3_0<true, RetType, Caller, P1, P2,
P3>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_0<true, RetType, Caller, P1, P2, P3>(
instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3>
inline typename ConstMemberResultCallback_3_0<false, RetType, Caller, P1, P2,
P3>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_0<false, RetType, Caller, P1, P2,
P3>(instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_3_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (Class::*Method)(P1, P2, P3);
inline MemberResultCallback_3_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3>
class MemberResultCallback_3_0<
del, void, Class, P1, P2, P3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback {
public:
typedef Callback base;
typedef void (Class::*Method)(P1, P2, P3);
inline MemberResultCallback_3_0(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_);
} else {
(instance_->*method_)(p1_, p2_, p3_);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3>
inline
typename MemberResultCallback_3_0<true, RetType, Caller, P1, P2, P3>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, P3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_0<true, RetType, Caller, P1, P2, P3>(
instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3>
inline
typename MemberResultCallback_3_0<false, RetType, Caller, P1, P2, P3>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, P3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_0<false, RetType, Caller, P1, P2, P3>(
instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename P1, typename P2, typename P3>
class FunctionResultCallback_3_0 : public ResultCallback<RetType> {
public:
typedef ResultCallback<RetType> base;
typedef RetType (*Function)(P1, P2, P3);
inline FunctionResultCallback_3_0(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run() override {
if (!del) {
return (*function_)(p1_, p2_, p3_);
} else {
RetType result = (*function_)(p1_, p2_, p3_);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename P1, typename P2, typename P3>
class FunctionResultCallback_3_0<del, void, P1, P2, P3> : public Callback {
public:
typedef Callback base;
typedef void (*Function)(P1, P2, P3);
inline FunctionResultCallback_3_0(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run() override {
if (!del) {
(*function_)(p1_, p2_, p3_);
} else {
(*function_)(p1_, p2_, p3_);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename RetType, typename P1, typename P2, typename P3>
inline typename FunctionResultCallback_3_0<true, RetType, P1, P2, P3>::base*
MakeCallback(RetType (*function)(P1, P2, P3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_0<true, RetType, P1, P2, P3>(
function, p1, p2, p3);
}
template <typename RetType, typename P1, typename P2, typename P3>
inline typename FunctionResultCallback_3_0<false, RetType, P1, P2, P3>::base*
MakePermanentCallback(RetType (*function)(P1, P2, P3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_0<false, RetType, P1, P2, P3>(
function, p1, p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_3_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1) const;
inline ConstMemberResultCallback_3_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1>
class ConstMemberResultCallback_3_1<
del, void, Class, P1, P2, P3, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, P2, P3, A1) const;
inline ConstMemberResultCallback_3_1(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1>
inline typename ConstMemberResultCallback_3_1<true, RetType, Caller, P1, P2, P3,
A1>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_1<true, RetType, Caller, P1, P2, P3,
A1>(instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1>
inline typename ConstMemberResultCallback_3_1<false, RetType, Caller, P1, P2,
P3, A1>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_1<false, RetType, Caller, P1, P2, P3,
A1>(instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_3_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1);
inline MemberResultCallback_3_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1>
class MemberResultCallback_3_1<
del, void, Class, P1, P2, P3, A1,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (Class::*Method)(P1, P2, P3, A1);
inline MemberResultCallback_3_1(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1>
inline typename MemberResultCallback_3_1<true, RetType, Caller, P1, P2, P3,
A1>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, P3, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_1<true, RetType, Caller, P1, P2, P3, A1>(
instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1>
inline typename MemberResultCallback_3_1<false, RetType, Caller, P1, P2, P3,
A1>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_1<false, RetType, Caller, P1, P2, P3, A1>(
instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename P1, typename P2, typename P3,
typename A1>
class FunctionResultCallback_3_1 : public ResultCallback1<RetType, A1> {
public:
typedef ResultCallback1<RetType, A1> base;
typedef RetType (*Function)(P1, P2, P3, A1);
inline FunctionResultCallback_3_1(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1) override {
if (!del) {
return (*function_)(p1_, p2_, p3_, a1);
} else {
RetType result = (*function_)(p1_, p2_, p3_, a1);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename P1, typename P2, typename P3, typename A1>
class FunctionResultCallback_3_1<del, void, P1, P2, P3, A1>
: public Callback1<A1> {
public:
typedef Callback1<A1> base;
typedef void (*Function)(P1, P2, P3, A1);
inline FunctionResultCallback_3_1(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1) override {
if (!del) {
(*function_)(p1_, p2_, p3_, a1);
} else {
(*function_)(p1_, p2_, p3_, a1);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename RetType, typename P1, typename P2, typename P3, typename A1>
inline typename FunctionResultCallback_3_1<true, RetType, P1, P2, P3, A1>::base*
MakeCallback(RetType (*function)(P1, P2, P3, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_1<true, RetType, P1, P2, P3, A1>(
function, p1, p2, p3);
}
template <typename RetType, typename P1, typename P2, typename P3, typename A1>
inline
typename FunctionResultCallback_3_1<false, RetType, P1, P2, P3, A1>::base*
MakePermanentCallback(RetType (*function)(P1, P2, P3, A1),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_1<false, RetType, P1, P2, P3, A1>(
function, p1, p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_3_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1, A2) const;
inline ConstMemberResultCallback_3_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1, typename A2>
class ConstMemberResultCallback_3_2<
del, void, Class, P1, P2, P3, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, P2, P3, A1, A2) const;
inline ConstMemberResultCallback_3_2(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1, a2);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2>
inline typename ConstMemberResultCallback_3_2<true, RetType, Caller, P1, P2, P3,
A1, A2>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_2<true, RetType, Caller, P1, P2, P3,
A1, A2>(instance, method, p1, p2,
p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2>
inline typename ConstMemberResultCallback_3_2<false, RetType, Caller, P1, P2,
P3, A1, A2>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_2<false, RetType, Caller, P1, P2, P3,
A1, A2>(instance, method, p1, p2,
p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1, typename A2,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_3_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1, A2);
inline MemberResultCallback_3_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1, a2);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1, a2);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1, typename A2>
class MemberResultCallback_3_2<
del, void, Class, P1, P2, P3, A1, A2,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (Class::*Method)(P1, P2, P3, A1, A2);
inline MemberResultCallback_3_2(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1, a2);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1, a2);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2>
inline typename MemberResultCallback_3_2<true, RetType, Caller, P1, P2, P3, A1,
A2>::base*
MakeCallback(Caller* instance, RetType (Callee::*method)(P1, P2, P3, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_2<true, RetType, Caller, P1, P2, P3, A1,
A2>(instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2>
inline typename MemberResultCallback_3_2<false, RetType, Caller, P1, P2, P3, A1,
A2>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_2<false, RetType, Caller, P1, P2, P3, A1,
A2>(instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename P1, typename P2, typename P3,
typename A1, typename A2>
class FunctionResultCallback_3_2 : public ResultCallback2<RetType, A1, A2> {
public:
typedef ResultCallback2<RetType, A1, A2> base;
typedef RetType (*Function)(P1, P2, P3, A1, A2);
inline FunctionResultCallback_3_2(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2) override {
if (!del) {
return (*function_)(p1_, p2_, p3_, a1, a2);
} else {
RetType result = (*function_)(p1_, p2_, p3_, a1, a2);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename P1, typename P2, typename P3, typename A1,
typename A2>
class FunctionResultCallback_3_2<del, void, P1, P2, P3, A1, A2>
: public Callback2<A1, A2> {
public:
typedef Callback2<A1, A2> base;
typedef void (*Function)(P1, P2, P3, A1, A2);
inline FunctionResultCallback_3_2(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2) override {
if (!del) {
(*function_)(p1_, p2_, p3_, a1, a2);
} else {
(*function_)(p1_, p2_, p3_, a1, a2);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename RetType, typename P1, typename P2, typename P3, typename A1,
typename A2>
inline typename FunctionResultCallback_3_2<true, RetType, P1, P2, P3, A1,
A2>::base*
MakeCallback(RetType (*function)(P1, P2, P3, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_2<true, RetType, P1, P2, P3, A1, A2>(
function, p1, p2, p3);
}
template <typename RetType, typename P1, typename P2, typename P3, typename A1,
typename A2>
inline typename FunctionResultCallback_3_2<false, RetType, P1, P2, P3, A1,
A2>::base*
MakePermanentCallback(RetType (*function)(P1, P2, P3, A1, A2),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_2<false, RetType, P1, P2, P3, A1, A2>(
function, p1, p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1, typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class ConstMemberResultCallback_3_3
: public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1, A2, A3) const;
inline ConstMemberResultCallback_3_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1, typename A2, typename A3>
class ConstMemberResultCallback_3_3<
del, void, Class, P1, P2, P3, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, P2, P3, A1, A2, A3) const;
inline ConstMemberResultCallback_3_3(
const Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
const Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_3_3<true, RetType, Caller, P1, P2, P3,
A1, A2, A3>::base*
MakeCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_3<true, RetType, Caller, P1, P2, P3,
A1, A2, A3>(instance, method, p1,
p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2, typename A3>
inline typename ConstMemberResultCallback_3_3<false, RetType, Caller, P1, P2,
P3, A1, A2, A3>::base*
MakePermanentCallback(const Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2, A3) const,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new ConstMemberResultCallback_3_3<false, RetType, Caller, P1, P2, P3,
A1, A2, A3>(instance, method, p1,
p2, p3);
}
template <bool del, typename RetType, typename Class, typename P1, typename P2,
typename P3, typename A1, typename A2, typename A3,
typename OnlyIf =
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
class MemberResultCallback_3_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (Class::*Method)(P1, P2, P3, A1, A2, A3);
inline MemberResultCallback_3_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
} else {
RetType result = (instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
method_ = nullptr;
delete this;
return result;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename Class, typename P1, typename P2, typename P3,
typename A1, typename A2, typename A3>
class MemberResultCallback_3_3<
del, void, Class, P1, P2, P3, A1, A2, A3,
typename ::std::enable_if<::std::is_compound<Class>::value>::type>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (Class::*Method)(P1, P2, P3, A1, A2, A3);
inline MemberResultCallback_3_3(Class* instance, Method method,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: instance_(instance), method_(method), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
} else {
(instance_->*method_)(p1_, p2_, p3_, a1, a2, a3);
method_ = nullptr;
delete this;
}
}
private:
Class* instance_;
Method method_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2, typename A3>
inline typename MemberResultCallback_3_3<true, RetType, Caller, P1, P2, P3, A1,
A2, A3>::base*
MakeCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_3<true, RetType, Caller, P1, P2, P3, A1,
A2, A3>(instance, method, p1, p2, p3);
}
template <typename Caller, typename Callee, typename RetType, typename P1,
typename P2, typename P3, typename A1, typename A2, typename A3>
inline typename MemberResultCallback_3_3<false, RetType, Caller, P1, P2, P3, A1,
A2, A3>::base*
MakePermanentCallback(Caller* instance,
RetType (Callee::*method)(P1, P2, P3, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new MemberResultCallback_3_3<false, RetType, Caller, P1, P2, P3, A1,
A2, A3>(instance, method, p1, p2, p3);
}
template <bool del, typename RetType, typename P1, typename P2, typename P3,
typename A1, typename A2, typename A3>
class FunctionResultCallback_3_3 : public ResultCallback3<RetType, A1, A2, A3> {
public:
typedef ResultCallback3<RetType, A1, A2, A3> base;
typedef RetType (*Function)(P1, P2, P3, A1, A2, A3);
inline FunctionResultCallback_3_3(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
RetType run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
return (*function_)(p1_, p2_, p3_, a1, a2, a3);
} else {
RetType result = (*function_)(p1_, p2_, p3_, a1, a2, a3);
function_ = nullptr;
delete this;
return result;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <bool del, typename P1, typename P2, typename P3, typename A1,
typename A2, typename A3>
class FunctionResultCallback_3_3<del, void, P1, P2, P3, A1, A2, A3>
: public Callback3<A1, A2, A3> {
public:
typedef Callback3<A1, A2, A3> base;
typedef void (*Function)(P1, P2, P3, A1, A2, A3);
inline FunctionResultCallback_3_3(Function function,
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3)
: function_(function), p1_(p1), p2_(p2), p3_(p3) {}
bool isRepeatable() const override {
return !del;
}
void run(A1 a1, A2 a2, A3 a3) override {
if (!del) {
(*function_)(p1_, p2_, p3_, a1, a2, a3);
} else {
(*function_)(p1_, p2_, p3_, a1, a2, a3);
function_ = nullptr;
delete this;
}
}
private:
Function function_;
typename ::std::remove_reference<P1>::type p1_;
typename ::std::remove_reference<P2>::type p2_;
typename ::std::remove_reference<P3>::type p3_;
};
template <typename RetType, typename P1, typename P2, typename P3, typename A1,
typename A2, typename A3>
inline typename FunctionResultCallback_3_3<true, RetType, P1, P2, P3, A1, A2,
A3>::base*
MakeCallback(RetType (*function)(P1, P2, P3, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_3<true, RetType, P1, P2, P3, A1, A2,
A3>(function, p1, p2, p3);
}
template <typename RetType, typename P1, typename P2, typename P3, typename A1,
typename A2, typename A3>
inline typename FunctionResultCallback_3_3<false, RetType, P1, P2, P3, A1, A2,
A3>::base*
MakePermanentCallback(RetType (*function)(P1, P2, P3, A1, A2, A3),
typename internal::ConstRef<P1>::type p1,
typename internal::ConstRef<P2>::type p2,
typename internal::ConstRef<P3>::type p3) {
return new FunctionResultCallback_3_3<false, RetType, P1, P2, P3, A1, A2,
A3>(function, p1, p2, p3);
}
}
#endif // PARAMOUNT_CALLBACK_IMPL_H
|
Kai-Wolf-SW-Consulting/Paramount | include/pmt/for_each_argument.h | // Copyright (c) 2017, <NAME>. All rights reserved.
// Use of this source code is governed by a personal license that can be
// found in the LICENSE file in the top directory.
#ifndef PARAMOUNT_FOR_EACH_ARGUMENT_H
#define PARAMOUNT_FOR_EACH_ARGUMENT_H
#include <iostream>
#include <utility>
namespace pmt {
template <class F, class... Args>
void ForEachArgument(F f, Args &&... args) {
[](...) {}((f(std::forward<Args>(args)), 0)...);
}
template <class F, class... Args>
void ForEachArgumentInOrder(F f, Args &&... args) {
(void) (int[]){(f(std::forward<Args>(args)), 0)...};
}
} // namespace pmt
#endif // PARAMOUNT_FOR_EACH_ARGUMENT_H
|
Kai-Wolf-SW-Consulting/Paramount | src/base/scope_guard.h | // Copyright (c) 2017, <NAME>. All rights reserved.
// Use of this source code is governed by a personal license that can be
// found in the LICENSE file in the top directory.
#ifndef PARAMOUNT_SCOPE_GUARD_H
#define PARAMOUNT_SCOPE_GUARD_H
#include "base/macros.h"
#include <utility>
namespace pmt {
namespace base {
/// This idiom ensures that resources always get released in face of an
/// exception or otherwise not returning normally. |ScopeGuard| can exploit
/// type inference and auto, move semantics as well as lambda functions which
/// can defer any arbitrary code
template <typename Func>
class ScopeGuard {
public:
ScopeGuard() = delete;
ScopeGuard(const ScopeGuard&) = delete;
ScopeGuard& operator=(const ScopeGuard&) = delete;
ScopeGuard(ScopeGuard&& rhs)
: func_(std::move(rhs.func_)), isActive_(rhs.isActive_) {
rhs.dismiss();
}
ScopeGuard(Func func) : func_(std::move(func)), isActive_(true) {}
~ScopeGuard() {
if (isActive_) func_();
}
void dismiss() {
isActive_ = false;
}
private:
Func func_;
bool isActive_;
};
/// This is a classic trick, having a template class, which we want to
/// associate with a template function, because a template function may use
/// type deduction, which the template class is incapable of.
/// Example usage:
/// void fun() {
/// auto buf = malloc(1024 * 1024);
/// auto g1 = scopeGuard([] { free(buf); });
/// // .. use buf here ..
/// }
template <typename Func>
ScopeGuard<Func> scopeGuard(Func func) {
return ScopeGuard<Func>(std::move(func));
}
namespace internal {
enum class ScopeGuardOnExit {};
template <typename Func>
ScopeGuard<Func> operator+(ScopeGuardOnExit, Func&& fn) {
return ScopeGuard<Func>(std::forward<Func>(fn));
}
} // namespace internal
} // namespace base
} // namespace pmt
/// This works as follows: |ANONYMOUS_VARIABLE| creates a variable which
/// shouldn't clash with any other variable in the current scope. This variable
/// gets initialized with |ScopeGuardOnExit| plus an unfinished lambda
/// function. Note that we're not interested in |ScopeGuardOnExit| itself, but
/// only need its type. If |SCOPE_EXIT| is used, the user finishes it with {}
/// and inserts the code, which gets executed when the current scope is left.
/// Example usage:
/// void fun() {
/// char name[] = "/tmp/deleteme.XXXXXX";
/// auto fd = mkstemp(name);
/// SCOPE_EXIT { fclose(fd); unlink(name); };
/// // .. use fd here ..
/// }
#define SCOPE_EXIT \
auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE) = \
pmt::base::internal::ScopeGuardOnExit() + [&]()
#endif // PARAMOUNT_SCOPE_GUARD_H
|
End of preview. Expand
in Dataset Viewer.
YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co./docs/hub/datasets-cards)
This dataset is 10% repo sampled dataset for selected languages. We applied a repo sample rate of 10%. e.g. if sample rate is 10% then we take 10% of all repos for a given language but include all files inside the repo.
This was generated using our codecomplete/training/completions/datagen
./launch.sh \
--dataset-name bigcode/starcoderdata \
--subset c,cpp,go,java,javascript,typescript,python,ruby,scala,sql \
--sample-rate 0.01 \
--hf-token <HF_TOKEN> \
--output-dir /home/${USER}/data \
--cache-dir /home/${USER}/hfcache \
--output-name c-cpp-go-java-javascript-typescript-python-ruby-scala-sql-0.01 \
--shuffle \
--build
Create the repository
# Install git lfs to suport large files
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
# create the dataset repo
huggingface-cli repo create <your_dataset_name> --type dataset --organization codecomplete
e.g.
huggingface-cli repo create base_dataset --type dataset --organization codecomplete
Clone the repository
git lfs install
git clone https://huggingface.co./datasets/<your_organization_name>/<your_dataset_name>
e.g.
git clone https://huggingface.co./datasets/codecomplete/base_dataset
Prepare your files
Create a descriptive README.md and check the dataset.json file
cp /somewhere/base_dataset/*.json .
git lfs track *.json
git add .gitattributes
git add *.json
git add --all
Upload your files
git status
git commit -m "First version of the your_dataset_name dataset."
git push
Verify dataset
from datasets import load_dataset
dataset = load_dataset("codecomplete/<your_dataset_name>")
print(dataset.num_rows)
- Downloads last month
- 15