core/vpdl/vpdt/vpdt_num_obs.h
Go to the documentation of this file.
00001 // This is core/vpdl/vpdt/vpdt_num_obs.h
00002 #ifndef vpdt_num_obs_h_
00003 #define vpdt_num_obs_h_
00004 //:
00005 // \file
00006 // \author Matthew Leotta
00007 // \brief Attach a "number of observations" variable to any distribution
00008 // \date April 7, 2009
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   None
00013 // \endverbatim
00014 
00015 
00016 #include <vpdl/vpdt/vpdt_field_traits.h>
00017 
00018 //: Attach a "number of observations" variable to any distribution.
00019 //  The number of observations is non-integral because there may be
00020 //  partial or weighted observations.
00021 template <class dist_t>
00022 class vpdt_num_obs : public dist_t
00023 {
00024  public:
00025   //: the data type to represent a point in the field
00026   typedef typename dist_t::field_type field_type;
00027   //: define the parent type
00028   typedef dist_t parent_type;
00029   //: define the scalar type (normally specified by template parameter T)
00030   typedef typename vpdt_field_traits<field_type>::scalar_type T;
00031 
00032   //: Constructor
00033   vpdt_num_obs<dist_t>() : dist_t(), num_observations(T(0)) {}
00034 
00035   //: Constructor - somewhat like a copy constructor
00036   vpdt_num_obs<dist_t>(const dist_t& d, const T& n_obs = T(0))
00037   : dist_t(d), num_observations(n_obs) {}
00038 
00039   //: The number of observations
00040   T num_observations;
00041 };
00042 
00043 
00044 #endif // vpdt_num_obs_h_