Views
Prototypes Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Static Public Member Functions
IlvAccessible Class Referenceabstract

Abstract class providing queryValue(), changeValue(), conversion, and introspection methods. More...

#include <ilviews/protos/value.h>

Inheritance diagram for IlvAccessible:
IlvValueInterface IlvAccessorHolder IlvGroupMediator IlvGroupNode IlvGroup IlvProtoMediator IlvGraphicNode IlvSubGroupNode IlvProtoInstance IlvPrototype

Public Member Functions

virtual IlBoolean changeValue (const IlvValue &v)
 Changes the object's value. Both the name and the new value are contained in val. More...
 
virtual IlBoolean changeValues (const IlvValue *v, IlUShort c)
 Changes several values of an object in a single call. The default implementation calls changeValue() for all values. More...
 
virtual IlUInt compareAllValues (const IlvAccessible *ref, IlvValueArray &diffs, IlBoolean any=IlFalse) const
 Compares two objects and returns the differing attributes. More...
 
virtual IlUInt compareValues (const IlvAccessible *ref, IlvValue *values, IlUShort count, IlvValueArray &diffs) const
 Compares two objects and returns the differing attributes. More...
 
virtual IlBoolean convertValues (IlvValue *v, IlUShort c, IlvDisplay *d) const
 Convert values to match the types defined by the object accessors. More...
 
virtual void getAccessors (const IlSymbol *const **a, const IlvValueTypeClass *const **t, IlUInt &c) const =0
 Returns the names of all the accessors known by this object. More...
 
virtual const char * getName () const =0
 Returns the object name. More...
 
IlUInt getSubscriptions (IlvAccessible *subscriber, IlSymbol **&sourceValue, IlSymbol **&subscriberValue, IlvValueTypeClass **&type, IlvValueSubscriptionMode *&mode, IlvAccessible ***subscribers=0) const
 Returns alls subscriptions made by subscriber. More...
 
virtual const IlvValueTypeClassgetValueType (const IlSymbol *s) const
 Returns the type of a given attribute. More...
 
virtual IlBoolean isOutputValue (const IlSymbol *value) const
 Indicates whether value designates an accessor that can generate notifying values. More...
 
virtual IlvValuepullValue (IlvValue &v) const
 See below.
 
virtual void pullValues (IlvValue *vals, IlUShort c) const
 Propagates value queries to the subscribers to this object. More...
 
virtual IlBoolean pushValue (const IlvValue &v) const
 See below.
 
virtual IlBoolean pushValues (const IlvValue *vals, IlUShort c) const
 Propagates value changes to the subscribers to this object. More...
 
virtual IlvValuequeryValue (IlvValue &value) const
 Queries the value designated by value from the object. Both the value and the value type are stored in value. More...
 
virtual void queryValues (IlvValue *v, IlUShort c) const
 Queries several values in a single call. The default implementation calls queryValue() for each value. More...
 
virtual void subscribe (IlvAccessible *subscriber, IlSymbol *sourceValue, IlSymbol *subscriberValue, IlvValueTypeClass *type, IlvValueSubscriptionMode mode=IlvValueSubscriptionChange)
 Subscribes the subscriber object to the value sourceValue of this object. More...
 
virtual void unSubscribe (IlvAccessible *subscriber, IlSymbol *sourceValue=0, IlSymbol *subscriberValue=0)
 Cancels subscriptions previously made. More...
 

Static Public Member Functions

static void DeclareAccessor (const IlSymbol *attr, IlvValueTypeClass *type, const IlSymbol *const **accessors, const IlvValueTypeClass *const **types, IlUInt &count, IlBoolean checkDuplicates=IlFalse, IlAny accessorList=0)
 
static const IlvValueTypeClassGetType (IlSymbol *name)
 Returns the type instance from a name. More...
 
static IlBoolean StringToValue (const char *s, const IlvValueTypeClass *typeClass, IlvValue &v, IlvDisplay *d)
 Converts the character string s to an IlvValue with the type type. More...
 
static IlBoolean StringToValue (const char *s, IlSymbol *type, IlvValue &v, IlvDisplay *display)
 Converts the character string s to an IlvValue with the type type. More...
 
