indii/ml/aux/PartitionTree.hpp

00001 #ifndef INDII_ML_AUX_PARTITIONTREE_HPP
00002 #define INDII_ML_AUX_PARTITIONTREE_HPP
00003 
00004 #include "PartitionTreeNode.hpp"
00005 #include "DiracMixturePdf.hpp"
00006 
00007 #include "boost/serialization/split_member.hpp"
00008 
00009 namespace indii {
00010   namespace ml {
00011     namespace aux {
00012 /**
00013  * Abstract spatial partition tree.
00014  *
00015  * @author Lawrence Murray <lawrence@indii.org>
00016  * @version $Rev: 562 $
00017  * @date $Date: 2008-09-11 17:37:07 +0100 (Thu, 11 Sep 2008) $
00018  *
00019  * @section PartitionTree_serialization Serialization
00020  *
00021  * This class supports serialization through the Boost.Serialization
00022  * library.
00023  */
00024 class PartitionTree {
00025 public:
00026   /**
00027    * Default constructor.
00028    *
00029    * This should generally only be used when the object is to be
00030    * restored from a serialization.
00031    */
00032   PartitionTree();
00033 
00034   /**
00035    * Constructor.
00036    *
00037    * @param p Weighted sample set from which to build the tree.
00038    */
00039   PartitionTree(DiracMixturePdf* p);
00040 
00041   /**
00042    * Destructor.
00043    */
00044   virtual ~PartitionTree();
00045 
00046   /**
00047    * Clone tree.
00048    *
00049    * @return Clone of tree. Caller has ownership.
00050    */
00051   virtual PartitionTree* clone() = 0;
00052 
00053   /**
00054    * Get the underlying weighted sample set.
00055    *
00056    * @return The underlying weighted sample set.
00057    */
00058   DiracMixturePdf* getData();
00059 
00060   /**
00061    * Get the root node of the partition tree.
00062    *
00063    * @return Root node of the partition tree.
00064    */
00065   virtual PartitionTreeNode* getRoot() = 0;
00066 
00067   /**
00068    * Set the underlying weighted sample set.
00069    *
00070    * @param p The underlying weighted sample set.
00071    *
00072    * The new set should have the same number of components as the existing
00073    * set.
00074    */
00075   void setData(DiracMixturePdf* p);
00076 
00077   /**
00078    * Set the root node of the partition tree.
00079    *
00080    * @param root Root node of the partition tree.
00081    *
00082    * Care should be taken that the index of the greatest component
00083    * in the subtree @p root is not greater than the number of components
00084    * in the weighted sample set underlying the tree. This is not checked.
00085    */
00086   virtual void setRoot(PartitionTreeNode* root) = 0;
00087 
00088 private:
00089   /**
00090    * Weighted sample set.
00091    */
00092   DiracMixturePdf* p;
00093 
00094   /**
00095    * Serialize.
00096    */
00097   template<class Archive>
00098   void save(Archive& ar, const unsigned int version) const;
00099 
00100   /**
00101    * Restore from serialization.
00102    */
00103   template<class Archive>
00104   void load(Archive& ar, const unsigned int version);
00105 
00106   /*
00107    * Boost.Serialization requirements.
00108    */
00109   BOOST_SERIALIZATION_SPLIT_MEMBER()
00110   friend class boost::serialization::access;
00111 
00112 };
00113 
00114     }
00115   }
00116 }
00117 
00118 inline indii::ml::aux::DiracMixturePdf*
00119     indii::ml::aux::PartitionTree::getData() {
00120   return p;
00121 }
00122 
00123 template<class Archive>
00124 void indii::ml::aux::PartitionTree::save(Archive& ar,
00125     const unsigned int version) const {
00126   //
00127 }
00128 
00129 template<class Archive>
00130 void indii::ml::aux::PartitionTree::load(Archive& ar,
00131     const unsigned int version) {
00132   //
00133 }
00134 
00135 #endif
00136 

Generated on Wed Dec 17 15:11:57 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3