Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Retinal_Composite Class Reference

#include <retinalobjs.h>

Inheritance diagram for Retinal_Composite:

Inheritance graph
[legend]
Collaboration diagram for Retinal_Composite:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class for composite objects, which are Retinal_Objects which may be composed of other Retinal_Objects.

Additional operations are supported for composite objects; other derived Retinal_Objects should rarely need to define their own operations other than those overriding or completing the ones in Retinal_Object.

Definition at line 365 of file retinalobjs.h.

Public Types

enum  AccumulationType {
  Max, Min, Add, OneHot,
  Replace
}
 Possible values for an accum_type.


Public Methods

Constructors and destructors
 Retinal_Composite (const string &name_val, AccumulationType accum_type_i=Max, const VarMap &init_vars=VarMap())
RetinalObjectStringArgs::ParamList paramlist ()
 Retinal_Composite (const string &name_val, RetinalObjectStringArgs &sa)
 Retinal_Composite (const Retinal_Composite &b)
Primary Interface
virtual bool next ()
 Advance to the next state (whatever that means for this object).

virtual void reset ()
 Reset to the starting state.

virtual bool update () const
 Must be called just before calling activation() one or more times.

Composite-only interface
virtual Coordinate nominal_height () const
 Most Composites don't have any width or height, and instead just ask their parents.

virtual Coordinate nominal_width () const
virtual void add (Retinal_Object *obj)
 Incorporate the given retinal object (must be allocated from the heap).

virtual bool is_empty () const
 Whether there are currently any children.

virtual Retinal_Objectfind (const string &othername)
 Returns the first object with a matching name from a preorder search on self and children.

virtual void remove (const string &childname="")
 Remove all children with the specified name.

virtual void remove_all ()
 Remove all children; separate routine for use with for_each.

virtual const Retinal_Objectmostactive (Coordinate x, Coordinate y) const
 Rarely needed: Returns child which has the highest activation at that location, or self if childless.

Retinal_Objectoperator[] (unsigned int idx) const
 Deprecated: Returns child specified by number.

size_t size () const
Other functions which may be useful
virtual string stringrep () const
 (Partial) representation of this object's state as a string

virtual Retinal_Objectclone () const
 Return an identical copy of this object allocated from the heap.

bool inside (Coordinate x, Coordinate y) const
 Returns true if the given coordinate is inside the active area of this object, favoring the most precise response possible, regardless of performance.


Protected Types

typedef std::vector< Retinal_Object * > ChildrenContainer
 Container with pointers to the child objects managed by this instance.

typedef ChildrenContainer::iterator iterator
 Iterator over this instance's children.

typedef ChildrenContainer::const_iterator const_iterator
 Iterator over this instance's children.


Protected Methods

Activity accum_base () const
 Starting value for an accumulation.


Protected Attributes

ChildrenContainer children
 The child objects managed by this instance.

AccumulationType accum_type
 How to combine the responses from multiple children.

Variable cosmt
 Cached values for activ().

Variable sinmt
 Cached values for activ().

Variable cx
 Cached values for activ().

Variable cy
 Cached values for activ().

Variable div_size
 Cached values for activ().

Retinal_Objectdominant_child
 If accum_type is OneHot, the currently-dominant child.


Member Function Documentation

virtual Retinal_Object* Retinal_Composite::find const string &    othername [inline, virtual]
 

Returns the first object with a matching name from a preorder search on self and children.

The empty string matches the first object found, whatever it is.

Reimplemented from Retinal_Object.

Definition at line 439 of file retinalobjs.h.

References children, Retinal_Object::find(), and iterator.

bool Retinal_Composite::inside Coordinate    x,
Coordinate    y
const [virtual]
 

Returns true if the given coordinate is inside the active area of this object, favoring the most precise response possible, regardless of performance.

A rectangular bounding box will suffice, but if an object can give a more precise answer, e.g. if it really has a circular or irregular shape instead of a box, it should give the more precise answer here. This call should be used only when such precision is needed; the regular rectangular bounding box can be used in other cases.

Reimplemented from Retinal_Object.

Definition at line 317 of file retinalobjs.c.

References accum_type, Retinal_Object::bounding_box, Retinal_Obj::Coordinate, cx, cy, div_size, dominant_child, and Retinal_Object::inside().

const Retinal_Object & Retinal_Composite::mostactive Coordinate    x,
Coordinate    y
const [virtual]
 

Rarely needed: Returns child which has the highest activation at that location, or self if childless.

There might be a way to encode this using max_element, mem_fun, bind1st, bind2nd, etc.

Definition at line 280 of file retinalobjs.c.

References Retinal_Object::activation(), Retinal_Obj::Activity, children, and const_iterator.

virtual Coordinate Retinal_Composite::nominal_height   const [inline, virtual]
 

Most Composites don't have any width or height, and instead just ask their parents.

With any luck, they will have a parent that knows the width and height, and overrides this implementation.

Reimplemented in Retinal_AnchoredManagedComposite.

Definition at line 415 of file retinalobjs.h.

References Retinal_Obj::Coordinate, Retinal_Object::get_parent(), and Retinal_Object::get_var().


The documentation for this class was generated from the following files:
Generated on Mon Jan 20 02:37:14 2003 for RF-LISSOM by doxygen1.3-rc2