HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeMap Class Reference

#include <PDG_AttributeMap.h>

+ Inheritance diagram for PDG_AttributeMap:

Classes

class  ScopedLock
 
class  ScopedTryLock
 

Public Types

enum  CreateWhen { eCreateNever, eCreateAlways, eCreateUpgrade }
 
enum  ChangeResult { eChangeNone, eChangeConstructive, eChangeDestructive }
 Enumeration of possible attribute change results during regeneration. More...
 
enum  AttribTable { eTableStatic, eTableDynamic, eTableCount }
 Enumeration of attribute tables. More...
 

Public Member Functions

template<typename Func >
bool lockedAccess (const Func &func) const
 
template<typename Func >
bool tryLockedAccess (const Func &func) const
 
template<typename Attribute , typename Func >
void forEachRO (const Func &func) const
 
template<typename Func >
bool forEachRO (const PDG_AttributePattern &pattern, const Func &func) const
 
template<typename Attribute , typename Func >
bool forEachRO (const PDG_AttributePattern &pattern, const Func &func) const
 
 PDG_AttributeMap (const PDG_AttributeOwner *owner, bool has_runtime)
 
 ~PDG_AttributeMap ()
 
int64 getMemoryUsage (bool inclusive) const
 Returns the memory usage of this attribute map. More...
 
void swap (PDG_AttributeMap &other)
 Swaps the target attribute map contents with this one. More...
 
void freeze ()
 
bool mergeFull (PDG_AttributeMerge &attrib_merge, const PDG_AttributeMap &other, AttribTable dst_table=eTableStatic, bool reset=true)
 Merges all attributes from another map into this one. More...
 
bool mergeFull (PDG_AttributeMerge &attrib_merge, const PDG_AttributeOwner *owner, AttribTable dst_table=eTableStatic, bool reset=true)
 Merges all attributes from another attribute owner into this one. More...
 
bool mergeStatic (PDG_AttributeMerge &attrib_merge, const PDG_AttributeOwner *owner)
 Merges static attributes from another attribute owenr into this one. More...
 
bool mergeDynamic (PDG_AttributeMerge &attrib_merge, const PDG_AttributeOwner *owner)
 Merges dynamic attributes from another attribute owenr into this one. More...
 
void setParentMap (PDG_AttributeOwner *parent)
 Sets the parent map. More...
 
void resolveMergeOps (PDG_AttributeMerge &attrib_merge)
 Resolves any pending operations in the specified attribute merge map. More...
 
bool eraseDirty (bool include_unowned)
 
void eraseStale ()
 
PDG_AttributeError eraseAll (bool include_internal)
 Erases all attributes in this map. More...
 
PDG_AttributeError erase (PDG_AttributeType type)
 Erases all attributes of the specified Attribute type from the map. More...
 
PDG_AttributeError erase (const UT_StringHolder &name)
 Erases an attribute from the map by name. More...
 
void clearConcat (AttribTable table=eTableCount)
 
bool timeDependentAttributes (UT_ArrayStringSet &names) const
 Returns the set of time dependent attributes for this map. More...
 
bool hasAttribute (const UT_StringHolder &name) const
 
PDG_AttributeType attributeType (const UT_StringHolder &name) const
 Returns the type of the attribute with the specified name. More...
 
int attributeSize (const UT_StringHolder &name) const
 Returns the size of the attribute with the specified name. More...
 
void attributeNames (UT_ArrayStringSet &names, PDG_AttributeType type) const
 
void attributeNames (UT_StringArray &names, PDG_AttributeType type) const
 
int numAttributes (PDG_AttributeType type) const
 
bool attributeMatch (const PDG_AttributePattern &pattern, bool include_internal) const
 Returns true if any attributes in this map match the specified pattern. More...
 
bool attributeMatch (UT_ArrayStringSet &names, const PDG_AttributePattern &pattern, bool include_internal) const
 
bool attributeMatch (UT_ArrayStringSet &names, const PDG_AttributePattern &pattern, PDG_AttributeType type, bool include_internal) const
 
bool save (UT_JSONWriter &writer, PDG_AttributeSaveType save_type, bool is_patch, bool include_bound) const
 
void save (UT_OptionsHolder &dict, PDG_AttributeSaveType save_type, bool is_patch, bool include_bound) const
 