static IlBoolean ValuesAreEqual (IlvValue &v1, IlvValue &v2, IlBoolean compareNames=IlTrue)
 Compares two values. More...
 

Detailed Description

Abstract class providing queryValue(), changeValue(), conversion, and introspection methods.

Library: ilvproto

IlvAccessible is an abstract base class used as a superclass for all objects in the prototype library that provide an interface based on the queryValue()/changeValue() methods.

IlvAccessible also provides methods for converting and comparing values, and implements the value subscription interface.

See also
IlvValue, IlvValueInterface, IlvAccessorHolder, IlvGroupNode.

Member Function Documentation

◆ changeValue()

virtual IlBoolean IlvAccessible::changeValue ( const IlvValue v)
virtual

Changes the object's value. Both the name and the new value are contained in val.

Parameters
vThe value to be set (both name and value).
Returns
Whether the object considered the operation successful or not.

Reimplemented from IlvValueInterface.

Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.

◆ changeValues()

virtual IlBoolean IlvAccessible::changeValues ( const IlvValue v,
IlUShort  c 
)
virtual

Changes several values of an object in a single call. The default implementation calls changeValue() for all values.

Parameters
vThe changed values (both name and values).
cThe number of values.
Returns
Whether the object considered the operation successful or not.

Reimplemented from IlvValueInterface.

Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.

◆ compareAllValues()

virtual IlUInt IlvAccessible::compareAllValues ( const IlvAccessible ref,
IlvValueArray diffs,
IlBoolean  any = IlFalse 
) const
virtual

Compares two objects and returns the differing attributes.

See below.

◆ compareValues()

virtual IlUInt IlvAccessible::compareValues ( const IlvAccessible ref,
IlvValue values,
IlUShort  count,
IlvValueArray diffs 
) const
virtual

Compares two objects and returns the differing attributes.

Compares the values of accessors known by this object with the corresponding values in the object ref. The values that differ are stored in diffs. The values stored are taken from the calling object (this), not from ref. The first method calls the getAccessors() method to get the list of all known accessors, while the second only compares the provided values. Then, both methods call compareValues() to actually compare the values.

Returns
The number of differing attributes.
Parameters
refThe object to compare to.
valuesThe attributes to compare in both objects.
countThe number of attributes to compare.
diffsThe differing attributes.

Reimplemented in IlvSubGroupNode, and IlvAccessorHolder.

◆ convertValues()

virtual IlBoolean IlvAccessible::convertValues ( IlvValue v,
IlUShort  c,
IlvDisplay d 
) const
virtual

Convert values to match the types defined by the object accessors.

Converts a set of values so their type match the type of accessors corresponding to the object. The values are normally stored in values as strings. They will be converted to the appropriate types. The result is returned in values.

Returns
Whether the conversion process was successful.
Parameters
vThe values to convert.
cThe number of values to convert.
dA display, needed to allow font, color, and other resource conversions.

◆ DeclareAccessor()

static void IlvAccessible::DeclareAccessor ( const IlSymbol attr,
IlvValueTypeClass type,
const IlSymbol *const **  accessors,
const IlvValueTypeClass *const **  types,
IlUInt count,
IlBoolean  checkDuplicates = IlFalse,
IlAny  accessorList = 0 
)
static

Adds the accessor name attr and its type type to the accessors and types lists, and increments the count parameter. To add an accessor to the list, this method must be called from getAccessors().

◆ getAccessors()

virtual void IlvAccessible::getAccessors ( const IlSymbol *const **  a,
const IlvValueTypeClass *const **  t,
IlUInt c 
) const
pure virtual

Returns the names of all the accessors known by this object.

Subclasses of IlvAccessible must override this method by calling the static method DeclareAccessor() for each accessor handled by the subclass. The returned arrays are filled by the method and must not be freed.

Parameters
aPointer to an array filled on return with the names of the accessors defined for the object.
tPointer to an array filled on return with the type of each accessor.
cNumber of accessors, set by the method.

Reimplemented from IlvValueInterface.

