Jeff Thompson | fa30664 | 2013-06-17 15:06:57 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Alexander Afanasyev |
| 5 | * Zhenkai Zhu |
| 6 | * |
| 7 | * BSD license, See the LICENSE file for more information |
| 8 | * |
| 9 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 10 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 11 | */ |
| 12 | |
| 13 | #include "closure.h" |
| 14 | |
| 15 | namespace ndn { |
| 16 | |
| 17 | Closure::Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback) |
| 18 | : m_timeoutCallback (timeoutCallback) |
| 19 | , m_dataCallback (dataCallback) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | Closure::~Closure () |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | void |
| 28 | Closure::runTimeoutCallback(Name interest, const Closure &closure, InterestPtr origInterest) |
| 29 | { |
| 30 | if (!m_timeoutCallback.empty ()) |
| 31 | { |
| 32 | m_timeoutCallback (interest, closure, origInterest); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | |
| 37 | void |
| 38 | Closure::runDataCallback(Name name, PcoPtr content) |
| 39 | { |
| 40 | if (!m_dataCallback.empty ()) |
| 41 | { |
| 42 | m_dataCallback (name, content); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | } // ndn |