bool save (UT_JSONWriter &writer, const PDG_AttributeHolder &holder, const UT_StringHolder &name) const
 
void save (UT_OptionsHolder &dict, const PDG_AttributeHolder &holder) const
 
bool loadV1 (PDG_AttributeCollision strategy, const UT_JSONValue &value)
 Loads a V1 data format json object. More...
 
bool loadV2 (PDG_AttributeSaveType save_type, PDG_AttributeCollision strategy, const UT_JSONValue &value)
 Loads a V2 data format json object. More...
 
bool loadV2 (PDG_AttributeSaveType save_type, PDG_AttributeCollision strategy, const UT_OptionsHolder &dict)
 Loads a V2 data format dictionary. More...
 
const PDG_AttributeOwnerowner () const
 Returns the attribute owner. More...
 
PDG_ROAttributeRef
< PDG_AttributeFile
inputFileRO (AttribTable table=eTableCount) const
 Returns a read-only handle to the standard input file attribute. More...
 
PDG_RWAttributeRef
< PDG_AttributeFile
inputFileRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 Returns a read/write handle to the standard input file attribute. More...
 
PDG_ROAttributeRef
< PDG_AttributeFile
outputFileRO (AttribTable table=eTableCount) const
 Returns a read-only handle to the standard output file attribute. More...
 
PDG_RWAttributeRef
< PDG_AttributeFile
outputFileRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 Returns a read-write handle to the standard output file attribute. More...
 
PDG_ROAttributeRef
< PDG_AttributeFile
addedFileRO (AttribTable table=eTableCount) const
 Returns a read-only handle to the standard added file attribute. More...
 
PDG_RWAttributeRef
< PDG_AttributeFile
addedFileRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 Returns a read/write handle to the standard input file attribute. More...
 
PDG_ROAttributeRef
< PDG_AttributeString
commandStringRO (AttribTable table=eTableCount) const
 
PDG_RWAttributeRef
< PDG_AttributeString
commandStringRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 Returns a read/write handle to the standard input file attribute. More...
 
PDG_ROAttributeRef
< PDG_AttributeString
labelRO (AttribTable table=eTableCount) const
 
PDG_RWAttributeRef
< PDG_AttributeString
labelRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 Returns a read/write handle to the standard work item label attribute. More...
 
PDG_ROAttributeRef
< PDG_AttributeString
stateRO (AttribTable table=eTableCount) const
 
PDG_RWAttributeRef
< PDG_AttributeString
stateRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 
PDG_ROAttributeRef
< PDG_AttributeFloat
cookPercentRO (AttribTable table=eTableCount) const
 
PDG_RWAttributeRef
< PDG_AttributeFloat
cookPercentRW (CreateWhen create=eCreateNever, AttribTable table=eTableCount)
 
template<typename Attribute = PDG_AttributeData>
PDG_ROAttributeRef< AttributerefRO (const UT_StringHolder &name, AttribTable table=eTableCount) const
 
template<typename Attribute >
PDG_RWAttributeRef< AttributerefRW (const UT_StringHolder &name)
 
template<typename Attribute >
PDG_RWAttributeRef< AttributerefRW (const UT_StringHolder &name, bool create, PDG_AttributeOverwrite overwrite=PDG_AttributeOverwrite::eMatch, uint16 flags=0)
 
template<typename Attribute >
PDG_RWAttributeRef< AttributerefRWC (const UT_StringHolder &name, CreateWhen create=eCreateNever, PDG_AttributeOverwrite overwrite=PDG_AttributeOverwrite::eMatch, AttribTable table=eTableCount, bool allow_internal_names=false, uint16 flags=0)
 Same as above, but with greater control on the creation flags. More...
 
template<typename Attribute >
PDG_AttributeError copyFrom (const UT_StringHolder &name, const PDG_ROAttributeRef< Attribute > &ref, bool overwrite_existing, bool deep_copy)
 Copies the specified attribute into an attribute on this map. More...
 
PDG_AttributeError rename (const UT_StringHolder &src_name, const UT_StringHolder &dst_name, bool overwrite)
 Renames the specififed attribute. More...
 
template<typename Attribute >
bool value (typename Attribute::Data &value, const UT_StringHolder &name, int index, uint16 flags=0) const
 
