RioNetiReqIdTable Class Reference

#include <RioNeti.h>

Public Member Functions

 RioNetiReqIdTable ()
RioNetiReqIdItemGetFirst ()
int Insert (RioNetiReqIdItem *item)
int Remove (int p_reqid)
int Search (int p_reqid, RioNetiReqIdItem **current, RioNetiReqIdItem **previous)
 Search varre a tabela de requisi��es multicasts procurando o elemento que tenha o p_reqid igual ao p_reqid fornecido como par�metro.
int SearchL (int l_reqid, RioNetiReqIdItem **current, RioNetiReqIdItem **previous)
 SearchL varre a tabela de requisi��es multicasts procurando o elemento que tenha o l_reqid igual ao l_reqid fornecido como par�metro.

Protected Member Functions

void SetFirst (RioNetiReqIdItem *first)

Protected Attributes

RioNetiReqIdItemfirst

Detailed Description

Definition at line 146 of file RioNeti.h.


Constructor & Destructor Documentation

RioNetiReqIdTable::RioNetiReqIdTable (  ) 

Definition at line 6235 of file RioNeti.cpp.

06236 {
06237     #ifdef RIO_DEBUG1
06238     RioErr << "[RioNetiReqIdTable - Constructor] Single" << endl;
06239     #endif
06240 
06241     SetFirst( NULL );
06242 }


Member Function Documentation

RioNetiReqIdItem * RioNetiReqIdTable::GetFirst ( void   ) 

Definition at line 6486 of file RioNeti.cpp.

06487 {
06488     #ifdef RIO_DEBUG1
06489     RioErr << "[RioNetiReqIdTable - GetFirst] Single" << endl;
06490     #endif
06491 
06492     return this->first;
06493 }

int RioNetiReqIdTable::Insert ( RioNetiReqIdItem item  ) 

Definition at line 6245 of file RioNeti.cpp.

06246 {
06247     #ifdef RIO_DEBUG1
06248     RioErr << "[RioNetiReqIdTable - Insert] Start" << endl;
06249     #endif
06250 
06251     if( item == NULL )
06252     {
06253         #ifdef RIO_DEBUG1
06254         RioErr << "[RioNetiReqIdTable - Insert] Finish 1" << endl;
06255         #endif
06256 
06257         return RESULT_NETIREQT_INSERT_ERROR;
06258     }
06259 
06260     RioNetiReqIdItem *current  = NULL,
06261                      *previous = NULL;
06262 
06263     int result = Search( item->GetPreqid(), &current, &previous );
06264 
06265     if( result == RESULT_NETIREQT_SEARCH_EMPTY_LIST )
06266     {
06267         SetFirst( item );
06268 
06269         #ifdef RIO_DEBUG1
06270         RioErr << "[RioNetiReqIdTable - Insert] Finish 2" << endl;
06271         #endif
06272 
06273         return RESULT_NETIREQT_INSERT_OK;
06274     }
06275 
06276     if( result == RESULT_NETIREQT_SEARCH_NOT_FOUND )
06277     {
06278         item->SetNext( current );
06279         if( previous )
06280             previous->SetNext( item );
06281         else
06282             SetFirst( item );
06283 
06284         #ifdef RIO_DEBUG1
06285         RioErr << "[RioNetiReqIdTable - Insert] Finish 3" << endl;
06286         #endif
06287 
06288         return RESULT_NETIREQT_INSERT_OK;
06289     }
06290 
06291     if( result == RESULT_NETIREQT_SEARCH_FOUND )
06292     {
06293         #ifdef RIO_DEBUG1
06294         RioErr << "[RioNetiReqIdTable - Insert] Finish 4" << endl;
06295         #endif
06296 
06297         return RESULT_NETIREQT_INSERT_ALREADY_EXIST;
06298     }
06299 
06300     #ifdef RIO_DEBUG1
06301     RioErr << "[RioNetiReqIdTable - Insert] Finish 5" << endl;
06302     #endif
06303 
06304     return RESULT_NETIREQT_INSERT_ERROR;
06305 }

int RioNetiReqIdTable::Remove ( int  p_reqid  ) 

Definition at line 6308 of file RioNeti.cpp.

06309 {
06310     #ifdef RIO_DEBUG1
06311     RioErr << "[RioNetiReqIdTable - Remove] Start" << endl;
06312     #endif
06313 
06314     RioNetiReqIdItem *current  = NULL,
06315                      *previous = NULL;
06316 
06317     int result = Search( p_reqid, &current, &previous );
06318 
06319     if( result == RESULT_NETIREQT_SEARCH_NOT_FOUND )
06320     {
06321         #ifdef RIO_DEBUG1
06322         RioErr << "[RioNetiReqIdTable - Remove] Finish 1" << endl;
06323         #endif
06324 
06325         return RESULT_NETIREQT_REMOVE_NOT_FOUND;
06326     }
06327     else if( result == RESULT_NETIREQT_SEARCH_FOUND )
06328     {
06329         if( previous == NULL )
06330             SetFirst( current->GetNext() );
06331         else
06332             previous->SetNext( current->GetNext() );
06333 
06334         delete current;
06335 
06336         #ifdef RIO_DEBUG1
06337         RioErr << "[RioNetiReqIdTable - Remove] Finish 2" << endl;
06338         #endif
06339 
06340         return RESULT_NETIREQT_REMOVE_OK;
06341     }
06342 
06343     #ifdef RIO_DEBUG1
06344     RioErr << "[RioNetiReqIdTable - Remove] Finish 333n";
06345     #endif
06346 
06347     return RESULT_NETIREQT_REMOVE_ERROR;
06348 }

