VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.h@ 106061

Last change on this file since 106061 was 106061, checked in by vboxsync, 5 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: VBoxMPSa.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2
3/** @file
4 * Sorted array API
5 */
6
7/*
8 * Copyright (C) 2014-2024 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * SPDX-License-Identifier: GPL-3.0-only
27 */
28#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPSa_h
29#define GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPSa_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <iprt/types.h>
35#include <iprt/assert.h>
36
37typedef struct CR_SORTARRAY
38{
39 uint32_t cBufferSize;
40 uint32_t cSize;
41 uint64_t *pElements;
42} CR_SORTARRAY;
43
44
45#ifndef IN_RING0
46# define VBOXSADECL(_type) DECLEXPORT(_type)
47#else
48# define VBOXSADECL(_type) RTDECL(_type)
49#endif
50
51
52DECLINLINE(uint32_t) CrSaGetSize(const CR_SORTARRAY *pArray)
53{
54 return pArray->cSize;
55}
56
57DECLINLINE(uint64_t) CrSaGetVal(const CR_SORTARRAY *pArray, uint32_t i)
58{
59 Assert(i < pArray->cSize);
60 return pArray->pElements[i];
61}
62
63DECLINLINE(const uint64_t*) CrSaGetElements(const CR_SORTARRAY *pArray)
64{
65 return pArray->pElements;
66}
67
68DECLINLINE(void) CrSaClear(CR_SORTARRAY *pArray)
69{
70 pArray->cSize = 0;
71}
72
73VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer);
74VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray);
75/*
76 * @return true if element is found */
77VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element);
78
79/*
80 * @return VINF_SUCCESS if element is added
81 * VINF_ALREADY_INITIALIZED if element was in array already
82 * VERR_NO_MEMORY - no memory
83 * */
84VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element);
85
86/*
87 * @return VINF_SUCCESS if element is removed
88 * VINF_ALREADY_INITIALIZED if element was NOT in array
89 * */
90VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element);
91
92/*
93 * @return VINF_SUCCESS on success
94 * VERR_NO_MEMORY - no memory
95 * */
96VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
97VBOXSADECL(int) CrSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
98
99/*
100 * @return VINF_SUCCESS on success
101 * VERR_NO_MEMORY - no memory
102 * */
103VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
104
105/*
106 * @return VINF_SUCCESS on success
107 * VERR_NO_MEMORY - no memory
108 * */
109VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult);
110
111VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
112
113VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
114
115#endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPSa_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