Skip to content

Commit 00488e8

Browse files
committed
Refactor naming convention in standalone algorithms api.
1 parent 47ee665 commit 00488e8

File tree

1 file changed

+48
-49
lines changed

1 file changed

+48
-49
lines changed

api/NeuroonStandaloneAlgorithmsApi.h

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,32 @@
2929
* Enumeration of circadian events types.
3030
* These are events with a potential to change circadian rhythm of a user.
3131
*/
32-
enum CIRCADIAN_EVENT_TYPE {
33-
NOCTURNAL_SLEEP = 0,
34-
CROSSOVER_SHIFTING_THERAPY,
35-
NAP,
36-
LIGHT_BOOST,
37-
LIGHT_SEEKING,
38-
LIGHT_AVOIDING,
32+
enum ncCircadianEventType {
33+
CET_NOCTURNAL_SLEEP = 0,
34+
CET_CROSSOVER_SHIFTING_THERAPY,
35+
CET_NAP,
36+
CET_LIGHT_BOOST,
37+
CET_LIGHT_SEEKING,
38+
CET_LIGHT_AVOIDING,
3939
};
4040

4141
/**
4242
* @struct Struct representing a circadian event instance.
4343
* These are events with a potential to change circadian rhythm
4444
* of a user.
4545
*/
46-
struct circadian_rhythm_event_t {
47-
CIRCADIAN_EVENT_TYPE type;
48-
unix_timestamp start;
49-
unix_timestamp end;
46+
struct ncCircadianRhythmEvent {
47+
ncCircadianEventType type;
48+
ncUnixTimestamp start;
49+
ncUnixTimestamp end;
5050
};
5151

5252
/**
5353
* @brief Estimates crossover point based on a usual wake up time of a user.
5454
* @param[out] usual_wake_up_time Hour and minutes of a usual wake-up.
5555
* @return Hour and minutes of estimated crossoverpoint.
5656
*/
57-
day_time_instant_t
58-
estimate_crossover_time(day_time_instant_t usual_wake_up_time);
57+
ncDayTimeInstant ncEstimateCrossoverTime(ncDayTimeInstant usual_wake_up_time);
5958

6059
/**
6160
* @brief Computes crossover point using data about biorhythm affecting events.
@@ -69,27 +68,27 @@ estimate_crossover_time(day_time_instant_t usual_wake_up_time);
6968
* @remark new_biorhythm_events should containt events passed
7069
* SINCE LAST CROSSOVER COMPUTATION.
7170
*/
72-
day_time_instant_t
73-
calculate_crossover_point(day_time_instant_t current_crossover,
74-
circadian_rhythm_event_t *new_biorhythm_events);
71+
ncDayTimeInstant
72+
ncCalculateCrossoverPoint(ncDayTimeInstant current_crossover,
73+
ncCircadianRhythmEvent *new_biorhythm_events);
7574

7675
// -------------------- Perfect napping schedule ------------------------------
7776

7877
/**
7978
* @struct A structure aggregating results from napping schedule computation.
8079
*/
81-
struct napping_schedule_t {
82-
day_time_instant_t power_nap_interval_start;
83-
day_time_instant_t power_nap_interval_end;
80+
struct ncNappingSchedule {
81+
ncDayTimeInstant power_nap_interval_start;
82+
ncDayTimeInstant power_nap_interval_end;
8483

85-
day_time_instant_t body_nap_interval_start;
86-
day_time_instant_t body_nap_interval_end;
84+
ncDayTimeInstant body_nap_interval_start;
85+
ncDayTimeInstant body_nap_interval_end;
8786

88-
day_time_instant_t rem_nap_interval_start;
89-
day_time_instant_t rem_nap_interval_end;
87+
ncDayTimeInstant rem_nap_interval_start;
88+
ncDayTimeInstant rem_nap_interval_end;
9089

91-
day_time_instant_t ultimate_nap_interval_start;
92-
day_time_instant_t ultimate_nap_interval_end;
90+
ncDayTimeInstant ultimate_nap_interval_start;
91+
ncDayTimeInstant ultimate_nap_interval_end;
9392
};
9493

9594
/**
@@ -101,18 +100,18 @@ struct napping_schedule_t {
101100
* affect the body clock.
102101
* @return Hour and minutes of computed crossoverpoint.
103102
*/
104-
napping_schedule_t
105-
compute_napping_schedule(day_time_instant_t current_crossover,
106-
circadian_rhythm_event_t *recent_biorhythm_events,
107-
staging_element_t **recent_nocturnal_sleeps);
103+
ncNappingSchedule
104+
compute_napping_schedule(ncDayTimeInstant current_crossover,
105+
ncCircadianRhythmEvent *recent_biorhythm_events,
106+
ncStagingElement **recent_nocturnal_sleeps);
108107

109108
// -------------------- Jetlag progress computation
110109
// ----------------------------
111110

112111
/**
113112
* @enum Directions of a flight.
114113
*/
115-
enum DIRECTION { EASTWARDS, WESTWARDS };
114+
enum ncFlightDirection { FD_EASTWARDS, FD_WESTWARDS };
116115

117116
/**
118117
* @struct This structure contains all the data the library needs about jetlag
@@ -127,28 +126,28 @@ enum DIRECTION { EASTWARDS, WESTWARDS };
127126
* The data can also be serialised to and from byte-string.
128127
*/
129128

130-
struct JetLagTherapyState;
129+
struct ncJetLagTherapyState;
131130

132131
/** @struct This structure holds public data of a jet lag therapy.
133132
*/
134-
struct jet_lag_therapy_info_t {
133+
struct ncJetLagTherapyInfo {
135134
/** When the first event will be scheduled by the therapy */
136-
unix_timestamp therapy_start;
135+
ncUnixTimestamp therapy_start;
137136

138137
/** The therapy estimated end date. This may change should the usser
139138
* does not make use of therapy events. */
140-
unix_timestamp therapy_end;
139+
ncUnixTimestamp therapy_end;
141140

142141
/** An immutable date passed when the therapy got created */
143-
unix_timestamp flight_date;
142+
ncUnixTimestamp flight_date;
144143

145144
/** An immutable date of a return flight. If its
146145
* earlier than flight date the algorithm will
147146
* assume that no return is planned. */
148-
unix_timestamp return_date;
147+
ncUnixTimestamp return_date;
149148

150149
/** Direction of the flight. */
151-
DIRECTION flight_direction;
150+
ncFlightDirection flight_direction;
152151

153152
/** Difference between timezones in hours.
154153
* Should be no less than 3 hour.. */
@@ -177,10 +176,10 @@ struct jet_lag_therapy_info_t {
177176
* @return Pointer containing entire state of jetlag therapy. Do not modify it
178177
* and use it as a token to jet lag therapy api functions.
179178
*/
180-
JetLagTherapyState *create_jetlag_therapy(unix_timestamp flight_date,
181-
unix_timestamp return_date,
182-
DIRECTION flight_direction,
183-
unsigned char timezone_difference);
179+
ncJetLagTherapyState *ncCreateJetlagTherapy(ncUnixTimestamp flight_date,
180+
ncUnixTimestamp return_date,
181+
ncFlightDirection flight_direction,
182+
unsigned char timezone_difference);
184183

185184
/**
186185
*
@@ -194,22 +193,22 @@ JetLagTherapyState *create_jetlag_therapy(unix_timestamp flight_date,
194193
*
195194
*
196195
*/
197-
void destroy_jet_lag_therapy(JetLagTherapyState *therapy);
196+
void ncDestroyJetLagTherapy(ncJetLagTherapyState *therapy);
198197

199198
/** This function provides main functionality of jetlag therapy
200199
* by returning schedule of upcoming therapy events within nearest 24h.
201200
*
202201
* @param[in] therapy Therapy state instance.
203-
* @param[in] unix_timestamp Time of calling this function.
202+
* @param[in] ncUnixTimestamp Time of calling this function.
204203
* @param[in] current_crossover Current and up-to-date cross-over point.
205204
*
206205
* @return Newly allocated array of sheduled events.
207206
*
208207
* @remark Always pass up-to-date crossover point.
209208
*/
210-
circadian_rhythm_event_t *
211-
get_jetlag_events(JetLagTherapyState *state,
212-
day_time_instant_t current_crossover, unix_timestamp now);
209+
ncCircadianRhythmEvent *ncGetJetlagEvents(ncJetLagTherapyState *state,
210+
ncDayTimeInstant current_crossover,
211+
ncUnixTimestamp now);
213212

214213
/** @brief Get public therapy information.
215214
* @remark Part of fields may change after updating the therapy with
@@ -220,21 +219,21 @@ get_jetlag_events(JetLagTherapyState *state,
220219
* @return Information about passed therapy.
221220
*/
222221

223-
jet_lag_therapy_info_t get_jetlag_therapy_info(JetLagTherapyState *therapy);
222+
ncJetLagTherapyInfo getJetlagTherapyInfo(ncJetLagTherapyState *therapy);
224223

225224
/** Encodes jet lag therapy as a byte string.
226225
*
227226
* @return Pointer to the newly allocated array of charts containing the
228227
* encoded therapy.
229228
*/
230-
char *serialize_jetlag_therapy(JetLagTherapyState *state);
229+
char *ncSerializeJetlagTherapy(ncJetLagTherapyState *state);
231230

232231
/** Deserializes byte string to the before-encoded jet lag therapy state.
233232
*
234233
* @return Pointer containing entire state of jetlag therapy. Do not modify it
235234
* and use it as a token to jet lag therapy api functions.
236235
* Or null if there was a problem with deserialization.
237236
*/
238-
JetLagTherapyState *deserialize_jetlag_therapy(char *serialized_therapy);
237+
ncJetLagTherapyState *ncDeserializeJetlagTherapy(char *serialized_therapy);
239238

240239
#endif

0 commit comments

Comments
 (0)