mi::shader_v3::Map_lookup_base Class Reference

Map_lookup_base class. More...

#include <shader_map.h>

List of all members.

Public Member Functions

virtual void release () const =0
 deletes the object.
virtual miUint size () const =0
 returns the number of elements in the lookup.
virtual bool is_empty () const =0
 returns true if the lookup is empty.
virtual Map_status reset ()=0
 resets itself to point to the first element.
virtual Map_status next ()=0
 moves to the next element.
virtual bool at_end (Map_status *status=0) const =0
 returns true if it's beyond the end.
virtual Map_status sort ()=0
 sorts the elements in ascending order of distance.
virtual Map_status sort_descending ()=0
 sorts the elements in descending order of distance.
virtual Map_lookup_entry get (const miUint n, Map_status *status=0) const =0
 returns the n-th entry of the lookup.
virtual Map_lookup_entry get (Map_status *status=0) const =0
 returns the current lookup entry.
virtual miUint get_index (Map_status *status=0) const =0
 returns the index in the map of the current element.
virtual float get_distance (Map_status *status=0) const =0
 returns the distance of the current element.
virtual Map_status get (Map_element &element) const =0
 returns a copy of the current element.
virtual Map_status get_position (float *position) const =0
 retrieves the position of the current element.
virtual Map_status get_position (miVector &position) const =0
 retrieves the position of the current element, 3D case.
virtual Map_status get (const Map_field_id field_id, float &value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status get (const Map_field_id field_id, int &value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status get (const Map_field_id field_id, miVector &value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status get (const Map_field_id field_id, miColor &value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status get (const Map_field_id field_id, miMatrix *value) const =0
 retrieves the value of the desired field of the current element. NOTE: 'value' is a pointer to a miMatrix.
virtual Map_status get (const Map_field_id field_id, float *value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status get (const Map_field_id field_id, int *value) const =0
 retrieves the value of the desired field of the current element.
virtual Map_status search (const Map_distance_base &distance_functor, const miUint max_elements=1, const float max_search_dist=miHUGE_SCALAR)=0
 searches for the closest elements to a given point.
virtual Map_status search (const miVector &point, const miUint max_elements=1, const float max_search_dist=miHUGE_SCALAR)=0
 searches for the closest elements to a given point, specialized case of the above for a simple quadratic distance in 3D.


Detailed Description

Map_lookup_base class.

The Map_lookup_base class is an interface class which provides access (read-only) to elements which are the result of a lookup inside a map. Searches are run inside a map by calling the 'search' method which takes a Map_distance_base distance functor as argument, provided by the user, or by calling the 'search' method which takes a miVector as argument. There is a wrapper class which provides a convenient way to manage this class, which is the Map_lookup class. For example, a shader might attach a map lookup to a map and use it in the following way:

    // 'map' is a Access_map. Attaches a lookup to a map
    Map_lookup lookup (map);
   
    miVector point = ...;
   
    // looks for the closest 10 elements to the given point
    lookup->search (point, 10);
   
    // loops through all the found elements, like an iterator,
    // but accessing only the elements which have been found
    // in the search
    for ( ; !lookup->at_end() ; lookup->next() )    { ... }


Member Function Documentation

virtual bool mi::shader_v3::Map_lookup_base::at_end Map_status status = 0  )  const [pure virtual]
 

returns true if it's beyond the end.

Parameters:
status is a status code
Returns:
true if it's beyond the end, false otherwise

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
int *  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field.
value is the integer array output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
float *  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field.
value is the float array output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
miMatrix *  value
const [pure virtual]
 

retrieves the value of the desired field of the current element. NOTE: 'value' is a pointer to a miMatrix.

Parameters:
field_id is the id of the desired field
value is the pointer to the transform output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
miColor &  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field
value is the color output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
miVector &  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field
value is the vector output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
int &  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field
value is the integer output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get const Map_field_id  field_id,
float &  value
const [pure virtual]
 

retrieves the value of the desired field of the current element.

Parameters:
field_id is the id of the desired field
value is the float output value
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get Map_element element  )  const [pure virtual]
 

returns a copy of the current element.

Parameters:
element is the element which will hold the copy
Returns:
a status code

virtual Map_lookup_entry mi::shader_v3::Map_lookup_base::get Map_status status = 0  )  const [pure virtual]
 

returns the current lookup entry.

Parameters:
status is a status code
Returns:
the current lookup entry

virtual Map_lookup_entry mi::shader_v3::Map_lookup_base::get const miUint  n,
Map_status status = 0
const [pure virtual]
 

returns the n-th entry of the lookup.

Parameters:
n is the index of the desired entry
status is a status code
Returns:
the n-th entry of the lookup

virtual float mi::shader_v3::Map_lookup_base::get_distance Map_status status = 0  )  const [pure virtual]
 

returns the distance of the current element.

Parameters:
status is a status code
Returns:
the distance of the current element

virtual miUint mi::shader_v3::Map_lookup_base::get_index Map_status status = 0  )  const [pure virtual]
 

returns the index in the map of the current element.

Parameters:
status is a status code
Returns:
the index in the map of the current element

virtual Map_status mi::shader_v3::Map_lookup_base::get_position miVector &  position  )  const [pure virtual]
 

retrieves the position of the current element, 3D case.

Parameters:
position is the output vector
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::get_position float *  position  )  const [pure virtual]
 

retrieves the position of the current element.

Parameters:
position is the output array
Returns:
a status code

virtual bool mi::shader_v3::Map_lookup_base::is_empty  )  const [pure virtual]
 

returns true if the lookup is empty.

Returns:
true if the lookup has no entries, false otherwise

virtual Map_status mi::shader_v3::Map_lookup_base::next  )  [pure virtual]
 

moves to the next element.

Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::reset  )  [pure virtual]
 

resets itself to point to the first element.

Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::search const miVector &  point,
const miUint  max_elements = 1,
const float  max_search_dist = miHUGE_SCALAR
[pure virtual]
 

searches for the closest elements to a given point, specialized case of the above for a simple quadratic distance in 3D.

Parameters:
point is the three dimensional search point
max_elements max num of elements to return
max_search_dist is the max search distance from the point (quadratic)
Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::search const Map_distance_base distance_functor,
const miUint  max_elements = 1,
const float  max_search_dist = miHUGE_SCALAR
[pure virtual]
 

searches for the closest elements to a given point.

Parameters:
distance_functor provides search point and distances
max_elements max num of elements to return
max_search_dist is the max search distance from point, in the same metric as the distance functor
Returns:
a status code

virtual miUint mi::shader_v3::Map_lookup_base::size  )  const [pure virtual]
 

returns the number of elements in the lookup.

Returns:
the number of elements in the lookup

virtual Map_status mi::shader_v3::Map_lookup_base::sort  )  [pure virtual]
 

sorts the elements in ascending order of distance.

Returns:
a status code

virtual Map_status mi::shader_v3::Map_lookup_base::sort_descending  )  [pure virtual]
 

sorts the elements in descending order of distance.

Returns:
a status code

Copyright © 1986-2009 by mental images GmbH