source: azure_iot_hub/trunk/azure_iothub/c-utility/inc/azure_c_shared_utility/singlylinkedlist.h@ 389

Last change on this file since 389 was 389, checked in by coas-nagasima, 5 years ago

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 3.5 KB
Line 
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#ifndef SINGLYLINKEDLIST_H
5#define SINGLYLINKEDLIST_H
6
7#ifdef __cplusplus
8extern "C" {
9#else
10#include "stdbool.h"
11#endif /* __cplusplus */
12
13#include "azure_c_shared_utility/umock_c_prod.h"
14
15typedef struct SINGLYLINKEDLIST_INSTANCE_TAG* SINGLYLINKEDLIST_HANDLE;
16typedef struct LIST_ITEM_INSTANCE_TAG* LIST_ITEM_HANDLE;
17
18/**
19* @brief Function passed to singlylinkedlist_find, which returns whichever first list item that matches it.
20* @param list_item Current list node being evaluated.
21* @param match_context Context passed to singlylinkedlist_find.
22* @returns True to indicate that the current list node is the one to be returned, or false to continue traversing the list.
23*/
24typedef bool (*LIST_MATCH_FUNCTION)(LIST_ITEM_HANDLE list_item, const void* match_context);
25/**
26* @brief Function passed to singlylinkedlist_remove_if, which is used to define if an item of the list should be removed or not.
27* @param item Value of the current list node being evaluated for removal.
28* @param match_context Context passed to singlylinkedlist_remove_if.
29* @param continue_processing Indicates if singlylinkedlist_remove_if shall continue iterating through the next nodes of the list or stop.
30* @returns True to indicate that the current list node shall be removed, or false to not to.
31*/
32typedef bool (*LIST_CONDITION_FUNCTION)(const void* item, const void* match_context, bool* continue_processing);
33/**
34* @brief Function passed to singlylinkedlist_foreach, which is called for the value of each node of the list.
35* @param item Value of the current list node being processed.
36* @param action_context Context passed to singlylinkedlist_foreach.
37* @param continue_processing Indicates if singlylinkedlist_foreach shall continue iterating through the next nodes of the list or stop.
38*/
39typedef void (*LIST_ACTION_FUNCTION)(const void* item, const void* action_context, bool* continue_processing);
40
41MOCKABLE_FUNCTION(, SINGLYLINKEDLIST_HANDLE, singlylinkedlist_create);
42MOCKABLE_FUNCTION(, void, singlylinkedlist_destroy, SINGLYLINKEDLIST_HANDLE, list);
43MOCKABLE_FUNCTION(, LIST_ITEM_HANDLE, singlylinkedlist_add, SINGLYLINKEDLIST_HANDLE, list, const void*, item);
44MOCKABLE_FUNCTION(, LIST_ITEM_HANDLE, singlylinkedlist_add_head, SINGLYLINKEDLIST_HANDLE, list, const void*, item);
45MOCKABLE_FUNCTION(, int, singlylinkedlist_remove, SINGLYLINKEDLIST_HANDLE, list, LIST_ITEM_HANDLE, item_handle);
46MOCKABLE_FUNCTION(, LIST_ITEM_HANDLE, singlylinkedlist_get_head_item, SINGLYLINKEDLIST_HANDLE, list);
47MOCKABLE_FUNCTION(, LIST_ITEM_HANDLE, singlylinkedlist_get_next_item, LIST_ITEM_HANDLE, item_handle);
48MOCKABLE_FUNCTION(, LIST_ITEM_HANDLE, singlylinkedlist_find, SINGLYLINKEDLIST_HANDLE, list, LIST_MATCH_FUNCTION, match_function, const void*, match_context);
49MOCKABLE_FUNCTION(, const void*, singlylinkedlist_item_get_value, LIST_ITEM_HANDLE, item_handle);
50MOCKABLE_FUNCTION(, int, singlylinkedlist_remove_if, SINGLYLINKEDLIST_HANDLE, list, LIST_CONDITION_FUNCTION, condition_function, const void*, match_context);
51MOCKABLE_FUNCTION(, int, singlylinkedlist_foreach, SINGLYLINKEDLIST_HANDLE, list, LIST_ACTION_FUNCTION, action_function, const void*, action_context);
52
53#ifdef __cplusplus
54}
55#endif /* __cplusplus */
56
57#endif /* SINGLYLINKEDLIST_H */
Note: See TracBrowser for help on using the repository browser.