keyreduc.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: keyreduc.h
00004 
00005     DESCRIPTION:  Key reduction
00006 
00007     CREATED BY: Rolf Berteig
00008 
00009     HISTORY: created 9/30/95
00010 
00011  *> Copyright (c) 1994, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 #include "coreexp.h"
00016 #include "maxheap.h"
00017 #include "interval.h"
00018 
00019 // forward declarations
00020 class Control;
00021 
00022 #define DEFULAT_KEYREDUCE_THRESHOLD     (0.5f)
00023 
00024 // Values returned from Progress
00025 #define KEYREDUCE_ABORT     -1      // Stops processing and undoes any key reduction
00026 #define KEYREDUCE_STOP      0       // Stops processing, but keeps any reduction done so far
00027 #define KEYREDUCE_CONTINUE  1       // Keeps going.
00028 
00029 // A callback so progress can be made during key reduction
00036 class KeyReduceStatus: public MaxHeapOperators {
00037     public:
00038         virtual ~KeyReduceStatus()  {}
00039         // Called once before reduction starts. 'total' is the number
00040         // reduction canidate keys.
00046         virtual void Init(int total)=0;
00047 
00048         // Called every now and again. 'p' is the number of keys
00049         // processed. So % done is p/total * 100.       
00065         virtual int Progress(int p)=0;
00066     };
00067 
00068 // Attempts to delete keys that lie within the given time range.
00069 // The controller will be sampled within the range in 'step' size
00070 // increments. After the key reduction, the controller's values
00071 // at each step are gauranteed to be withen 'threshold' distance
00072 // from their original values.
00073 //
00074 CoreExport int ApplyKeyReduction(
00075         Control *cont,Interval range,float thresh,TimeValue step,
00076         KeyReduceStatus *status);
00077 
00078 
00079