Go to the documentation of this file.00001 #ifndef Bound_H
00002 #define Bound_H
00003
00004 #include <vector>
00005 #include "Const.h"
00006 #include "MathLib.h"
00007 #include "Belief.h"
00008 #include "PointBasedAlgorithm.h"
00009
00010 using namespace std;
00011 using namespace momdp;
00012 namespace momdp
00013 {
00014 class MObject;
00015 class BeliefTreeNode;
00016 class BeliefCache;
00017
00018 template <typename T> class Backup;
00019
00020 template <typename T>
00021 class Bound
00022 {
00023 public:
00024 typedef void (*BackupCallback)(PointBasedAlgorithm *solver, BeliefTreeNode * node, SharedPointer<T> backupResult) ;
00025 Backup<T> *backupEngine;
00026
00027 protected:
00028 vector<BackupCallback> onBackup;
00029 PointBasedAlgorithm *solver;
00030
00031 void doNothing(BeliefTreeNode * node, SharedPointer<T> backupResult)
00032 {
00033 }
00034
00035 public:
00036
00037
00038
00039
00040
00041
00042
00043 virtual void appendOnBackupHandler(BackupCallback _onBackup)
00044 {
00045 onBackup.push_back( _onBackup);
00046 }
00047 virtual void removeOnBackupHandler(BackupCallback _onBackup)
00048 {
00049 typename vector<BackupCallback>::iterator iter;
00050 for(iter = onBackup.begin(); iter!= onBackup.end() ; iter ++)
00051 {
00052 if(_onBackup == *iter)
00053 {
00054 onBackup.erase( iter);
00055 break;
00056 }
00057 }
00058 }
00059
00060 void setBackupEngine(Backup<T> *_backupEngine)
00061 {
00062 backupEngine = _backupEngine;
00063 }
00064
00065 virtual ~Bound(void)
00066 {
00067 }
00068
00069
00070
00071
00072 virtual SharedPointer<T> backup(BeliefTreeNode * node) = 0;
00073
00074 };
00075
00076 }
00077
00078
00079 #endif
00080