VirtualBox

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

Last change on this file since 89361 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: VBoxMPSa.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2
3/** @file
4 * Sorted array API
5 */
6
7/*
8 * Copyright (C) 2014-2020 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#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPSa_h
19#define GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPSa_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/types.h>
25#include <iprt/assert.h>
26
27typedef struct CR_SORTARRAY
28{
29 uint32_t cBufferSize;
30 uint32_t cSize;
31 uint64_t *pElements;
32} CR_SORTARRAY;
33
34
35#ifndef IN_RING0
36# define VBOXSADECL(_type) DECLEXPORT(_type)
37#else
38# define VBOXSADECL(_type) RTDECL(_type)
39#endif
40
41
42DECLINLINE(uint32_t) CrSaGetSize(const CR_SORTARRAY *pArray)
43{
44 return pArray->cSize;
45}
46
47DECLINLINE(uint64_t) CrSaGetVal(const CR_SORTARRAY *pArray, uint32_t i)
48{
49 Assert(i < pArray->cSize);
50 return pArray->pElements[i];
51}
52
53DECLINLINE(const uint64_t*) CrSaGetElements(const CR_SORTARRAY *pArray)
54{
55 return pArray->pElements;
56}
57
58DECLINLINE(void) CrSaClear(CR_SORTARRAY *pArray)
59{
60 pArray->cSize = 0;
61}
62
63VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer);
64VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray);
65/*
66 * @return true if element is found */
67VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element);
68
69/*
70 * @return VINF_SUCCESS if element is added
71 * VINF_ALREADY_INITIALIZED if element was in array already
72 * VERR_NO_MEMORY - no memory
73 * */
74VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element);
75
76/*
77 * @return VINF_SUCCESS if element is removed
78 * VINF_ALREADY_INITIALIZED if element was NOT in array
79 * */
80VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element);
81
82/*
83 * @return VINF_SUCCESS on success
84 * VERR_NO_MEMORY - no memory
85 * */
86VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
87VBOXSADECL(int) CrSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
88
89/*
90 * @return VINF_SUCCESS on success
91 * VERR_NO_MEMORY - no memory
92 * */
93VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
94
95/*
96 * @return VINF_SUCCESS on success
97 * VERR_NO_MEMORY - no memory
98 * */
99VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult);
100
101VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
102
103VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
104
105#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