ERIS CORE

◆ update() [2/4]

bool SvcDataDictionary::update ( const char *  key,
float32_t  val,
uint32_t *  owner 
)

update the value of an owned 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 126 of file svcDataDictionary.cpp.

126  {
127  uint32_t h;
128  h = hash(key);
129 
130  for(int i=0;i<DATADICT_KEYVALUE_PAIRS;i++){
131  //key found
132  if (record[i].key_hash == h){
133  //if ((0==strncmp(record[i].key,key,DATADICT_MAX_KEY_LEN))){
134  if (record[next].owner == owner && record[next].data_type == DDDT_FLOAT32){
135  record[i].val.float32_val = val;
136  //arm_dcache_flush_delete(&record[i], sizeof(record[i]));
137  return true;
138  } else return false;
139  }
140  }
141  //key not found - try to create a new record
142  return create(key, val, owner);
143 }
@ DDDT_FLOAT32
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_FLOAT32, value_container::float32_val, hash(), next, record, and svcDataDictionaryRecord::val.

+ Here is the call graph for this function: