Base class for persistent behaviors. More...
#include <ilviews/protos/useracc.h>
Public Member Functions | |
IlvUserAccessor (const char *name, const IlvValueTypeClass *type, IlUInt flags=0) | |
Constructor. More... | |
virtual void | initialize (const IlvAccessorHolder *object) |
Attachment method to an IlvAccessorHolder . More... | |
virtual IlBoolean | isOutputValue (const IlSymbol *) const |
Queries if the accessor is an output accessor. More... | |
IlBoolean | isPrivate () const |
Checks the private status. More... | |
IlBoolean | isRuntime () const |
Checks the RunTime status. More... | |
void | setPrivate (IlBoolean val) |
Sets the Private flag of this accessor. More... | |
void | setRuntime (IlBoolean runTime) |
Sets the RunTime flag of this accessor. More... | |
Public Member Functions inherited from IlvAccessor | |
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 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 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... | |
Protected Member Functions | |
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... | |
IlBoolean | getValue (IlvValue &val, const IlvAccessorHolder *object, IlvDisplay *display, IlvValueTypeClass *typeClass=0, IlSymbol *typeVal=0, const IlvValue *arg=0) const |
Evaluates a parameter of a user accessor. More... | |
Friends | |
class | IlvAccessorHolder |
class | IlvGroup |
Base class for persistent behaviors.
Library: ilvproto
An IlvUserAccessor
is an accessor that can be saved and restored. IlvUserAccessor
is the base class for all accessors that are to be added dynamically by the user when building a prototype.
IlvAccessorHolder
, IlvGroup
. IlvUserAccessor::IlvUserAccessor | ( | const char * | name, |
const IlvValueTypeClass * | type, | ||
IlUInt | flags = 0 |
||
) |
Constructor.
name | The name of the accessor, that is, the attribute by which one accesses this accessor in an accessor holder. Calls to object->queryValue(IlvValue(name, ...)) and object->changeValue(IlvValue(name, ...)) on the object will result in a corresponding call to accessor->queryValue(object, value) . |
type | The type of the accessors. Some accessors hold internal data in the form of an IlvValue . This argument allows you to set the type of this value. |
flags | The attributes of the new accessors. It is a combination of the following values:
|
|
protectedvirtual |
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 from IlvAccessor.
Reimplemented in IlvPrototypeAccessor, IlvGroupUserAccessor, and IlvCompositeAccessor.
|
protected |
Evaluates a parameter of a user accessor.
A user accessor parameter is often specified as a character string (which can contain a constant value, such as "100"), the name of another accessor, or an arbitrary expression containing constants and/or accessor names. This method takes an input value and evaluates it.
The result of the evaluation and potential conversion is stored in the val parameter.
val | Input/output parameter that initially contains the character string to convert. The getValue() method converts this character string as explained below, and stores the resulting value in val. If the value contains any of the characters "()+*-/&|^!>;<;=", it is considered as an expression and it is evaluated (see further). Otherwise, if the value starts with a quotation mark ("), or a
digit, or if it is equal to the values "IlTrue" or
"IlFalse", it is converted to the appropriate type (string or integer).If the value consists of a single identifier, it is interpreted as an accessor name, and the accessor value is retrieved from object. |
object | Object holding the accessor. Used to access other attributes in the object that can be referenced by the input value. |
display | The display instance that is used should the value type be a graphical resource type, that all need a display. |
typeVal | (see typeClass). |
typeClass | If non-null, the value is converted to that type. If typeVal is non-null and typeClass is 0 , the value is converted to the type of the typeVal property of object. |
arg | An argument that can be used as input by the evaluation process. |
IlTrue
if the conversion was successful, or IlFalse
if an error occurred while retrieving or converting the value.Expressions follow the usual C++ syntax. You can use the operators +, -, *, /, %, <, >, =, >=, <=, &&, ||, and parentheses. The ternary conditional operator "*?*:*" is not supported. The operands can be integer constants (in decimal or hexadecimal format) or floating-point constants (with the format defined by the C library function strtod()
). The operands can also be string constants (which must be placed in quotation marks), or identifiers that are interpreted as accessors of object. When the two operands are strings, the + operator returns the concatenation of its operands, and the == and != operators compare their operands as strings.
Expressions must not contain blank spaces between their operands or operators, or they will not be saved correctly to .ivp
files.
|
virtual |
Attachment method to an IlvAccessorHolder
.
This method is called when the accessor object is attached to a group. You can redefine it in subclasses of IlvUserAccessor
to perform any kind of initialization.
object | The object the accessor is attached to. |
Reimplemented in IlvPrototypeAccessor, IlvJavaScriptAccessor, IlvSlideYAccessor, IlvSlideXAccessor, IlvRotationAccessor, IlvAbstractEventAccessor, IlvLoopbackAccessor, IlvCallbackAccessor, and IlvAnimationAccessor.
Queries if the accessor is an output accessor.
IlTrue
if the accessor is an output accessor, and IlFalse
otherwise. Reimplemented from IlvAccessor.
Reimplemented in IlvPrototypeAccessor, IlvExportOutputAccessor, IlvOutputAccessor, and IlvCallbackAccessor.
IlBoolean IlvUserAccessor::isPrivate | ( | ) | const |
Checks the private status.
IlTrue
if the accessor has the private flag set. Otherwise, it returns IlFalse
. IlBoolean IlvUserAccessor::isRuntime | ( | ) | const |
Checks the RunTime status.
IlTrue
if the accessor has the RunTime flag set. Otherwise, it returns IlFalse
. void IlvUserAccessor::setPrivate | ( | IlBoolean | val | ) |
Sets the Private flag of this accessor.
val | The new Private flag value. |
void IlvUserAccessor::setRuntime | ( | IlBoolean | runTime | ) |
Sets the RunTime flag of this accessor.
runTime | The new RunTime flag value. |