Added expressInterest which takes the Interest directly.
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 802b84a..5bee365 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -58,19 +58,9 @@
return false;
}
-void Node::expressInterest(const Name &name, const Interest *interestTemplate, const OnData &onData, const OnTimeout &onTimeout)
+void Node::expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout)
{
- shared_ptr<const Interest> interest;
- if (interestTemplate)
- interest.reset(new Interest
- (name, interestTemplate->getMinSuffixComponents(), interestTemplate->getMaxSuffixComponents(),
- interestTemplate->getPublisherPublicKeyDigest(), interestTemplate->getExclude(),
- interestTemplate->getChildSelector(), interestTemplate->getAnswerOriginKind(),
- interestTemplate->getScope(), interestTemplate->getInterestLifetimeMilliseconds()));
- else
- interest.reset(new Interest(name, 4000.0));
-
- shared_ptr<PitEntry> pitEntry(new PitEntry(interest, onData, onTimeout));
+ shared_ptr<PitEntry> pitEntry(new PitEntry(shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout));
pit_.push_back(pitEntry);
shared_ptr<vector<unsigned char> > encoding = pitEntry->getInterest()->wireEncode();
@@ -82,6 +72,18 @@
transport_->send(*encoding);
}
+void Node::expressInterest(const Name &name, const Interest *interestTemplate, const OnData &onData, const OnTimeout &onTimeout)
+{
+ if (interestTemplate)
+ expressInterest(Interest
+ (name, interestTemplate->getMinSuffixComponents(), interestTemplate->getMaxSuffixComponents(),
+ interestTemplate->getPublisherPublicKeyDigest(), interestTemplate->getExclude(),
+ interestTemplate->getChildSelector(), interestTemplate->getAnswerOriginKind(),
+ interestTemplate->getScope(), interestTemplate->getInterestLifetimeMilliseconds()), onData, onTimeout);
+ else
+ expressInterest(Interest(name, 4000.0), onData, onTimeout);
+}
+
void Node::processEvents()
{
transport_->processEvents();