Implemented in IlvGraphicNode, IlvSubGroupNode, IlvGroup, IlvAccessorHolder, and IlvGroupMediator.

◆ getName()

virtual const char* IlvAccessible::getName ( ) const
pure virtual

Returns the object name.

Returns
The object name. This pointer must not be freed.

Reimplemented from IlvValueInterface.

Implemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroupNode, and IlvGroup.

◆ getSubscriptions()

IlUInt IlvAccessible::getSubscriptions ( IlvAccessible subscriber,
IlSymbol **&  sourceValue,
IlSymbol **&  subscriberValue,
IlvValueTypeClass **&  type,
IlvValueSubscriptionMode *&  mode,
IlvAccessible ***  subscribers = 0 
) const

Returns alls subscriptions made by subscriber.

The sourceValue, subscriberValues, types, and modes arguments are modified to contain the parameters of all the subscriptions for the specified subscriber. These parameters must be released using the delete[] operator when they are no longer needed. The method returns the number of elements returned in each array.

Returns
The number of subscriptions.
Parameters
subscriberThe subscriber to start with.
sourceValueThe names of the attributes observed by the subscription.
subscriberValueThe names of the attributes to be notified in the subscriber.
typeThe types of the expected values pushed in subscriber.
modeThe modes of the subscriptions.
subscribersThe subscribers also observing the object.

◆ GetType()

static const IlvValueTypeClass* IlvAccessible::GetType ( IlSymbol name)
static

Returns the type instance from a name.

Parameters
nameThe name of the type that is requested.
Returns
A pointer to the type instance that corresponds to the name name.

◆ getValueType()

virtual const IlvValueTypeClass* IlvAccessible::getValueType ( const IlSymbol s) const
virtual

Returns the type of a given attribute.

Parameters
sThe name of the accessor.
Returns
The type of this object accessor, or IlvValueNoType if the accessor does not exist.

Reimplemented in IlvGroup.

◆ isOutputValue()

virtual IlBoolean IlvAccessible::isOutputValue ( const IlSymbol value) const
virtual

Indicates whether value designates an accessor that can generate notifying values.

Returns
IlTrue if value designates an accessor that can generate notifying values, that is, a value for which pushValue() calls may be issued. The default implementation returns IlFalse. Subclasses such as IlvAccessorHolder redefine this method.
Parameters
valueName of the accessor.
See also
pushValue().

Reimplemented in IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.

◆ pullValues()

virtual void IlvAccessible::pullValues ( IlvValue vals,
IlUShort  c 
) const
virtual

Propagates value queries to the subscribers to this object.

Must be called to propagate value queries to the subscribers to this object. When pullValue() or pullValues() is called, every IlvAccessible object subscribed to the value identified by val with a mode of IlvValueSubscriptionQuery is notified through a call to the subscriber queryValue() or queryValues() methods. The value name is equal to the subscriberValue passed to the subscribe method when the subscription was made. The first method returns the last value returned by the queryValue() methods of the subscribers. The second method returns whether the object considered the call successful.

Parameters
valsThe pulled values.
cThe number of values.
Returns
Whether the object considered the call successful, or the last value returned by the queryValue() methods of the subscribers.

◆ pushValues()

virtual IlBoolean IlvAccessible::pushValues ( const IlvValue vals,
IlUShort  c 
) const
virtual

Propagates value changes to the subscribers to this object.

Must be called to propagate value changes to the subscribers to this object. When pushValue() or pushValues() is called, every IlvAccessible object subscribed to the value identified by v with a mode of IlvValueSubscriptionChange is notified through a call to the subscriber changeValue() or changeValues() methods. The value name is equal to the subscriberValue passed to the subscribe method when the subscription was made, with a data value equal to the data contained in val. The method returns IlTrue if at least one of the changeValue() methods of the subscribers returns IlTrue, and IlFalse otherwise.

Returns
Whether the object considered the call successful.
Parameters
valsThe pushed values.
cThe number of values.

◆ queryValue()

virtual IlvValue& IlvAccessible::queryValue ( IlvValue value) const
virtual

Queries the value designated by value from the object. Both the value and the value type are stored in value.

Parameters
valueThe queried value name.
Returns
The value passed in argument, set to the object value.

Reimplemented from IlvValueInterface.

Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.

◆ queryValues()

virtual void IlvAccessible::queryValues ( IlvValue v,
IlUShort  c 
) const
virtual

Queries several values in a single call. The default implementation calls queryValue() for each value.

Parameters
vThe array of value names to be queried
cThe number of values to be queried.

Reimplemented from IlvValueInterface.

Reimplemented in IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.

◆ StringToValue() [1/2]

static IlBoolean IlvAccessible::StringToValue ( const char *  s,
const IlvValueTypeClass typeClass,
IlvValue v,
IlvDisplay d 
)
static

Converts the character string s to an IlvValue with the type type.

Returns
IlTrue if the conversion was successful, and IlFalse otherwise.
Parameters
sInput string.
typeClassType of the value to convert the string into.
vResulting value.
dDisplay used to convert resources such as colors, fonts, and so on.

◆ StringToValue() [2/2]

static IlBoolean IlvAccessible::StringToValue ( const char *  s,
IlSymbol type,
IlvValue v,
IlvDisplay display 
)
static

Converts the character string s to an IlvValue with the type type.

See below.

◆ subscribe()

virtual void IlvAccessible::subscribe ( IlvAccessible subscriber,
IlSymbol sourceValue,
IlSymbol subscriberValue,
IlvValueTypeClass type,
IlvValueSubscriptionMode  mode = IlvValueSubscriptionChange 
)
virtual

Subscribes the subscriber object to the value sourceValue of this object.

After this subscription, every call to this object pushValue() method with a value name of sourceValue will cause the subscriber changeValue() method to be called with the value name subscriberValue, and with the value data passed to the initial pushValue() call of the value source. The type parameter specifies the type of the sourceValue and subscriberValue values. An IlvAccessible object can subscribe several times to another IlvAccessible object for different source values and/or subscriber values, but it may not subscribe several times to the same object and subscriber values. The mode argument specifies whether the subscriber wants to be notified of value changes (this is the default mode IlvValueSubscriptionChange), or if it wants to be notified of value queries (mode IlvValueSubscriptionQuery). In this last case, the source object notifies its subscribers of calls to pullValue() instead of pushValue() by calling queryValue() instead of changeValue().

Parameters
subscriberThe object to be notified of accesses to sourceValue.
sourceValueThe name of the attribute to be observed by the subscription.
subscriberValueThe name of the attribute to be notified in the subscriber.
typeThe expected value type to be pushed to the subscriber.
modeThe type of access to sourceValue to be reported to subscriber.
See also
IlvValueSubscriptionMode

Reimplemented in IlvSubGroupNode, and IlvGroup.

◆ unSubscribe()

virtual void IlvAccessible::unSubscribe ( IlvAccessible subscriber,
IlSymbol sourceValue = 0,
IlSymbol subscriberValue = 0 
)
virtual

Cancels subscriptions previously made.

Cancels the subscription of the subscriber object to the specified sourceValue and subscriberValue. If sourceValue is 0, the subscriptions of subscriber to all source values are cancelled. If subscriberValue is 0, the subscriptions of subscriber for all subscriber values are removed. If both are 0, all subscriptions of subscriber to this source object are cancelled.

Parameters
subscriberThe object that is to be notified of accesses to sourceValue.
sourceValueThe name of the attribute to be observed by the subscription.
subscriberValueThe name of the attribute to be notified in the subscriber.

Reimplemented in IlvSubGroupNode, and IlvGroup.

◆ ValuesAreEqual()

static IlBoolean IlvAccessible::ValuesAreEqual ( IlvValue v1,
IlvValue v2,
IlBoolean  compareNames = IlTrue 
)
static

Compares two values.

The actual comparison depends on the type of the values: scalar types are compared using their == operators, strings are compared using the strcmp() function, and resource values (such as IlvColors) are compared using their pointers (that is, two distinct instances of IlvColor representing the same RGB values will still be considered as different).

Returns
IlTrue if the values are equal, and IlFalse if they differ.
Parameters
v1First value.
v2Second value.
compareNamesSpecifies whether names should also be identical.