mixpp: bdm::root Class Reference

bdm::root Class Reference

Root class of BDM objects. More...

#include <bdmroot.h>

Inheritance diagram for bdm::root:

bdm::BM bdm::Controller bdm::DS bdm::fnc bdm::log_level_base bdm::logger bdm::MergerBase bdm::Participant bdm::pdf bdm::RV bdm::SettingResolver List of all members.

Public Member Functions

 root ()
 default constructor
virtual ~root ()
 make sure this is a virtual object
virtual string to_string () const
 Returns basic textual info about the current instance.
virtual void log_register (logger &L, const string &prefix)
 Register log levels of each inheritance layer to a logger, i.e. allocate space for data from this class.
virtual void log_write () const
 Write current information into the given logger.
virtual void validate ()
 This method checks that all internal structures has been set up correctly.
virtual root_copy () const NOT_IMPLEMENTED(NULL)
 Virtual method providing deep copy of instances.

Protected Member Functions

virtual void from_setting (const Setting &set)
 Read instance properties according the data stored in the Setting structure. It has to be called only through UI class, therefore it is protected.
virtual void to_setting (Setting &set) const
 Save all the instance properties into the Setting structure. It has to be called only through UI class, therefore it is protected.

Friends

class UI
 It is necessary to allow calling of from_setting and to_setting within the UI class ++ i log_options.

Detailed Description

Root class of BDM objects.


Member Function Documentation

virtual void bdm::root::from_setting ( const Setting &  set  )  [inline, protected, virtual]

Read instance properties according the data stored in the Setting structure. It has to be called only through UI class, therefore it is protected.

At the begining of this method, it is obligatory to call the corresponding base::from_setting method. Sometimes, there can be an exception from this rule. If so, the programmer is encouraged to describe the reasons for this exception in the documentation in detail.

Then, all the configuration components should be read through the UI mechanism. Those with UI::SettingPresence set to optional shoud have their defaults fulfilled within the body of this method.

For instance, declaring a class trunk derived from our root class, the implementation of the from_setting method should look like this

    public trunk : public root {
        anytype xxx, yyy;
        virtual void from_setting ( const Setting &set ) {
                root::from_setting( set );
                UI::get ( xxx, set, "xxx", UI::compulsory );
                if ( !UI::get ( yyy, set, "yyy", UI::optional ) ) {
                        ... // here, it is necessary to set the default of attribute yyy
                }
                ... // another stuff related to trunk class
        }
        ... // other members of this class
    };

Reimplemented in bdm::RV, bdm::log_level_template< T >, bdm::pdf, bdm::DS, bdm::BM, bdm::MemDS, bdm::FileDS, bdm::ITppFileDS, bdm::CsvFileDS, bdm::EpdfDS, bdm::PdfDS, bdm::memlog, bdm::stdlog, bdm::dirfilelog, bdm::Participant, bdm::LQG_ARX, bdm::ARX, bdm::ARXg, bdm::Kalman< sq_T >, bdm::KalmanCh, bdm::EKFfull, bdm::EKFCh, bdm::EKF_UD, bdm::MixEF, bdm::MarginalizedParticleBase, bdm::MarginalizedParticle, bdm::BootstrapParticle, bdm::PF, bdm::mxArrayDS, bdm::mexFnc, bdm::mexlog, bdm::emix, bdm::mprod, bdm::eprod, bdm::mmix, bdm::BMEF, bdm::mgdirac, bdm::enorm< sq_T >, bdm::estudent< sq_T >, bdm::egiw, bdm::eDirich, bdm::eBeta, bdm::mDirich, bdm::mBeta, bdm::multiBM, bdm::egamma, bdm::euni, bdm::mguni, bdm::mlnorm< sq_T, TEpdf >, bdm::mgnorm< sq_T >, bdm::mgamma, bdm::migamma_ref, bdm::mlognorm, bdm::MergerDiscrete, and bdm::merger_mix.

virtual void bdm::root::to_setting ( Setting &  set  )  const [inline, protected, virtual]

Save all the instance properties into the Setting structure. It has to be called only through UI class, therefore it is protected.

The only obligatory rule concerning the body of this method is to call the corresponding base::to_setting method first. Sometimes, there can be an exception from this rule. If so, the programmer is encouraged to describe the reasons for this exception in the documentation in detail.

For instance, declaring a class trunk derived from our root class, the implementation of the to_setting method should look like this

    public trunk : public root {
        anytype xxx;
        virtual void to_setting ( const Setting &set ) {
                root::to_setting( set );
                UI::save ( xxx, set, "xxx" );
                ... // another stuff related directly to trunk class
        }
        ... // other members of this class
    };

Reimplemented in bdm::log_level_template< T >, and bdm::egiw.

virtual void bdm::root::validate (  )  [inline, virtual]

This method checks that all internal structures has been set up correctly.

It is called automatically after the call of the from_setting method by the mechanism of the UI class. However, it can be called in any other situation to assure the correctness of an instance.

The only obligatory rule concerning the body of this method is to call the corresponding base::validate method first. Sometimes, there can be an exception from this rule. If so, the programmer is encouraged to describe the reasons for this exception in the documentation in detail.

Then, only those checks which are not implemented in the base method are implemented here. For instance, declaring a class trunk derived from our root class, the implementation of the method validate should look like this

    public trunk : public root {
        virtual void validate ( ) {
                root::validate( );
                ... // checks related directly to trunk class
        }
        ... // other members of this class
    };

Reimplemented in bdm::BM, bdm::LQG, bdm::LQG_universal, bdm::Kalman< sq_T >, bdm::Kalman< bdm::chmat >, and bdm::Kalman< bdm::fsqmat >.


The documentation for this class was generated from the following file:
Generated on 2 Dec 2013 for mixpp by  doxygen 1.4.7