All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
attrMap.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXRUSDKATANA_ATTRMAP_H
25 #define PXRUSDKATANA_ATTRMAP_H
26 
27 #include "pxr/pxr.h"
28 #include <FnAttribute/FnGroupBuilder.h>
29 #include <FnGeolib/op/FnGeolibOp.h>
30 #include "pxr/usd/usd/attribute.h"
31 
32 #include <boost/thread/shared_mutex.hpp>
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 
45 {
46 public:
48  void SetUSDTimeCode(UsdTimeCode timeCode) {
49  _usdTimeCode = timeCode;
50  }
51 
55  PxrUsdKatanaAttrMap& Set(const std::string& path, const UsdAttribute& attr);
56 
58  void set(const std::string& path, const Foundry::Katana::Attribute& attr);
59 
61  void del(const std::string& path);
62 
64  FnAttribute::GroupAttribute build();
65 
67  void toInterface(Foundry::Katana::GeolibCookInterface& interface);
68 
69 
72  bool isBuilt();
73 
74 
75  typedef boost::upgrade_mutex Mutex;
78  Mutex & getInstanceMutex() { return m_mutex; }
79 
80 private:
81 
82  Foundry::Katana::GroupBuilder _groupBuilder;
83 
84  // Cache the last call to _groupBuilder.build() so that instances can be
85  // reused (as GroupBuilder clears itself by default)
86  Foundry::Katana::GroupAttribute _lastBuilt;
87 
88 
89  // Timecode to use when reading USD samples
90  UsdTimeCode _usdTimeCode;
91 
92  // per-instance mutex available for external use.
93  Mutex m_mutex;
94 
95 };
96 
97 
98 PXR_NAMESPACE_CLOSE_SCOPE
99 
100 #endif // PXRUSDKATANA_ATTRMAP_H
void del(const std::string &path)
delete attribute at path
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
bool isBuilt()
returns true if a call to build has been made prior to any subsequent calls to set or del...
FnAttribute::GroupAttribute build()
build a group attribute
PxrUsdKatanaAttrMap & Set(const std::string &path, const UsdAttribute &attr)
Set the katana attribute path by evaluating the given USD attribute attr at the time configured in Se...
Mutex & getInstanceMutex()
while no locking occurs internal to this class, calling code may wish to manage read/write locks per-...
Definition: attrMap.h:78
void toInterface(Foundry::Katana::GeolibCookInterface &interface)
sets attrs in attrs onto the interface.
An object to store attributes.
Definition: attrMap.h:44
void set(const std::string &path, const Foundry::Katana::Attribute &attr)
set attr at path.
void SetUSDTimeCode(UsdTimeCode timeCode)
Configure this object to evaluate USD attributes at the given time.
Definition: attrMap.h:48