template<typename Attribute >
bool value (typename Attribute::Array &value, const UT_StringHolder &name, uint16 flags=0) const
 
template<typename Attribute >
PDG_AttributeError setValue (const UT_StringHolder &name, const typename Attribute::Data &value, int index, bool create, PDG_AttributeOverwrite overwrite=PDG_AttributeOverwrite::eMatch)
 
template<typename Attribute >
PDG_AttributeError setValue (const UT_StringHolder &name, const typename Attribute::Array &values, bool create, PDG_AttributeOverwrite overwrite=PDG_AttributeOverwrite::eMatch)
 
template<typename Attribute >
PDG_AttributeError clearValues (const UT_StringHolder &name, bool create, PDG_AttributeOverwrite overwrite=PDG_AttributeOverwrite::eMatch)
 
template<typename Attribute >
bool values (typename Attribute::Map &value_map, uint16 flags=0) const
 
bool value (PDGT_Value &value, const UT_StringHolder &name, int index, uint16 flags=0) const
 Queries a scalar value by name/index and stores it as a PDGT_Value. More...
 
bool values (PDGT_Value::Map &value_map, uint16 flags=0) const
 Queries all values as PDGT_Values. More...
 
bool hasFlag (const UT_StringHolder &name, PDG_AttributeFlag flag) const
 Returns true if attribute has the the specified flag set, else false. More...
 
PDG_AttributeError setFlag (const UT_StringHolder &name, PDG_AttributeFlag flag, bool set)
 Sets or clears a flag on the specified attribute. More...
 
bool setFlagAll (PDG_AttributeFlag flag, bool set)
 Sets or clears a flag on all attributes. More...
 
void startChangeTracking ()
 Begins tracking attribute changes. More...
 
ChangeResult endChangeTracking (bool check_all)
 Ends tracking changes, returning true if a change made was. More...
 
bool hash (SYS_HashType &hash_val, AttribTable table, bool include_internal, bool include_unowned, UT_WorkBuffer &errors) const
 
bool hash (SYS_HashType &hash_val, const UT_ArrayStringSet &filter, AttribTable table, bool include_internal, bool include_unowned, UT_WorkBuffer &errors) const
 

Static Public Attributes

static const UT_StringHolder theBuiltinPrefix
 
static const UT_StringHolder theInputFileName
 
static const UT_StringHolder theOutputFileName
 
static const UT_StringHolder theAddedFileName
 
static const UT_StringHolder theCommandStringName
 Name of the built-in command attribute. More...
 
static const UT_StringHolder theLabelName
 Name of the built-in human readable label attribute. More...
 
static const UT_StringHolder theCustomStateName
 Name of the built-in custom state attribute. More...
 
static const UT_StringHolder theCookPercentName
 Name of the built-in cook percent attribute. More...
 
static const UT_StringHolder thePartitionSizeName
 Name of the built-in partition size attribute. More...
 
static const UT_StringHolder theAllAttribName
 
static const UT_StringHolder thePseudoAttribName
 
static const uint16 theInputFileFlags
 Flags for the standard input file attribute. More...
 
static const uint16 theOutputFileFlags
 Flags for the standard output file attribute. More...
 
static const uint16 theAddedFileFlags
 Flags for the standard added file attribute. More...
 
static const uint16 theCommandStringFlags
 Flags for the standard command string attribute. More...
 
static const uint16 theLabelFlags
 Flags for the standard label attribute. More...
 
static const uint16 theCustomStateFlags
 Flags for the standard custom state attribute. More...
 

Detailed Description

Map for storing, accessing and persisting PDG attribute data. Attributes are stored in a map of string value to attribute holder, which maintains a weak/strong reference to an attribute. Writing to an attrib value results in a deep copy being performed on the specified attribute (i.e. copy on write). Attribute handles are given to callers in the form of a PDG_ROAttributeRef or PDG_RWAttributeRef, depending on whether the caller requested a read only or read/write handle.

Attributes are owned by a PDG_AttributeOwner instance. In most cases this is a PDG_WorkItem, and the attributes are accessed/modified when the node creates or cooks the work item.

