ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
|
Abstract base class for Attributes interface. More...
#include <attributes.h>
Public Types | |
typedef std::shared_ptr< Attributes > | Ptr |
typedef std::vector< std::pair< std::string, std::string > > | Enums |
Public Member Functions | |
Attributes () | |
Constructor. More... | |
Attributes (const Attributes &)=default | |
Default copy constructor. More... | |
virtual | ~Attributes () |
Destructor. More... | |
virtual SceneItem::Ptr | sceneItem () const =0 |
virtual Attribute::Type | attributeType (const std::string &name)=0 |
virtual Attribute::Ptr | attribute (const std::string &name)=0 |
virtual std::vector< std::string > | attributeNames () const =0 |
virtual bool | hasAttribute (const std::string &name) const =0 |
virtual Attribute::Ptr | addAttribute (const std::string &name, const Attribute::Type &type) |
virtual AddAttributeUndoableCommand::Ptr | addAttributeCmd (const std::string &name, const Attribute::Type &type)=0 |
virtual bool | removeAttribute (const std::string &name) |
virtual UndoableCommand::Ptr | removeAttributeCmd (const std::string &name)=0 |
virtual Attribute::Ptr | renameAttribute (const std::string &originalName, const std::string &newName) |
virtual RenameAttributeUndoableCommand::Ptr | renameAttributeCmd (const std::string &originalName, const std::string &newName)=0 |
virtual Enums | getEnums (const std::string &attrName) const =0 |
Static Public Member Functions | |
static Ptr | attributes (const SceneItem::Ptr &item) |
static bool | addObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs) |
static bool | addObserver (const Observer::Ptr &obs) |
static bool | removeObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs) |
static bool | removeObserver (const Observer::Ptr &obs) |
static std::size_t | nbObservers (const SceneItem::Ptr &item) |
static std::size_t | nbObservers () |
static bool | hasObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs) |
static bool | hasObserver (const Observer::Ptr &obs) |
static bool | hasObservers (const Path &path) |
static bool | hasObservers (Rtid runTimeId) |
static void | notify (const AttributeChanged ¬ification) |
Abstract base class for Attributes interface.
This base class defines an interface for factory objects that runtimes can implement to create attribute interface objects as well as query attribute names, attribute type and attribute existence. The Attributes interface object can be considered as a factory, because it provides an interface to create an Attribute object per attribute, given an attribute name. The Attribute object actually performs the work of reading from and writing to the attribute.
As with the rest of UFE, attribute observation is done through the Observer Pattern. Observers can be added to an individual scene item, to be notified when an attribute changes.
To avoid the memory-consuming "one proxy object per scene object" approach, attributes interface objects should be obtained and used within a local scope, and not stored.
Definition at line 51 of file attributes.h.
typedef std::vector< std::pair< std::string, std::string> > Ufe::Attributes::Enums |
Definition at line 55 of file attributes.h.
typedef std::shared_ptr<Attributes> Ufe::Attributes::Ptr |
Definition at line 54 of file attributes.h.
Ufe::Attributes::Attributes | ( | ) |
Constructor.
|
default |
Default copy constructor.
|
virtual |
Destructor.
|
virtual |
Adds an attribute to the SceneItem this Attributes interface refers to.
name | The name of the new attribute. |
type | The type of the new attribute. |
|
pure virtual |
Creates a command to add an attribute to the SceneItem this Attributes interface refers to. The command is not executed.
name | The name of the new attribute. |
type | The type of the new attribute. |
|
static |
Add observation for attribute changes on any item in the scene (global observation).
obs | Observer to add. |
|
static |
|
pure virtual |
|
pure virtual |
|
static |
Convenience method that calls the attributes method on the attribute handler for the item. Returns a null pointer if the argument is null, or has an empty path.
item | SceneItem's Attributes interface to retrieve. |
|
pure virtual |
|
pure virtual |
Gets the enums associated with the named attribute
attrName | The name of the attribute to return the enums for. |
|
pure virtual |
Queries whether an attribute exists with the given name.
name | The attribute name to check. |
|
static |
Query observation for attribute changes on any item in the scene (global observers).
obs | Observer to query. |
|
static |
|
static |
path | Path to verify if being observed. |
|
static |
Helper query for runtimes, to determine if a path they are responsible for is being observed specifically. This only considers observation of that specific path, and does not consider observation of any item in the scene (global observation), which is in addition.
runTimeId | runtime Id to find observers on. |
|
static |
Number of observers for attribute changes on any item in the scene (global observers).
|
static |
|
static |
Notify all observers, including global observers. The order in which observers are notified is unspecified. If no observer exists, does nothing.
notification | Attribute notification to send. |
|
virtual |
Removes an attribute created via addAttribute.
name | The name of the attribute to remove. |
|
pure virtual |
Create a command to remove an attribute created via addAttribute. The command is not executed.
name | The name of the attribute to remove. |
|
static |
Remove observation for attribute changes on any item in the scene (global observation).
obs | Observer to remove. |
|
static |
|
virtual |
Rename an attribute. If an attribute already exists with the newName name, a unique name from newName is generated.
originalName | The name of the attribute to rename. |
newName | The new name for the attribute |
|
pure virtual |
Create a command to rename an attribute. The command is not executed.
originalName | The name of the attribute to rename. |
newName | The new name for the attribute |
|
pure virtual |