tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pair.h
Go to the documentation of this file.
1 /* =============================================================================
2  *
3  * pair.h
4  *
5  * =============================================================================
6  *
7  * Copyright (C) Stanford University, 2006. All Rights Reserved.
8  * Author: Chi Cao Minh
9  *
10  * =============================================================================
11  *
12  * For the license of bayes/sort.h and bayes/sort.c, please see the header
13  * of the files.
14  *
15  * ------------------------------------------------------------------------
16  *
17  * For the license of kmeans, please see kmeans/LICENSE.kmeans
18  *
19  * ------------------------------------------------------------------------
20  *
21  * For the license of ssca2, please see ssca2/COPYRIGHT
22  *
23  * ------------------------------------------------------------------------
24  *
25  * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
26  * header of the files.
27  *
28  * ------------------------------------------------------------------------
29  *
30  * For the license of lib/rbtree.h and lib/rbtree.c, please see
31  * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
32  *
33  * ------------------------------------------------------------------------
34  *
35  * Unless otherwise noted, the following license applies to STAMP files:
36  *
37  * Copyright (c) 2007, Stanford University
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions are
42  * met:
43  *
44  * * Redistributions of source code must retain the above copyright
45  * notice, this list of conditions and the following disclaimer.
46  *
47  * * Redistributions in binary form must reproduce the above copyright
48  * notice, this list of conditions and the following disclaimer in
49  * the documentation and/or other materials provided with the
50  * distribution.
51  *
52  * * Neither the name of Stanford University nor the names of its
53  * contributors may be used to endorse or promote products derived
54  * from this software without specific prior written permission.
55  *
56  * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
57  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
60  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
61  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
62  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
64  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
66  * THE POSSIBILITY OF SUCH DAMAGE.
67  *
68  * =============================================================================
69  */
70 
71 
72 #ifndef PAIR_H
73 #define PAIR_H 1
74 
75 #include "tm.h"
76 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 
82 typedef struct pair {
83  void* firstPtr;
84  void* secondPtr;
85 } pair_t;
86 
87 
88 /* =============================================================================
89  * pair_alloc
90  * -- Returns NULL if failure
91  * =============================================================================
92  */
93 pair_t*
94 pair_alloc (void* firstPtr, void* secondPtr);
95 
96 
97 /* =============================================================================
98  * Ppair_alloc
99  * -- Returns NULL if failure
100  * =============================================================================
101  */
102 pair_t*
103 Ppair_alloc (void* firstPtr, void* secondPtr);
104 
105 
106 /* =============================================================================
107  * TMpair_alloc
108  * -- Returns NULL if failure
109  * =============================================================================
110  */
111 pair_t*
112 TMpair_alloc (TM_ARGDECL void* firstPtr, void* secondPtr);
113 
114 
115 /* =============================================================================
116  * pair_free
117  * =============================================================================
118  */
119 void
120 pair_free (pair_t* pairPtr);
121 
122 
123 /* =============================================================================
124  * Ppair_free
125  * =============================================================================
126  */
127 void
128 Ppair_free (pair_t* pairPtr);
129 
130 
131 /* =============================================================================
132  * TMpair_free
133  * =============================================================================
134  */
135 void
136 TMpair_free (TM_ARGDECL pair_t* pairPtr);
137 
138 
139 /* =============================================================================
140  * pair_swap
141  * -- Exchange 'firstPtr' and 'secondPtr'
142  * =============================================================================
143  */
144 void
145 pair_swap (pair_t* pairPtr);
146 
147 
148 #define PPAIR_ALLOC(f,s) Ppair_alloc(f, s)
149 #define PPAIR_FREE(p) Ppair_free(p)
150 
151 #define TMPAIR_ALLOC(f,s) TMpair_alloc(TM_ARG f, s)
152 #define TMPAIR_FREE(p) TMpair_free(TM_ARG p)
153 
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 
160 #endif /* PAIR_H */
161 
162 
163 /* =============================================================================
164  *
165  * End of pair.h
166  *
167  * =============================================================================
168  */
void Ppair_free(pair_t *pairPtr)
Definition: pair.c:153
pair_t * TMpair_alloc(TM_ARGDECL void *firstPtr, void *secondPtr)
Definition: pair.c:123
void TMpair_free(TM_ARGDECL pair_t *pairPtr)
Definition: pair.c:164
void * firstPtr
Definition: pair.h:83
struct pair pair_t
void * secondPtr
Definition: pair.h:84
pair_t * Ppair_alloc(void *firstPtr, void *secondPtr)
Definition: pair.c:103
pair_t * pair_alloc(void *firstPtr, void *secondPtr)
Definition: pair.c:83
#define TM_ARGDECL
Definition: tm.h:532
void pair_swap(pair_t *pairPtr)
Definition: pair.c:176
void pair_free(pair_t *pairPtr)
Definition: pair.c:142
Definition: pair.h:82