akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 19 | * Chaoyi Bian <bcy@pku.edu.cn> |
| 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 21 | */ |
| 22 | |
| 23 | #ifndef SYNC_LOGIC_EVENT_CONTAINER_H |
| 24 | #define SYNC_LOGIC_EVENT_CONTAINER_H |
| 25 | |
| 26 | #include "sync-event.h" |
| 27 | |
| 28 | #include <boost/function.hpp> |
| 29 | #include <boost/date_time/posix_time/posix_time_types.hpp> |
| 30 | |
| 31 | #include <boost/multi_index_container.hpp> |
| 32 | // #include <boost/multi_index/tag.hpp> |
| 33 | #include <boost/multi_index/ordered_index.hpp> |
| 34 | // #include <boost/multi_index/composite_key.hpp> |
| 35 | // #include <boost/multi_index/hashed_index.hpp> |
| 36 | // #include <boost/multi_index/random_access_index.hpp> |
| 37 | #include <boost/multi_index/member.hpp> |
| 38 | // #include <boost/multi_index/mem_fun.hpp> |
| 39 | |
| 40 | namespace mi = boost::multi_index; |
| 41 | |
| 42 | namespace Sync |
| 43 | { |
| 44 | |
| 45 | struct LogicEvent |
| 46 | { |
| 47 | LogicEvent (const boost::system_time &_time, Event _event, uint32_t _label) |
| 48 | : time (_time) |
| 49 | , event (_event) |
| 50 | , lbl (_label) |
| 51 | { } |
| 52 | |
| 53 | boost::system_time time; |
| 54 | Event event; |
| 55 | uint32_t lbl; |
| 56 | }; |
| 57 | |
| 58 | /// @cond include_hidden |
| 59 | struct byLabel { } ; |
| 60 | /// @endcond |
| 61 | |
| 62 | /** |
| 63 | * \ingroup sync |
| 64 | * @brief ??? |
| 65 | */ |
| 66 | struct EventsContainer : public mi::multi_index_container< |
| 67 | LogicEvent, |
| 68 | mi::indexed_by< |
| 69 | |
| 70 | mi::ordered_non_unique< |
| 71 | mi::member<LogicEvent, boost::system_time, &LogicEvent::time> |
| 72 | >, |
| 73 | |
| 74 | mi::ordered_non_unique< |
| 75 | mi::tag<byLabel>, |
| 76 | mi::member<LogicEvent, uint32_t, &LogicEvent::lbl> |
| 77 | > |
| 78 | > |
| 79 | > |
| 80 | { |
| 81 | }; |
| 82 | |
| 83 | } // Sync |
| 84 | |
| 85 | #endif // SYNC_LOGIC_EVENT_CONTAINER_H |