blob: 184703a74045e65ae15f36d0a6ff84822110df33 [file] [log] [blame]
Alexander Afanasyeva9034b02014-01-26 18:32:02 -08001/* -*- 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
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080012namespace nfd {
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080013
14/**
15 * \brief Base class for all channel factories
16 */
17template<class E, class C>
18class ChannelFactory
19{
20public:
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
32protected:
Alexander Afanasyev8ad71ba2014-01-27 00:07:14 -080033 typedef std::map< Endpoint, shared_ptr<Channel> > ChannelMap;
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080034 ChannelMap m_channels;
35};
36
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080037} // namespace nfd
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080038
39#endif // NFD_FACE_CHANNEL_FACTORY_HPP