The attribute map maintains a separate table for static and dynamic attributes. Static attributes are any attributes created during the work item generation step, and dynamic attributes are attributes created or modified at any other point in time. If a work item attempts to modify a static attribute while cooking, including adding output files, then a copy made is in the dynamic map. The modifications are peformed on that rather than on the original static attribute. This means that when a work item is dirtied, it can easily roll back to the exact same state it was in before cooking. When a work item is being regenerated, only static values are considered. If the item is dirty then all dynamic attributes are discarded, otherwise if the item is still valid then the dynamic values are left as-is.

The various merge* methods should be used to merge attribute map data from a parent or dependency on the work item. Care should be taken to only merge static attributes during work item generation. Dynamic attributes can be merged at any point between generation and the work item being marked as cooked.

Definition at line 74 of file PDG_AttributeMap.h.

Member Enumeration Documentation

Enumeration of attribute tables.

Enumerator
eTableStatic 

Static attribute table, attributes in this table are modified when the work item is generated

eTableDynamic 

Dynamic attribute table, attributes in this table are modified outside of the generation step (during the cook, precook, etc).

eTableCount 

Number of attribute tables.

Definition at line 168 of file PDG_AttributeMap.h.

Enumeration of possible attribute change results during regeneration.

Enumerator
eChangeNone 

No changes occured.

eChangeConstructive 

Attribute values were changed or added.

eChangeDestructive 

At least one attribute was deleted.

Definition at line 155 of file PDG_AttributeMap.h.

Determines when to create an attribute, for refRW method calls that can optionally create one if it does not yet exist.

Enumerator
eCreateNever 

Never create the attribute, even if its not found.

eCreateAlways 

Always create the attribute if it does not exist.

eCreateUpgrade 

Only create the attribute if its necessary to upgrade from a static table entry to a dynamic table entry.

Definition at line 141 of file PDG_AttributeMap.h.

Constructor & Destructor Documentation

PDG_AttributeMap::PDG_AttributeMap ( const PDG_AttributeOwner owner,
bool  has_runtime 
)
explicit
PDG_AttributeMap::~PDG_AttributeMap ( )

Member Function Documentation

PDG_ROAttributeRef<PDG_AttributeFile> PDG_AttributeMap::addedFileRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard added file attribute.

Definition at line 597 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeFile> PDG_AttributeMap::addedFileRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard input file attribute.

Definition at line 604 of file PDG_AttributeMap.h.

bool PDG_AttributeMap::attributeMatch ( const PDG_AttributePattern pattern,
bool  include_internal 
) const

Returns true if any attributes in this map match the specified pattern.

bool PDG_AttributeMap::attributeMatch ( UT_ArrayStringSet names,
const PDG_AttributePattern pattern,
bool  include_internal 
) const

Returns the set of attribute names in the map that match the specified attribute pattern. Returns true if anything matches, else false.

bool PDG_AttributeMap::attributeMatch ( UT_ArrayStringSet names,
const PDG_AttributePattern pattern,
PDG_AttributeType  type,
bool  include_internal 
) const

Returns the set of attribute names in the map that match the specified attribute pattern and attribute type. Returns true if anything matches, else false.

void PDG_AttributeMap::attributeNames ( UT_ArrayStringSet names,
PDG_AttributeType  type 
) const

Returns the set of attribute names in the map, for the specified attribute type. Values are returned back as a string set.

void PDG_AttributeMap::attributeNames ( UT_StringArray names,
PDG_AttributeType  type 
) const

Returns the set of attribute names in the map, for the specified attribute type. Values are returned back as an array, sorted by attribute name.

int PDG_AttributeMap::attributeSize ( const UT_StringHolder name) const

Returns the size of the attribute with the specified name.

PDG_AttributeType PDG_AttributeMap::attributeType ( const UT_StringHolder name) const

Returns the type of the attribute with the specified name.

void PDG_AttributeMap::clearConcat ( AttribTable  table = eTableCount)

Clears the contents of any owned concatenated attributes, but does not remove them

template<typename Attribute >
PDG_AttributeError PDG_AttributeMap::clearValues ( const UT_StringHolder name,
bool  create,
PDG_AttributeOverwrite  overwrite = PDG_AttributeOverwrite::eMatch 
)
inline

Utility method that clears all values from an attribute, and creates it if it does not already exist

Definition at line 1008 of file PDG_AttributeMap.h.

PDG_ROAttributeRef<PDG_AttributeString> PDG_AttributeMap::commandStringRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard command string file attribute

