blob: a45ef2a373232da5b3daf90a33f0a386cc82094f [file] [log] [blame]
Jeff Thompsonfa306642013-06-17 15:06:57 -07001/* -*- 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
15namespace ndn {
16
17Closure::Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback)
18 : m_timeoutCallback (timeoutCallback)
19 , m_dataCallback (dataCallback)
20{
21}
22
23Closure::~Closure ()
24{
25}
26
27void
28Closure::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
37void
38Closure::runDataCallback(Name name, PcoPtr content)
39{
40 if (!m_dataCallback.empty ())
41 {
42 m_dataCallback (name, content);
43 }
44}
45
46} // ndn