Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_FACE_CHANNEL_FACTORY_HPP |
| 8 | #define NFD_FACE_CHANNEL_FACTORY_HPP |
| 9 | |
| 10 | #include "common.hpp" |
| 11 | |
| 12 | namespace ndn { |
| 13 | |
| 14 | /** |
| 15 | * \brief Base class for all channel factories |
| 16 | */ |
| 17 | template<class E, class C> |
| 18 | class ChannelFactory |
| 19 | { |
| 20 | public: |
| 21 | typedef E Endpoint; |
| 22 | typedef C Channel; |
| 23 | |
| 24 | /** |
| 25 | * \brief Base class for all exceptions thrown by channel factories |
| 26 | */ |
| 27 | struct Error : public std::runtime_error |
| 28 | { |
| 29 | Error(const std::string& what) : std::runtime_error(what) {} |
| 30 | }; |
| 31 | |
| 32 | protected: |
| 33 | typedef std::map<Endpoint, Channel> ChannelMap; |
| 34 | ChannelMap m_channels; |
| 35 | }; |
| 36 | |
| 37 | } // namespace ndn |
| 38 | |
| 39 | #endif // NFD_FACE_CHANNEL_FACTORY_HPP |