HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeClassify.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __PDG_ATTRIBUTE_CLASSIFY_H__
10 #define __PDG_ATTRIBUTE_CLASSIFY_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_WorkItemTypes.h"
15 
16 #include <UT/UT_Array.h>
17 #include <UT/UT_ArrayMap.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_WorkBuffer.h>
20 
21 #include <SYS/SYS_Hash.h>
22 
23 class PDG_WorkItem;
24 
25 class UT_StringArray;
26 
27 /*
28  * Groups work items into separate classes based on their attributes
29  */
31 {
32 public:
33  /// A map of attribute hash to the work items that match that particular
34  /// class.
36 
37  /// A map of work item ID to the monotonically increasing class numbers
38  /// that the work item is a part of
40 
41 public:
42  /// Returns the immediate results of classification, as a map of attrib
43  /// hash to the matching work items
45  { return myClassifications; }
46 
47  /// Returns the number of unique classifiction keys found from the input
48  /// work items
49  exint numKeys() const
50  { return myClassificationKeys.size(); }
51 
52  /// Returns a map of work item ID to class, produced by post-processing the
53  /// classification map
54  void classifications(ClassMap& class_map) const;
55 
56  /// Classifies the work item by creating a unique classification for ALL
57  /// attribute names. Returns true if the work item has the desired set of
58  /// attributes, and false if the work item is missing an attribute.
59  bool classifyAll(
60  const UT_StringArray& names,
61  const PDG_WorkItem* work_item,
62  bool skip_failures,
63  UT_WorkBuffer& errors);
64 
65  /// Classifies the work item by creating a unique classification for EACH
66  /// attribute name. Returns true if the work items has the desired set of
67  /// attributes, and false if the work items is missing an attribute.
68  bool classifyEach(
69  const UT_StringArray& names,
70  const PDG_WorkItem* work_item,
71  bool skip_failures,
72  UT_WorkBuffer& errors);
73 
74 private:
75  AttributeMap myClassifications;
76  UT_Array<SYS_HashType> myClassificationKeys;
77 };
78 
79 #endif
#define PDG_API
Definition: PDG_API.h:23
int64 exint
Definition: SYS_Types.h:125
const AttributeMap & classifications() const