1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
/*
* File: sort_SimpleCounter_Impl.c
* Symbol: sort.SimpleCounter-v0.1
* Symbol Type: class
* Babel Version: 0.10.2
* Description: Server-side implementation for sort.SimpleCounter
*
* WARNING: Automatically generated; only changes within splicers preserved
*
* babel-version = 0.10.2
*/
/*
* DEVELOPERS ARE EXPECTED TO PROVIDE IMPLEMENTATIONS
* FOR THE FOLLOWING METHODS BETWEEN SPLICER PAIRS.
*/
/*
* Symbol "sort.SimpleCounter" (version 0.1)
*
* Simple counter
*/
#include "sort_SimpleCounter_Impl.h"
#line 26 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter._includes) */
#include <stdlib.h>
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter._includes) */
#line 30 "sort_SimpleCounter_Impl.c"
/*
* Static class initializer called exactly once before any user-defined method is dispatched
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter__load"
void
impl_sort_SimpleCounter__load(
void)
{
#line 41 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter._load) */
/* Insert the implementation of the static class initializer method here... */
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter._load) */
#line 47 "sort_SimpleCounter_Impl.c"
}
/*
* Class constructor called when the class is created.
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter__ctor"
void
impl_sort_SimpleCounter__ctor(
/* in */ sort_SimpleCounter self)
{
#line 56 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter._ctor) */
struct sort_SimpleCounter__data *dptr =
malloc(sizeof(struct sort_SimpleCounter__data));
if (dptr) {
dptr->d_count = 0;
}
sort_SimpleCounter__set_data(self, dptr);
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter._ctor) */
#line 69 "sort_SimpleCounter_Impl.c"
}
/*
* Class destructor called when the class is deleted.
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter__dtor"
void
impl_sort_SimpleCounter__dtor(
/* in */ sort_SimpleCounter self)
{
#line 77 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter._dtor) */
struct sort_SimpleCounter__data *dptr =
sort_SimpleCounter__get_data(self);
if (dptr) {
free((void *)dptr);
}
sort_SimpleCounter__set_data(self, NULL);
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter._dtor) */
#line 92 "sort_SimpleCounter_Impl.c"
}
/*
* Set the count to zero.
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter_reset"
void
impl_sort_SimpleCounter_reset(
/* in */ sort_SimpleCounter self)
{
#line 98 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter.reset) */
struct sort_SimpleCounter__data *dptr =
sort_SimpleCounter__get_data(self);
if (dptr) {
dptr->d_count = 0;
}
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter.reset) */
#line 114 "sort_SimpleCounter_Impl.c"
}
/*
* Return the current count.
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter_getCount"
int32_t
impl_sort_SimpleCounter_getCount(
/* in */ sort_SimpleCounter self)
{
#line 118 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter.getCount) */
struct sort_SimpleCounter__data *dptr =
sort_SimpleCounter__get_data(self);
return dptr ? dptr->d_count : 0;
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter.getCount) */
#line 134 "sort_SimpleCounter_Impl.c"
}
/*
* Increment the count (i.e. add one).
*/
#undef __FUNC__
#define __FUNC__ "impl_sort_SimpleCounter_inc"
int32_t
impl_sort_SimpleCounter_inc(
/* in */ sort_SimpleCounter self)
{
#line 136 "../../../../babel/regression/sort/libC/sort_SimpleCounter_Impl.c"
/* DO-NOT-DELETE splicer.begin(sort.SimpleCounter.inc) */
struct sort_SimpleCounter__data *dptr =
sort_SimpleCounter__get_data(self);
return dptr ? (++(dptr->d_count)) : 0;
/* DO-NOT-DELETE splicer.end(sort.SimpleCounter.inc) */
#line 154 "sort_SimpleCounter_Impl.c"
}
|