当前位置: 首页>>代码示例>>C++>>正文


C++ UtlHashMap::insertKeyAndValue方法代码示例

本文整理汇总了C++中UtlHashMap::insertKeyAndValue方法的典型用法代码示例。如果您正苦于以下问题:C++ UtlHashMap::insertKeyAndValue方法的具体用法?C++ UtlHashMap::insertKeyAndValue怎么用?C++ UtlHashMap::insertKeyAndValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UtlHashMap的用法示例。


在下文中一共展示了UtlHashMap::insertKeyAndValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copyInto

void UtlHashMap::copyInto(UtlHashMap& into) const
{
    UtlHashMapIterator i(*this);
    while (i() != NULL)
    {
       into.insertKeyAndValue(i.key(), i.value());
    }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:8,代码来源:UtlHashMap.cpp

示例2: UtlString

void 
PermissionDB::getIdentities (
    const UtlString& permission,
    ResultSet& rResultSet ) const
{
    // This should erase the contents of the existing resultset
    rResultSet.destroyAll();

    if ( !permission.isNull() && (m_pFastDB != NULL) )
    {
        // Thread Local Storage
        m_pFastDB->attach();

        dbQuery query;

        // Primary Key is the uriPermission's identity
        query="permission=", permission;

        // Search to see if we have a Credential Row
        dbCursor< PermissionRow > cursor;

        if ( cursor.select(query) > 0 )
        {
            do {
                UtlHashMap record;
                UtlString* identityValue = 
                    new UtlString ( cursor->identity );
                UtlString* permissionValue = 
                    new UtlString ( cursor->permission );

                // Memory Leak fixes, make shallow copies of static keys
                UtlString* identityKey = new UtlString( gIdentityKey );
                UtlString* permissionKey = new UtlString( gPermissionKey );

                record.insertKeyAndValue ( 
                    identityKey, identityValue );
                record.insertKeyAndValue ( 
                    permissionKey, permissionValue );

                rResultSet.addValue(record);
            } while ( cursor.next() );
        }
        // Commit the rows to memory - multiprocess workaround
        m_pFastDB->detach(0);
    }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:46,代码来源:PermissionDB.cpp

示例3: UtlString

void 
UserLocationDB::getLocations (
    const UtlString& identityString,
    ResultSet& rResultSet ) const
{
    // This should erase the contents of the existing resultset
    rResultSet.clear();

    if ( !identityString.isNull() && ( m_pFastDB != NULL) )
    {
        // Thread Local Storage
        m_pFastDB->attach();
        dbQuery query;
        query="identity=",identityString;

        // Search to see if we have a Credential Row
        dbCursor< UserLocationRow > cursor;

        if ( cursor.select(query) > 0 )
        {
            do {
                UtlHashMap record;
                UtlString* identityValue = 
                    new UtlString ( cursor->identity );
                UtlString* locationValue = 
                    new UtlString ( cursor->location );

                // Memory Leak fixes, make shallow copies of static keys
                UtlString* identityKey = new UtlString( gIdentityKey );
                UtlString* locationKey = new UtlString( gLocationKey );

                record.insertKeyAndValue ( 
                    identityKey, identityValue );
                record.insertKeyAndValue ( 
                    locationKey, locationValue );

                rResultSet.addValue(record);
            } while ( cursor.next() );
        }
        // Commit the rows to memory - multiprocess workaround
        m_pFastDB->detach(0);
    }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:43,代码来源:UserLocationDB.cpp

示例4: itor

void
ResultSet::addValue( const UtlHashMap& record )
{
    UtlHashMap*     pNewRecord = new UtlHashMap() ;
    UtlContainable* pObj ;

    // Proceed with shallow copy
    UtlHashMapIterator itor(const_cast<UtlHashMap&>(record)) ;
    while ((pObj = (UtlContainable*) itor()) != NULL)
    {
        pNewRecord->insertKeyAndValue(itor.key(), itor.value()) ;
    }
    append(pNewRecord) ;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:14,代码来源:ResultSet.cpp

示例5: UtlString

void
ExtensionDB::getAllRows(ResultSet& rResultSet) const
{
    // Clear the out any previous records
    rResultSet.destroyAll();

    if ( m_pFastDB != NULL )
    {
        // must do this first to ensure process/tls integrity
        m_pFastDB->attach();

        dbCursor< ExtensionRow > cursor;
        if ( cursor.select() > 0 )
        {
            do {
                UtlHashMap record;
                UtlString* uriValue = 
                    new UtlString ( cursor->uri );
                UtlString* extensionValue = 
                    new UtlString ( cursor->extension );

                // Memory Leak fixes, make shallow copies of static keys
                UtlString* uriKey = new UtlString( gUriKey );
                UtlString* extensionKey = new UtlString( gExtensionKey );

                record.insertKeyAndValue ( 
                    uriKey, uriValue );
                record.insertKeyAndValue ( 
                    extensionKey, extensionValue );

                rResultSet.addValue(record);
            } while (cursor.next());
        }
        // commit rows and also ensure process/tls integrity
        m_pFastDB->detach(0);
    }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:37,代码来源:ExtensionDB.cpp

示例6: UtlString

void
UserForwardDB::getAllRows(ResultSet& rResultSet) const
{
    // Clear the out any previous records
    rResultSet.destroyAll();

    if (m_pFastDB != NULL)
    {
        // must do this first to ensure process/tls integrity
        m_pFastDB->attach();

        dbCursor< UserForwardRow > cursor;
        if ( cursor.select() > 0 )
        {
            do {
                UtlHashMap record;
                UtlString* identityValue = 
                    new UtlString ( cursor->identity );
                UtlString* cfwdtimeValue = 
                    new UtlString ( cursor->cfwdtime );

                // Memory Leak fixes, make shallow copies of static keys
                UtlString* identityKey = new UtlString( gIdentityKey );
                UtlString* cfwdtimeKey = new UtlString( gCfwdtimeKey );

                record.insertKeyAndValue ( 
                    identityKey, identityValue );
                record.insertKeyAndValue ( 
                    cfwdtimeKey, cfwdtimeValue );

                rResultSet.addValue(record);
            } while (cursor.next());
        }
        // commit rows and also ensure process/tls integrity
        m_pFastDB->detach(0);
    }
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:37,代码来源:UserForwardDB.cpp

示例7: UtlString

void
RegistrationDB::getAllRows ( ResultSet& rResultSet ) const
{
    // Clear out any previous records
    rResultSet.destroyAll();

    if ( m_pFastDB != NULL )
    {
        SMART_DB_ACCESS;
        dbCursor< RegistrationRow > cursor;
        if ( cursor.select() > 0 )
        {
            do {
                UtlHashMap record;
                UtlString* uriValue = new UtlString(cursor->uri);
                UtlString* callidValue = new UtlString(cursor->callid);
                UtlString* contactValue = new UtlString(cursor->contact);
                UtlInt* expiresValue = new UtlInt(cursor->expires);
                UtlInt* cseqValue = new UtlInt(cursor->cseq);
                UtlString* qvalueValue = new UtlString(cursor->qvalue);
                UtlString* primaryValue = new UtlString(cursor->primary);
                UtlLongLongInt* updateNumberValue = new UtlLongLongInt(cursor->update_number);

                // Memory Leak fixes, make shallow copies of static keys
                UtlString* uriKey = new UtlString(gUriKey);
                UtlString* callidKey = new UtlString(gCallidKey);
                UtlString* contactKey = new UtlString(gContactKey);
                UtlString* expiresKey = new UtlString(gExpiresKey);
                UtlString* cseqKey = new UtlString(gCseqKey);
                UtlString* qvalueKey = new UtlString(gQvalueKey);
                UtlString* primaryKey = new UtlString(gPrimaryKey);
                UtlString* updateNumberKey = new UtlString(gUpdateNumberKey);

                record.insertKeyAndValue(uriKey, uriValue);
                record.insertKeyAndValue(callidKey, callidValue);
                record.insertKeyAndValue(contactKey, contactValue);
                record.insertKeyAndValue(expiresKey, expiresValue);
                record.insertKeyAndValue(cseqKey, cseqValue);
                record.insertKeyAndValue(qvalueKey, qvalueValue);
                record.insertKeyAndValue(primaryKey, primaryValue);
                record.insertKeyAndValue(updateNumberKey, updateNumberValue);

                rResultSet.addValue(record);
            } while (cursor.next());
        }
    }
    else
    {
       OsSysLog::add(FAC_DB, PRI_CRIT, "RegistrationDB::getAllRows failed - no DB");
    }       
}
开发者ID:mranga,项目名称:sipxecs,代码行数:51,代码来源:RegistrationDB.cpp

示例8: getProcessStateAll

// Fill in a map of process names and states (as UtlStrings)
void SipxProcessManager::getProcessStateAll(UtlHashMap& processStates //< key->name, value->state string
                         )
{
   processStates.destroyAll();
   SipxProcess* process;

   // the lock is not required with the Iterator
   UtlHashBagIterator processes(mProcesses);
   while ((process = dynamic_cast<SipxProcess*>(processes())))
   {
      if ( 0 != process->compareTo(SUPERVISOR_PROCESS_NAME) )
      {
         processStates.insertKeyAndValue(new UtlString(process->data()),
                                      new UtlString(process->GetCurrentState()->name())
                                      );
      }
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:19,代码来源:SipxProcessManager.cpp

示例9: publishDefault

void SipPublishContentMgr::publishDefault(const char* eventTypeKey,
                                          const char* eventType,
                                          SipPublishContentMgrDefaultConstructor*
                                          defaultConstructor,
                                          UtlBoolean fullState)
{
    Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                  "SipPublishContentMgr::publishDefault eventTypeKey '%s', eventType '%s', fullState %d, defaultConstructor %p",
                  eventTypeKey, eventType, fullState, defaultConstructor);

    // Construct the key to look up.
    UtlString key;
    key.append(CONTENT_KEY_SEPARATOR);
    key.append(eventTypeKey);

    lock();

    // Determine the storage we will be using.
    UtlHashMap* pContent;

    if (fullState)
    {
       pContent = &mDefaultContentConstructors;
    }
    else
    {
       pContent = &mDefaultPartialContentConstructors;
    }

    // Remove any old value first.
    pContent->destroy(&key);

    // Add the default constructor.
    if (defaultConstructor)
    {
       UtlString* key_heap = new UtlString(key);
       pContent->insertKeyAndValue(key_heap, defaultConstructor);
    }

    // Do not call the observer for the content change since this is default
    // content.

    unlock();
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:44,代码来源:SipPublishContentMgr.cpp

示例10: string_get

void
SipRedirectorGateway::processForm(const HttpRequestContext& requestContext,
                              const HttpMessage& request,
                              HttpMessage*& response)
{
   UtlString string_get("get");
   UtlString string_set("set");
   UtlString string_prefix("prefix");
   UtlString string_destination("destination");

   OsSysLog::add(FAC_SIP, PRI_DEBUG,
                 "%s::processForm entered", mLogName.data());
   UtlString* user;

   // Process the request.

   // Get the body of the request.
   const HttpBody* request_body = request.getBody();

   OsSysLog::add(FAC_SIP, PRI_DEBUG,
                 "%s::processForm A *** request body is '%s'",
                 mLogName.data(), request_body->getBytes());

   // Get the values from the form.
   if (request_body->isMultipart())
   {
      // Extract the values from the form data.
      UtlHashMap values;
      int c = request_body->getMultipartCount();
      for (int i = 0; i < c; i++)
      {
         UtlString* name = new UtlString;
         if (request_body->getMultipart(i)->getPartHeaderValue("name", *name))
         {
            const char* v;
            int l;
            request_body->getMultipartBytes(i, &v, &l);
            // Strip leading and trailing whitespace from values.
            UtlString* value = new UtlString(v, l);
            value->strip(UtlString::both);
            OsSysLog::add(FAC_SIP, PRI_CRIT,
                          "%s::processForm "
                          "form value '%s' = '%s'",
                          mLogName.data(), name->data(), value->data());
            // 'name' and 'value' are now owned by 'values'.
            values.insertKeyAndValue(name, value);
         }
         else
         {
            // 'name' is not owned by 'values' and we have to delete it.
            delete name;
         }
      }

      if (values.findValue(&string_get))
      {
         // This is a "get gateway" request.

         // Insert the HTML into the response.
         HttpBody* response_body = new HttpBody(form, -1, CONTENT_TYPE_TEXT_HTML);
         response->setBody(response_body);
      }
      else if (values.findValue(&string_set))
      {
         // This is a "set gateway" request.

         // Validate the routing prefix.
         UtlString* prefix =
            dynamic_cast <UtlString*> (values.findValue(&string_prefix));
         if (prefixIsValid(*prefix))
         {
            // Validate the destination.
            UtlString* destination =
               dynamic_cast <UtlString*>
                   (values.findValue(&string_destination));
            if (destination_is_valid(destination))
            {
               OsSysLog::add(FAC_SIP, PRI_CRIT,
                             "%s::processForm "
                             "add mapping '%s' -> '%s'",
                             mLogName.data(), prefix->data(), destination->data());

               mMapLock.acquire();
               // Insert the mapping.
               mMapUserToContacts.insertKeyAndValue(prefix, destination);
               mMapContactsToUser.insertKeyAndValue(destination, prefix);
               mMapLock.release();

               writeMappings();
            }
         }
         // Insert the HTML into the response.
         HttpBody* response_body = new HttpBody(form, -1, CONTENT_TYPE_TEXT_HTML);
         response->setBody(response_body);
      }
      else
      {
         // Incomprehensible request.

         // Insert the HTML into the response.
//.........这里部分代码省略.........
开发者ID:chemeris,项目名称:sipxecs,代码行数:101,代码来源:SipRedirectorGateway.cpp

示例11: main

int main(int argc, char* argv[])
{
   parseArgs(argc, argv);
   initLogger(argv);
   OsEvent taskDone;

   Url url(xmlrpcURI);
    
   if (MemCheckDelay)
   {
      // Delay 45 seconds to allow memcheck start
      printf("Wating %d seconds for start of memcheck ...", MemCheckDelay);
      OsTask::delay(MemCheckDelay * 1000);
      printf("starting\n");
   }
   
   // If an input file was specified we start up the number
   // of specified threads to execute that input file. If number
   // of threads wasn't specified we start up 1 thread.
   if (bInputFile)
   {
      int signaled = 0;
      
      for (int i=0; i<numThreads; i++)
      {
         ClientTask* pTask = new ClientTask(&taskDone);
         pTask->start();
      }

      // Wait for threads to shut down
      while (signaled < numThreads)
      {
         taskDone.wait();
         taskDone.reset();
         ++signaled;
      }
      exit(0);
   }

   switch (Method)
   {
   case Version: // --version <xmlrpc URI> <dataset>
   {
      if (optind < argc)
      {
         fprintf(stderr, "Too many arguments: '%s'\n", argv[optind]);
         showHelp(argv);
         exit(1);
      }

      requestVersion(url);

      break;
   }
   case Get: // --get <xmlrpc URI> <dataset> <name> ...
   {
      UtlSList names;
      // copy remaining arguments into the names list
      while (optind < argc)
      {
         names.append(new UtlString(argv[optind++]));
      }
      
      requestGet(url, names);

      break;
   }
   case Set: // --set <xmlrpc URI> <dataset> <name> <value> [ <name> <value> ] ... 
   {
      UtlHashMap parameters;
      // copy remaining arguments into the names list
      while (optind + 1 < argc)
      {
         UtlString* setName = new UtlString(argv[optind++]);
         UtlString* setValue = new UtlString(argv[optind++]);
         parameters.insertKeyAndValue(setName, setValue);
      }
      if (optind < argc)
      {
         fprintf(stderr, "name '%s' without a value\n", argv[optind]);
         showHelp(argv);
         exit(1);
      }
      
      if (parameters.isEmpty())
      {
         fprintf(stderr, "must specify at least one name and value\n");
         showHelp(argv);
         exit(1);
      }
      else
      {
        requestSet(url, parameters);
        parameters.destroyAll();
      }

      break;
   }
   case Delete: // --delete <xmlrpc URI> <dataset> <name> ... 
   {
//.........这里部分代码省略.........
开发者ID:mranga,项目名称:sipxecs,代码行数:101,代码来源:configrpc.cpp

示例12: testRegistrationSet

   void testRegistrationSet()
      {
         ResultSet registrations;

         size_t row;
         for (row = 0; row < sizeof(regdata)/sizeof(RegistrationRow); row++)
         {
            UtlHashMap regRow;

            UtlString* uriKey = new UtlString("uri");
            UtlString* uriValue = new UtlString(regdata[row].uri);
            regRow.insertKeyAndValue(uriKey, uriValue);

            UtlString* callidKey = new UtlString("callid");
            UtlString* callidValue = new UtlString(regdata[row].callid);
            regRow.insertKeyAndValue(callidKey, callidValue);

            UtlString* contactKey = new UtlString("contact");
            UtlString* contactValue = new UtlString(regdata[row].contact);
            regRow.insertKeyAndValue(contactKey, contactValue);

            UtlString* expiresKey = new UtlString("expires");
            UtlString* expiresValue = new UtlString(regdata[row].expires);
            regRow.insertKeyAndValue(expiresKey, expiresValue);

            UtlString* cseqKey = new UtlString("cseq");
            UtlString* cseqValue = new UtlString(regdata[row].cseq);
            regRow.insertKeyAndValue(cseqKey, cseqValue);

            UtlString* qvalueKey = new UtlString("qvalue");
            UtlString* qvalueValue = new UtlString(regdata[row].qvalue);
            regRow.insertKeyAndValue(qvalueKey, qvalueValue);

            UtlString* instanceIdKey = new UtlString("instance_id");
            UtlString* instanceIdValue = new UtlString(regdata[row].instance_id);
            regRow.insertKeyAndValue(instanceIdKey, instanceIdValue);

            UtlString* gruuKey = new UtlString("gruu");
            UtlString* gruuValue = new UtlString(regdata[row].gruu);
            regRow.insertKeyAndValue(gruuKey, gruuValue);

            UtlString* pathKey = new UtlString("path");
            UtlString* pathValue = new UtlString(regdata[row].path);
            regRow.insertKeyAndValue(pathKey, pathValue);

            registrations.addValue(regRow);
         }

         Url target("http://server.exmple.com");

         XmlRpcRequest request(target,"RPC.METHOD");

         request.addParam(&registrations);

         UtlString requestBody;
         ssize_t bodyLength;
         request.mpRequestBody->getBytes(&requestBody, &bodyLength);

         const char* correctRequestBody =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            "<methodCall>\n"
            "<methodName>RPC.METHOD</methodName>\n"
            "<params>\n"
            "<param>\n"
            "<value><array><data>\n"
            "<value><struct>\n"
            "<member>\n"
            "<name>gruu</name><value><string>sip:[email protected];gr</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>path</name><value><string>&lt;sip:visitme.com&gt;,&lt;sip:overhere.com&gt;,&lt;sip:comemyway.com&gt;</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>uri</name><value><string>sip:[email protected]</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>contact</name><value><string>sip:[email protected]:6012</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>qvalue</name><value><string></string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>cseq</name><value><string>3</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>expires</name><value><string>1133218054</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>instance_id</name><value><string>1111</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>callid</name><value><string>[email protected]</string></value>\n"
            "</member>\n"
            "</struct></value>\n"
            "<value><struct>\n"
            "<member>\n"
            "<name>gruu</name><value><string>sip:[email protected];gr</string></value>\n"
            "</member>\n"
            "<member>\n"
            "<name>path</name><value><string>&lt;sip:visitme.com&gt;,&lt;sip:overhere.com&gt;,&lt;sip:comemyway.com&gt;</string></value>\n"
//.........这里部分代码省略.........
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:101,代码来源:ResultSetRpcTest.cpp

示例13: fileExecute


//.........这里部分代码省略.........
                        }
                    }
                }
                else if (strcasecmp(token, "set") == 0)
                {
                    token = strtok(NULL, " ");
                    if (token == NULL)
                    {
                        fileError(1, line);
                    }
                    else
                    {
                        Url url(token);                
                        token = strtok(NULL, " ");
                        if (token == NULL)
                        {
                            fileError(2, line);
                        }               
                        else
                        {
                            DataSet = token;
                            UtlHashMap parameters;
                            char *key;
                            char *value;
                            while (token != NULL)
                            {
                                key = strtok(NULL, " ");
                                if (key == NULL)
                                {
                                    break;
                                }
                                value = strtok(NULL, " ");
                                if (value == NULL)
                                {
                                    fileError(3, line);
                                    break;
                                }
                                parameters.insertKeyAndValue(new UtlString(key), new UtlString(value));
                            }
                            int entries = parameters.entries();
                    
                            if (entries != 0 || (entries%2) == 0)
                            {
                                requestSet(url, parameters);
                                parameters.destroyAll();
                            }
                        }
                    }
                }
                else if (strcasecmp(token, "delete") == 0)
                {
                    token = strtok(NULL, " ");
                    if (token == NULL)
                    {
                        fileError(1, line);
                    }
                    else
                    {
                        Url url(token);                
                        token = strtok(NULL, " ");
                        if (token == NULL)
                        {
                            fileError(2, line);
                        }
                        else
                        {
                            DataSet = token;
                            UtlSList names;
                            while (token != NULL)
                            {
                                token = strtok(NULL, " ");
                                if (token != NULL)
                                {
                                    names.append(new UtlString(token));
                                }
                            }
                            requestDelete(url, names);
                            names.destroyAll();                             
                        }
                    }
                }
                else
                {
                    fprintf(stderr, "Unknown RPC request %s - ignoring line\n", token);
                }
                if (bSingleStep)
                {
                    getchar();
                }
            }
        }
        while ( bRepeatFile );
        fclose(fp);
    }
    else
    {
        fprintf(stderr, "Can't open %s\n", inputFile);
        exit(1);
    }
}
开发者ID:mranga,项目名称:sipxecs,代码行数:101,代码来源:configrpc.cpp

示例14: parseStruct

bool XmlRpcResponse::parseStruct(TiXmlNode* subNode, UtlHashMap* members)
{
   bool result = false;

   // struct
   UtlString name;
   UtlString paramValue;
   TiXmlNode* memberValue;
   for (TiXmlNode* memberNode = subNode->FirstChild("member");
        memberNode; 
        memberNode = memberNode->NextSibling("member"))
   {
      TiXmlNode* memberName = memberNode->FirstChild("name");
      if (memberName)
      {
         if (memberName->FirstChild())
         {
            name = memberName->FirstChild()->Value();
         }
         else
         {
            result = false;
            break;
         }
         
         memberValue = memberNode->FirstChild("value");        
         if (memberValue)
         {
            // four-byte signed integer                         
            TiXmlNode* valueElement = memberValue->FirstChild("i4");
            if (valueElement)
            {
               if (valueElement->FirstChild())
               {
                  paramValue = valueElement->FirstChild()->Value();
                  members->insertKeyAndValue(new UtlString(name), new UtlInt(atoi(paramValue)));
                  result = true;
               }
               else
               {
                  result = false;
                  break;
               }
            }
            else
            {
               valueElement = memberValue->FirstChild("int");
               if (valueElement)
               {
                  if (valueElement->FirstChild())
                  {
                     paramValue = valueElement->FirstChild()->Value();
                     members->insertKeyAndValue(new UtlString(name), new UtlInt(atoi(paramValue)));
                     result = true;
                  }
                  else
                  {
                     result = false;
                     break;
                  }
               }
               else
               {
                  valueElement = memberValue->FirstChild("i8");
                  if (valueElement)
                  {
                     if (valueElement->FirstChild())
                     {
                        paramValue = valueElement->FirstChild()->Value();
                        members->insertKeyAndValue(new UtlString(name), new UtlLongLongInt(UtlLongLongInt::stringToLongLong(paramValue)));
                        result = true;
                     }
                     else
                     {
                        result = false;
                        break;
                     }
                  }
                  else
                  {
                     valueElement = memberValue->FirstChild("boolean");
                     if (valueElement)
                     {
                        if (valueElement->FirstChild())
                        {
                           paramValue = valueElement->FirstChild()->Value();
                           members->insertKeyAndValue(new UtlString(name), new UtlBool((atoi(paramValue)==1)));
                           result = true;
                        }
                        else
                        {
                           result = false;
                           break;
                        }
                     }
                     else
                     {              
                        valueElement = memberValue->FirstChild("string");
                        if (valueElement)
                        {
//.........这里部分代码省略.........
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:101,代码来源:XmlRpcResponse.cpp

示例15: linkTopologyResources


//.........这里部分代码省略.........
            result = lookupResource(outputResourceName, outputResource);
            if(result != OS_SUCCESS)
            {
                int virtPortIdx = outputResourcePortIndex>=0?outputResourcePortIndex:-1;
                int realPortIdx;
                result = lookupVirtualOutput(outputResourceName, virtPortIdx,
                                             outputResource, realPortIdx);
                if (result == OS_SUCCESS && outputResourcePortIndex>=0)
                {
                   outputResourcePortIndex = realPortIdx;
                }
            }
            assert(result == OS_SUCCESS);
        }
        inputResource = (MpResource*) newResources.find(&inputResourceName);
        if(inputResource == NULL)
        {
            result = lookupResource(inputResourceName, inputResource);
            if(result != OS_SUCCESS)
            {
                int virtPortIdx = inputResourcePortIndex>=0?inputResourcePortIndex:-1;
                int realPortIdx;
                result = lookupVirtualInput(inputResourceName, virtPortIdx,
                                            inputResource, realPortIdx);
                if (result == OS_SUCCESS && inputResourcePortIndex>=0)
                {
                   inputResourcePortIndex = realPortIdx;
                }
            }
            assert(result == OS_SUCCESS);
        }
        assert(outputResource);
        assert(inputResource);

        if(outputResource && inputResource)
        {
            if(outputResourcePortIndex == MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
            {
                outputResourcePortIndex = outputResource->reserveFirstUnconnectedOutput();
                assert(outputResourcePortIndex >= 0);
            }
            else if(outputResourcePortIndex < MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
            {
                // First see if a real port is already in the dictionary
                UtlInt searchKey(outputResourcePortIndex);
                UtlInt* foundValue = NULL;
                if((foundValue = (UtlInt*) newConnectionIds.findValue(&searchKey)))
                {
                    // Use the mapped index
                    outputResourcePortIndex = foundValue->getValue();
                }
                else
                {
                    // Find an available port and add it to the map
                    int realPortNum = outputResource->reserveFirstUnconnectedOutput();
                    assert(realPortNum >= 0);
                    UtlInt* portKey = new UtlInt(outputResourcePortIndex);
                    UtlInt* portValue = new UtlInt(realPortNum);
                    newConnectionIds.insertKeyAndValue(portKey, portValue);
                    outputResourcePortIndex = realPortNum;
                }
            }

            if(inputResourcePortIndex == MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
            {
                inputResourcePortIndex = inputResource->reserveFirstUnconnectedInput();
                assert(inputResourcePortIndex >= 0);
            }
            else if(inputResourcePortIndex < MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
            {
                // First see if a real port is already in the dictionary
                UtlInt searchKey(inputResourcePortIndex);
                UtlInt* foundValue = NULL;
                if((foundValue = (UtlInt*) newConnectionIds.findValue(&searchKey)))
                {
                    // Use the mapped index
                    inputResourcePortIndex = foundValue->getValue();
                }
                else
                {
                    // Find an available port and add it to the map
                    int realPortNum = inputResource->reserveFirstUnconnectedInput();
                    assert(realPortNum >= 0);
                    UtlInt* portKey = new UtlInt(inputResourcePortIndex);
                    UtlInt* portValue = new UtlInt(realPortNum);
                    newConnectionIds.insertKeyAndValue(portKey, portValue);
                    inputResourcePortIndex = realPortNum;
                }
            }


            result = addLink(*outputResource, outputResourcePortIndex, *inputResource, inputResourcePortIndex);
            assert(result == OS_SUCCESS);
        }
        connectionIndex++;
    }

    newConnectionIds.destroyAll();
    return(connectionIndex);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:101,代码来源:MpTopologyGraph.cpp


注:本文中的UtlHashMap::insertKeyAndValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。