Definition at line 619 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeString> PDG_AttributeMap::commandStringRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard input file attribute.

Definition at line 626 of file PDG_AttributeMap.h.

PDG_ROAttributeRef<PDG_AttributeFloat> PDG_AttributeMap::cookPercentRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard work item cook progress attribute

Definition at line 686 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeFloat> PDG_AttributeMap::cookPercentRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard work item custom state attribute

Definition at line 694 of file PDG_AttributeMap.h.

template<typename Attribute >
PDG_AttributeError PDG_AttributeMap::copyFrom ( const UT_StringHolder name,
const PDG_ROAttributeRef< Attribute > &  ref,
bool  overwrite_existing,
bool  deep_copy 
)
inline

Copies the specified attribute into an attribute on this map.

Definition at line 822 of file PDG_AttributeMap.h.

ChangeResult PDG_AttributeMap::endChangeTracking ( bool  check_all)

Ends tracking changes, returning true if a change made was.

PDG_AttributeError PDG_AttributeMap::erase ( PDG_AttributeType  type)

Erases all attributes of the specified Attribute type from the map.

PDG_AttributeError PDG_AttributeMap::erase ( const UT_StringHolder name)

Erases an attribute from the map by name.

PDG_AttributeError PDG_AttributeMap::eraseAll ( bool  include_internal)

Erases all attributes in this map.

bool PDG_AttributeMap::eraseDirty ( bool  include_unowned)

Erases any dynamic attributes, unowned attributes, or owned attributes that were formed by concatenating input attributes. Returns true if an attribute that was owned by this map is destroyed.

void PDG_AttributeMap::eraseStale ( )

Removes any stale attributes from the map from the deserialization process

template<typename Attribute , typename Func >
void PDG_AttributeMap::forEachRO ( const Func &  func) const
inline

Iterates over attributes in the map of the specified type, and invokes the input function on each matching entry. This function operates on the space of attribute names, and therefore will including parent map attributes and dynamic attributes, if permitted by the active context.

The supplied function can return true to halt iteration.

Definition at line 330 of file PDG_AttributeMap.h.

template<typename Func >
bool PDG_AttributeMap::forEachRO ( const PDG_AttributePattern pattern,
const Func &  func 
) const
inline

Iterates over attributes in the map that match the specified pattern, and invokes the function on each matching entry. Attributes are referenced generally, as PDG_AttributeData references.

The supplied function can return true to halt iteration. This function returns true if iteration was interrupted.

Definition at line 350 of file PDG_AttributeMap.h.

template<typename Attribute , typename Func >
bool PDG_AttributeMap::forEachRO ( const PDG_AttributePattern pattern,
const Func &  func 
) const
inline

Iterates over attributes in the map that match the specified pattern and type, and invokes the function on each matching entry. Attributes are referenced generally, as PDG_AttributeData references.

The supplied function can return true to halt iteration. This function returns true if iteration was interrupted.

Definition at line 375 of file PDG_AttributeMap.h.

void PDG_AttributeMap::freeze ( )

Freezes the attributes in the map, which invokes a deep copy on any unowned attributes. This makes the map fully standalone, without any shallow references to external attribute maps.

int64 PDG_AttributeMap::getMemoryUsage ( bool  inclusive) const

Returns the memory usage of this attribute map.

bool PDG_AttributeMap::hasAttribute ( const UT_StringHolder name) const

Checks for the existance of an attribute by name. Returns true if the attribute is found, else false

bool PDG_AttributeMap::hasFlag ( const UT_StringHolder name,
PDG_AttributeFlag  flag 
) const

Returns true if attribute has the the specified flag set, else false.

bool PDG_AttributeMap::hash ( SYS_HashType hash_val,
AttribTable  table,
bool  include_internal,
bool  include_unowned,
UT_WorkBuffer errors 
) const

Computes the hash value for attrib values, errors can occur if python objects hash() raises an exception.

bool PDG_AttributeMap::hash ( SYS_HashType hash_val,
const UT_ArrayStringSet filter,
AttribTable  table,
bool  include_internal,
bool  include_unowned,
UT_WorkBuffer errors 
) const

Computes the hash value for the specific attribute values specified in the set of names. This is the same as the function above, but it only applies to the indicated subset of attribs.

