Beispiel #1
0
  Table::TableFind Table::getTable(const String &key, bool create)
  {
    SLB_DEBUG_CALL;
    if (_separator.empty()) return TableFind(this,key);

    String::size_type pos = key.find(_separator);
    if (pos != String::npos)
    {
      const String &base = key.substr(0, pos);
      const String &next = key.substr(pos+_separator.length());

      Table* subtable = slb_dynamic_cast<Table>(rawGet(base));
      
      if (subtable == 0)
      {
        if (create)
        {
          SLB_DEBUG(6, "Table (%p) create Subtable %s -> %s", this, 
            base.c_str(), next.c_str());

          subtable = new (Malloc(sizeof(Table))) Table(_separator, _cacheable);
          rawSet(base,subtable);
        }
        else
        {
          return TableFind((Table*)0,key); // not found
        }
      }

      return subtable->getTable(next, create); //< TODO: recursivity... replace with iterative version.
    }
    // else :
    return TableFind(this,key);
  }
Beispiel #2
0
 void Insert(State* s)
 {
   State* existing = TableFind(s);
   if (existing) {
     if (s->Distance() < existing->Distance()) {
       existing->distance_so_far = s->distance_so_far;
       existing->distance_to_goal = s->distance_to_goal;
       existing->parent = s->parent;
       if (existing->heap_index >= 0) {
         HeapUpdatePriority(existing->heap_index);
       }
       else {
         HeapInsert(existing);
       }
     }
     else if (existing->heap_index == -1) {
       HeapInsert(existing);
     }
   }
   else {
     TableInsert(s);
     HeapInsert(s);
   }
 }
char *
RequestHeaderValue(TSession *   const sessionP,
                   const char * const name) {

    return (TableFind(&sessionP->requestHeaderFields, name));
}
Beispiel #4
0
char *RequestHeaderValue(TSession *r,char *name)
{
    return (TableFind(&r->request_headers,name));
}
Beispiel #5
0
 State* Find(State* s)
 {
   return TableFind(s);
 }