RavEngine
Loading...
Searching...
No Matches
SnRepXCollection.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// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef SN_REPX_COLLECTION_H
30#define SN_REPX_COLLECTION_H
31
32#include "common/PxTolerancesScale.h"
33#include "extensions/PxRepXSerializer.h"
34
35namespace physx { namespace Sn {
36
37 struct XmlNode;
38
40 {
41 PxRepXObject liveObject;
42 XmlNode* descriptor;
43 RepXCollectionItem( PxRepXObject inItem = PxRepXObject(), XmlNode* inDescriptor = NULL )
44 : liveObject( inItem )
45 , descriptor( inDescriptor )
46 {
47 }
48 };
49
51 {
52 const char* name;
53 const char* value;
54 RepXDefaultEntry( const char* pn, const char* val ) : name( pn ), value( val ){}
55 };
56
61 {
62 enum Enum
63 {
64 Success,
65 SerializerNotFound,
66 InvalidParameters, //Null data passed in.
67 AlreadyInCollection
68 };
69
70 PxSerialObjectId collectionId;
71 Enum result;
72
73 RepXAddToCollectionResult( Enum inResult = Success, const PxSerialObjectId inId = 0 )
74 : collectionId( inId )
75 , result( inResult )
76 {
77 }
78 bool isValid() { return result == Success && collectionId != 0; }
79 };
102 {
103 protected:
104 virtual ~RepXCollection(){}
105
106 public:
107 virtual void destroy() = 0;
108
114 virtual void setTolerancesScale( const PxTolerancesScale& inScale ) = 0;
115
122
128 virtual void setUpVector( const PxVec3& inUpVector ) = 0;
129
134 virtual PxVec3 getUpVector() const = 0;
135
136 virtual const char* getVersion() = 0;
137 static const char* getLatestVersion();
138
139 //Necessary accessor functions for translation/upgrading.
140 virtual const RepXCollectionItem* begin() const = 0;
141 virtual const RepXCollectionItem* end() const = 0;
142
143
144 //Performs a deep copy of the repx node.
145 virtual XmlNode* copyRepXNode( const XmlNode* srcNode ) = 0;
146
147 virtual void addCollectionItem( RepXCollectionItem inItem ) = 0;
148
149 //Create a new repx node with this name. Its value is unset.
150 virtual XmlNode& createRepXNode( const char* name ) = 0;
151
152 virtual RepXCollection& createCollection( const char* inVersionStr ) = 0;
153 //Release this when finished.
154 virtual XmlReaderWriter& createNodeEditor() = 0;
155
156 virtual PxAllocatorCallback& getAllocator() = 0;
157
158 virtual bool instantiateCollection( PxRepXInstantiationArgs& inArgs, PxCollection& inPxCollection ) = 0;
159
160
161 virtual RepXAddToCollectionResult addRepXObjectToCollection( const PxRepXObject& inObject, PxCollection* inCollection, PxRepXInstantiationArgs& inArgs ) = 0;
162
169 virtual void save( PxOutputStream& inStream ) = 0;
170 };
171} }
172
173#endif
Abstract base class for an application defined memory allocator that can be used by the Nv library.
Definition PxAllocatorCallback.h:53
Collection class for serialization.
Definition PxCollection.h:104
Output stream class for I/O.
Definition PxIO.h:114
Class to define the scale at which simulation runs. Most simulation tolerances are calculated in term...
Definition PxTolerancesScale.h:53
3 Element vector class.
Definition PxVec3.h:50
Definition SnRepXCollection.h:102
virtual void setUpVector(const PxVec3 &inUpVector)=0
virtual void save(PxOutputStream &inStream)=0
virtual PxVec3 getUpVector() const =0
virtual PxTolerancesScale getTolerancesScale() const =0
virtual void setTolerancesScale(const PxTolerancesScale &inScale)=0
Definition SnXmlReader.h:78
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxU64 PxSerialObjectId
ID type for PxBase objects in a PxCollection.
Definition PxSerialFramework.h:61
Arguments required to instantiate a serializable object from RepX.
Definition PxRepXSimpleType.h:83
Helper class containing the mapping of id to object, and type name.
Definition PxRepXSimpleType.h:50
Definition SnRepXCollection.h:61
Definition SnRepXCollection.h:40
Definition SnRepXCollection.h:51
Definition SnXmlImpl.h:103