Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 3 | * Copyright (c) 2012-2014 University of California, Los Angeles |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 5 | * This file is part of ChronoSync, synchronization library for distributed realtime |
| 6 | * applications for NDN. |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 8 | * ChronoSync is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, either |
| 10 | * version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 12 | * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/> |
| 20 | * @author Chaoyi Bian <bcy@pku.edu.cn> |
| 21 | * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html> |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #ifndef SYNC_LOGIC_EVENT_CONTAINER_H |
| 25 | #define SYNC_LOGIC_EVENT_CONTAINER_H |
| 26 | |
Alexander Afanasyev | ca6f329 | 2012-04-09 10:03:30 -0700 | [diff] [blame] | 27 | #include "sync-event.h" |
| 28 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 29 | #include <boost/function.hpp> |
| 30 | #include <boost/date_time/posix_time/posix_time_types.hpp> |
| 31 | |
| 32 | #include <boost/multi_index_container.hpp> |
| 33 | // #include <boost/multi_index/tag.hpp> |
| 34 | #include <boost/multi_index/ordered_index.hpp> |
| 35 | // #include <boost/multi_index/composite_key.hpp> |
| 36 | // #include <boost/multi_index/hashed_index.hpp> |
| 37 | // #include <boost/multi_index/random_access_index.hpp> |
| 38 | #include <boost/multi_index/member.hpp> |
| 39 | // #include <boost/multi_index/mem_fun.hpp> |
| 40 | |
| 41 | namespace mi = boost::multi_index; |
| 42 | |
| 43 | namespace Sync |
| 44 | { |
| 45 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 46 | struct LogicEvent |
| 47 | { |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 48 | LogicEvent (const boost::system_time &_time, Event _event, uint32_t _label) |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 49 | : time (_time) |
| 50 | , event (_event) |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 51 | , lbl (_label) |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 52 | { } |
Yingdi Yu | 7c64e5c | 2014-04-30 14:06:37 -0700 | [diff] [blame] | 53 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 54 | boost::system_time time; |
| 55 | Event event; |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 56 | uint32_t lbl; |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 59 | /// @cond include_hidden |
| 60 | struct byLabel { } ; |
| 61 | /// @endcond |
| 62 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 63 | /** |
| 64 | * \ingroup sync |
| 65 | * @brief ??? |
| 66 | */ |
| 67 | struct EventsContainer : public mi::multi_index_container< |
| 68 | LogicEvent, |
| 69 | mi::indexed_by< |
| 70 | |
| 71 | mi::ordered_non_unique< |
| 72 | mi::member<LogicEvent, boost::system_time, &LogicEvent::time> |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 73 | >, |
| 74 | |
| 75 | mi::ordered_non_unique< |
| 76 | mi::tag<byLabel>, |
| 77 | mi::member<LogicEvent, uint32_t, &LogicEvent::lbl> |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 78 | > |
| 79 | > |
| 80 | > |
| 81 | { |
| 82 | }; |
| 83 | |
| 84 | } // Sync |
| 85 | |
| 86 | #endif // SYNC_LOGIC_EVENT_CONTAINER_H |