AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ShareHandle.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17
18#ifndef AGXDATA_SHARE_HANDLE_H
19#define AGXDATA_SHARE_HANDLE_H
20
21
22#include <agx/agxCore_export.h>
23#include <agx/Vector.h>
24#include <agx/Referenced.h>
25#include <agx/SymmetricPair.h>
26
27namespace agxData
28{
29 class Buffer;
30
33 {
34 public:
37
38 public:
40
41 void addBuffer(Buffer *buffer);
42
43 Buffer *getActiveBuffer();
44 const Buffer *getActiveBuffer() const;
45
46 void activate(Buffer* buffer);
47 void removeBuffer(Buffer *buffer);
48
49 void reinit();
50
51 protected:
52 virtual ~ShareHandle();
53
54 public:
55 typedef void (*ActivationFn)(Buffer *activationTarget, Buffer *currentHolder);
57
60 {
61 public:
63 virtual ~PlatformBridge();
64
65 virtual void init(Buffer *buffer1, Buffer *buffer2);
67
68 DevicePairDescriptor getDescriptor() const;
69 private:
70 DevicePairDescriptor m_descriptor;
71 };
72
73 private:
74 Buffer *m_activeBuffer;
75 agx::Vector<Buffer *> m_buffers;
76 };
77
78
79 /* Implementation */
81 AGX_FORCE_INLINE const Buffer *ShareHandle::getActiveBuffer() const { return m_activeBuffer; }
82
84
85}
86
87#endif // AGXDATA_SHARE_HANDLE_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXCORE_EXPORT
Abstract representation of a data buffer.
Definition Buffer.h:56
virtual void init(Buffer *buffer1, Buffer *buffer2)
PlatformBridge(agx::UInt type1, agx::UInt type2)
DevicePairDescriptor getDescriptor() const
Definition ShareHandle.h:83
virtual void activate(Buffer *activationTarget, Buffer *currentHolder)=0
void activate(Buffer *buffer)
void addBuffer(Buffer *buffer)
static bool hasBridge(Buffer *buffer1, Buffer *buffer2)
Buffer * getActiveBuffer()
Definition ShareHandle.h:80
agx::SymmetricPair< agx::UInt > DevicePairDescriptor
Definition ShareHandle.h:56
void removeBuffer(Buffer *buffer)
static ShareHandle * create(Buffer *buffer1, Buffer *buffer2)
Only use as member allocated variable.
Definition Value.h:285
Base class providing referencing counted objects.
Definition Referenced.h:120
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a)
Templated vector class.
Definition agx/Vector.h:53
#define AGX_FORCE_INLINE
Definition macros.h:58
Contains classes for low level data storage for AGX.
Definition Container.h:23
uint64_t UInt
Definition Integer.h:27