QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::ConceptIterator Struct Reference
[Knowledge BaseObject Iterators]

#include <Q/q.h>

Inheritance diagram for Q::ConceptIterator:

Q::ObjectBase List of all members.

Public Member Functions

 ConceptIterator ()
Concept current () const
unsigned int currentDepth () const
Utils::Result next ()
bool valid () const
Concept operator * () const
ConceptIteratoroperator++ ()

Static Public Member Functions

ConceptIterator create (const Concept &parent, unsigned int depth=1)
ClassType classType ()
ConceptIterator cast (const ObjectBase &obj)

Detailed Description

The ConceptIterator is a convenient way to find all concepts descendant from a given parent to a given depth. The parent is associated with a Concept through the "isa" relation. Examples are (tibbles isa cat), (cat isa animal), (animal isa thing), (dog isa animal), (spike isa dog) and (spot isa dog).

The parent-child relationships between Concepts via "isa" constitute a type lattice.

Suppose we want to find all dogs. Use a ConceptIterator(dog) to get the list (spike spot). ConceptIterator(animal) would get (cat dog). Both these examples work to the default depth of 1.

Using depths > 1, you can find more derived types. Note that only the leaves are returned. For example, ConceptIterator(animal, 2) would get (tibbles spike spot). A depth of zero continues to the most derived types.


Constructor & Destructor Documentation

Q::ConceptIterator::ConceptIterator  )  [inline]
 

Create a null ConceptIterator.


Member Function Documentation

ConceptIterator Q::ConceptIterator::cast const ObjectBase obj  )  [static]
 

If the object referenced by obj is a ConceptIterator, then return a suitable reference to the object.

ClassType Q::ConceptIterator::classType  )  [static]
 

Return the type of this class.

ConceptIterator Q::ConceptIterator::create const Concept parent,
unsigned int  depth = 1
[static]
 

Create a new iterator for subtypes of the given parent at the given depth.

Note:
depth=0 finds the most derived types.

Concept Q::ConceptIterator::current  )  const
 

Return the iterator's current Concept.

unsigned int Q::ConceptIterator::currentDepth  )  const
 

Return the depth of the current ConceptIterator's current position in the list.

Utils::Result Q::ConceptIterator::next  ) 
 

Advance the iterator to the next object in the list or if the current object is the last object in the list, then set the state of the iterator to invalid.

Concept Q::ConceptIterator::operator *  )  const [inline]
 

See also:
current

ConceptIterator& Q::ConceptIterator::operator++  )  [inline]
 

See also:
next

bool Q::ConceptIterator::valid  )  const
 

Return true if the iterator's current position in the iteration represents a valid concept. When the iterator has finished iterating through the list, valid() will return false.

Reimplemented from Q::ObjectBase.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004