/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/Map.h

  • Committer: Gustav Hartvigsson
  • Date: 2017-01-24 20:55:19 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20170124205519-gtr18o3dwbunrrnx
* Fixed the tests in the CMake file
* Made doxygen output static declarations.
* Started work on SApplication
* Played with BaseN.c
  * Now it is a lil' bit better
* Spilt defs.h
  * Added types.h
    * Started work on the full typesystem.
      (Still needs testing)
  * Added primes.[c,h]
    * Contains some static array with primes.
      ("Good" primes, and all primes up to 5 000.
    * And helper functions related to Primes (Needs Tests).
* fixed s_dynamic_array_dump_array.
  (The old version did not make much sense)
* removed some functions from DymanicArray.c
* fixed compiler warnings in Mainloop.c
* removed s_map_(de)serialize_json functions.
* Made s_thread_status_get_name be less prone to error
  (This due to the C11 standard not specifing what these
   values should be)
* fixed s_thread_run
* fixed s_threa_stop

  TODO:
* Write tests for the s_prime_* functions
* Write tests for the s_type_* functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 * An SMap is a data structure that holds many mappings of objects to objects:
41
41
 * say, a string to an other string. This can be likened to the Dict structure
42
42
 * in python, but not fully.
43
 
 * 
 
43
 *
44
44
 * An SMap is made up of SMapItems, each MapItem holds two pointers to data.
45
45
 * The first pointer is the key, the secold is the value.
46
46
 *
55
55
 
56
56
/** @brief
57
57
 * An SMap is a map many SMapItems. Mapping between a key and a value.
58
 
 * 
 
58
 *
59
59
 * An SMap is not dependent on SObject, because it should be more generic
60
60
 * and have the ability to be used more easily in other SObject based classes
61
61
 * without causing circular dependencies.
95
95
 
96
96
/** @breif
97
97
 * Frees a SMapItem.
98
 
 * 
 
98
 *
99
99
 * @param self the item to be freed.
100
100
 * @param free_key The function to be used to free the key.
101
101
 * @param free_value The function to be used to free the value.
133
133
 
134
134
/** @breif
135
135
 * This function frees an instance of an SMap.
136
 
 * 
 
136
 *
137
137
 * @param self the object to free.
138
138
 */
139
139
S_EXPORTED
142
142
 
143
143
/** @breif
144
144
 * This function adds a key/value pair to an SMap.
145
 
 * 
 
145
 *
146
146
 * @param self the SMap to add the key/value pair to.
147
147
 * @param key the key that is used to
148
148
 *
155
155
 
156
156
/** @breif
157
157
 * Get a value using using a key.
158
 
 * 
 
158
 *
159
159
 * @param self the SMap that you want to retrieve a value from.
160
160
 * @param key the key that you use to retrieve the value from the SMap from
161
161
 *            with.
170
170
s_map_get_item (SMap * self, spointer key);
171
171
 
172
172
/**
173
 
 * This function removes an item from 
 
173
 * This function removes an item from
174
174
 */
175
175
S_EXPORTED
176
176
void
194
194
void
195
195
s_map_for_each (SMap * self, ForEachFunc foreach_func, spointer user_data);
196
196
 
197
 
/**
198
 
 * @TODO
199
 
 * @warning NOT IMPLIED
200
 
 *
201
 
 * Get the map as JSON.
202
 
 * @param self The SMap to get the JSON from.
203
 
 * @param to_json_key Functon to 
204
 
 *
205
 
 * @return a null-terminated JSON string representing the matrix.
206
 
 *
207
 
 * The outputted JSON will have the format:
208
 
 @code{.js}
209
 
{
210
 
  "Cats": "Meew",
211
 
  "Dogs": "Bark",
212
 
  "Cows": "Moo"
213
 
}
214
 
 @endcode
215
 
 */
216
 
S_EXPORTED
217
 
char *
218
 
s_map_serialize_json (SMap * self,
219
 
                      FuncPointer to_json_key,
220
 
                      FuncPointer to_json_value);
221
 
 
222
 
/**
223
 
 * @TODO
224
 
 * @warning NOT IMPLIED
225
 
 *
226
 
 * Deselialize JSON into an SMap.
227
 
 *
228
 
 * This will append the key/value pair to the map, with the caviat that 
229
 
 *
230
 
 * @param self The SMap to write to.
231
 
 * @param data the JSON data to be deselialised.
232
 
 */
233
 
S_EXPORTED
234
 
void
235
 
s_map_deserialize_json (SMap * self ,const char * data,
236
 
                        FuncPointer from_json_key,
237
 
                        FuncPointer from_json_value);
238
197
 
239
198
/** @} */
240
199