RavEngine
Loading...
Searching...
No Matches
PxPvdDataStreamHelpers.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26
27#ifndef PX_PVD_DATA_STREAM_HELPERS_H
28#define PX_PVD_DATA_STREAM_HELPERS_H
29
33#include "PxPvdObjectModelBaseTypes.h"
34
35#if !PX_DOXYGEN
36namespace physx
37{
38namespace pvdsdk
39{
40#endif
41
43{
44 protected:
46 {
47 }
48
49 public:
53 virtual void pushName(const char* inName, const char* inAppendStr = ".") = 0;
57 virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") = 0;
61 virtual void popName() = 0;
62
63 virtual void clearNameStack() = 0;
68 virtual const char* getTopName() = 0;
69
70 virtual void addNamedValue(const char* name, uint32_t value) = 0;
71 virtual void clearNamedValues() = 0;
72 virtual DataRef<NamedValue> getNamedValues() = 0;
73
77 virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName,
78 PropertyType::Enum propType = PropertyType::Scalar) = 0;
79
80 template <typename TClsType, typename TDataType>
81 void createProperty(const char* inSemantic = "", PropertyType::Enum propType = PropertyType::Scalar)
82 {
83 createProperty(getPvdNamespacedNameForType<TClsType>(), inSemantic, getPvdNamespacedNameForType<TDataType>(),
84 propType);
85 }
86
87 // The datatype used for instances needs to be pointer unless you actually have pvdsdk::InstanceId members on your
88 // value structs.
89 virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) = 0;
90
91 template <typename TDataType>
92 void addPropertyMessageArg(uint32_t offset)
93 {
94 addPropertyMessageArg(getPvdNamespacedNameForType<TDataType>(), offset, static_cast<uint32_t>(sizeof(TDataType)));
95 }
96 virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName,
97 uint32_t inStructSizeInBytes) = 0;
98 template <typename TClsType, typename TMsgType>
99 void addPropertyMessage()
100 {
101 addPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(),
102 static_cast<uint32_t>(sizeof(TMsgType)));
103 }
104 virtual void clearPropertyMessageArgs() = 0;
105
106 void clearBufferedData()
107 {
108 clearNameStack();
109 clearPropertyMessageArgs();
110 clearNamedValues();
111 }
112};
113
114#if !PX_DOXYGEN
115} // pvdsdk
116} // physx
117#endif
118
120#endif
121
Definition PxPvdObjectModelBaseTypes.h:345
Definition PxPvdDataStreamHelpers.h:43
virtual void pushBracketedName(const char *inName, const char *leftBracket="[", const char *rightBracket="]")=0
virtual void createProperty(const NamespacedName &clsName, const char *inSemantic, const NamespacedName &dtypeName, PropertyType::Enum propType=PropertyType::Scalar)=0
virtual void pushName(const char *inName, const char *inAppendStr=".")=0
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxPvdObjectModelBaseTypes.h:188