HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_PostLayers.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_PostLayers_h__
19 #define __HUSD_PostLayers_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include <UT/UT_IntrusivePtr.h>
24 #include <UT/UT_IStream.h>
25 #include <UT/UT_StringArray.h>
26 #include <iosfwd>
27 
29  public UT_IntrusiveRefCounter<HUSD_PostLayers>,
30  public UT_NonCopyable
31 {
32 public:
34  ~HUSD_PostLayers();
35 
36  int layerCount() const;
37  const UT_StringHolder &layerName(int i) const;
38  bool hasLayer(const UT_StringRef &name) const;
39  PXR_NS::XUSD_LayerPtr layer(int i) const;
40  PXR_NS::XUSD_LayerPtr layer(const UT_StringRef &name) const;
41  void *pythonLayer(int i) const;
42  void *pythonLayer(const UT_StringRef &name) const;
43 
44  void save(std::ostream &os) const;
45  bool load(UT_IStream &is);
46  void copy(const HUSD_PostLayers &src);
47  void clear();
48  bool removeLayer(int i);
49  bool removeLayer(const UT_StringRef &name);
50 
51  // Prepare to author data into the named layer in the context of the
52  // supplied data handle and load masks.
53  void writeLock(const HUSD_DataHandle &datahandle,
54  const HUSD_LoadMasksPtr &loadmasks,
55  const UT_StringHolder &layername);
56  // Once a write lock has been established, it is possible to author data
57  // to our own copy of this data handle using stadard AutoLock methods.
58  const HUSD_DataHandle &lockedDataHandle();
59  // Releasing the write lock copies the active layer of our data handle
60  // into the named layer in our map.
61  void release(const HUSD_AutoWriteLock *writelock);
62 
63  exint versionId() const
64  { return myVersionId; }
65 
66 private:
68  UT_StringArray myLayerNames;
69  HUSD_DataHandle myDataHandle;
70  const HUSD_DataHandle *myLockedToDataHandle;
71  UT_StringHolder myLockedToLayerName;
72  exint myLockedToLayerIndex;
73  exint myVersionId;
74 };
75 
76 #endif
77 
UT_SharedPtr< HUSD_LoadMasks > HUSD_LoadMasksPtr
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:32
A reference counter base class for use with UT_IntrusivePtr.
exint versionId() const
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
GLuint const GLchar * name
Definition: glcorearb.h:786
UT_IntrusivePtr< XUSD_Layer > XUSD_LayerPtr
GLenum src
Definition: glcorearb.h:1793