PDG_ROAttributeRef<PDG_AttributeFile> PDG_AttributeMap::inputFileRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard input file attribute.

Definition at line 555 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeFile> PDG_AttributeMap::inputFileRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard input file attribute.

Definition at line 562 of file PDG_AttributeMap.h.

PDG_ROAttributeRef<PDG_AttributeString> PDG_AttributeMap::labelRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard work item label attribute

Definition at line 641 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeString> PDG_AttributeMap::labelRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard work item label attribute.

Definition at line 648 of file PDG_AttributeMap.h.

bool PDG_AttributeMap::loadV1 ( PDG_AttributeCollision  strategy,
const UT_JSONValue value 
)

Loads a V1 data format json object.

bool PDG_AttributeMap::loadV2 ( PDG_AttributeSaveType  save_type,
PDG_AttributeCollision  strategy,
const UT_JSONValue value 
)

Loads a V2 data format json object.

bool PDG_AttributeMap::loadV2 ( PDG_AttributeSaveType  save_type,
PDG_AttributeCollision  strategy,
const UT_OptionsHolder dict 
)

Loads a V2 data format dictionary.

template<typename Func >
bool PDG_AttributeMap::lockedAccess ( const Func &  func) const
inline

Runs a functor on this map under the scoped read lock, so it's safe for concurrent access on an arbitrary thread. This holds both the global read lock and attribute map read lock, so it can always be called in order to safely iterate over attribute values. This should be used in, for example, an event handler callback in order to ensure that the attributes are not also being written to by the owner or a full-item list operation performed by another holder of the global lock.

If this map does not have an owner, or the owner does not have a global lock, the functor will be called with only the local attribute lock held.

Definition at line 302 of file PDG_AttributeMap.h.

bool PDG_AttributeMap::mergeDynamic ( PDG_AttributeMerge attrib_merge,
const PDG_AttributeOwner owner 
)

Merges dynamic attributes from another attribute owenr into this one.

bool PDG_AttributeMap::mergeFull ( PDG_AttributeMerge attrib_merge,
const PDG_AttributeMap other,
AttribTable  dst_table = eTableStatic,
bool  reset = true 
)

Merges all attributes from another map into this one.

bool PDG_AttributeMap::mergeFull ( PDG_AttributeMerge attrib_merge,
const PDG_AttributeOwner owner,
AttribTable  dst_table = eTableStatic,
bool  reset = true 
)

Merges all attributes from another attribute owner into this one.

bool PDG_AttributeMap::mergeStatic ( PDG_AttributeMerge attrib_merge,
const PDG_AttributeOwner owner 
)

Merges static attributes from another attribute owenr into this one.

int PDG_AttributeMap::numAttributes ( PDG_AttributeType  type) const

Returns the total number of attributes in the map, for the specified atribute type.

PDG_ROAttributeRef<PDG_AttributeFile> PDG_AttributeMap::outputFileRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard output file attribute.

Definition at line 576 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeFile> PDG_AttributeMap::outputFileRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read-write handle to the standard output file attribute.

Definition at line 583 of file PDG_AttributeMap.h.

const PDG_AttributeOwner* PDG_AttributeMap::owner ( ) const
inline

Returns the attribute owner.

Definition at line 550 of file PDG_AttributeMap.h.

template<typename Attribute = PDG_AttributeData>
PDG_ROAttributeRef<Attribute> PDG_AttributeMap::refRO ( const UT_StringHolder name,
AttribTable  table = eTableCount 
) const
inline

Returns a read-only, const attribute handle. Will be invalid if the specified attribute does not exist or is of the wrong type.

Definition at line 710 of file PDG_AttributeMap.h.

template<typename Attribute >
PDG_RWAttributeRef<Attribute> PDG_AttributeMap::refRW ( const UT_StringHolder name)
inline

Returns a read/write, non-const attribute handle that permits both flag and data manipulation. Does not create the attribute, but will upgrade it from a parent map/lower table if necessary. Note that this method is intionally distinct from the version below since it uses a codepath that doesn't require a concrete Attribute type in order to create an attribute reference.

Definition at line 735 of file PDG_AttributeMap.h.

