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_PCP_ERRORS_H
25 #define PXR_USD_PCP_ERRORS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/pcp/api.h"
29 #include "pxr/usd/pcp/site.h"
30 #include "pxr/usd/pcp/types.h"
31 #include "pxr/usd/sdf/layer.h"
32 #include "pxr/usd/sdf/layerOffset.h"
33 #include "pxr/usd/sdf/path.h"
34 
35 #include "pxr/base/tf/enum.h"
36 
37 #include <memory>
38 #include <string>
39 #include <vector>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
43 // Forward declaration:
44 class PcpCache;
45 
46 /// \enum PcpErrorType
47 ///
48 /// Enum to indicate the type represented by a Pcp error.
49 ///
50 enum PcpErrorType {
51     PcpErrorType_ArcCycle,
52     PcpErrorType_ArcPermissionDenied,
53     PcpErrorType_IndexCapacityExceeded,
54     PcpErrorType_ArcCapacityExceeded,
55     PcpErrorType_ArcNamespaceDepthCapacityExceeded,
56     PcpErrorType_InconsistentPropertyType,
57     PcpErrorType_InconsistentAttributeType,
58     PcpErrorType_InconsistentAttributeVariability,
59     PcpErrorType_InternalAssetPath,
60     PcpErrorType_InvalidPrimPath,
61     PcpErrorType_InvalidAssetPath,
62     PcpErrorType_InvalidInstanceTargetPath,
63     PcpErrorType_InvalidExternalTargetPath,
64     PcpErrorType_InvalidTargetPath,
65     PcpErrorType_InvalidReferenceOffset,
66     PcpErrorType_InvalidSublayerOffset,
67     PcpErrorType_InvalidSublayerOwnership,
68     PcpErrorType_InvalidSublayerPath,
69     PcpErrorType_InvalidVariantSelection,
70     PcpErrorType_MutedAssetPath,
71     PcpErrorType_OpinionAtRelocationSource,
72     PcpErrorType_PrimPermissionDenied,
73     PcpErrorType_PropertyPermissionDenied,
74     PcpErrorType_SublayerCycle,
75     PcpErrorType_TargetPermissionDenied,
76     PcpErrorType_UnresolvedPrimPath
77 };
78 
79 // Forward declarations:
80 class PcpErrorBase;
81 typedef std::shared_ptr<PcpErrorBase> PcpErrorBasePtr;
82 typedef std::vector<PcpErrorBasePtr> PcpErrorVector;
83 
84 /// \class PcpErrorBase
85 ///
86 /// Base class for all error types.
87 ///
88 class PcpErrorBase {
89 public:
90     /// Destructor.
91     PCP_API virtual ~PcpErrorBase();
92     /// Converts error to string message.
93     virtual std::string ToString() const = 0;
94 
95     /// The error code.
96     const TfEnum errorType;
97 
98     /// The site of the composed prim or property being computed when
99     /// the error was encountered.  (Note that some error types
100     /// contain an additional site to capture more specific information
101     /// about the site of the error.)
102     PcpSiteStr rootSite;
103 
104     /// Return true if this type of error should be reported at most
105     /// once for a given prim.
ShouldReportAtMostOnce()106     bool ShouldReportAtMostOnce() const {
107         // Capacity errors are reported at most once. (If these limits are
108         // reached, there is likely to be a very large number of whatever
109         // caused it.)
110         return errorType == PcpErrorType_IndexCapacityExceeded ||
111             errorType == PcpErrorType_ArcCapacityExceeded ||
112             errorType == PcpErrorType_ArcNamespaceDepthCapacityExceeded;
113     }
114 
115 protected:
116     /// Constructor.
117     PcpErrorBase(TfEnum errorType);
118 };
119 
120 ///////////////////////////////////////////////////////////////////////////////
121 
122 // Forward declarations:
123 class PcpErrorArcCycle;
124 typedef std::shared_ptr<PcpErrorArcCycle> PcpErrorArcCyclePtr;
125 
126 /// \class PcpErrorArcCycle
127 ///
128 /// Arcs between PcpNodes that form a cycle.
129 ///
130 class PcpErrorArcCycle : public PcpErrorBase {
131 public:
132     /// Returns a new error object.
133     static PcpErrorArcCyclePtr New();
134     /// Destructor.
135     PCP_API ~PcpErrorArcCycle();
136     /// Converts error to string message.
137     PCP_API virtual std::string ToString() const;
138 
139     PcpSiteTracker cycle;
140 
141 private:
142     /// Constructor is private. Use New() instead.
143     PcpErrorArcCycle();
144 };
145 
146 ///////////////////////////////////////////////////////////////////////////////
147 
148 // Forward declarations:
149 class PcpErrorArcPermissionDenied;
150 typedef std::shared_ptr<PcpErrorArcPermissionDenied>
151     PcpErrorArcPermissionDeniedPtr;
152 
153 /// \class PcpErrorArcPermissionDenied
154 ///
155 /// Arcs that were not made between PcpNodes because of permission
156 /// restrictions.
157 ///
158 class PcpErrorArcPermissionDenied : public PcpErrorBase {
159 public:
160     /// Returns a new error object.
161     static PcpErrorArcPermissionDeniedPtr New();
162     /// Destructor.
163     PCP_API ~PcpErrorArcPermissionDenied();
164     /// Converts error to string message.
165     PCP_API virtual std::string ToString() const;
166 
167     /// The site where the invalid arc was expressed.
168     PcpSite site;
169     /// The private, invalid target of the arc.
170     PcpSite privateSite;
171     /// The type of arc.
172     PcpArcType arcType;
173 
174 private:
175     /// Constructor is private. Use New() instead.
176     PcpErrorArcPermissionDenied();
177 };
178 
179 ///////////////////////////////////////////////////////////////////////////////
180 
181 // Forward declarations:
182 class PcpErrorCapacityExceeded;
183 typedef std::shared_ptr<PcpErrorCapacityExceeded> PcpErrorCapacityExceededPtr;
184 
185 /// \class PcpErrorCapacityExceeded
186 ///
187 /// Exceeded the capacity for composition arcs at a single site.
188 ///
189 class PcpErrorCapacityExceeded : public PcpErrorBase {
190 public:
191     /// Returns a new error object.
192     static PcpErrorCapacityExceededPtr New(PcpErrorType errorType);
193     /// Destructor.
194     PCP_API ~PcpErrorCapacityExceeded();
195     /// Converts error to string message.
196     PCP_API virtual std::string ToString() const;
197 
198 private:
199     /// Constructor is private. Use New() instead.
200     PcpErrorCapacityExceeded(PcpErrorType errorType);
201 };
202 
203 ///////////////////////////////////////////////////////////////////////////////
204 
205 class PcpErrorInconsistentPropertyBase : public PcpErrorBase {
206 public:
207     /// Destructor.
208     PCP_API virtual ~PcpErrorInconsistentPropertyBase();
209 
210     /// The identifier of the layer with the defining property spec.
211     std::string definingLayerIdentifier;
212     /// The path of the defining property spec.
213     SdfPath definingSpecPath;
214 
215     /// The identifier of the layer with the conflicting property spec.
216     std::string conflictingLayerIdentifier;
217     /// The path of the conflicting property spec.
218     SdfPath conflictingSpecPath;
219 
220 protected:
221     /// Constructor.
222     PcpErrorInconsistentPropertyBase(TfEnum errorType);
223 };
224 
225 ///////////////////////////////////////////////////////////////////////////////
226 
227 // Forward declarations:
228 class PcpErrorInconsistentPropertyType;
229 typedef std::shared_ptr<PcpErrorInconsistentPropertyType>
230     PcpErrorInconsistentPropertyTypePtr;
231 
232 /// \class PcpErrorInconsistentPropertyType
233 ///
234 /// Properties that have specs with conflicting definitions.
235 ///
236 class PcpErrorInconsistentPropertyType :
237     public PcpErrorInconsistentPropertyBase {
238 public:
239     /// Returns a new error object.
240     static PcpErrorInconsistentPropertyTypePtr New();
241     /// Destructor.
242     PCP_API ~PcpErrorInconsistentPropertyType();
243     /// Converts error to string message.
244     PCP_API virtual std::string ToString() const;
245 
246     /// The type of the defining spec.
247     SdfSpecType definingSpecType;
248     /// The type of the conflicting spec.
249     SdfSpecType conflictingSpecType;
250 
251 private:
252     /// Constructor is private. Use New() instead.
253     PcpErrorInconsistentPropertyType();
254 };
255 
256 ///////////////////////////////////////////////////////////////////////////////
257 
258 // Forward declarations:
259 class PcpErrorInconsistentAttributeType;
260 typedef std::shared_ptr<PcpErrorInconsistentAttributeType>
261     PcpErrorInconsistentAttributeTypePtr;
262 
263 /// \class PcpErrorInconsistentAttributeType
264 ///
265 /// Attributes that have specs with conflicting definitions.
266 ///
267 class PcpErrorInconsistentAttributeType :
268     public PcpErrorInconsistentPropertyBase {
269 public:
270     /// Returns a new error object.
271     static PcpErrorInconsistentAttributeTypePtr New();
272     /// Destructor.
273     PCP_API ~PcpErrorInconsistentAttributeType();
274     /// Converts error to string message.
275     PCP_API virtual std::string ToString() const;
276 
277     /// The value type from the defining spec.
278     TfToken definingValueType;
279     /// The value type from the conflicting spec.
280     TfToken conflictingValueType;
281 
282 private:
283     /// Constructor is private. Use New() instead.
284     PcpErrorInconsistentAttributeType();
285 };
286 
287 ///////////////////////////////////////////////////////////////////////////////
288 
289 // Forward declarations:
290 class PcpErrorInconsistentAttributeVariability;
291 typedef std::shared_ptr<PcpErrorInconsistentAttributeVariability>
292     PcpErrorInconsistentAttributeVariabilityPtr;
293 
294 /// \class PcpErrorInconsistentAttributeVariability
295 ///
296 /// Attributes that have specs with conflicting variability.
297 ///
298 class PcpErrorInconsistentAttributeVariability :
299     public PcpErrorInconsistentPropertyBase {
300 public:
301     /// Returns a new error object.
302     static PcpErrorInconsistentAttributeVariabilityPtr New();
303     /// Destructor.
304     PCP_API ~PcpErrorInconsistentAttributeVariability();
305     /// Converts error to string message.
306     PCP_API virtual std::string ToString() const;
307 
308     /// The variability of the defining spec.
309     SdfVariability definingVariability;
310     /// The variability of the conflicting spec.
311     SdfVariability conflictingVariability;
312 
313 private:
314     /// Constructor is private. Use New() instead.
315     PcpErrorInconsistentAttributeVariability();
316 };
317 
318 ///////////////////////////////////////////////////////////////////////////////
319 
320 // Forward declarations:
321 class PcpErrorInternalAssetPath;
322 typedef std::shared_ptr<PcpErrorInternalAssetPath>
323     PcpErrorInternalAssetPathPtr;
324 
325 /// \class PcpErrorInternalAssetPath
326 ///
327 /// Error about an arc that is prohibited due to being internal to an asset.
328 ///
329 class PcpErrorInternalAssetPath : public PcpErrorBase {
330 public:
331     /// Returns a new error object.
332     static PcpErrorInternalAssetPathPtr New();
333     /// Destructor.
334     PCP_API ~PcpErrorInternalAssetPath();
335     /// Converts error to string message.
336     PCP_API virtual std::string ToString() const;
337 
338     /// The site where the invalid arc was expressed.
339     PcpSite site;
340     SdfPath targetPath;
341     std::string assetPath;
342     std::string resolvedAssetPath;
343     PcpArcType arcType;
344 
345 private:
346     /// Constructor is private. Use New() instead.
347     PcpErrorInternalAssetPath();
348 };
349 
350 ///////////////////////////////////////////////////////////////////////////////
351 
352 // Forward declarations:
353 class PcpErrorInvalidPrimPath;
354 typedef std::shared_ptr<PcpErrorInvalidPrimPath>
355     PcpErrorInvalidPrimPathPtr;
356 
357 /// \class PcpErrorInvalidPrimPath
358 ///
359 /// Invalid prim paths used by references or payloads.
360 ///
361 class PcpErrorInvalidPrimPath : public PcpErrorBase {
362 public:
363     /// Returns a new error object.
364     static PcpErrorInvalidPrimPathPtr New();
365     /// Destructor.
366     PCP_API ~PcpErrorInvalidPrimPath();
367     /// Converts error to string message.
368     PCP_API virtual std::string ToString() const;
369 
370     /// The site where the invalid arc was expressed.
371     PcpSite site;
372     SdfPath primPath;
373     PcpArcType arcType;
374 
375 private:
376     /// Constructor is private. Use New() instead.
377     PcpErrorInvalidPrimPath();
378 };
379 
380 ///////////////////////////////////////////////////////////////////////////////
381 
382 // Forward declarations:
383 class PcpErrorInvalidAssetPathBase;
384 typedef std::shared_ptr<PcpErrorInvalidAssetPathBase>
385     PcpErrorInvalidAssetPathBasePtr;
386 
387 class PcpErrorInvalidAssetPathBase : public PcpErrorBase {
388 public:
389     /// Destructor.
390     PCP_API ~PcpErrorInvalidAssetPathBase();
391 
392     /// The site where the invalid arc was expressed.
393     PcpSite site;
394     SdfPath targetPath;
395     std::string assetPath;
396     std::string resolvedAssetPath;
397     PcpArcType arcType;
398     SdfLayerHandle layer;
399     std::string messages;
400 
401 protected:
402     /// Constructor.
403     PcpErrorInvalidAssetPathBase(TfEnum errorType);
404 };
405 
406 ///////////////////////////////////////////////////////////////////////////////
407 
408 // Forward declarations:
409 class PcpErrorInvalidAssetPath;
410 typedef std::shared_ptr<PcpErrorInvalidAssetPath>
411     PcpErrorInvalidAssetPathPtr;
412 
413 /// \class PcpErrorInvalidAssetPath
414 ///
415 /// Invalid asset paths used by references or payloads.
416 ///
417 class PcpErrorInvalidAssetPath : public PcpErrorInvalidAssetPathBase {
418 public:
419     /// Returns a new error object.
420     static PcpErrorInvalidAssetPathPtr New();
421     /// Destructor.
422     PCP_API ~PcpErrorInvalidAssetPath();
423     /// Converts error to string message.
424     PCP_API virtual std::string ToString() const;
425 
426 private:
427     /// Constructor is private. Use New() instead.
428     PcpErrorInvalidAssetPath();
429 };
430 
431 ///////////////////////////////////////////////////////////////////////////////
432 
433 // Forward declarations:
434 class PcpErrorMutedAssetPath;
435 typedef std::shared_ptr<PcpErrorMutedAssetPath>
436     PcpErrorMutedAssetPathPtr;
437 
438 /// \class PcpErrorMutedAssetPath
439 ///
440 /// Muted asset paths used by references or payloads.
441 ///
442 class PcpErrorMutedAssetPath : public PcpErrorInvalidAssetPathBase {
443 public:
444     /// Returns a new error object.
445     static PcpErrorMutedAssetPathPtr New();
446     /// Destructor.
447     PCP_API ~PcpErrorMutedAssetPath();
448     /// Converts error to string message.
449     PCP_API virtual std::string ToString() const;
450 
451 private:
452     /// Constructor is private. Use New() instead.
453     PcpErrorMutedAssetPath();
454 };
455 
456 ///////////////////////////////////////////////////////////////////////////////
457 
458 // Forward declarations:
459 class PcpErrorTargetPathBase;
460 typedef std::shared_ptr<PcpErrorTargetPathBase>
461     PcpErrorTargetPathBasePtr;
462 
463 /// \class PcpErrorTargetPathBase
464 ///
465 /// Base class for composition errors related to target or connection paths.
466 ///
467 class PcpErrorTargetPathBase : public PcpErrorBase {
468 public:
469     /// Destructor.
470     PCP_API ~PcpErrorTargetPathBase();
471 
472     /// The invalid target or connection path that was authored.
473     SdfPath targetPath;
474     /// The path to the property where the target was authored.
475     SdfPath owningPath;
476     /// The spec type of the property where the target was authored.
477     SdfSpecType ownerSpecType;
478     /// The layer containing the property where the target was authored.
479     SdfLayerHandle layer;
480 
481     /// The target or connection path in the composed scene.
482     /// If this path could not be translated to the composed scene
483     /// (e.g., in the case of an invalid external target path),
484     /// this path will be empty.
485     SdfPath composedTargetPath;
486 
487 protected:
488     PcpErrorTargetPathBase(TfEnum errorType);
489 };
490 
491 ///////////////////////////////////////////////////////////////////////////////
492 
493 // Forward declarations:
494 class PcpErrorInvalidInstanceTargetPath;
495 typedef std::shared_ptr<PcpErrorInvalidInstanceTargetPath>
496     PcpErrorInvalidInstanceTargetPathPtr;
497 
498 /// \class PcpErrorInvalidInstanceTargetPath
499 ///
500 /// Invalid target or connection path authored in an inherited
501 /// class that points to an instance of that class.
502 ///
503 class PcpErrorInvalidInstanceTargetPath : public PcpErrorTargetPathBase {
504 public:
505     /// Returns a new error object.
506     static PcpErrorInvalidInstanceTargetPathPtr New();
507     /// Destructor.
508     PCP_API ~PcpErrorInvalidInstanceTargetPath();
509     /// Converts error to string message.
510     PCP_API virtual std::string ToString() const;
511 
512 private:
513     /// Constructor is private. Use New() instead.
514     PcpErrorInvalidInstanceTargetPath();
515 };
516 
517 ///////////////////////////////////////////////////////////////////////////////
518 
519 // Forward declarations:
520 class PcpErrorInvalidExternalTargetPath;
521 typedef std::shared_ptr<PcpErrorInvalidExternalTargetPath>
522     PcpErrorInvalidExternalTargetPathPtr;
523 
524 /// \class PcpErrorInvalidExternalTargetPath
525 ///
526 /// Invalid target or connection path in some scope that points to
527 /// an object outside of that scope.
528 ///
529 class PcpErrorInvalidExternalTargetPath : public PcpErrorTargetPathBase {
530 public:
531     /// Returns a new error object.
532     static PcpErrorInvalidExternalTargetPathPtr New();
533     /// Destructor.
534     PCP_API ~PcpErrorInvalidExternalTargetPath();
535     /// Converts error to string message.
536     PCP_API virtual std::string ToString() const;
537 
538     PcpArcType ownerArcType;
539     SdfPath ownerIntroPath;
540 
541 private:
542     /// Constructor is private. Use New() instead.
543     PcpErrorInvalidExternalTargetPath();
544 };
545 
546 ///////////////////////////////////////////////////////////////////////////////
547 
548 // Forward declarations:
549 class PcpErrorInvalidTargetPath;
550 typedef std::shared_ptr<PcpErrorInvalidTargetPath>
551     PcpErrorInvalidTargetPathPtr;
552 
553 /// \class PcpErrorInvalidTargetPath
554 ///
555 /// Invalid target or connection path.
556 ///
557 class PcpErrorInvalidTargetPath : public PcpErrorTargetPathBase {
558 public:
559     /// Returns a new error object.
560     static PcpErrorInvalidTargetPathPtr New();
561     /// Destructor.
562     PCP_API ~PcpErrorInvalidTargetPath();
563     /// Converts error to string message.
564     PCP_API virtual std::string ToString() const;
565 
566 private:
567     /// Constructor is private. Use New() instead.
568     PcpErrorInvalidTargetPath();
569 };
570 
571 ///////////////////////////////////////////////////////////////////////////////
572 
573 // Forward declarations:
574 class PcpErrorInvalidSublayerOffset;
575 typedef std::shared_ptr<PcpErrorInvalidSublayerOffset>
576     PcpErrorInvalidSublayerOffsetPtr;
577 
578 /// \class PcpErrorInvalidSublayerOffset
579 ///
580 /// Sublayers that use invalid layer offsets.
581 ///
582 class PcpErrorInvalidSublayerOffset : public PcpErrorBase {
583 public:
584     /// Returns a new error object.
585     static PcpErrorInvalidSublayerOffsetPtr New();
586     /// Destructor.
587     PCP_API ~PcpErrorInvalidSublayerOffset();
588     /// Converts error to string message.
589     PCP_API virtual std::string ToString() const;
590 
591     SdfLayerHandle layer;
592     SdfLayerHandle sublayer;
593     SdfLayerOffset offset;
594 
595 private:
596     /// Constructor is private. Use New() instead.
597     PcpErrorInvalidSublayerOffset();
598 };
599 
600 ///////////////////////////////////////////////////////////////////////////////
601 
602 // Forward declarations:
603 class PcpErrorInvalidReferenceOffset;
604 typedef std::shared_ptr<PcpErrorInvalidReferenceOffset>
605     PcpErrorInvalidReferenceOffsetPtr;
606 
607 /// \class PcpErrorInvalidReferenceOffset
608 ///
609 /// Sublayers that use invalid layer offsets.
610 ///
611 class PcpErrorInvalidReferenceOffset : public PcpErrorBase {
612 public:
613     /// Returns a new error object.
614     static PcpErrorInvalidReferenceOffsetPtr New();
615     /// Destructor.
616     PCP_API ~PcpErrorInvalidReferenceOffset();
617     /// Converts error to string message.
618     PCP_API virtual std::string ToString() const;
619 
620     SdfLayerHandle layer;
621     SdfPath sourcePath;
622     std::string assetPath;
623     SdfPath targetPath;
624     SdfLayerOffset offset;
625 
626 private:
627     /// Constructor is private. Use New() instead.
628     PcpErrorInvalidReferenceOffset();
629 };
630 
631 ///////////////////////////////////////////////////////////////////////////////
632 
633 // Forward declarations:
634 class PcpErrorInvalidSublayerOwnership;
635 typedef std::shared_ptr<PcpErrorInvalidSublayerOwnership>
636     PcpErrorInvalidSublayerOwnershipPtr;
637 
638 /// \class PcpErrorInvalidSublayerOwnership
639 ///
640 /// Sibling layers that have the same owner.
641 ///
642 class PcpErrorInvalidSublayerOwnership : public PcpErrorBase {
643 public:
644     /// Returns a new error object.
645     static PcpErrorInvalidSublayerOwnershipPtr New();
646     /// Destructor.
647     PCP_API ~PcpErrorInvalidSublayerOwnership();
648     /// Converts error to string message.
649     PCP_API virtual std::string ToString() const;
650 
651     std::string owner;
652     SdfLayerHandle layer;
653     SdfLayerHandleVector sublayers;
654 
655 private:
656     /// Constructor is private. Use New() instead.
657     PcpErrorInvalidSublayerOwnership();
658 };
659 
660 ///////////////////////////////////////////////////////////////////////////////
661 
662 // Forward declarations:
663 class PcpErrorInvalidSublayerPath;
664 typedef std::shared_ptr<PcpErrorInvalidSublayerPath>
665     PcpErrorInvalidSublayerPathPtr;
666 
667 /// \class PcpErrorInvalidSublayerPath
668 ///
669 /// Asset paths that could not be both resolved and loaded.
670 ///
671 class PcpErrorInvalidSublayerPath : public PcpErrorBase {
672 public:
673     /// Returns a new error object.
674     static PcpErrorInvalidSublayerPathPtr New();
675     /// Destructor.
676     PCP_API ~PcpErrorInvalidSublayerPath();
677     /// Converts error to string message.
678     PCP_API virtual std::string ToString() const;
679 
680     SdfLayerHandle layer;
681     std::string sublayerPath;
682     std::string messages;
683 
684 private:
685     /// Constructor is private. Use New() instead.
686     PcpErrorInvalidSublayerPath();
687 };
688 
689 ///////////////////////////////////////////////////////////////////////////////
690 
691 // Forward declarations:
692 class PcpErrorInvalidVariantSelection;
693 typedef std::shared_ptr<PcpErrorInvalidVariantSelection>
694     PcpErrorInvalidVariantSelectionPtr;
695 
696 /// \class PcpErrorInvalidVariantSelection
697 ///
698 /// Invalid variant selections.
699 ///
700 class PcpErrorInvalidVariantSelection : public PcpErrorBase {
701 public:
702     /// Returns a new error object.
703     static PcpErrorInvalidVariantSelectionPtr New();
704     /// Destructor.
705     PCP_API ~PcpErrorInvalidVariantSelection();
706     /// Converts error to string message.
707     PCP_API virtual std::string ToString() const;
708 
709     std::string siteAssetPath;
710     SdfPath sitePath;
711     std::string vset, vsel;
712 
713 private:
714     /// Constructor is private. Use New() instead.
715     PcpErrorInvalidVariantSelection();
716 };
717 
718 ///////////////////////////////////////////////////////////////////////////////
719 
720 // Forward declarations:
721 class PcpErrorOpinionAtRelocationSource;
722 typedef std::shared_ptr<PcpErrorOpinionAtRelocationSource>
723     PcpErrorOpinionAtRelocationSourcePtr;
724 
725 /// \class PcpErrorOpinionAtRelocationSource
726 ///
727 /// Opinions were found at a relocation source path.
728 ///
729 class PcpErrorOpinionAtRelocationSource : public PcpErrorBase {
730 public:
731     /// Returns a new error object.
732     static PcpErrorOpinionAtRelocationSourcePtr New();
733     /// Destructor.
734     PCP_API ~PcpErrorOpinionAtRelocationSource();
735     /// Converts error to string message.
736     PCP_API virtual std::string ToString() const;
737 
738     SdfLayerHandle layer;
739     SdfPath path;
740 
741 private:
742     /// Constructor is private. Use New() instead.
743     PcpErrorOpinionAtRelocationSource();
744 };
745 
746 ///////////////////////////////////////////////////////////////////////////////
747 
748 // Forward declarations:
749 class PcpErrorPrimPermissionDenied;
750 typedef std::shared_ptr<PcpErrorPrimPermissionDenied>
751     PcpErrorPrimPermissionDeniedPtr;
752 
753 /// \class PcpErrorPrimPermissionDenied
754 ///
755 /// Layers with illegal opinions about private prims.
756 ///
757 class PcpErrorPrimPermissionDenied : public PcpErrorBase {
758 public:
759     /// Returns a new error object.
760     static PcpErrorPrimPermissionDeniedPtr New();
761     /// Destructor.
762     PCP_API ~PcpErrorPrimPermissionDenied();
763     /// Converts error to string message.
764     PCP_API virtual std::string ToString() const;
765 
766     /// The site where the invalid arc was expressed.
767     PcpSiteStr site;
768     /// The private, invalid target of the arc.
769     PcpSiteStr privateSite;
770 
771 private:
772     /// Constructor is private. Use New() instead.
773     PcpErrorPrimPermissionDenied();
774 };
775 
776 ///////////////////////////////////////////////////////////////////////////////
777 
778 // Forward declarations:
779 class PcpErrorPropertyPermissionDenied;
780 typedef std::shared_ptr<PcpErrorPropertyPermissionDenied>
781     PcpErrorPropertyPermissionDeniedPtr;
782 
783 /// \class PcpErrorPropertyPermissionDenied
784 ///
785 /// Layers with illegal opinions about private properties.
786 ///
787 class PcpErrorPropertyPermissionDenied : public PcpErrorBase {
788 public:
789     /// Returns a new error object.
790     static PcpErrorPropertyPermissionDeniedPtr New();
791     /// Destructor.
792     PCP_API ~PcpErrorPropertyPermissionDenied();
793     /// Converts error to string message.
794     PCP_API virtual std::string ToString() const;
795 
796     SdfPath propPath;
797     SdfSpecType propType;
798     std::string layerPath;
799 
800 private:
801     /// Constructor is private. Use New() instead.
802     PcpErrorPropertyPermissionDenied();
803 };
804 
805 ///////////////////////////////////////////////////////////////////////////////
806 
807 // Forward declarations:
808 class PcpErrorSublayerCycle;
809 typedef std::shared_ptr<PcpErrorSublayerCycle> PcpErrorSublayerCyclePtr;
810 
811 /// \class PcpErrorSublayerCycle
812 ///
813 /// Layers that recursively sublayer themselves.
814 ///
815 class PcpErrorSublayerCycle : public PcpErrorBase {
816 public:
817     /// Returns a new error object.
818     static PcpErrorSublayerCyclePtr New();
819     /// Destructor.
820     PCP_API ~PcpErrorSublayerCycle();
821     /// Converts error to string message.
822     PCP_API virtual std::string ToString() const;
823 
824     SdfLayerHandle layer;
825     SdfLayerHandle sublayer;
826 
827 private:
828     /// Constructor is private. Use New() instead.
829     PcpErrorSublayerCycle();
830 };
831 
832 ///////////////////////////////////////////////////////////////////////////////
833 
834 // Forward declarations:
835 class PcpErrorTargetPermissionDenied;
836 typedef std::shared_ptr<PcpErrorTargetPermissionDenied>
837     PcpErrorTargetPermissionDeniedPtr;
838 
839 /// \class PcpErrorTargetPermissionDenied
840 ///
841 /// Paths with illegal opinions about private targets.
842 ///
843 class PcpErrorTargetPermissionDenied : public PcpErrorTargetPathBase {
844 public:
845     /// Returns a new error object.
846     static PcpErrorTargetPermissionDeniedPtr New();
847     /// Destructor.
848     PCP_API ~PcpErrorTargetPermissionDenied();
849     /// Converts error to string message.
850     PCP_API virtual std::string ToString() const;
851 
852 private:
853     /// Constructor is private. Use New() instead.
854     PcpErrorTargetPermissionDenied();
855 };
856 
857 ///////////////////////////////////////////////////////////////////////////////
858 
859 // Forward declarations:
860 class PcpErrorUnresolvedPrimPath;
861 typedef std::shared_ptr<PcpErrorUnresolvedPrimPath>
862     PcpErrorUnresolvedPrimPathPtr;
863 
864 /// \class PcpErrorUnresolvedPrimPath
865 ///
866 /// Asset paths that could not be both resolved and loaded.
867 ///
868 class PcpErrorUnresolvedPrimPath : public PcpErrorBase {
869 public:
870     /// Returns a new error object.
871     static PcpErrorUnresolvedPrimPathPtr New();
872     /// Destructor.
873     PCP_API ~PcpErrorUnresolvedPrimPath();
874     /// Converts error to string message.
875     PCP_API virtual std::string ToString() const;
876 
877     /// The site where the invalid arc was expressed.
878     PcpSiteStr site;
879     SdfPath unresolvedPath;
880     PcpArcType arcType;
881 
882 private:
883     /// Constructor is private. Use New() instead.
884     PcpErrorUnresolvedPrimPath();
885 };
886 
887 /// Raise the given errors as runtime errors.
888 PCP_API
889 void PcpRaiseErrors(const PcpErrorVector &errors);
890 
891 PXR_NAMESPACE_CLOSE_SCOPE
892 
893 #endif // PXR_USD_PCP_ERRORS_H
894