MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/NavigationAndControl/pNav/MOOSPriorityInput.h
Go to the documentation of this file.
00001 
00002 //
00003 //   MOOS - Mission Oriented Operating Suite 
00004 //  
00005 //   A suit of Applications and Libraries for Mobile Robotics Research 
00006 //   Copyright (C) 2001-2005 Massachusetts Institute of Technology and 
00007 //   Oxford University. 
00008 //    
00009 //   This software was written by Paul Newman and others
00010 //   at MIT 2001-2002 and Oxford University 2003-2005.
00011 //   email: pnewman@robots.ox.ac.uk. 
00012 //      
00013 //   This file is part of a  MOOS Basic (Common) Application. 
00014 //        
00015 //   This program is free software; you can redistribute it and/or 
00016 //   modify it under the terms of the GNU General Public License as 
00017 //   published by the Free Software Foundation; either version 2 of the 
00018 //   License, or (at your option) any later version. 
00019 //          
00020 //   This program is distributed in the hope that it will be useful, 
00021 //   but WITHOUT ANY WARRANTY; without even the implied warranty of 
00022 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
00023 //   General Public License for more details. 
00024 //            
00025 //   You should have received a copy of the GNU General Public License 
00026 //   along with this program; if not, write to the Free Software 
00027 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00028 //   02111-1307, USA. 
00029 //
00032 //                                                               //
00033 //          This file is part of MOOS Suite                      //
00034 //            Copyright Paul Newman, September 2000                //
00035 //                                                               // 
00037 
00038 // MOOSPriorityInput.h: interface for the CMOOSPriorityInput class.
00039 //
00041 #ifdef _WIN32
00042     #pragma warning(disable : 4786)
00043 #endif
00044 
00045 
00046 
00047 #if !defined(AFX_MOOSPRIORITYINPUT_H__7A2A1C64_F6EC_4DDA_9493_85D35E563F8F__INCLUDED_)
00048 #define AFX_MOOSPRIORITYINPUT_H__7A2A1C64_F6EC_4DDA_9493_85D35E563F8F__INCLUDED_
00049 
00050 #if _MSC_VER > 1000
00051 #pragma once
00052 #endif // _MSC_VER > 1000
00053 
00054 #include <string>
00055 //#include <list>
00056 #include <vector>
00057 
00058 //using namespace std;
00059 
00060 class CMOOSPriorityInput  
00061 {
00062 public:
00063     bool GetLastValue(double & dfTime,double &dfVal);
00064     bool Clear();
00065     bool SetInput(CMOOSMsg & InMsg,double dfTimeNow);
00066     bool GetOutput(CMOOSMsg & OUtMsg,double dfTimeNow);
00067     
00068 
00070     bool Initialise(std::string sName, std::string  sSources,std::string  sStem,STRING_LIST & ToSubscribe);
00071 
00072     CMOOSPriorityInput();
00073     virtual ~CMOOSPriorityInput();
00074 
00075 
00076     class CPrioritySource
00077     {
00078         public:
00079             double GetLastInputTime();
00080             std::string & GetSource();
00081             bool Initialise(std::string & sName,double dfTimeOut);
00082             bool Get(double & dfval,double & dfTime);
00083                 bool Get(std::string  & dfval,double & dfTime);
00084         char GetDataType();
00085                 bool Set(const std::string & sVal,double dfTime);
00086             bool Set(double dfVal,double dfTime);
00087             bool HasExpired(double dfTimeNow);
00088             bool IsFresh(){return   m_bFresh;}; 
00089             CPrioritySource();
00090         
00091         protected:
00092             std::string m_sSource;
00093             double m_dfTimeOut;
00094             double m_dfLastInputTime;
00095             double m_dfVal;
00096             double m_dfDataTime;
00097                 char   m_cDataType;
00098                 std::string m_sVal;
00099             bool   m_bFresh; 
00100 
00101 
00102 
00103     };
00104 
00105     typedef std::vector<CPrioritySource> PRIORITY_SOURCE_VECTOR;
00106 
00107     PRIORITY_SOURCE_VECTOR m_Sources;
00108     int        m_nCurrentSourceNdx;
00109     std::string    m_sName;
00110 
00111 protected:
00112     double m_dfLastValue;
00113     double m_dfLastTimeSet;
00114     bool SetActiveSource(int nSrcNdx);
00115 };
00116 
00117 #endif // !defined(AFX_MOOSPRIORITYINPUT_H__7A2A1C64_F6EC_4DDA_9493_85D35E563F8F__INCLUDED_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines