-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
md5sum a.out 8191e56ee56845255c053bdc927a66b1 a.out Created implementation of heatmap model. To be honest, I'm not happy with name of the model, it's a piece of the heatmap so I want to call it something better. Like heatzone, or heatpoint, or something. But I'm not sure what I would call it. IntensitySpot? For now, heatmap works well. Updated MakeFile to reflect new model file, and changed the linker to just do *.o so I don't have to keep updating the linking portion. While it does pay to be explicit about these things, I'm throwing everything into one obj folder so it's not really a problem. I don't do any partial compilation and linking either so all is good. Although it might be interesting to try to do that. Another thing to note is that the setId functions are all the same really, same with setting scope Id. I don't think there's a way to do inheritance in C (easily at least, function pointers?). But this would be the time for it I guess. I wonder if doing it as a generic struct with an id field and doing a cast would allow me to do it.
- Loading branch information
1 parent
4144337
commit 549d76d
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <string.h> | ||
#include "models/heatmap.h" | ||
|
||
/* Any functions specifically working with just gs_marker: */ | ||
void gs_mheatmap_setId(long id, struct gs_heatmap * gsh){ | ||
gsh->id = id; | ||
} | ||
|
||
void gs_heatmap_setIntensity(long intensity, struct gs_heatmap * gsh){ | ||
gsh->intensity = intensity; | ||
} | ||
|
||
void gs_heatmap_setScopeId(long scopeId, struct gs_heatmap * gsh){ | ||
gsh->scopeId = scopeId; | ||
} | ||
|
||
/* Will truncate to 19 characters */ | ||
void gs_heatmap_setCreatedTime(char * createdTime, struct gs_heatmap * gsh){ | ||
strncpy(gsh->createdTime, createdTime, GS_HEATMAP_CREATED_TIME_LENGTH); | ||
} | ||
|
||
void gs_heatmap_setLongitude(Decimal longitude, struct gs_heatmap * gsh){ | ||
gsh->longitude = longitude; | ||
} | ||
|
||
void gs_heatmap_setLatitude(Decimal latitude, struct gs_heatmap * gsh){ | ||
gsh->latitude = latitude; | ||
} | ||
|
||
|
||
/* Empties a marker structure of data and sets flag values */ | ||
void gs_heatmap_ZeroStruct(struct gs_heatmap * gsh){ | ||
bzero(gsh->createdTime, GS_HEATMAP_CREATED_TIME_LENGTH+1); | ||
gsh->id = GS_HEATMAP_INVALID_ID; | ||
gsh->intensity = 0; | ||
/* 0 is actually a good 'invalid' or default for the right | ||
* side because if someone gives just 1. or 1 to a string | ||
* parsing function and we only set the left, the right is | ||
* still correct! | ||
*/ | ||
gsh->longitude.left = 0; | ||
gsh->longitude.right = 0; | ||
gsh->latitude.left = 0; | ||
gsh->latitude.right = 0; | ||
} |