ERIS CORE

◆ update() [3/4]

bool FASTRUN SvcDataDictionary::update ( const char *  key,
int32_t  val 
)

update the value of a global record
creates a new record if one does not exist and
initializes its value to zero

Parameters
key
val
owner
Returns
true
false

Definition at line 145 of file svcDataDictionary.cpp.

145  {
146  uint32_t h;
147  h = hash(key);
148 
149  for(int i=0;i<DATADICT_KEYVALUE_PAIRS;i++){
150  //key found
151  if (record[i].key_hash == h){
152  //if ((0==strncmp(record[i].key,key,DATADICT_MAX_KEY_LEN))){
153  if (record[i].record_type == DDRT_READWRITE && record[i].data_type == DDDT_INT32){
154  record[i].val.int32_val = val;
155  //arm_dcache_flush_delete(&record[i], sizeof(record[i]));
156  return true;
157  } else return false;
158  }
159  }
160  //key not found - try to create a new record
161  return create(key, val);
162 }
@ DDRT_READWRITE
@ DDDT_INT32
bool create(const char *key, int32_t val, uint32_t *owner)
create a record with ownership
svcDataDictionaryRecord record[DATADICT_KEYVALUE_PAIRS]
uint32_t hash(const char *s)
hashing function used to accelerate searches

References create(), DDDT_INT32, DDRT_READWRITE, hash(), value_container::int32_val, record, and svcDataDictionaryRecord::val.

+ Here is the call graph for this function: