void wxGISGPStringDomain::AddString(const wxString &soStr, const wxString &soName) { if(soName.IsEmpty()) AddValue(wxVariant(soStr), soStr); else AddValue(wxVariant(soStr), soName); }
//--------------------------------------------------------------------------- void __fastcall CUBRelay::GetDump(void *&Dump, DWORD &DumpSize) { CStdElement::GetDump(Dump, DumpSize); AddValue(Dump, DumpSize, &B, sizeof(long double)); AddValue(Dump, DumpSize, &dX, sizeof(long double)); AddValue(Dump, DumpSize, &dY, sizeof(long double)); }
bool plKeysAndValues::AddValue(const std::string & key, double value, KAddValueMode mode) { char buf[30]; sprintf(buf, "%f", value); std::string v(buf); return AddValue(key,v,mode); }
HRESULT CXFields::AddField(LPCWSTR key, short type, __int64 fmt) { int i; if(!isVBType(type) && type != VT_DISPATCH) return E_INVALIDARG; if(type == VT_DISPATCH) type = VT_USERDEFINED; for(i = 0; i < (int)GetCount(); i ++) if(!GetValue(i)->m_strName.CompareNoCase(key)) { GetValue(i)->m_nType = type; GetValue(i)->m_nFormat = fmt; return S_OK; } CXComPtr<CXField> pField; pField.CreateObject(); pField->m_strName = key; pField->m_nType = type; pField->m_nFormat = fmt; AddValue(pField); return S_OK; }
bool plConfigInfo::AddValue(const std::string & section, const std::string & key, double value, KAddValueMode mode) { char buf[30]; sprintf(buf, "%f", value); std::string v(buf); return AddValue(section,key,v,mode); }
WindowNameFilter(unsigned int type, const unsigned int* vec, size_t length) : RemapFilterBase(type) { targets_.reserve(length); for (size_t i = 0; i < length; ++i) { targets_.push_back(AddValue(vec[i])); } }
//============================================================================== /// Configures the given filter. //============================================================================== void JRangeFilter::Config(std::string filter){ Reset(); std::string tx,tx2; while(!filter.empty()){ int pos=int(filter.find(",")); tx=(pos>0? filter.substr(0,pos): filter); filter=(pos>0? filter.substr(pos+1): ""); pos=int(tx.find("-")); tx2=(pos>0? tx.substr(0,pos): ""); if(pos>0)tx=tx.substr(pos+1); if(tx2.empty())AddValue(atoi(tx.c_str())); else AddRange(atoi(tx2.c_str()),atoi(tx.c_str())); } SortRanges(); JoinRanges(); if(Count){ ValueMin=Ranges[0]; ValueMax=Ranges[((int(Count)-1)<<1)+1]; if(ValueMax-ValueMin<1000&&ValueMax-ValueMin>1&&Count>1){ FastValue=new byte[ValueMax-ValueMin+1]; memset(FastValue,0,sizeof(byte)*(ValueMax-ValueMin+1)); for(unsigned c=0;c<Count;c++){ unsigned r=Ranges[c<<1],r2=Ranges[(c<<1)+1]; for(;r<=r2;r++)FastValue[r-ValueMin]=1; } } } }
static void CopyValues( ValArr *va, Sect *sec, DSpec *dspec, int isconfig ) { Value val; int i; Debug( "getting values for section class [%s]\n", sec->name ); for (i = 0; i < sec->numents; i++) { /*Debug ("value %#x\n", sec->ents[i].id);*/ if ((sec->ents[i].id & (int)C_CONFIG) != isconfig) ; else if (sec->ents[i].id & C_INTERNAL) { GetValue( sec->ents + i, dspec, ((Value *)sec->ents[i].ptr), 0 ); } else { if (((sec->ents[i].id & C_MTYPE_MASK) == C_ENUM) || !sec->ents[i].ptr || !((int (*)( Value * ))sec->ents[i].ptr)(&val)) { GetValue( sec->ents + i, dspec, &val, (char **)sec->ents[i].ptr ); } if (!AddValue( va, sec->ents[i].id, &val )) break; } } return; }
bool KThruput::AddValue(int duration, unsigned long in, unsigned long out) { int index = CurIndex(); if (index >= 0 && RunTime[index] == duration) return TRUE; index = CurIndex(COUNT); RunTime[index] = duration; AddValue(IN_DATA,in); AddValue(OUT_DATA,out); repaint(); return TRUE; }
void R2Image:: AddValue(double x, double y, int c, double value) { // Bilinear splat int ix1 = (int) x; int iy1 = (int) y; int ix2 = ix1 + 1; int iy2 = iy1 + 1; if (ix2 >= width) ix2 = ix1; if (iy2 >= height) iy2 = iy1; double dx = x - ix1; double dy = y - iy1; AddValue(ix1, iy1, c, value * (1.0-dx) * (1.0-dy)); AddValue(ix1, iy2, c, value * (1.0-dx) * dy); AddValue(ix2, iy1, c, value * dx * (1.0-dy)); AddValue(ix2, iy2, c, value * dx * dy); }
void PerformanceStackPair::SendValues() { UpdateBuilder builder; for (uint32_t i = 0; i < EVENTS_PER_ITERATION; ++i) { AddValue(i, builder); } this->outstation->Apply(builder.Build()); }
CGPValue::CGPValue(const char *initName, const char *initValue) : CGPObject(initName), mList(0) { if (initValue) { AddValue(initValue); } }
Store::Store(SymbolTable& symTab):_cell(0.0), _status (stNotInit) { std::cout << "e = " << std::exp(1) << std::endl; int id = symTab.ForceAdd("e"); SetValue (id, std::exp(1) ); std::cout << "pi = " << 2 * std::acos (0.0) << std::endl; id = symTab.ForceAdd("pi"); AddValue (id, 2.0 * std::acos (0.0) ); }
bool CAuthAuthority::AddValue( CFStringRef inAuthAuthorityString ) { char aaBuffer[1024]; if ( CFStringGetCString(inAuthAuthorityString, aaBuffer, sizeof(aaBuffer), kCFStringEncodingUTF8) ) return AddValue( aaBuffer ); return false; }
HRESULT CBCookie::ParseUrlEncodeString(LPCSTR pstr, UINT nSize) { LPCSTR pstrTemp; CBString strKey, strValue; LPCSTR pdefstr = pstr; UINT nDefSize = nSize; m_dict.RemoveAll(); while(nSize) { pstrTemp = pstr; while(nSize && *pstr != '=') { pstr ++; nSize --; } if(!nSize)break; if(pstr > pstrTemp) strKey = CBEncoding::UrlDecode(pstrTemp, (UINT)(pstr - pstrTemp)); else strKey.Empty(); if(nSize) { nSize --; pstr ++; } pstrTemp = pstr; while(nSize && *pstr != '&') { pstr ++; nSize --; } if(!strKey.IsEmpty()) if(pstr > pstrTemp) strValue = CBEncoding::UrlDecode(pstrTemp, (UINT)(pstr - pstrTemp)); else strValue.Empty(); if(nSize) { nSize --; pstr ++; } if(!strKey.IsEmpty())AddValue(strKey, strValue); } if(m_dict.GetCount())m_strDefault = CBString(pdefstr, nDefSize); else m_strDefault = CBEncoding::UrlDecode(pdefstr, nDefSize); return S_OK; }
bool User::BuildYourValueSet(){ ManagedObject::BuildYourValueSet(); AddValue( &m_userName , SSAPI_USER_FID_USERNAME ); AddValue( &m_password , SSAPI_USER_FID_PASSWORD ); AddValue( &m_firstName , SSAPI_USER_FID_FIRST_NAME ); AddValue( &m_lastName , SSAPI_USER_FID_LAST_NAME ); AddValue( &m_description , SSAPI_USER_FID_DESCRIPTION ); AddValue( &m_email , SSAPI_USER_FID_EMAIL ); AddValue( &m_phoneNumber1 , SSAPI_USER_FID_PHONE_1 ); AddValue( &m_phoneNumber2 , SSAPI_USER_FID_PHONE_2 ); AddValue( &m_department , SSAPI_USER_FID_DEPARTMENT); AddInt(m_language, SSAPI_USER_FID_LANGUAGE ); return true; }
void Storage::SetValue(unsigned int id,double value) { assert(id<=cells_.size()); if (id<cells_.size()) { cells_[id] = value; inits_[id] = true; }else if(id == cells_.size()) { AddValue(id,value); } }
long long ComputeBestMix(struct ingredient **pantry, struct cookie jar, int numLeft, int maxTsp) { int myTsp; long long retVal = 0, tmpVal; if (maxTsp == 0) { return CookieValue(&jar); } else if (numLeft == 1) { AddValue(pantry[0], &jar, maxTsp); return CookieValue(&jar); } for (myTsp = maxTsp; myTsp >= 0; myTsp--) { AddValue(pantry[0], &jar, myTsp); tmpVal = ComputeBestMix(pantry+1, jar, numLeft-1, maxTsp-myTsp); SubtractValue(pantry[0], &jar, myTsp); if (tmpVal > retVal) { retVal = tmpVal; } } return retVal; }
void SSAPIEvent::BuildYourValueSet(){ AddInt(m_eventType, SSAPI_EVENT_FID_EVENT_TYPE ); AddInt64(m_timeStamp, SSAPI_EVENT_FID_TIMESTAMP ); AddGenericValue( (char *)&m_parentId, sizeof(m_parentId), SSAPI_EVENT_FID_PARENT_ID ); if( m_pManagedObject ){ m_pManagedObject->BuildYourValueSet(); AddValue( m_pManagedObject, SSAPI_EVENT_FID_MANAGED_OBJECT ); m_pManagedObject->Clear(); } }
bool Object::Combine(const Object& img, bool allow_mix, float factor) { AddValue(img.Value(), factor); if (!allow_mix && (stagevalues.Nitems() || img.stagevalues.Nitems()) && (stagevalues.Nitems()!=1 || img.stagevalues.Nitems()!=1)) { char txt[100]; sprintf(txt, "%d %d", stagevalues.Nitems(), img.stagevalues.Nitems()); return ShowError("Object::Combine() error #1a: ", txt); } if (allow_mix && stagevalues.Nitems()!=img.stagevalues.Nitems()) { char txt[100]; sprintf(txt, "%d %d", stagevalues.Nitems(), img.stagevalues.Nitems()); return ShowError("Object::Combine() error #1b: ", txt); } for (int j=0; j<stagevalues.Nitems(); j++) { FloatVector &dst = stagevalues[j]; const FloatVector &src = img.stagevalues[j]; if (dst.Length()!=src.Length() || dst.Length()<2) { char txt[100]; sprintf(txt, "j=%d %d %d", j, dst.Length(), src.Length()); return ShowError("Object::Combine() error #2: ", txt); } for (int i=0; i<dst.Length()-1; i++) { if (!allow_mix && dst[i]!=MAXFLOAT && src[i]!=MAXFLOAT) { cout << "this=" << DumpString(-1) << endl; cout << "img =" << img.DumpString(-1) << endl; char txt[100]; sprintf(txt, "j=%d i=%d", j, i); return ShowError("Object::Combine() error #3: ", txt); } if (src[i]!=MAXFLOAT) { if (dst[i]==MAXFLOAT) dst[i] = src[i]; else dst[i] += src[i]; } } dst.Last() = value; } return true; }
bool CWizXmlRpcStructValue::Read(CWizXMLNode& nodeValue) { CWizXMLNode nodeStruct; if (!nodeValue.FindChildNode(_T("struct"), nodeStruct)) { TOLOG(_T("Failed to get struct node!")); return FALSE; } // std::deque<CWizXMLNode> arrayMember; nodeStruct.GetAllChildNodes(arrayMember); // for (std::deque<CWizXMLNode>::iterator it = arrayMember.begin(); it != arrayMember.end(); it++) { CWizXMLNode& nodeMember = *it; // CString strName; if (!nodeMember.GetChildNodeText(_T("name"), strName)) { TOLOG(_T("Failed to get struct member name!")); return FALSE; } // CWizXMLNode nodeMemberValue; if (!nodeMember.FindChildNode(_T("value"), nodeMemberValue)) { TOLOG(_T("Failed to get struct member value!")); return FALSE; } // CWizXmlRpcValue* pMemberValue = NULL; if (!WizXmlRpcValueFromXml(nodeMemberValue, &pMemberValue)) { TOLOG(_T("Failed to load struct member value from node!")); return FALSE; } // ATLASSERT(pMemberValue); // AddValue(strName, pMemberValue); } // return TRUE; }
bool LogMessage::BuildYourValueSet(){ ManagedObject::BuildYourValueSet(); AddU32( m_sequenceNumber, SSAPI_LOG_MESSAGE_FID_SEQ_NUMBER ); AddInt64( m_timeStamp, SSAPI_LOG_MESSAGE_FID_TIME_STAMP ); AddInt( m_ec, SSAPI_LOG_MESSAGE_FID_EVENT_CODE ); AddInt( m_slot, SSAPI_LOG_MESSAGE_FID_SLOT ); AddInt( m_facility, SSAPI_LOG_MESSAGE_FID_FACILITY ); AddInt( m_severity, SSAPI_LOG_MESSAGE_FID_SEVERITY ); AddInt( m_did, SSAPI_LOG_MESSAGE_FID_DID ); AddInt( m_vdn, SSAPI_LOG_MESSAGE_FID_VDN ); AddValue( m_pParmVector, SSAPI_LOG_MESSAGE_FID_PARAMETER_VECTOR ); return true; }
void Fluid::AddForces(const Vector2& position, float sigma, float amplitude, View2f* velocities) const { const int x = std::lroundf(position.x * Width()); const int y = std::lroundf((1.0f - position.y) * Height()); const int radius = std::lround(4.0f * sigma); const float sigmaSq = sigma * sigma; for (int j = y - radius; j <= y + radius; ++j) { for (int i = x - radius; i <= x + radius; ++i) { const int s = i - x; const int t = y - j; // Flips at y-axis. const Vector2 dir = (s != 0 || t != 0) ? Vector2(s, t).Normalized() : Vector2(0.0f); const float weight = amplitude * std::exp(-(0.5f / sigmaSq) * (s * s + t * t)); AddValue(i, j, weight * dir, velocities); } } }
bool CWizXmlRpcStructValue::Read(CWizXMLNode& nodeValue) { CWizXMLNode nodeStruct; if (!nodeValue.FindChildNode("struct", nodeStruct)) { TOLOG("Failed to get struct node!"); return false; } std::deque<CWizXMLNode> arrayMember; nodeStruct.GetAllChildNodes(arrayMember); std::deque<CWizXMLNode>::iterator it; for (it = arrayMember.begin(); it != arrayMember.end(); it++) { CWizXMLNode& nodeMember = *it; QString strName; if (!nodeMember.GetChildNodeText("name", strName)) { TOLOG("Failed to get struct member name!"); return false; } CWizXMLNode nodeMemberValue; if (!nodeMember.FindChildNode("value", nodeMemberValue)) { TOLOG("Failed to get struct member value!"); return false; } CWizXmlRpcValue* pMemberValue = NULL; if (!WizXmlRpcValueFromXml(nodeMemberValue, &pMemberValue)) { TOLOG("Failed to load struct member value from node!"); return false; } Q_ASSERT(pMemberValue); AddValue(strName, pMemberValue); } return true; }
//============================================================================== /// Adds a range of values. //============================================================================== void JRangeFilter::AddRange(unsigned v,unsigned v2){ if(v==v2)AddValue(v); else if(v<v2){ int len; do{ len=v2-v+1; for(int c=0;c<int(Count)&&v<=v2;c++){ unsigned r=Ranges[c<<1],r2=Ranges[(c<<1)+1]; if(r<=v&&v<=r2)v=r2+1; if(r<=v2&&v2<=r2)v2=r-1; } }while(len!=v2-v+1&&v<=v2); if(v<=v2){ if(Count+1>Size)ResizeRanges(Size+50); Ranges[Count<<1]=v; Ranges[(Count<<1)+1]=v2; Count++; } } }
void Fluid::AddForces(const Vector2& position, const Vector2& direction, float sigma, float amplitude, View2f* velocities) const { if (direction.LengthSquared() < 1e-4f) { return AddForces(position, sigma, amplitude, velocities); } const int x = std::lroundf(position.x * Width()); const int y = std::lroundf((1.0f - position.y) * Height()); const int radius = std::lround(3.3f * sigma); const Vector2 dn = direction.Normalized(); const float sigmaSq = sigma * sigma; for (int j = y - radius; j <= y + radius; ++j) { for (int i = x - radius; i <= x + radius; ++i) { const int s = i - x; const int t = y - j; // Flips at y-axis. const float e = amplitude * std::exp(-(0.5f / sigmaSq) * (s * s + t * t)); AddValue(i, j, e * dn, velocities); } } }
void CGPValue::Parse(char **dataPtr, CTextPool **textPool) { char *token; char *value; while(1) { token = GetToken(dataPtr, true, true); if (!token[0]) { // end of data - error! break; } else if (Q_strcmpi(token, "]") == 0) { // ending brace for this list break; } value = (*textPool)->AllocText(token, true, textPool); AddValue(value); } }
HRESULT CXFields::AddRecordset(LPCWSTR key, __int64 fmt) { int i; for(i = 0; i < (int)GetCount(); i ++) if(!GetValue(i)->m_strName.CompareNoCase(key)) { GetValue(i)->m_nType = VT_DISPATCH; GetValue(i)->m_nFormat = fmt; return S_OK; } CXComPtr<CXField> pField; pField.CreateObject(); pField->m_strName = key; pField->m_nType = VT_DISPATCH; pField->m_nFormat = fmt; AddValue(pField); return S_OK; }
void add(Option newval) { add(AddDataType(BRIDGE_DATATYPE_OPTION), AddValue(newval.get())); }
// utility void add(KeyCode newval) { add(AddDataType(BRIDGE_DATATYPE_KEYCODE), AddValue(newval.get())); }