# LBTS.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002, 2003, 2004  ONERA
    00004 //
    00005 // This file is part of CERTI-libCERTI
    00006 //
    00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: LBTS.hh,v 3.9 2009/04/02 19:58:08 erk Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef LIBCERTI_LBTS_HH
    00026 #define LIBCERTI_LBTS_HH
    00027
    00028 #include "certi.hh"
    00029 #include "FedTimeD.hh"
    00030
    00031 #ifndef _WIN32
    00032 #include <unistd.h>
    00033 #include <stdlib.h>
    00034 #endif
    00035
    00036 #include <map>
    00037 #include <vector>
    00038
    00039 namespace certi {
    00040
    00041 class CERTI_EXPORT LBTS
    00042 {
    00043 public:
    00044     typedef std::pair<FederateHandle, FederationTime> FederateClock ;
    00045
    00046     LBTS();
    00047     ~LBTS();
    00048
    00049     void compute();
    00050     bool exists(FederateHandle) const ;
    00051     void get(std::vector<FederateClock> &) const ;
    00052     void insert(FederateHandle num_fed, FederationTime the_time);
    00053     void remove(FederateHandle num_fed);
    00054     void setFederate(FederateHandle handle) { MyFederateNumber = handle ; };
    00055     size_t size() const { return clocks.size(); };
    00056     void update(FederateHandle num_fed, FederationTime the_time);
    00057
    00058 protected:
    00059     FederationTime _LBTS ;
    00060     FederateHandle MyFederateNumber ;
    00061
    00062 private:
    00063     typedef std::map<FederateHandle, FederationTime> ClockSet ;
    00064
    00065     ClockSet clocks ;
    00066 };
    00067
    00068 }
    00069
    00070 #endif // LIBCERTI_LBTS_HH
    00071
    00072 // $Id: LBTS.hh,v 3.9 2009/04/02 19:58:08 erk Exp $