本文整理汇总了C++中ControlParameters::setUri方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlParameters::setUri方法的具体用法?C++ ControlParameters::setUri怎么用?C++ ControlParameters::setUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlParameters
的用法示例。
在下文中一共展示了ControlParameters::setUri方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
Nfdc::ribRegisterPrefix()
{
m_name = m_commandLineArguments[0];
ControlParameters parameters;
parameters
.setName(m_name)
.setCost(m_cost)
.setFlags(m_flags)
.setOrigin(m_origin);
if (m_expires != DEFAULT_EXPIRATION_PERIOD)
parameters.setExpirationPeriod(m_expires);
if (!isValidUri(m_commandLineArguments[1])) {
try { //So the uri is not valid, may be a faceId is provided.
m_faceId = boost::lexical_cast<int>(m_commandLineArguments[1]);
}
catch (const std::exception& e) {
std::cerr << "No valid faceUri or faceId is provided"<< std::endl;
return;
}
parameters.setFaceId(m_faceId);
ribRegisterPrefix(parameters);
}
else {
ControlParameters faceParameters;
faceParameters.setUri(m_commandLineArguments[1]);
m_controller.start<FaceCreateCommand>(faceParameters,
bind(&Nfdc::ribRegisterPrefix, this, _1),
bind(&Nfdc::onError, this, _1, _2,
"Face creation failed"));
}
}
示例2: addCreatedFaceToForwarder
void
FaceManager::onCreated(const Name& requestName,
ControlParameters& parameters,
const shared_ptr<Face>& newFace)
{
addCreatedFaceToForwarder(newFace);
parameters.setFaceId(newFace->getId());
parameters.setUri(newFace->getRemoteUri().toString());
sendResponse(requestName, 200, "Success", parameters.wireEncode());
}
示例3: makeUpdateFaceResponse
static ControlParameters
makeCreateFaceResponse(const Face& face)
{
ControlParameters params = makeUpdateFaceResponse(face);
params.setUri(face.getRemoteUri().toString())
.setLocalUri(face.getLocalUri().toString());
copyMtu(face, params);
return params;
}
示例4: encodedParameters
BOOST_FIXTURE_TEST_CASE(OnCreated, AuthorizedCommandFixture<FaceFixture>)
{
ControlParameters parameters;
parameters.setUri("tcp://127.0.0.1");
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/faces");
commandName.append("create");
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
ControlParameters resultParameters;
resultParameters.setUri("dummy://");
resultParameters.setFaceId(FACEID_RESERVED_MAX + 1);
shared_ptr<DummyFace> dummy(make_shared<DummyFace>());
ndn::nfd::FaceEventNotification expectedFaceEvent;
expectedFaceEvent.setKind(ndn::nfd::FACE_EVENT_CREATED)
.setFaceId(FACEID_RESERVED_MAX + 1)
.setRemoteUri(dummy->getRemoteUri().toString())
.setLocalUri(dummy->getLocalUri().toString())
.setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
Block encodedResultParameters(resultParameters.wireEncode());
getFace()->onReceiveData +=
[this, command, encodedResultParameters, expectedFaceEvent] (const Data& response) {
this->callbackDispatch(response,command->getName(), 200, "Success",
encodedResultParameters, expectedFaceEvent);
};
onCreated(command->getName(), parameters, dummy);
BOOST_REQUIRE(didCallbackFire());
BOOST_REQUIRE(didReceiveNotication());
}
示例5: bind
void
Nfdc::startFaceCreate(const ndn::util::FaceUri& canonicalUri)
{
ControlParameters parameters;
parameters.setUri(canonicalUri.toString());
m_controller.start<FaceCreateCommand>(parameters,
bind(&Nfdc::onSuccess, this, _1,
"Face creation succeeded"),
bind(&Nfdc::onError, this, _1, _2,
"Face creation failed"));
}
示例6: encodedParameters
BOOST_FIXTURE_TEST_CASE(OnCreated, AuthorizedCommandFixture<FaceFixture>)
{
ControlParameters parameters;
parameters.setUri("tcp://127.0.0.1");
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/faces");
commandName.append("create");
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
ControlParameters resultParameters;
resultParameters.setUri("tcp://127.0.0.1");
resultParameters.setFaceId(1);
shared_ptr<DummyFace> dummy(make_shared<DummyFace>());
ndn::nfd::FaceEventNotification expectedFaceEvent;
expectedFaceEvent.setKind(ndn::nfd::FACE_EVENT_CREATED)
.setFaceId(1)
.setRemoteUri(dummy->getRemoteUri().toString())
.setLocalUri(dummy->getLocalUri().toString())
.setFlags(0);
Block encodedResultParameters(resultParameters.wireEncode());
getFace()->onReceiveData +=
bind(&FaceFixture::callbackDispatch, this, _1,
command->getName(), 200, "Success",
encodedResultParameters, expectedFaceEvent);
onCreated(command->getName(), parameters, dummy);
BOOST_REQUIRE(didCallbackFire());
BOOST_REQUIRE(didReceiveNotication());
}
示例7: succeed
void
Nfdc::FaceIdFetcher::startFaceCreate(const ndn::util::FaceUri& canonicalUri)
{
ControlParameters parameters;
parameters.setUri(canonicalUri.toString());
m_controller.start<FaceCreateCommand>(parameters,
[this] (const ControlParameters& result) {
succeed(result.getFaceId());
},
bind(&FaceIdFetcher::onFaceCreateError, this, _1, _2,
"Face creation failed"));
}
示例8: Error
void
Nfdc::faceCreate()
{
if (!isValidUri(m_commandLineArguments[0]))
throw Error("invalid uri format");
ControlParameters parameters;
parameters.setUri(m_commandLineArguments[0]);
m_controller.start<FaceCreateCommand>(parameters,
bind(&Nfdc::onSuccess, this, _1,
"Face creation succeeded"),
bind(&Nfdc::onError, this, _1, _2,
"Face creation failed"));
}