template<typename Attribute >
PDG_RWAttributeRef<Attribute> PDG_AttributeMap::refRW ( const UT_StringHolder name,
bool  create,
PDG_AttributeOverwrite  overwrite = PDG_AttributeOverwrite::eMatch,
uint16  flags = 0 
)
inline

Returns a read/write, non-const attribute handle that permits both flag and data manipulation. Optionally creates the attribute if it does not exist. Will be invalid if the specified attribute does not exist, is of the wrong type, or is marked as read-only.

Definition at line 768 of file PDG_AttributeMap.h.

template<typename Attribute >
PDG_RWAttributeRef<Attribute> PDG_AttributeMap::refRWC ( const UT_StringHolder name,
CreateWhen  create = eCreateNever,
PDG_AttributeOverwrite  overwrite = PDG_AttributeOverwrite::eMatch,
AttribTable  table = eTableCount,
bool  allow_internal_names = false,
uint16  flags = 0 
)
inline

Same as above, but with greater control on the creation flags.

Definition at line 786 of file PDG_AttributeMap.h.

PDG_AttributeError PDG_AttributeMap::rename ( const UT_StringHolder src_name,
const UT_StringHolder dst_name,
bool  overwrite 
)
inline

Renames the specififed attribute.

Definition at line 864 of file PDG_AttributeMap.h.

void PDG_AttributeMap::resolveMergeOps ( PDG_AttributeMerge attrib_merge)

Resolves any pending operations in the specified attribute merge map.

bool PDG_AttributeMap::save ( UT_JSONWriter writer,
PDG_AttributeSaveType  save_type,
bool  is_patch,
bool  include_bound 
) const

Saves the attribute map to a JSON writer, in the most current data format

void PDG_AttributeMap::save ( UT_OptionsHolder dict,
PDG_AttributeSaveType  save_type,
bool  is_patch,
bool  include_bound 
) const

Saves the attribute map to a UT_Options, in the most current data format

bool PDG_AttributeMap::save ( UT_JSONWriter writer,
const PDG_AttributeHolder holder,
const UT_StringHolder name 
) const

Saves a single attribute holder to a JSON writer, in the most current data format.

void PDG_AttributeMap::save ( UT_OptionsHolder dict,
const PDG_AttributeHolder holder 
) const

Saves a single attribute holder to a UT_Options, in the most current data format.

PDG_AttributeError PDG_AttributeMap::setFlag ( const UT_StringHolder name,
PDG_AttributeFlag  flag,
bool  set 
)

Sets or clears a flag on the specified attribute.

bool PDG_AttributeMap::setFlagAll ( PDG_AttributeFlag  flag,
bool  set 
)

Sets or clears a flag on all attributes.

void PDG_AttributeMap::setParentMap ( PDG_AttributeOwner parent)

Sets the parent map.

template<typename Attribute >
PDG_AttributeError PDG_AttributeMap::setValue ( const UT_StringHolder name,
const typename Attribute::Data &  value,
int  index,
bool  create,
PDG_AttributeOverwrite  overwrite = PDG_AttributeOverwrite::eMatch 
)
inline

Utility method that sets an attribute value at a specified index, and creates it if it does not already exist

Examples:
PDG/PDG_ProcessorRandom.C.

Definition at line 975 of file PDG_AttributeMap.h.

template<typename Attribute >
PDG_AttributeError PDG_AttributeMap::setValue ( const UT_StringHolder name,
const typename Attribute::Array values,
bool  create,
PDG_AttributeOverwrite  overwrite = PDG_AttributeOverwrite::eMatch 
)
inline

Utility method that sets an attribute array value, and creates it if it does not already exist

Definition at line 992 of file PDG_AttributeMap.h.

void PDG_AttributeMap::startChangeTracking ( )

Begins tracking attribute changes.

PDG_ROAttributeRef<PDG_AttributeString> PDG_AttributeMap::stateRO ( AttribTable  table = eTableCount) const
inline

Returns a read-only handle to the standard work item custom state attribute

Definition at line 663 of file PDG_AttributeMap.h.

PDG_RWAttributeRef<PDG_AttributeString> PDG_AttributeMap::stateRW ( CreateWhen  create = eCreateNever,
AttribTable  table = eTableCount 
)
inline

Returns a read/write handle to the standard work item custom state attribute

Definition at line 671 of file PDG_AttributeMap.h.

