本文整理汇总了C++中Integer函数的典型用法代码示例。如果您正苦于以下问题:C++ Integer函数的具体用法?C++ Integer怎么用?C++ Integer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Integer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Spec
HEADER_DECLARE
Term* Spec(atom_t atom, int size){
FRAME_ENTER;
FRAME_LOCAL(tatom) = Atom(atom);
FRAME_LOCAL(tsize) = Integer(size);
FRAME_RETURN(Term*, Functor2(atom_slash, tatom, tsize));
}
示例2: RpcString
void Dispatcher::getCapabilities (Struct &str) const
{
// parent::getCapabilities (str); just in case..
str.addMember("specUrl",
RpcString("http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php"));
str.addMember("specVersion", Integer(20010516));
}
示例3: WriteMODM
/*}}}*/
void WriteMODM(char *alphabet, ProfileSAD* profile, int numRes, double *parameter, FILE *fpout)/*{{{*/
{
int i,j;
fprintf(fpout,"#Num: amino acid sequence number\n");
fprintf(fpout,"#AA: 1 letter amino acid\n");
fprintf(fpout,"# profile is derived from log odd score in PSSM file, \n");
fprintf(fpout,"# \n");
int width = 5;
fprintf(fpout,"%-5s %-2s","Num","AA");
fprintf(fpout," %3s","SAD");
for(j = 0 ; j < 20 ; j++) fprintf(fpout,"%4c",alphabet[j]);
fprintf(fpout, "\n");
for(i = 0 ; i < numRes ; i ++)
{
fprintf(fpout,"%5d %-2c",i+1,profile[i].aa);
fprintf(fpout," %1c%1d%1c",profile[i].shape, profile[i].waterAcc, profile[i].dsspSec);
for(j = 0 ; j < 20 ; j++) { fprintf(fpout,"%4d",Integer(profile[i].p[j])); }
fprintf(fpout," %4.2f", profile[i].score1);
fprintf(fpout," %4.2f", profile[i].score2);
fprintf(fpout,"\n");
}
fprintf(fpout," K Lambda\n" );
fprintf(fpout,"Standard Ungapped %.4lf %.4lf \n", parameter[0], parameter[1] );
fprintf(fpout,"Standard Gapped %.4lf %.4lf \n", parameter[2], parameter[3] );
fprintf(fpout,"PSI Ungapped %.4lf %.4lf \n", parameter[4], parameter[5] );
fprintf(fpout,"PSI Gapped %.4lf %.4lf \n", parameter[6], parameter[7] );
}
示例4: TEST
//--------------------------------------------------------------
//LinkableRingSignProver constructor check
TEST(LinkableRingSignProverTest, DefaultArgs) {
unsigned int n = 100, identity = 12;
Integer g_in, p_in, q_in, private_key_in;
vector<Integer> public_keys_in;
GetGroupParameters(g_in, p_in, q_in);
RandomPool rng;
//set safe_NO for private key here.
Integer SAFE_NO = 1231;
//generate private_public keys
for(unsigned int i = 1; i <= n; i++)
{
Integer a = Integer(rng, SAFE_NO, q_in - 1);
if(i == 11)
private_key_in = a;
public_keys_in.push_back(a_exp_b_mod_c(g_in, a, p_in));
}
LinkableRingSignProver P(n, identity, g_in, p_in, q_in, public_keys_in, private_key_in);
EXPECT_EQ(P.num_members, n);
EXPECT_EQ(P.g, g_in); EXPECT_EQ(P.q, q_in); EXPECT_EQ(P.p, p_in);
vector<Integer>::iterator itr = public_keys_in.begin();
unsigned int j = 0;
for(itr = public_keys_in.begin(); itr != public_keys_in.end(); itr++)
{
ASSERT_EQ(P.public_keys[j++], *itr);
}
}
示例5: Integer
int AsymmCipher::decodeintarray(Integer* t, int numints, const byte* data, int len)
{
int p, i, n;
p = 0;
for (i = 0; i < numints; i++)
{
if (p + 2 > len)
{
break;
}
n = ((data[p] << 8) + data[p + 1] + 7) >> 3;
p += 2;
if (p + n > len)
{
break;
}
t[i] = Integer(data + p, n);
p += n;
}
return i == numints && len - p < 16;
}
示例6: main
int main(){
std::vector <int > nums ;
std::vector < Integer > ints ;
for ( int i = 0; i < 10; i++ ) {
nums.push_back ( i );
ints.push_back ( Integer ( i ) );
}
std::vector <int > nums2 ( nums );
std::ostream_iterator<int> o( std::cout , ", " );
// ptr_fun
std::transform ( nums.begin(), nums.end(), o, std::ptr_fun ( plusOne ) ) ;
std::cout << std::endl ;
// bind
Multiplier theMult ;
transform(nums.begin(), nums.end(), o, std::bind2nd ( theMult , 10 ) );
std::cout << std::endl ;
// mem_fun
std::ostream_iterator < Integer > os( std::cout , ", " );
std::for_each ( ints.begin(), ints.end(), std::mem_fun_ref ( & Integer::increment ) ); //i like this one
//not1
std::remove_copy_if ( ints.begin(), ints.end(), os, std::not1(std::ptr_fun(checkValid<Integer>)));
std::cout << std::endl ;
return 0;
}
示例7: switch
//
// VarSys::VarItem::GetStringValue
//
// Get the string value of a var
//
const char * VarSys::VarItem::GetStringValue()
{
static char buff[32];
switch (type)
{
default:
case VarSys::VI_SCOPE:
case VarSys::VI_BINARY:
ERR_FATAL(("Unsupported type for getting string value"))
break;
case VarSys::VI_INTEGER:
{
Utils::Sprintf(buff, 32, "%d", Integer());
return (buff);
break;
}
case VarSys::VI_FPOINT:
{
Utils::Sprintf(buff, 32, "%f", Float());
return (buff);
break;
}
case VarSys::VI_STRING:
{
return (Str());
break;
}
}
}
示例8: switch
std::ostream& operator<<(std::ostream& out, Month m) {
switch (m) {
case January:
return out << "January";
case February:
return out << "February";
case March:
return out << "March";
case April:
return out << "April";
case May:
return out << "May";
case June:
return out << "June";
case July:
return out << "July";
case August:
return out << "August";
case September:
return out << "September";
case October:
return out << "October";
case November:
return out << "November";
case December:
return out << "December";
default:
QL_FAIL("unknown month (" << Integer(m) << ")");
}
}
示例9: GetPrimeTable
void PrimeSieve::DoSieve()
{
unsigned int primeTableSize;
const word16 * primeTable = GetPrimeTable(primeTableSize);
const unsigned int maxSieveSize = 32768;
unsigned int sieveSize = STDMIN(Integer(maxSieveSize), (m_last-m_first)/m_step+1).ConvertToLong();
m_sieve.clear();
m_sieve.resize(sieveSize, false);
if (m_delta == 0)
{
for (unsigned int i = 0; i < primeTableSize; ++i)
SieveSingle(m_sieve, primeTable[i], m_first, m_step, (word16)m_step.InverseMod(primeTable[i]));
}
else
{
assert(m_step%2==0);
Integer qFirst = (m_first-m_delta) >> 1;
Integer halfStep = m_step >> 1;
for (unsigned int i = 0; i < primeTableSize; ++i)
{
word16 p = primeTable[i];
word16 stepInv = (word16)m_step.InverseMod(p);
SieveSingle(m_sieve, p, m_first, m_step, stepInv);
word16 halfStepInv = 2*stepInv < p ? 2*stepInv : 2*stepInv-p;
SieveSingle(m_sieve, p, qFirst, halfStep, halfStepInv);
}
}
}
示例10: isPrime
template <typename Integer> static bool isPrime(Integer N){
Integer M = sqrt(N)+1;
for(Integer i = 2; i < M; i = i+Integer(1)){
if (N%i == 0) return false;
}
return true;
}
示例11: switch
Array DifferentialEvolution::getMutationProbabilities(
const std::vector<Candidate> & population) const {
Array mutationProbabilities = currGenCrossover_;
switch (configuration().crossoverType) {
case Normal:
break;
case Binomial:
mutationProbabilities = currGenCrossover_
* (1.0 - 1.0 / population.front().values.size())
+ 1.0 / population.front().values.size();
break;
case Exponential:
for (Size coIter = 0;coIter< currGenCrossover_.size(); coIter++){
mutationProbabilities[coIter] =
(1.0 - std::pow(currGenCrossover_[coIter],
(int) population.front().values.size()))
/ (population.front().values.size()
* (1.0 - currGenCrossover_[coIter]));
}
break;
default:
QL_FAIL("Unknown crossover type ("
<< Integer(configuration().crossoverType) << ")");
break;
}
return mutationProbabilities;
}
示例12: Integer
const Integer Integer::negate() const {
std::string temp = this->bytes;
if (this->positive) {
temp.insert(0, "-");
}
return Integer(temp);
}
示例13: switch
std::ostream& operator<<(std::ostream& out,
const short_period_holder& holder) {
Integer n = holder.p.length();
Integer m = 0;
switch (holder.p.units()) {
case Days:
if (n>=7) {
m = n/7;
out << m << "W";
n = n%7;
}
if (n != 0 || m == 0)
return out << n << "D";
else
return out;
case Weeks:
return out << n << "W";
case Months:
if (n>=12) {
m = n/12;
out << n/12 << "Y";
n = n%12;
}
if (n != 0 || m == 0)
return out << n << "M";
else
return out;
case Years:
return out << n << "Y";
default:
QL_FAIL("unknown time unit (" << Integer(holder.p.units()) << ")");
}
}
示例14: reduce_phase2
void * reduce_phase2(const void * _exp)
{
if(isA(_exp, Integer()))
return domainCast(_exp, Real());
else if(isA(_exp, Real()) || isA(_exp, Var()))
return copy(_exp);
else if(isA(_exp, Sum()) || isA(_exp, Product()))
{
void * s = copy(_exp);
size_t i;
for(i = 0; i < size(s); ++i)
{
delete(argv(s, i));
setArgv(s, i, reduce_phase2(argv(_exp, i)));
}
return s;
}
else if(isA(_exp, Pow()))
{
void * p = copy(_exp);
delete(base(p));
delete(power(p));
setBase(p, reduce_phase2(base(_exp)));
setPower(p, reduce_phase2(power(_exp)));
return p;
}
else if(isOf(_exp, Apply_1()))
{
void * f = copy(_exp);
delete(arg(f));
setArg(f, reduce_phase2(arg(_exp)));
return f;
}
assert(0);
}
示例15: GetVoidValue
virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
{
TestData::const_iterator i = m_data.find(name);
if (i == m_data.end())
return false;
const std::string &value = i->second;
if (valueType == typeid(int))
*reinterpret_cast<int *>(pValue) = atoi(value.c_str());
else if (valueType == typeid(Integer))
*reinterpret_cast<Integer *>(pValue) = Integer((std::string(value) + "h").c_str());
else if (valueType == typeid(ConstByteArrayParameter))
{
m_temp.resize(0);
PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref());
reinterpret_cast<ConstByteArrayParameter *>(pValue)->Assign((const byte *)m_temp.data(), m_temp.size(), true);
}
else if (valueType == typeid(const byte *))
{
m_temp.resize(0);
PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref());
*reinterpret_cast<const byte * *>(pValue) = (const byte *)m_temp.data();
}
else
throw ValueTypeMismatch(name, typeid(std::string), valueType);
return true;
}