本文整理汇总了C++中ControlParameters::setExpirationPeriod方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlParameters::setExpirationPeriod方法的具体用法?C++ ControlParameters::setExpirationPeriod怎么用?C++ ControlParameters::setExpirationPeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlParameters
的用法示例。
在下文中一共展示了ControlParameters::setExpirationPeriod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bind
void
Nfdc::ribRegisterPrefix()
{
m_name = m_commandLineArguments[0];
const std::string& faceName = m_commandLineArguments[1];
FaceIdFetcher::start(m_face, m_controller, faceName, true,
[this] (const uint32_t faceId) {
ControlParameters parameters;
parameters
.setName(m_name)
.setCost(m_cost)
.setFlags(m_flags)
.setOrigin(m_origin)
.setFaceId(faceId);
if (m_expires != DEFAULT_EXPIRATION_PERIOD)
parameters.setExpirationPeriod(m_expires);
m_controller
.start<RibRegisterCommand>(parameters,
bind(&Nfdc::onSuccess, this, _1,
"Successful in name registration"),
bind(&Nfdc::onError, this, _1, _2,
"Failed in name registration"));
},
bind(&Nfdc::onObtainFaceIdFailure, this, _1));
}
示例2: 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"));
}
}
示例3: applyDefaultsToRequest
virtual void
applyDefaultsToRequest(ControlParameters& parameters) const
{
if (!parameters.hasFaceId()) {
parameters.setFaceId(0);
}
if (!parameters.hasOrigin()) {
parameters.setOrigin(ROUTE_ORIGIN_APP);
}
if (!parameters.hasCost()) {
parameters.setCost(0);
}
if (!parameters.hasFlags()) {
parameters.setFlags(ROUTE_FLAG_CHILD_INHERIT);
}
if (!parameters.hasExpirationPeriod()) {
if (parameters.getFaceId() == 0) {
parameters.setExpirationPeriod(time::milliseconds::max());
}
else {
parameters.setExpirationPeriod(time::hours(1));
}
}
}
示例4: bind
void
Nfdc::ribRegisterPrefix(const ControlParameters& faceCreateResult)
{
ControlParameters ribParameters;
ribParameters
.setName(m_name)
.setCost(m_cost)
.setFlags(m_flags)
.setOrigin(m_origin)
.setFaceId(faceCreateResult.getFaceId());
if (m_expires != DEFAULT_EXPIRATION_PERIOD)
ribParameters.setExpirationPeriod(m_expires);
m_controller.start<RibRegisterCommand>(ribParameters,
bind(&Nfdc::onSuccess, this, _1,
"Successful in name registration"),
bind(&Nfdc::onError, this, _1, _2,
"Failed in name registration"));
}