int RioNetiReqIdTable::Search ( int  p_reqid,
RioNetiReqIdItem **  current,
RioNetiReqIdItem **  previous 
)

Search varre a tabela de requisi��es multicasts procurando o elemento que tenha o p_reqid igual ao p_reqid fornecido como par�metro.

Retorna em current um ponteiro para este item e em previous um ponteiro para o item anterior da lista.

Definition at line 6351 of file RioNeti.cpp.

06353 {
06354     #ifdef RIO_DEBUG1
06355     RioErr << "[RioNetiReqIdTable - Search] Start" << endl;
06356     #endif
06357 
06358     if( current == NULL || previous == NULL )
06359     {
06360         #ifdef RIO_DEBUG1
06361         RioErr << "[RioNetiReqIdTable - Search] Finish 1" << endl;
06362         #endif
06363 
06364         return RESULT_NETIREQT_SEARCH_NULL_REFERENCE;
06365     }
06366 
06367     bool found = false;
06368 
06369     RioNetiReqIdItem *aux = this->first;
06370     RioNetiReqIdItem *auxPrevious = NULL;
06371 
06372     if( aux == NULL )
06373     {
06374         #ifdef RIO_DEBUG1
06375         RioErr << "[RioNetiReqIdTable - Search] Finish 2" << endl;
06376         #endif
06377 
06378         return RESULT_NETIREQT_SEARCH_EMPTY_LIST;
06379     }
06380 
06381     while( aux != NULL && !found )
06382     {
06383         if( p_reqid == aux->GetPreqid() )
06384         {
06385             found = true;
06386         }
06387         else
06388         {
06389             auxPrevious = aux;
06390             aux = aux->GetNext();
06391         }
06392     }
06393 
06394     *previous = auxPrevious;
06395     *current  = aux;
06396 
06397     if( aux == NULL )
06398     {
06399         #ifdef RIO_DEBUG1
06400         RioErr << "[RioNetiReqIdTable - Search] Finish 3" << endl;
06401         #endif
06402 
06403         return RESULT_NETIREQT_SEARCH_NOT_FOUND;
06404     }
06405 
06406     #ifdef RIO_DEBUG1
06407     RioErr << "[RioNetiReqIdTable - Search] Finish 4" << endl;
06408     #endif
06409 
06410     return RESULT_NETIREQT_SEARCH_FOUND;
06411 }

int RioNetiReqIdTable::SearchL ( int  l_reqid,
RioNetiReqIdItem **  current,
RioNetiReqIdItem **  previous 
)

SearchL varre a tabela de requisi��es multicasts procurando o elemento que tenha o l_reqid igual ao l_reqid fornecido como par�metro.

Retorna em current um ponteiro para este item e em previous um ponteiro para o item anterior da lista.

Definition at line 6413 of file RioNeti.cpp.

06415 {
06416     #ifdef RIO_DEBUG1
06417     RioErr << "[RioNetiReqIdTable - Search] Start" << endl;
06418     #endif
06419 
06420     if( current == NULL || previous == NULL )
06421     {
06422         #ifdef RIO_DEBUG1
06423         RioErr << "[RioNetiReqIdTable - Search] Finish 1" << endl;
06424         #endif
06425 
06426         return RESULT_NETIREQT_SEARCH_NULL_REFERENCE;
06427     }
06428 
06429     bool found = false;
06430 
06431     RioNetiReqIdItem *aux = this->first;
06432     RioNetiReqIdItem *auxPrevious = NULL;
06433 
06434     if( aux == NULL )
06435     {
06436         #ifdef RIO_DEBUG1
06437         RioErr << "[RioNetiReqIdTable - Search] Finish 2" << endl;
06438         #endif
06439 
06440         return RESULT_NETIREQT_SEARCH_EMPTY_LIST;
06441     }
06442 
06443     while( aux != NULL && !found )
06444     {
06445         if( l_reqid == aux->GetLreqid() )
06446         {
06447             found = true;
06448         }
06449         else
06450         {
06451             auxPrevious = aux;
06452             aux = aux->GetNext();
06453         }
06454     }
06455 
06456     *previous = auxPrevious;
06457     *current  = aux;
06458 
06459     if( aux == NULL )
06460     {
06461         #ifdef RIO_DEBUG1
06462         RioErr << "[RioNetiReqIdTable - Search] Finish 3" << endl;
06463         #endif
06464 
06465         return RESULT_NETIREQT_SEARCH_NOT_FOUND;
06466     }
06467 
06468     #ifdef RIO_DEBUG1
06469     RioErr << "[RioNetiReqIdTable - Search] Finish 4" << endl;
06470     #endif
06471 
06472     return RESULT_NETIREQT_SEARCH_FOUND;
06473 }

void RioNetiReqIdTable::SetFirst ( RioNetiReqIdItem first  )  [protected]

Definition at line 6476 of file RioNeti.cpp.

06477 {
06478     #ifdef RIO_DEBUG1
06479     RioErr << "[RioNetiReqIdTable - SetFirst] Single" << endl;
06480     #endif
06481 
06482     this->first = item;
06483 }


Field Documentation

Definition at line 149 of file RioNeti.h.


The documentation for this class was generated from the following files:
Generated on Wed Jul 4 16:03:36 2012 for RIO by  doxygen 1.6.3