Wiselib
wiselib.testing/algorithms/localization/distance_based/modules/position/localization_gpsfree_ncs_messages.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  ** This file is part of the generic algorithm library Wiselib.           **
00003  ** Copyright (C) 2008,2009 by the Wisebed (www.wisebed.eu) project.      **
00004  **                                                                       **
00005  ** The Wiselib is free software: you can redistribute it and/or modify   **
00006  ** it under the terms of the GNU Lesser General Public License as        **
00007  ** published by the Free Software Foundation, either version 3 of the    **
00008  ** License, or (at your option) any later version.                       **
00009  **                                                                       **
00010  ** The Wiselib is distributed in the hope that it will be useful,        **
00011  ** but WITHOUT ANY WARRANTY; without even the implied warranty of        **
00012  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         **
00013  ** GNU Lesser General Public License for more details.                   **
00014  **                                                                       **
00015  ** You should have received a copy of the GNU Lesser General Public      **
00016  ** License along with the Wiselib.                                       **
00017  ** If not, see <http://www.gnu.org/licenses/>.                           **
00018  ***************************************************************************/
00019 #ifndef __ALGORITHMS_LOCALIZATION_DISTANCE_BASED_LOCALIZATION_GPSFREE_NCS_MESSAGES_H
00020 #define __ALGORITHMS_LOCALIZATION_DISTANCE_BASED_LOCALIZATION_GPSFREE_NCS_MESSAGES_H
00021 
00022 #include "util/serialization/simple_types.h"
00023 #include "algorithms/localization/distance_based/util/localization_defutils.h"
00024 
00025 namespace wiselib
00026 {
00027 
00028    template<typename OsModel_P,
00029             typename Radio_P,
00030             typename LocalCoordinateSystem_P>
00031    class LocalizationGpsFreeNcsLcsMessage
00032    {
00033    public:
00034       typedef OsModel_P OsModel;
00035       typedef Radio_P Radio;
00036       typedef LocalCoordinateSystem_P LocalCoordinateSystem;
00037       typedef typename Radio::node_id_t node_id_t;
00038       typedef typename Radio::block_data_t block_data_t;
00039       typedef typename Radio::size_t size_t;
00040       typedef typename Radio::message_id_t message_id_t;
00041       // --------------------------------------------------------------------
00042       inline LocalizationGpsFreeNcsLcsMessage();
00043       // --------------------------------------------------------------------
00044       inline message_id_t msg_id()
00045       { return read<OsModel, block_data_t, message_id_t>( buffer ); };
00046       // --------------------------------------------------------------------
00047       inline void set_msg_id( message_id_t id )
00048       { write<OsModel, block_data_t, message_id_t>( buffer, id ); }
00049       // --------------------------------------------------------------------
00050       inline LocalCoordinateSystem* local_coord_sys()
00051       { return local_coord_sys_; }
00052       // --------------------------------------------------------------------
00053       inline void set_local_coord_sys( LocalCoordinateSystem *local_coord_sys )
00054       { local_coord_sys_ = local_coord_sys; }
00055       // --------------------------------------------------------------------
00056       inline size_t buffer_size()
00057       { return MSGEND_POS; }
00058 
00059    private:
00060       enum data_positions
00061       {
00062          NEIGHBORS_POS = sizeof(message_id_t),
00063          MSGEND_POS = NEIGHBORS_POS + 1
00064       };
00065 
00066       block_data_t buffer[MSGEND_POS];
00067       // TODO: write this in buffer
00068       LocalCoordinateSystem *local_coord_sys_;
00069    };
00070    // -----------------------------------------------------------------------
00071    template<typename OsModel_P,
00072             typename Radio_P,
00073             typename LocalCoordinateSystem_P>
00074    LocalizationGpsFreeNcsLcsMessage<OsModel_P, Radio_P, LocalCoordinateSystem_P>::
00075    LocalizationGpsFreeNcsLcsMessage()
00076    {
00077       set_msg_id( 0 );
00078    }
00079 
00080 }// namespace wiselib
00081 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines