All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
alembicData.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 USDABC_ALEMBICDATA_H
25 #define USDABC_ALEMBICDATA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/sdf/data.h"
29 #include "pxr/base/tf/declarePtrs.h"
30 #include <boost/shared_ptr.hpp>
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 
35 TF_DECLARE_WEAK_AND_REF_PTRS(UsdAbc_AlembicData);
36 
41 class UsdAbc_AlembicData : public SdfAbstractData {
42 public:
46  static UsdAbc_AlembicDataRefPtr New();
47 
52  bool Open(const std::string& filePath);
53 
56  void Close();
57 
60  static bool Write(const SdfAbstractDataConstPtr& data,
61  const std::string& filePath,
62  const std::string& comment);
63 
64  // SdfAbstractData overrides
65  virtual bool StreamsData() const;
66  virtual void CreateSpec(const SdfPath&, SdfSpecType specType);
67  virtual bool HasSpec(const SdfPath&) const;
68  virtual void EraseSpec(const SdfPath&);
69  virtual void MoveSpec(const SdfPath& oldPath, const SdfPath& newPath);
70  virtual SdfSpecType GetSpecType(const SdfPath&) const;
71  virtual bool Has(const SdfPath&, const TfToken& fieldName,
72  SdfAbstractDataValue* value) const;
73  virtual bool Has(const SdfPath&, const TfToken& fieldName,
74  VtValue* value = NULL) const;
75  virtual VtValue Get(const SdfPath&, const TfToken& fieldName) const;
76  virtual void Set(const SdfPath&, const TfToken& fieldName,
77  const VtValue& value);
78  virtual void Set(const SdfPath&, const TfToken& fieldName,
79  const SdfAbstractDataConstValue& value);
80  virtual void Erase(const SdfPath&, const TfToken& fieldName);
81  virtual std::vector<TfToken> List(const SdfPath&) const;
82  virtual std::set<double>
83  ListAllTimeSamples() const;
84  virtual std::set<double>
85  ListTimeSamplesForPath(const SdfPath&) const;
86  virtual bool
87  GetBracketingTimeSamples(double time, double* tLower, double* tUpper) const;
88  virtual size_t
89  GetNumTimeSamplesForPath(const SdfPath& path) const;
90  virtual bool
91  GetBracketingTimeSamplesForPath(const SdfPath&,
92  double time,
93  double* tLower, double* tUpper) const;
94  virtual bool
95  QueryTimeSample(const SdfPath&, double time,
96  SdfAbstractDataValue* value) const;
97  virtual bool
98  QueryTimeSample(const SdfPath&, double time,
99  VtValue* value) const;
100  virtual void
101  SetTimeSample(const SdfPath&, double, const VtValue&);
102  virtual void
103  EraseTimeSample(const SdfPath&, double);
104 
105 protected:
106  UsdAbc_AlembicData();
107  virtual ~UsdAbc_AlembicData();
108 
109  // SdfAbstractData overrides
110  virtual void _VisitSpecs(SdfAbstractDataSpecVisitor* visitor) const;
111 
112 private:
113  boost::shared_ptr<class UsdAbc_AlembicDataReader> _reader;
114 };
115 
116 
117 PXR_NAMESPACE_CLOSE_SCOPE
118 
119 #endif // USDABC_ALEMBICDATA_H
virtual SDF_API void EraseSpec(const SdfPath &path)=0
Erase the spec at path and any fields that are on it.
Base class for objects used to visit specs in an SdfAbstractData object.
Definition: abstractData.h:561
A type-erased container for a const field value in an SdfAbstractData.
Definition: abstractData.h:472
A type-erased container for a field value in an SdfAbstractData.
Definition: abstractData.h:394
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:91
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:89
virtual SDF_API bool HasSpec(const SdfPath &path) const =0
Return true if this data has a spec for path.
virtual SDF_API void CreateSpec(const SdfPath &path, SdfSpecType specType)=0
Create a new spec at path with the given specType.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
virtual SdfSpecType GetSpecType(const SdfPath &path) const =0
Return the spec type for the spec at path.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
virtual SDF_API VtValue Get(const SdfPath &path, const TfToken &fieldName) const =0
Return the value for the given path and fieldName.
virtual SDF_API bool Has(const SdfPath &path, const TfToken &fieldName, SdfAbstractDataValue *value) const =0
Returns whether a value exists for the given path and fieldName.
virtual SDF_API void MoveSpec(const SdfPath &oldPath, const SdfPath &newPath)=0
Move the spec at oldPath to newPath, including all the fields that are on it.
virtual SDF_API void _VisitSpecs(SdfAbstractDataSpecVisitor *visitor) const =0
Visits every spec in this SdfAbstractData object with the given visitor.
virtual SDF_API void Set(const SdfPath &path, const TfToken &fieldName, const VtValue &value)=0
Set the value of the given path and fieldName.
virtual SDF_API bool StreamsData() const =0
Returns true if this data object streams its data to and from its serialized data store on demand...
virtual SDF_API void Erase(const SdfPath &path, const TfToken &fieldName)=0
Remove the field at path and fieldName, if one exists.
virtual SDF_API std::vector< TfToken > List(const SdfPath &path) const =0
Return the names of all the fields that are set at path.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182
Interface for scene description data storage.
Definition: abstractData.h:73