rtcFunctor.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008
00003  * Robert Bosch LLC
00004  * Research and Technology Center North America
00005  * Palo Alto, California
00006  *
00007  * All rights reserved.
00008  *
00009  *------------------------------------------------------------------------------
00010  * project ....: PUMA: Probablistic Unsupervised Model Acquisition
00011  * file .......: Functor.cpp
00012  * authors ....: Benjamin Pitzer
00013  * organization: Robert Bosch LLC
00014  * creation ...: 08/16/2006
00015  * modified ...: $Date: 2008-05-26 18:51:04 -0700 (Mon, 26 May 2008) $
00016  * changed by .: $Author: benjaminpitzer $
00017  * revision ...: $Revision: 288 $
00018  */
00019 
00020 //== INCLUDES ==================================================================
00021 #include "rtc/rtcFunctor.h"
00022 
00023 //== NAMESPACES ================================================================
00024 namespace rtc {
00025 
00026   //== IMPLEMENTATION ==========================================================
00027 
00028   // ----------------------------
00029   // Parameters
00030   // ----------------------------
00031   Functor::Parameters::Parameters()
00032   : IOObject()
00033   {
00034   }
00035 
00036   Functor::Parameters::Parameters(const Parameters& other)
00037   : IOObject()
00038   {
00039     copy(other);
00040   }
00041 
00042 
00043   Functor::Parameters::~Parameters()
00044   {
00045   }
00046 
00047   Functor::Parameters& Functor::Parameters::copy(const Parameters& other) {
00048     return (*this);
00049   }
00050 
00051   Functor::Parameters& Functor::Parameters::operator=(const Parameters& other){
00052     return (*this);
00053   }
00054 
00055   /*
00056   * read the functor parameters
00057   */
00058   bool Functor::Parameters::read(InputHandler &ih)
00059   {
00060     return true;
00061   }
00062 
00063   /*
00064   * write the functor parameters
00065   */
00066   bool Functor::Parameters::write(OutputHandler &oh) const
00067   {
00068     return true;
00069   }
00070 
00071 
00072   // ----------------------------
00073   // Functor
00074   // ----------------------------
00075 
00076   // constructor
00077   Functor::Functor()
00078   : IOObject(),params(0)
00079   {
00080   }
00081 
00082   // copy constructor
00083   Functor::Functor(const Functor& other)
00084   : IOObject(),params(0)
00085   {
00086     copy(other);
00087   }
00088 
00089   // destructor
00090   Functor::~Functor()
00091   {
00092     delete params;
00093   }
00094 
00095   // copy constructor
00096 
00097   /* sets the Functor's Parameters.
00098      The Functor keeps its own copy of the given Parameters.*/
00099   bool Functor::setParameters(const Functor::Parameters& theParams)
00100   {
00101     delete params;
00102     params = 0;
00103     params = theParams.clone();
00104     return true;
00105   }
00106 
00107   /*
00108    * returns current Parameters.
00109    */
00110   const Functor::Parameters& Functor::getParameters() const
00111   {
00112     return *params;
00113   }
00114 
00115   // copy data of "other" Functor.
00116   Functor& Functor::copy(const Functor& other)
00117   {
00118     setParameters(other.getParameters());
00119     return (*this);
00120   }
00121 
00122   // alias for copy
00123   Functor& Functor::operator=(const Functor& other) {
00124     return (*this);
00125   }
00126 
00130   void Functor::addStatusMessage(const StatusMessage msg) {
00131     m_messages.push_back(msg);
00132   }
00133 
00137   const Functor::StatusMessages& Functor::getStatusMessages() const {
00138     return m_messages;
00139   }
00140 
00141   /*
00142   * read the functor parameters
00143   */
00144   bool Functor::read(InputHandler &ih)
00145   {
00146     if (params != 0) {
00147       return params->read(ih);
00148     } else {
00149       addStatusMessage("Tried to read <null> parameters object");
00150       return false;
00151     }
00152   }
00153 
00154   /*
00155   * read the functor parameters
00156   */
00157   bool Functor::write(OutputHandler &oh) const
00158   {
00159     if (params != 0) {
00160       return params->write(oh);
00161     } else {
00162       return false;
00163     }
00164   }
00165 
00166 //==============================================================================
00167 } // namespace rtc
00168 //==============================================================================


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:34