void PDG_AttributeMap::swap ( PDG_AttributeMap other)

Swaps the target attribute map contents with this one.

bool PDG_AttributeMap::timeDependentAttributes ( UT_ArrayStringSet names) const

Returns the set of time dependent attributes for this map.

template<typename Func >
bool PDG_AttributeMap::tryLockedAccess ( const Func &  func) const
inline

Same as above, but only try-locks. If the lock cannot be acquired the functor is not run and the method returns false. If the functor is run successfully this method returns true.

Definition at line 313 of file PDG_AttributeMap.h.

template<typename Attribute >
bool PDG_AttributeMap::value ( typename Attribute::Data &  value,
const UT_StringHolder name,
int  index,
uint16  flags = 0 
) const
inline

Utility method that looks up a value from an attribute, with a given index, and an optional flag filter

Definition at line 941 of file PDG_AttributeMap.h.

template<typename Attribute >
bool PDG_AttributeMap::value ( typename Attribute::Array value,
const UT_StringHolder name,
uint16  flags = 0 
) const
inline

Utility method that looks up an array value from an attribute, with an optional flag filter

Definition at line 958 of file PDG_AttributeMap.h.

bool PDG_AttributeMap::value ( PDGT_Value value,
const UT_StringHolder name,
int  index,
uint16  flags = 0 
) const

Queries a scalar value by name/index and stores it as a PDGT_Value.

template<typename Attribute >
bool PDG_AttributeMap::values ( typename Attribute::Map &  value_map,
uint16  flags = 0 
) const
inline

Queries all values of the specified attribute type and returns them as a map.

Definition at line 1023 of file PDG_AttributeMap.h.

bool PDG_AttributeMap::values ( PDGT_Value::Map value_map,
uint16  flags = 0 
) const

Queries all values as PDGT_Values.

Member Data Documentation

const uint16 PDG_AttributeMap::theAddedFileFlags
static

Flags for the standard added file attribute.

Definition at line 128 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theAddedFileName
static

Name of the built-in added file list attribute, which contains files explicitly added to the work item.

Definition at line 92 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theAllAttribName
static

Special token indicating all attributes, used when binding attributes with PDG_AttributeInfo.

Definition at line 112 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theBuiltinPrefix
static

Prefix for all built-in PDG attributes that can potentially appear on work items. User-created attributes cannot begin with this prefix.

Definition at line 79 of file PDG_AttributeMap.h.

const uint16 PDG_AttributeMap::theCommandStringFlags
static

Flags for the standard command string attribute.

Definition at line 131 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theCommandStringName
static

Name of the built-in command attribute.

Definition at line 95 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theCookPercentName
static

Name of the built-in cook percent attribute.

Definition at line 104 of file PDG_AttributeMap.h.

const uint16 PDG_AttributeMap::theCustomStateFlags
static

Flags for the standard custom state attribute.

Definition at line 137 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theCustomStateName
static

Name of the built-in custom state attribute.

Definition at line 101 of file PDG_AttributeMap.h.

const uint16 PDG_AttributeMap::theInputFileFlags
static

Flags for the standard input file attribute.

Definition at line 122 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theInputFileName
static

Name of the built-in input file list attribute, which contains the read only list of input files to a work item

Definition at line 83 of file PDG_AttributeMap.h.

const uint16 PDG_AttributeMap::theLabelFlags
static

Flags for the standard label attribute.

Definition at line 134 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theLabelName
static

Name of the built-in human readable label attribute.

Definition at line 98 of file PDG_AttributeMap.h.

const uint16 PDG_AttributeMap::theOutputFileFlags
static

Flags for the standard output file attribute.

Definition at line 125 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::theOutputFileName
static

Name of the built-in output file list attribute, which contains the list of all output files from the work item, including any outputs copied from inputs.

Definition at line 88 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::thePartitionSizeName
static

Name of the built-in partition size attribute.

Definition at line 107 of file PDG_AttributeMap.h.

const UT_StringHolder PDG_AttributeMap::thePseudoAttribName
static

Special token used to indicate a "pseudo" attribute dependency, such as the work item's index or frame. These attribute dependencies only exist because the values are accessible via expressions like a regular attribute, although the value itself is not stored as an attribute.

Definition at line 118 of file PDG_AttributeMap.h.


The documentation for this class was generated from the following file: