Abstract class providing queryValue()
, changeValue()
, conversion, and introspection methods.
More...
#include <ilviews/protos/value.h>
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 IlvValueTypeClass * | getValueType (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 IlvValue & | pullValue (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 IlvValue & | queryValue (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 IlvValueTypeClass * | GetType (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... | |
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.
IlvValue
, IlvValueInterface
, IlvAccessorHolder
, IlvGroupNode
. Changes the object's value. Both the name and the new value are contained in val.
v | The value to be set (both name and value). |
Reimplemented from IlvValueInterface.
Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.
Changes several values of an object in a single call. The default implementation calls changeValue()
for all values.
v | The changed values (both name and values). |
c | The number of values. |
Reimplemented from IlvValueInterface.
Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.
|
virtual |
Compares two objects and returns the differing attributes.
See below.
|
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.
ref | The object to compare to. |
values | The attributes to compare in both objects. |
count | The number of attributes to compare. |
diffs | The differing attributes. |
Reimplemented in IlvSubGroupNode, and IlvAccessorHolder.
|
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.
v | The values to convert. |
c | The number of values to convert. |
d | A display, needed to allow font, color, and other resource conversions. |
|
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()
.
|
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.
a | Pointer to an array filled on return with the names of the accessors defined for the object. |
t | Pointer to an array filled on return with the type of each accessor. |
c | Number of accessors, set by the method. |
Reimplemented from IlvValueInterface.
Implemented in IlvGraphicNode, IlvSubGroupNode, IlvGroup, IlvAccessorHolder, and IlvGroupMediator.
|
pure virtual |
Returns the object name.
Reimplemented from IlvValueInterface.
Implemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroupNode, and IlvGroup.
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.
subscriber | The subscriber to start with. |
sourceValue | The names of the attributes observed by the subscription. |
subscriberValue | The names of the attributes to be notified in the subscriber. |
type | The types of the expected values pushed in subscriber. |
mode | The modes of the subscriptions. |
subscribers | The subscribers also observing the object. |
|
static |
Returns the type instance from a name.
name | The name of the type that is requested. |
|
virtual |
Returns the type of a given attribute.
s | The name of the accessor. |
IlvValueNoType
if the accessor does not exist. Reimplemented in IlvGroup.
Indicates whether value designates an accessor that can generate notifying values.
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. value | Name of the accessor. |
pushValue()
. Reimplemented in IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.
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.
vals | The pulled values. |
c | The number of values. |
queryValue()
methods of the subscribers. 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.
vals | The pushed values. |
c | The number of values. |
Queries the value designated by value from the object. Both the value and the value type are stored in value.
value | The queried value name. |
Reimplemented from IlvValueInterface.
Reimplemented in IlvGraphicNode, IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.
Queries several values in a single call. The default implementation calls queryValue()
for each value.
v | The array of value names to be queried |
c | The number of values to be queried. |
Reimplemented from IlvValueInterface.
Reimplemented in IlvGroupMediator, IlvSubGroupNode, IlvGroup, and IlvAccessorHolder.
|
static |
Converts the character string s to an IlvValue
with the type type.
IlTrue
if the conversion was successful, and IlFalse
otherwise. s | Input string. |
typeClass | Type of the value to convert the string into. |
v | Resulting value. |
d | Display used to convert resources such as colors, fonts, and so on. |
|
static |
Converts the character string s to an IlvValue
with the type type.
See below.
|
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()
.
subscriber | The object to be notified of accesses to sourceValue. |
sourceValue | The name of the attribute to be observed by the subscription. |
subscriberValue | The name of the attribute to be notified in the subscriber. |
type | The expected value type to be pushed to the subscriber. |
mode | The type of access to sourceValue to be reported to subscriber. |
Reimplemented in IlvSubGroupNode, and IlvGroup.
|
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.
subscriber | The object that is to be notified of accesses to sourceValue. |
sourceValue | The name of the attribute to be observed by the subscription. |
subscriberValue | The name of the attribute to be notified in the subscriber. |
Reimplemented in IlvSubGroupNode, and IlvGroup.
|
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 IlvColor
s) are compared using their pointers (that is, two distinct instances of IlvColor
representing the same RGB values will still be considered as different).
IlTrue
if the values are equal, and IlFalse
if they differ. v1 | First value. |
v2 | Second value. |
compareNames | Specifies whether names should also be identical. |