VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.h@ 37636

Last change on this file since 37636 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/** @file
2 *
3 * VBox Host Guest Shared Memory Interface (HGSMI).
4 * Host part helpers.
5 */
6
7/*
8 * Copyright (C) 2006-2008 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19
20#ifndef __HGSMIHostHlp_h__
21#define __HGSMIHostHlp_h__
22
23#include <iprt/assert.h>
24#include <iprt/types.h>
25
26typedef struct _HGSMILISTENTRY
27{
28 struct _HGSMILISTENTRY *pNext;
29} HGSMILISTENTRY;
30
31typedef struct _HGSMILIST
32{
33 HGSMILISTENTRY *pHead;
34 HGSMILISTENTRY *pTail;
35} HGSMILIST;
36
37void hgsmiListAppend (HGSMILIST *pList, HGSMILISTENTRY *pEntry);
38DECLINLINE(void) hgsmiListPrepend (HGSMILIST *pList, HGSMILISTENTRY *pEntry)
39{
40 HGSMILISTENTRY * pHead = pList->pHead;
41 pList->pHead = pEntry;
42 pEntry->pNext = pHead;
43 if (!pHead)
44 pList->pTail = pEntry;
45}
46
47void hgsmiListRemove (HGSMILIST *pList, HGSMILISTENTRY *pEntry, HGSMILISTENTRY *pPrev);
48
49DECLINLINE(HGSMILISTENTRY*) hgsmiListRemoveHead (HGSMILIST *pList)
50{
51 HGSMILISTENTRY *pHead = pList->pHead;
52 if (pHead)
53 hgsmiListRemove (pList, pHead, NULL);
54 return pHead;
55}
56
57DECLINLINE(bool) hgsmiListIsEmpty (HGSMILIST *pList)
58{
59 return !pList->pHead;
60}
61
62DECLINLINE(void) hgsmiListInit (HGSMILIST *pList)
63{
64 pList->pHead = NULL;
65 pList->pTail = NULL;
66}
67
68HGSMILISTENTRY * hgsmiListRemoveAll (HGSMILIST *pList, HGSMILISTENTRY ** ppTail /* optional */);
69
70DECLINLINE(void) hgsmiListAppendAll (HGSMILIST *pList, HGSMILISTENTRY *pHead, HGSMILISTENTRY *pTail)
71{
72 if(hgsmiListIsEmpty (pList))
73 {
74 pList->pHead = pHead;
75 pList->pTail = pTail;
76 }
77 else
78 {
79 pList->pTail->pNext = pHead;
80 pList->pTail = pTail;
81 }
82}
83
84DECLINLINE(void) hgsmiListPrependAll (HGSMILIST *pList, HGSMILISTENTRY *pHead, HGSMILISTENTRY *pTail)
85{
86 HGSMILISTENTRY *pOldHead = pList->pHead;
87 if(!pOldHead)
88 {
89 pList->pHead = pHead;
90 pList->pTail = pTail;
91 }
92 else
93 {
94 pList->pHead = pHead;
95 pTail->pNext = pOldHead;
96 }
97}
98
99DECLINLINE(void) hgsmiListCat (HGSMILIST *pList, HGSMILIST *pList2)
100{
101 hgsmiListAppendAll (pList, pList2->pHead, pList2->pTail);
102 hgsmiListInit (pList2);
103}
104
105DECLINLINE(void) hgsmiListPrepCat (HGSMILIST *pList, HGSMILIST *pList2)
106{
107 hgsmiListPrependAll (pList, pList2->pHead, pList2->pTail);
108 hgsmiListInit (pList2);
109}
110
111
112#endif /* !__HGSMIHostHlp_h__*/
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette