本文整理汇总了C++中DD函数的典型用法代码示例。如果您正苦于以下问题:C++ DD函数的具体用法?C++ DD怎么用?C++ DD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sql_find_buddy_fd
int sql_find_buddy_fd(cs_request_t *req, sqlite3 *db)
{
if (req == NULL || req->name == NULL ||
req->buddy_name == NULL || db == NULL) {
E("parameter error.");
return -1;
}
char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX);
if (query_line == NULL) {
E("cs_malloc() failed.");
return -1;
}
sprintf(query_line, "select * from users where name='%s'",
req->buddy_name);
DS(query_line);
int fd = 0;
int ret = sqlite3_exec(db, query_line, sql_buddy_fd_cb, &fd, NULL);
if (ret != SQLITE_OK || fd < 0) {
E("sqlite3_exec() failed.");
DD(fd);
cs_free(&query_line);
return -1;
}
cs_free(&query_line);
D(GREEN"user %s fd is %d.", req->buddy_name, fd);
return fd;
}
示例2: zxid_soap_call_raw
/* Called by: zxid_soap_call_hdr_body, zxid_wsc_call */
struct zx_root_s* zxid_soap_call_raw(zxid_conf* cf, struct zx_str* url, struct zx_e_Envelope_s* env, char** ret_enve)
{
#ifdef USE_CURL
struct zx_root_s* r;
struct zx_str* ret;
struct zx_str* ss;
char soap_action_buf[1024];
char* soap_act;
const char* env_start;
ss = zx_easy_enc_elem_opt(cf, &env->gg);
DD("ss(%.*s) len=%d", ss->len, ss->s, ss->len);
if (cf->soap_action_hdr && strcmp(cf->soap_action_hdr,"#inhibit")) {
if (!strcmp(cf->soap_action_hdr,"#same")) {
if (env->Header && env->Header->Action && ZX_GET_CONTENT_S(env->Header->Action)) {
snprintf(soap_action_buf,sizeof(soap_action_buf), "SOAPAction: \"%.*s\"", ZX_GET_CONTENT_LEN(env->Header->Action), ZX_GET_CONTENT_S(env->Header->Action));
soap_action_buf[sizeof(soap_action_buf)-1] = 0;
soap_act = soap_action_buf;
D("SOAPaction(%s)", soap_action_buf);
} else {
ERR("e:Envelope/e:Headers/a:Action SOAP header is malformed %p", env->Header);
}
} else {
snprintf(soap_action_buf,sizeof(soap_action_buf), "SOAPAction: \"%s\"", cf->soap_action_hdr);
soap_action_buf[sizeof(soap_action_buf)-1] = 0;
soap_act = soap_action_buf;
}
} else
soap_act = 0;
ret = zxid_http_post_raw(cf, url->len, url->s, ss->len, ss->s, soap_act);
zx_str_free(cf->ctx, ss);
if (ret_enve)
*ret_enve = ret?ret->s:0;
if (!ret)
return 0;
env_start = zxid_locate_soap_Envelope(ret->s);
if (!env_start) {
ERR("SOAP response does not have Envelope element url(%.*s)", url->len, url->s);
D_XML_BLOB(cf, "NO ENVELOPE SOAP RESPONSE", ret->len, ret->s);
ZX_FREE(cf->ctx, ret);
return 0;
}
cf->ctx->top1 = 1; /* Stop parsing after first toplevel <e:Envelope> */
r = zx_dec_zx_root(cf->ctx, ret->len - (env_start - ret->s), env_start, "soap_call");
if (!r || !r->Envelope || !r->Envelope->Body) {
ERR("Failed to parse SOAP response url(%.*s)", url->len, url->s);
D_XML_BLOB(cf, "BAD SOAP RESPONSE", ret->len, ret->s);
ZX_FREE(cf->ctx, ret);
return 0;
}
return r;
#else
ERR("This copy of zxid was compiled to NOT use libcurl. SOAP calls (such as Artifact profile and WSC) are not supported. Add -DUSE_CURL (make ENA_CURL=1) and recompile. %d", 0);
return 0;
#endif
}
示例3: create_range
void uv_orb::fillDeltagrids(const std::string& file){
E_delta.clear();L_delta.clear();Delta.clear();
E_delta = create_range(E0,Emax,NE);
L_delta = std::vector<VecDoub>(NE,VecDoub(NL,0.));
Delta = std::vector<VecDoub>(NE,VecDoub(NL,0.));
#pragma omp parallel for schedule (dynamic)
for(int i=0; i<NE;i++){
double R = Pot->R_E(E_delta[i]);
for(double j=0;j<NL;j++){
L_delta[i][j] = Pot->L_circ(R)*(j*0.8/(double)(NL-1)+0.001);
find_best_delta DD(Pot, E_delta[i], L_delta[i][j]);
Delta[i][j]=DD.delta(R*.9);
if(Delta[i][j]<0. or Delta[i][j]!=Delta[i][j])
Delta[i][j]=R/5.;
std::cerr<<"DeltaGrid: "
<<OUTPUT(E_delta[i])
<<OUTPUT(L_delta[i][j])
<<OUTPUT(R)
<<OUTPUTE(Delta[i][j]);
}
}
std::cerr<<"DeltaGrid calculated: NE = "<<NE<<", NL = "<<NL<<std::endl;
std::ofstream outfile; outfile.open(file);
for(int i=0;i<NE;++i)
for(int j=0;j<NL;++j)
outfile<<E_delta[i]<<" "<<L_delta[i][j]<<" "<<Delta[i][j]<<std::endl;
outfile.close();
}
示例4: zxid_oauth_dynclireg_client
struct zx_str* zxid_oauth_dynclireg_client(zxid_conf* cf, zxid_cgi* cgi, zxid_ses* ses, const char* as_uri)
{
struct zx_str* res;
char* azhdr;
char* req = zxid_mk_oauth2_dyn_cli_reg_req(cf);
char* url = zxid_oauth_get_well_known_item(cf, as_uri, "\"dynamic_client_endpoint\"");
char* p;
if (iat) {
azhdr = zx_alloc_sprintf(cf->ctx, 0, "Authorization: Bearer %s", iat);
} else
azhdr = 0;
DD("url(%s) req(%s) iat(%s)", url, req, STRNULLCHKD(azhdr));
if (_uma_authn) {
p = url;
url = zx_alloc_sprintf(cf->ctx, 0, "%s%c_uma_authn=%s", url, strchr(url,'?')?'&':'?', _uma_authn);
ZX_FREE(cf->ctx, p);
}
D("url(%s) req(%s) iat(%s)", url, req, STRNULLCHKD(azhdr));
res = zxid_http_cli(cf, -1, url, -1, req, ZXID_JSON_CONTENT_TYPE, azhdr, 0);
ZX_FREE(cf->ctx, url);
if (azhdr) ZX_FREE(cf->ctx, azhdr);
ZX_FREE(cf->ctx, req);
D("%.*s", res->len, res->s);
ses->client_id = zx_json_extract_dup(cf->ctx, res->s, "\"client_id\"");
ses->client_secret = zx_json_extract_dup(cf->ctx, res->s, "\"client_secret\"");
return res;
}
示例5: slab_get_obj
static void * slab_get_obj(kmem_cache_t *cachep, struct slab *slabp)
{
if(cachep == NULL || slabp == NULL)
{
return NULL;
}
struct list_head *item = NULL;
if(slabp->free == BUFCTL_END)
{
DD("not free obj.");
return NULL;
}
void *objp = index_to_obj(cachep, slabp, slabp->free);
uint32_t next = slab_bufctl(slabp)[slabp->free];
inc_slab_use(slabp);
set_slab_free(slabp, next);
/* move to the full list*/
if(slabp->inuse == cachep->obj_num)
{
item = &(slabp->list);
list_del(item);
list_add(item, &(cachep->kmem_lists.full));
}
dec_cache_free(cachep);
return objp;
}
示例6: DD
void HelloWorld::update (float delta)
{
CCLayer::update (delta);
static double thinginterval =0;
thinginterval+= delta;
for (int i=0; i < bads.size(); ++i)
{
DD (bads[i]->GetID(), Telegram_AI, { });
DD (bads[i]->GetID(), Telegram_UPDATE, { delta });
}
thinginterval=0;
}
示例7: _getSearchPaths
/* Parse a given config.ini file and extract the list of SDK search paths
* from it. Returns the number of valid paths stored in 'searchPaths', or -1
* in case of problem.
*
* Relative search paths in the config.ini will be stored as full pathnames
* relative to 'sdkRootPath'.
*
* 'searchPaths' must be an array of char* pointers of at most 'maxSearchPaths'
* entries.
*/
static int
_getSearchPaths( IniFile* configIni,
const char* sdkRootPath,
int maxSearchPaths,
char** searchPaths )
{
char temp[PATH_MAX], *p = temp, *end= p+sizeof temp;
int nn, count = 0;
for (nn = 0; nn < maxSearchPaths; nn++) {
char* path;
p = bufprint(temp, end, "%s%d", SEARCH_PREFIX, nn+1 );
if (p >= end)
continue;
path = iniFile_getString(configIni, temp, NULL);
if (path != NULL) {
DD(" found image search path: %s", path);
if (!path_is_absolute(path)) {
p = bufprint(temp, end, "%s/%s", sdkRootPath, path);
AFREE(path);
path = ASTRDUP(temp);
}
searchPaths[count++] = path;
}
}
return count;
}
示例8: EsqCurto
void EsqCurto (ApontadorNo *Ap, short *Fim){
ApontadorNo Ap1;
if ((*Ap)->BitE == Horizontal){
(*Ap)->BitE = Vertical;
*Fim = TRUE;
return;
}
if ((*Ap)->BitD == Horizontal){
Ap1 = (*Ap)->Dir;
(*Ap)->Dir = Ap1->Esq;
Ap1->Esq = *Ap;
*Ap = Ap1;
if ((*Ap)->Esq->Dir->BitE == Horizontal){
DE(&(*Ap)->Esq);
(*Ap)->BitE = Horizontal;
}
*Fim = TRUE;
return;
}
(*Ap)->BitD = Horizontal;
if ((*Ap)->Dir->BitE == Horizontal){
DE(Ap);
*Fim = TRUE;
return;
}
if ((*Ap)->Dir->BitD == Horizontal){
DD(Ap);
*Fim == TRUE;
}
}
示例9: buscarIzquierdaAVL
int buscarIzquierdaAVL( AVL *a, int dato, int *band )
{
int retAux;
retAux = eliminaAVL( &(*a)->izq, dato, band );
if( *band )
{
if( (*a) -> fe == 0 )
{
(*a) -> fe = 1;
*band = 0;
}else
if( (*a) -> fe == -1 )
(*a) -> fe = 0;
else
{
if( (*a) -> der -> fe >= 0 )
{
if( (*a) -> der -> fe == 0 )
*band = 0;
DD( a );
}else
DI( a );
}
}
return( retAux );
}
示例10: eliminaAVL
int eliminaAVL( AVL *a, int dato, int *band )
{
int ret;
AVL aux;
if( !*a )
*band = ret = 0;
else
{
if( dato == (*a) -> info )
{
ret = *band = 1;
aux = *a;
if( !(*a) -> izq )
*a = (*a)-> der;
else
if( !(*a) -> der )
*a = (*a) -> izq;
else
{
recorreIzqDerAVL( &(*a) -> izq, &aux, band );
(*a) -> info = aux -> info;
if( *band )
{
if( (*a) -> fe == 0 )
{
(*a) -> fe = 1;
*band = 0;
}else
if( (*a) -> fe == -1 )
(*a) -> fe = 0;
else
{
if( (*a) -> der -> fe >= 0 )
{
if( (*a) -> der -> fe == 0 )
*band = 0;
DD( a );
}else
DI( a );
}
}
}
free( aux );
}else
if( dato < (*a) -> info )
ret = buscarIzquierdaAVL( a, dato, band );
else
if( dato > (*a) -> info )
ret= buscarDerechaAVL( a, dato, band );
}
return( ret );
}
示例11: trans
int GaussianProcessNormal::precomputePrediction()
{
size_t n = mGPXX.size();
size_t p = mMean->nFeatures();
mKF = trans(mFeatM);
inplace_solve(mL,mKF,ublas::lower_tag());
//TODO: make one line
matrixd DD(p,p);
DD = prod(trans(mKF),mKF);
utils::addToDiagonal(DD,mInvVarW);
utils::cholesky_decompose(DD,mD);
vectord vn = mGPY;
inplace_solve(mL,vn,ublas::lower_tag());
mWMap = prod(mFeatM,vn) + utils::ublas_elementwise_prod(mInvVarW,mW0);
utils::cholesky_solve(mD,mWMap,ublas::lower());
mVf = mGPY - prod(trans(mFeatM),mWMap);
inplace_solve(mL,mVf,ublas::lower_tag());
if (boost::math::isnan(mWMap(0)))
{
FILE_LOG(logERROR) << "Error in precomputed prediction. NaN found.";
return -1;
}
return 0;
}
示例12: IInsere
void IInsere(TipoReg x, TipoApont *Ap,TipoInclinacao *IAp, short *Fim)
{ if (*Ap == NULL)
{ *Ap = (TipoApont)malloc(sizeof(TipoNo));
*IAp = Horizontal; (*Ap)->Reg = x;
(*Ap)->BitE = Vertical; (*Ap)->BitD = Vertical;
(*Ap)->Esq = NULL; (*Ap)->Dir = NULL; *Fim = FALSE;
return;
}
if (x.Chave < (*Ap)->Reg.Chave)
{ IInsere(x, &(*Ap)->Esq, &(*Ap)->BitE, Fim);
if (*Fim) return;
if ((*Ap)->BitE != Horizontal) { *Fim = TRUE; return; }
if ((*Ap)->Esq->BitE == Horizontal)
{ EE(Ap); *IAp = Horizontal; return; }
if ((*Ap)->Esq->BitD == Horizontal) { ED(Ap); *IAp = Horizontal; }
return;
}
//COMPARA플O AQUI
if (x.Chave <= (*Ap)->Reg.Chave)
{ printf("Erro: Chave ja esta na arvore\n");
*Fim = TRUE;
return;
}
IInsere(x, &(*Ap)->Dir, &(*Ap)->BitD, Fim);
if (*Fim) return;
if ((*Ap)->BitD != Horizontal) { *Fim = TRUE; return; }
if ((*Ap)->Dir->BitD == Horizontal)
{ DD(Ap); *IAp = Horizontal; return;}
if ((*Ap)->Dir->BitE == Horizontal) { DE(Ap); *IAp = Horizontal; }
}
示例13: InitTinyHashTable
int InitTinyHashTable(HashTable *pstHashTable, key_t key , int iCreateFlags)
{
int ret = 0;
if(pstHashTable == NULL)
{
return -1;
}
if((ret = SequenceShmInit(&gstShm, CACHE_SEQ_KEY + key, 0666 | IPC_CREAT )) < 0)
{
printf("SequenceShmInit error.ret = %d\n", ret);
return -2;
}
if((ret = InitHashtable(pstHashTable, CACHE_HASHTABLE_BASE_KEY + key, HASH_MAX_ROW, sizeof(IndexNode),auNodeNums, auMods, iCreateFlags, compare)) < 0)
{
DD("_InitHashtable error.ret = %d\n", ret);
return -3;
}
/**ppstHashTable = g_pstHashTable;*/
return 0;
}
示例14: DD
//This method is call to compute solution
ERMsg CYHSSModel::OnExecuteDaily()
{
ERMsg msg;
// if (!m_weather.IsHourly() )
//m_weather.ComputeHourlyVariables();
static const double THRESHOLD = 0;
CDegreeDays DD(CDegreeDays::DAILY_AVERAGE, THRESHOLD);
CYHSSStatVector stat(m_weather.GetEntireTPeriod(CTM(CTM::DAILY)));
for (size_t y = 0; y < m_weather.size(); y++)
{
CTPeriod p = m_weather[y].GetEntireTPeriod();
double tot_adult[366] = { 0 };
double dd = 0;
double cum_adult = 0;
for (size_t jd = 0; jd < 90; jd++)
{
CTRef TRef = p.Begin() + jd;
stat[TRef][O_L1] = 100;
stat[TRef][O_AI] = 1;
}
for (size_t jd = 89; jd < m_weather[y].GetNbDays(); jd++)
{
CTRef TRef = p.Begin() + jd;
const CWeatherDay& wDay = m_weather.GetDay(TRef);
dd += DD.GetDD(wDay);
double freq[9] = { 0 };
double ai = ComputeStageFrequencies(dd, freq);
// adults alive
tot_adult[jd] = freq[0];
cum_adult += (tot_adult[jd] - tot_adult[jd - m_adultLongevity]) / m_adultLongevity;
stat[TRef][O_DEGREE_DAY] = dd;
stat[TRef][O_ADULT] = freq[0];
stat[TRef][O_TRAP_CATCH] = cum_adult;
for (size_t i = 0; i < 6; i++)
stat[TRef][O_L1 + i] = freq[i + 3];
stat[TRef][O_AI] = ai;
}
}
SetOutput(stat);
return msg;
}
示例15: close_if
static void close_if(int handle)
{
if(close(handle) < 0)
{
DD("error in file %s line %d:\n", __FILE__, __LINE__);
error(2,0L);
}
}