本文整理汇总了C++中parameters::get方法的典型用法代码示例。如果您正苦于以下问题:C++ parameters::get方法的具体用法?C++ parameters::get怎么用?C++ parameters::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameters
的用法示例。
在下文中一共展示了parameters::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
bool attack_cpa<real>::setup(crypto_instance *crypto, const parameters ¶ms)
{
if (!params.get("num_events", m_nevents) ||
!params.get("num_reports", m_nreports) ||
!params.get("byte", m_byte) ||
!params.get("offset", m_offset) ||
!params.get("bits", m_bits)) {
fprintf(stderr, "required parameters: byte, offset, bits\n");
return false;
}
m_mask = 0;
for (unsigned int i = m_offset; i < (m_offset + m_bits); ++i)
m_mask |= 1 << i;
m_crypto = crypto;
m_guesses = 1 << m_crypto->estimate_bits();
m_center = m_bits >> 1;
m_traces = 0;
// allocate storage for intermediate results in advance
m_t1.resize(m_nevents, 0);
m_t2.resize(m_nevents, 0);
m_w1.resize(m_guesses, 0);
m_w2.resize(m_guesses, 0);
m_tw.resize(m_guesses * m_nevents, 0);
m_dtemp.resize(m_guesses * m_nevents, 0);
m_maxes.resize(m_guesses * m_nreports, 0);
return true;
}
示例2: shape
shape_datasource::shape_datasource(const parameters ¶ms)
: shape_name_(params.get("file")),
type_(datasource::Vector),
file_length_(0),
indexed_(false),
desc_(params.get("name"))
{
try
{
shape_io shape(shape_name_);
init(shape);
for (int i=0;i<shape.dbf().num_fields();++i)
{
field_descriptor const& fd=shape.dbf().descriptor(i);
std::string fld_name=fd.name_;
switch (fd.type_)
{
case 'C':
case 'D':
case 'M':
case 'L':
desc_.add_descriptor(attribute_descriptor(fld_name,String));
break;
case 'N':
case 'F':
{
if (fd.dec_>0)
{
desc_.add_descriptor(attribute_descriptor(fld_name,Double,false,8));
}
else
{
desc_.add_descriptor(attribute_descriptor(fld_name,Integer,false,4));
}
break;
}
default:
//
std::clog << "unknown type "<<fd.type_<<"\n";
break;
}
}
}
catch (datasource_exception& ex)
{
std::clog<<ex.what()<<std::endl;
throw;
}
}