reSIProcate/DialogUsageManager  9694
Public Member Functions | Private Attributes
resip::ServerRegistration::AsyncLocalStore Class Reference

Local datastore used to aggregate all changes to the current contact list when using the asynchronous logic. More...

Collaboration diagram for resip::ServerRegistration::AsyncLocalStore:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AsyncLocalStore (std::auto_ptr< ContactPtrList > originalContacts)
 ~AsyncLocalStore (void)
void create (std::auto_ptr< ContactPtrList > originalContacts)
 Setup this object in preparation for updating the records.
void destroy (void)
void removeContact (const ContactInstanceRecord &rec)
void removeAllContacts (void)
 All original contacts are to be removed, move them all to the removed list.
RegistrationPersistenceManager::update_status_t updateContact (const ContactInstanceRecord &rec)
 Could be an addition or refresh.
void releaseLog (std::auto_ptr< ContactRecordTransactionLog > &log, std::auto_ptr< ContactPtrList > &modifiedContacts)
 Remove the transacation log and updated contact list.
unsigned int numContacts ()

Private Attributes

std::auto_ptr
< ContactRecordTransactionLog > 
mLog
std::auto_ptr< ContactPtrList > mModifiedContacts

Detailed Description

Local datastore used to aggregate all changes to the current contact list when using the asynchronous logic.

Definition at line 139 of file ServerRegistration.hxx.


Constructor & Destructor Documentation

resip::ServerRegistration::AsyncLocalStore::AsyncLocalStore ( std::auto_ptr< ContactPtrList >  originalContacts) [inline]

Definition at line 143 of file ServerRegistration.hxx.

References create().

            {
               create(originalContacts);
            }

Here is the call graph for this function:

resip::ServerRegistration::AsyncLocalStore::~AsyncLocalStore ( void  ) [inline]

Definition at line 148 of file ServerRegistration.hxx.

References destroy().

            {
               destroy();
            }

Here is the call graph for this function:


Member Function Documentation

void ServerRegistration::AsyncLocalStore::create ( std::auto_ptr< ContactPtrList >  originalContacts)

Setup this object in preparation for updating the records.

Updates occur when processing a REGISTER message.

Definition at line 735 of file ServerRegistration.cxx.

References mLog, and mModifiedContacts.

Referenced by AsyncLocalStore().

{
   mModifiedContacts = originalContacts;
   mLog = std::auto_ptr<ContactRecordTransactionLog>(new ContactRecordTransactionLog());
}
void ServerRegistration::AsyncLocalStore::destroy ( void  )

Definition at line 742 of file ServerRegistration.cxx.

Referenced by ~AsyncLocalStore().

{
   mModifiedContacts.reset();
   mLog.reset();
}
unsigned int resip::ServerRegistration::AsyncLocalStore::numContacts ( ) [inline]

Definition at line 179 of file ServerRegistration.hxx.

References mModifiedContacts.

{ if(mModifiedContacts.get()) return (unsigned int)mModifiedContacts->size(); return 0; }
void resip::ServerRegistration::AsyncLocalStore::releaseLog ( std::auto_ptr< ContactRecordTransactionLog > &  log,
std::auto_ptr< ContactPtrList > &  modifiedContacts 
) [inline]

Remove the transacation log and updated contact list.

This object should be considered destroyed and not used after releasing.

Definition at line 173 of file ServerRegistration.hxx.

References mLog, and mModifiedContacts.

            {
               log = mLog;
               modifiedContacts = mModifiedContacts;
            }
void ServerRegistration::AsyncLocalStore::removeAllContacts ( void  )

All original contacts are to be removed, move them all to the removed list.

Definition at line 817 of file ServerRegistration.cxx.

References resip::ContactRecordTransaction::removeAll.

void ServerRegistration::AsyncLocalStore::removeContact ( const ContactInstanceRecord rec)

Definition at line 788 of file ServerRegistration.cxx.

References resip::ContactRecordTransaction::remove.

{
   if (!mModifiedContacts.get() || !mLog.get())
   {
      assert(0);
      return;
   }

   ContactPtrList::iterator it(mModifiedContacts->begin());
   ContactPtrList::iterator itEnd(mModifiedContacts->end());

   // See if the contact is present. We use URI matching rules here.
   for (; it != itEnd; ++it)
   {
      if ((*it) && **it == rec)
      {
         resip::SharedPtr<ContactRecordTransaction>
         logEntry(resip::SharedPtr<ContactRecordTransaction>
                  (new ContactRecordTransaction(ContactRecordTransaction::remove,*it)));

         mLog->push_back(logEntry);

         mModifiedContacts->erase(it);
         return;
      }
   }
}
RegistrationPersistenceManager::update_status_t ServerRegistration::AsyncLocalStore::updateContact ( const ContactInstanceRecord rec)

Could be an addition or refresh.

Definition at line 749 of file ServerRegistration.cxx.

References resip::RegistrationPersistenceManager::CONTACT_CREATED, resip::RegistrationPersistenceManager::CONTACT_UPDATED, resip::ContactRecordTransaction::create, and resip::ContactRecordTransaction::update.

{
   if (!mModifiedContacts.get() || !mLog.get())
   {
      assert(0);
      return RegistrationPersistenceManager::CONTACT_UPDATED;
   }

   ContactPtrList::iterator it(mModifiedContacts->begin());
   ContactPtrList::iterator itEnd(mModifiedContacts->end());

   resip::SharedPtr<ContactRecordTransaction> logEntry;

   // See if the contact is already present. We use URI matching rules here.
   for (; it != itEnd; ++it)
   {
      if ((*it) && **it == rec)
      {
         **it = rec;

         logEntry = resip::SharedPtr<ContactRecordTransaction>(new ContactRecordTransaction(ContactRecordTransaction::update,*it));
         mLog->push_back(logEntry);

         return RegistrationPersistenceManager::CONTACT_UPDATED;
      }
   }

   // This is a new contact, so we add it to the list.
   resip::SharedPtr<ContactInstanceRecord> newRec(new ContactInstanceRecord(rec));

   logEntry = resip::SharedPtr<ContactRecordTransaction>(new ContactRecordTransaction(ContactRecordTransaction::create,newRec));
   mLog->push_back(logEntry);

   mModifiedContacts->push_back(newRec);

   return RegistrationPersistenceManager::CONTACT_CREATED;
}

Member Data Documentation

std::auto_ptr<ContactRecordTransactionLog> resip::ServerRegistration::AsyncLocalStore::mLog [private]

Definition at line 181 of file ServerRegistration.hxx.

Referenced by create(), and releaseLog().

std::auto_ptr<ContactPtrList> resip::ServerRegistration::AsyncLocalStore::mModifiedContacts [private]

Definition at line 182 of file ServerRegistration.hxx.

Referenced by create(), numContacts(), and releaseLog().


The documentation for this class was generated from the following files: