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 PXR_USD_PLUGIN_USD_ABC_ALEMBIC_DATA_H
25 #define PXR_USD_PLUGIN_USD_ABC_ALEMBIC_DATA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/sdf/data.h"
29 #include "pxr/usd/sdf/fileFormat.h"
30 #include "pxr/base/tf/declarePtrs.h"
31 #include <boost/shared_ptr.hpp>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
36 TF_DECLARE_WEAK_AND_REF_PTRS(UsdAbc_AlembicData);
37 
42 class UsdAbc_AlembicData : public SdfAbstractData {
43 public:
47  static UsdAbc_AlembicDataRefPtr New(
49 
54  bool Open(const std::string& filePath);
55 
58  void Close();
59 
62  static bool Write(const SdfAbstractDataConstPtr& data,
63  const std::string& filePath,
64  const std::string& comment);
65 
66  // SdfAbstractData overrides
67  virtual bool StreamsData() const;
68  virtual void CreateSpec(const SdfPath&, SdfSpecType specType);
69  virtual bool HasSpec(const SdfPath&) const;
70  virtual void EraseSpec(const SdfPath&);
71  virtual void MoveSpec(const SdfPath& oldPath, const SdfPath& newPath);
72  virtual SdfSpecType GetSpecType(const SdfPath&) const;
73  virtual bool Has(const SdfPath&, const TfToken& fieldName,
74  SdfAbstractDataValue* value) const;
75  virtual bool Has(const SdfPath&, const TfToken& fieldName,
76  VtValue* value = NULL) const;
77  virtual VtValue Get(const SdfPath&, const TfToken& fieldName) const;
78  virtual void Set(const SdfPath&, const TfToken& fieldName,
79  const VtValue& value);
80  virtual void Set(const SdfPath&, const TfToken& fieldName,
81  const SdfAbstractDataConstValue& value);
82  virtual void Erase(const SdfPath&, const TfToken& fieldName);
83  virtual std::vector<TfToken> List(const SdfPath&) const;
84  virtual std::set<double>
85  ListAllTimeSamples() const;
86  virtual std::set<double>
87  ListTimeSamplesForPath(const SdfPath&) const;
88  virtual bool
89  GetBracketingTimeSamples(double time, double* tLower, double* tUpper) const;
90  virtual size_t
91  GetNumTimeSamplesForPath(const SdfPath& path) const;
92  virtual bool
93  GetBracketingTimeSamplesForPath(const SdfPath&,
94  double time,
95  double* tLower, double* tUpper) const;
96  virtual bool
97  QueryTimeSample(const SdfPath&, double time,
98  SdfAbstractDataValue* value) const;
99  virtual bool
100  QueryTimeSample(const SdfPath&, double time,
101  VtValue* value) const;
102  virtual void
103  SetTimeSample(const SdfPath&, double, const VtValue&);
104  virtual void
105  EraseTimeSample(const SdfPath&, double);
106 
107 protected:
108  UsdAbc_AlembicData(SdfFileFormat::FileFormatArguments);
109  virtual ~UsdAbc_AlembicData();
110 
111  // SdfAbstractData overrides
112  virtual void _VisitSpecs(SdfAbstractDataSpecVisitor* visitor) const;
113 
114 private:
115  boost::shared_ptr<class UsdAbc_AlembicDataReader> _reader;
116  const SdfFileFormat::FileFormatArguments _arguments;
117 };
118 
119 
120 PXR_NAMESPACE_CLOSE_SCOPE
121 
122 #endif // PXR_USD_PLUGIN_USD_ABC_ALEMBIC_DATA_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:87
virtual SdfSpecType GetSpecType(const SdfPath &path) const =0
Return the spec type for the spec at path.
std::map< std::string, std::string > FileFormatArguments
Type for specifying additional file format-specific arguments to the various API below.
Definition: fileFormat.h:113
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
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:174
Interface for scene description data storage.
Definition: abstractData.h:73