Property.cpp
Go to the documentation of this file.
00001 /*
00002  * Predicate.cpp
00003  *
00004  *  Created on: Jan 12, 2012
00005  *      Author: sdries
00006  */
00007 
00008 #include "wire/core/Property.h"
00009 #include "wire/core/IStateEstimator.h"
00010 
00011 namespace mhf {
00012 
00013 Property::Property(const Attribute& attribute, const IStateEstimator& bm, const ObjectID& object_id)
00014     : time_(0), attribute_(attribute), estimator_(bm.clone()) {
00015 }
00016 
00017 Property::Property(const Property& orig)
00018     : time_(orig.time_), attribute_(orig.attribute_), estimator_(orig.estimator_->clone()) {
00019 }
00020 
00021 Property::~Property() {
00022     delete estimator_;
00023 }
00024 
00025 Property* Property::clone() const {
00026     return new Property(*this);
00027 }
00028 
00029 Property& Property::operator=(const Property& other) {
00030     if (this != &other) {
00031         delete estimator_;
00032         time_ = other.time_;
00033         attribute_ = other.attribute_;
00034         estimator_ = other.estimator_->clone();
00035     }
00036 
00037     return *this;
00038 }
00039 
00040 const Attribute& Property::getAttribute() const {
00041     return attribute_;
00042 }
00043 
00044 const IStateEstimator& Property::getEstimator() const {
00045     return *estimator_;
00046 }
00047 
00048 const pbl::PDF& Property::getValue() const {
00049     return estimator_->getValue();
00050 }
00051 
00052 void Property::update(const pbl::PDF& z, const Time& time) {
00053     if (time < time_) return;
00054     estimator_->update(z, time);
00055     time_ = time;
00056 }
00057 
00058 void Property::propagate(const Time& time) {
00059     if (time < time_) return;
00060     estimator_->propagate(time);
00061     time_ = time;
00062 }
00063 
00064 void Property::reset() {
00065     estimator_->reset();
00066 }
00067 
00068 double Property::getLikelihood(const pbl::PDF& pdf) const {
00069     return estimator_->getValue().getLikelihood(pdf);
00070 }
00071 
00072 std::string Property::toString(const std::string& prefix) const {
00073     return estimator_->getValue().toString();
00074 }
00075 
00076 }


wire_core
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Tue Jan 7 2014 11:43:19