Open
Conversation
shifi325
commented
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
| #include "Cache_Mng.h" | ||
| //get 2 points from Master , return all the images pointers in this range | ||
|
|
||
| int** cache_getImagesPointersInRangeFromMaster(Point_t topLeft, Point_t buttomRight); |
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
| CacheByImageId_t* cache_ByImageId; | ||
| CacheEmptyAddresses_t* cache_EmptyAddresses; | ||
| CallSource sourceForAPICall; | ||
| int** ram; |
sariDaitch
reviewed
Sep 12, 2024
| void ram_initialize(); | ||
|
|
||
| //cache_getRange_internal-get 2 points ,Fetches image pointers in the given range from cache or loads them from disk if not present. | ||
| int ** cache_getRange_internal(Point_t topLeft, Point_t bottomRight); |
Collaborator
There was a problem hiding this comment.
check if need to be changed to int *
sariDaitch
reviewed
Sep 12, 2024
| int ** cache_getRange_internal(Point_t topLeft, Point_t bottomRight); | ||
|
|
||
| //cache_TreatmentOfReturningAnswers-get images pointers in range,returns to each the requested answer | ||
| int ** cache_TreatmentOfReturningAnswers(Point_t topLeft, Point_t bottomRight,int** imagePointersInCache); |
Collaborator
There was a problem hiding this comment.
change the return to the address of the array
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
| { | ||
| if (node!=NULL) | ||
| { | ||
| if (node == cache_mng_CB->cache_LRU->head) { |
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
| { | ||
| free(hashInfo); | ||
| } | ||
| void queue_initialize() |
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 12, 2024
sariDaitch
reviewed
Sep 15, 2024
| } | ||
|
|
||
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) |
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); |
Collaborator
There was a problem hiding this comment.
change the name to hashTableIndex
| void hashTable_delete(HashInfo_t* hashInfo) { | ||
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); |
Collaborator
There was a problem hiding this comment.
change the name for the hash table function
| if (hashInfo!=NULL) | ||
| { | ||
| int index = hashTable_function(hashInfo->imageId); | ||
| HashInfo_t* hashInfo1 = cache_mng_CB->cache_ByImageId->entries[index]; |
Collaborator
There was a problem hiding this comment.
change the name : correct entree
| int index = hashTable_function(hashInfo->imageId); | ||
| HashInfo_t* hashInfo1 = cache_mng_CB->cache_ByImageId->entries[index]; | ||
| HashInfo_t* prevHashInfo = NULL; | ||
| while (hashInfo1 != NULL) |
Collaborator
There was a problem hiding this comment.
add function to delete the spesific entree in hash table
| } | ||
| else | ||
| { | ||
| linkedList_moveToHead(hashInfo->linkPointer);//when we access a member in the list, it moves to the top priority (LRU) |
| void cache_deleteImageByLRU() | ||
| { | ||
| LinkedListNode_t* lruPointer; | ||
| for (int i = 0; i < CACHE_SIZE / 10; i++)//loop on 10% from the tail |
Collaborator
There was a problem hiding this comment.
moov the calc to out of the loop
| for (int i = 0; i < CACHE_SIZE / 10; i++)//loop on 10% from the tail | ||
| { | ||
| lruPointer = cache_mng_CB->cache_LRU->tail; | ||
| if (lruPointer!=NULL) |
| } | ||
| HashInfo_t* cache_addImageToTheCacheMapping(int imageId) | ||
| { | ||
| LinkedListNode_t* newLinkedListNode = node_create();//create new node for the linked list |
Collaborator
There was a problem hiding this comment.
add declaration to all the variables
| cache_mng_CB = (Cache_Management_CB_t*)allocate_memory(sizeof(Cache_Management_CB_t), "Failed to allocate memory for cache control block", Error_When_Allocating_Memory_Space, "cache_initialize_CB"); | ||
| } | ||
|
|
||
| void cache_initialize() |
Collaborator
There was a problem hiding this comment.
explain that cache_initialize the data and control
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.