Base class of all dynamic accessors. More...
#include <ilviews/protos/accessor.h>
Public Member Functions | |
IlvAccessor (const char *name, IlvValueTypeClass *type) | |
Creates a new accessor of name name and type type. | |
virtual IlBoolean | changeValue (IlvAccessorHolder *object, const IlvValue &val) |
Called by the method IlvAccessible::changeValue() for each IlvAccessor attached to the IlvAccessorHolder . | |
virtual IlBoolean | changeValues (IlvAccessorHolder *object, const IlvValue *values, IlUShort count) |
Called by the method IlvAccessible::changeValues() for each IlvAccessor attached to the IlvAccessorHolder . | |
virtual IlUInt | compareValues (const IlvAccessorHolder *object, const IlvAccessible *ref, IlvValue *values, IlUShort count, IlvValueArray &diffs) const |
Compares the values in ref and object and returns the differing values. More... | |
virtual void | getAccessors (const IlSymbol *const **accessors, const IlvValueTypeClass *const **types, IlUInt &count) const |
Returns the names and types of the values handled by this accessor. More... | |
const IlSymbol * | getName () const |
Returns the name of the accessor. More... | |
IlvValueTypeClass * | getType () const |
Returns the type of the accessor. More... | |
virtual IlBoolean | isOutputAccessor (IlBoolean &inputAndOutput) |
Queries if the accessor is an output accessor. More... | |
virtual IlBoolean | isOutputValue (const IlSymbol *name) const |
Queries if the accessor is an output accessor. More... | |
virtual IlShort | matchValues (const IlvAccessorHolder *object, const IlvValue *values, IlUShort count, IlvValue *matchingValues=0) const |
Returns the number of values that are handled by the accessor in the values array of length count. More... | |
virtual IlvValue & | queryValue (const IlvAccessorHolder *object, IlvValue &val) const |
Called by the method IlvAccessible::queryValue() for each IlvAccessor attached to the IlvAccessorHolder . | |
virtual void | queryValues (const IlvAccessorHolder *object, IlvValue *values, IlUShort count) const |
Called by the method IlvAccessible::queryValues() for each IlvAccessor attached to the IlvAccessorHolder . | |
void | setName (const IlSymbol *name) |
Sets the name of the accessor. More... | |
Friends | |
class | IlvAccessorHolder |
Base class of all dynamic accessors.
Library: ilvproto
IlvAccessor
is the base class of all dynamic accessors in the prototypes library. An IlvAccessor
associates a value name, which can be accessed with the changeValue()
/queryValue()
interface, with methods that will be called when the value is changed, queried, and compared to another value. An IlvAccessor
can be dynamically added to an instance of a subclass of IlvAccessorHolder
(most often, an IlvPrototype
), which will cause the object to respond to changeValue()
/queryValue()
requests for the new value. IlvAccessor
provides methods that are similar to those of the IlvAccessible
class, except that they have an additional argument, the object for which the accessor is called. IlvAccessorHolder
methods call the corresponding methods of IlvAccessor
for all accessors attached to the holder.
IlvAccessor
is subclassed into many specialized classes with particular behaviors. These accessor subclasses provide a simple way of programming the side effects of prototype attributes by combining appropriate IlvAccessor
objects.
The most important IlvAccessor
subclass is IlvUserAccessor
. It provides persistence methods, which make it possible to save accessors to files (in particular, prototype description files). Unless you write new subclasses of IlvGroupNode
that define built-in accessors, you will not need to use IlvAccessor
subclasses that are not IlvUserAccessor
subclasses.
Accessors are base 'bricks' of behavior that hold data (in which case they are called 'attributes') or perform side effects. Therefore, an attribute is a name that can be referenced to store data or perform side effects when a call to changeValue()
or queryValue()
is made. An attribute can consist of several accessors, each of them defining part of what the attribute is meant to do.
|
virtual |
Compares the values in ref and object and returns the differing values.
Compares the objects object and ref for the values specified by the values array of length count.
The default implementation simply calls the IlvAccessible::compareValues(const IlvAccessible*, IlvValue*, IlUShort, IlvValueArray&) const
method, which will query the values for the two objects and compare them one by one. Subclasses may compare values more cleverly by grouping differences: for example, the IlvGroupAccessor
subclass detects when all nodes of a group differ homogeneously and reports only one difference for the whole group.
object | The object to compare. |
ref | The reference to compare to. |
values | The values to be compared. |
count | The number of elements in the array values. |
diffs | Where the differences are stored. |
Reimplemented in IlvUserAccessor, IlvPrototypeAccessor, IlvMultipleGroupAccessor, IlvGroupAccessor, IlvGroupUserAccessor, and IlvCompositeAccessor.
|
virtual |
Returns the names and types of the values handled by this accessor.
IlvMultipleAccessor
) may add several names and types to signal that the accessor can respond to requests for several values. Reimplemented in IlvPrototypeAccessor, IlvMultipleAccessor, and IlvMultipleUserAccessor.
const IlSymbol* IlvAccessor::getName | ( | ) | const |
Returns the name of the accessor.
IlvValueTypeClass* IlvAccessor::getType | ( | ) | const |
Returns the type of the accessor.
Queries if the accessor is an output accessor.
inputAndOutput | Is set to IlTrue if this accessor is both an input and an output accessor. If this is not the case, inputAndOutput is set to IlFalse when returning from this member function. |
IlTrue
if the accessor is an output accessor, and IlFalse
otherwise. Queries if the accessor is an output accessor.
IlTrue
if the accessor is an output accessor, and IlFalse
otherwise. Reimplemented in IlvPrototypeAccessor, IlvExportOutputAccessor, IlvOutputAccessor, IlvCallbackAccessor, and IlvUserAccessor.
|
virtual |
Returns the number of values that are handled by the accessor in the values array of length count.
The matching values are copied to the matchingValues array, which must have a length of at least count. This method is called by the changeValue()
[s]/queryValue()
[s] methods of the IlvAccessorHolder
class to determine which IlvAccessor
objects respond to a request for a set of value names. All the accessors that return a non-null count of matching values will be called by the IlvAccessorHolder
, with the matching values as arguments. The base class implementation looks for a value corresponding to the accessor name given in values and copies it to matchingValues. Subclasses of IlvAccessor
(for example IlvMultipleAccessor
) may match several values.
Reimplemented in IlvPrototypeAccessor, IlvMultipleAccessor, and IlvMultipleUserAccessor.
void IlvAccessor::setName | ( | const IlSymbol * | name | ) |
Sets the name of the accessor.
name | The new name of the accessor. |