NLMISC::CBMSDbgInfo Class Reference

#include <bit_mem_stream.h>


Public Member Functions

void addPoke (uint32 bitpos, uint32 size, TBMSSerialInfo::TSerialType type)
 Add a serial event in the middle.

void addSerial (uint32 bitpos, uint32 size, TBMSSerialInfo::TSerialType type)
 Add a serial event at the end.

void beginEventBrowsing ()
 Begin a browsing session of serial events, addSerial()/addPoke() is now disabled.

 CBMSDbgInfo ()
 Constructor.

void clear ()
 Clear.

void endEventBrowsing ()
 End a browsing session of serial events, and reenable addSerial()/addPoke().

std::string getEventIdAtBitPos (uint32 bitpos, sint32 *eventId)
 Return an eventId of serial event, or "" (and eventId -1) if nothing found at the specified bitpos.

std::string getEventLegendAtBitPos (CBitMemStream &bms, sint32 eventId)
 Return full info about a serial event, or "" if eventId is -1.

void setSymbolOfNextSerialEvent (const char *symbol)
 Set the symbol for the next event that will be added (optional).


Constructor & Destructor Documentation

NLMISC::CBMSDbgInfo::CBMSDbgInfo  )  [inline]
 

Constructor.

Definition at line 191 of file bit_mem_stream.h.

00191 {}


Member Function Documentation

void NLMISC::CBMSDbgInfo::addPoke uint32  bitpos,
uint32  size,
TBMSSerialInfo::TSerialType  type
[inline]
 

Add a serial event in the middle.

Definition at line 234 of file bit_mem_stream.h.

References nlwarning, size, type, and uint32.

Referenced by NLMISC::CBitMemStream::poke(), and NLMISC::CBitMemStream::pokeBits().

00235         {
00236 #ifdef NL_DEBUG
00237                 if ( ! _DbgData->AddEventIsEnabled )
00238                 {
00239                         _DbgData->NextSymbol = NULL;
00240                         return;
00241                 }
00242 
00243                 TBMSSerialInfo serialItem( bitpos, size, type, _DbgData->NextSymbol );
00244 
00246                 bool found = false;
00247                 TBMSSerialInfoList::iterator itl;
00248                 for ( itl=_DbgData->List.begin(); itl!=_DbgData->List.end(); ++itl )
00249                 {
00250                         if ( (*itl).BitPos == bitpos )
00251                         {
00252                                 // Found, replace reserved by poked
00253                                 (*itl) = serialItem;
00254                                 found = true;
00255                                 break;
00256                         }
00257                 }
00258                 if ( ! found )
00259                 {
00260                         nlwarning( "Missing reserve() corresponding to poke()" );
00261                 }
00262                 _DbgData->NextSymbol = NULL;
00263 #endif
00264         }

void NLMISC::CBMSDbgInfo::addSerial uint32  bitpos,
uint32  size,
TBMSSerialInfo::TSerialType  type
[inline]
 

Add a serial event at the end.

Definition at line 218 of file bit_mem_stream.h.

References size, type, and uint32.

Referenced by NLMISC::CBitMemStream::serial(), NLMISC::CBitMemStream::serialBit(), and NLMISC::CBitMemStream::serialBuffer().

00219         {
00220 #ifdef NL_DEBUG
00221                 if ( ! _DbgData->AddEventIsEnabled )
00222                 {
00223                         _DbgData->NextSymbol = NULL;
00224                         return;
00225                 }
00226 
00227                 TBMSSerialInfo serialItem( bitpos, size, type, _DbgData->NextSymbol );
00228                 _DbgData->List.push_back( serialItem );
00229                 _DbgData->NextSymbol = NULL;
00230 #endif
00231         }

void NLMISC::CBMSDbgInfo::beginEventBrowsing  )  [inline]
 

Begin a browsing session of serial events, addSerial()/addPoke() is now disabled.

Definition at line 283 of file bit_mem_stream.h.

Referenced by NLMISC::CBitMemStream::displayStream().

00284         {
00285 #ifdef NL_DEBUG
00286                 _DbgData->CurrentBrowsedItem = 0;
00287                 _DbgData->AddEventIsEnabled = false;
00288 #endif
00289         }

void NLMISC::CBMSDbgInfo::clear void   )  [inline]
 

Clear.

Definition at line 275 of file bit_mem_stream.h.

Referenced by NLMISC::CBitMemStream::bufferToFill(), NLMISC::CBitMemStream::fill(), and NLMISC::CBitMemStream::resetBufPos().

00276         {
00277 #ifdef NL_DEBUG
00278                 _DbgData->List.clear();
00279 #endif
00280         }

void NLMISC::CBMSDbgInfo::endEventBrowsing  )  [inline]
 

End a browsing session of serial events, and reenable addSerial()/addPoke().

Definition at line 292 of file bit_mem_stream.h.

Referenced by NLMISC::CBitMemStream::displayStream().

00293         {
00294 #ifdef NL_DEBUG
00295                 _DbgData->AddEventIsEnabled = true;
00296 #endif
00297         }

std::string NLMISC::CBMSDbgInfo::getEventIdAtBitPos uint32  bitpos,
sint32 eventId
[inline]
 

Return an eventId of serial event, or "" (and eventId -1) if nothing found at the specified bitpos.

Definition at line 300 of file bit_mem_stream.h.

References sint32, NLMISC::toString(), and uint32.

Referenced by NLMISC::CBitMemStream::displayStream().

00301         {
00302 #ifdef NL_DEBUG
00303                 if ( _DbgData->CurrentBrowsedItem < _DbgData->List.size() )
00304                 {
00305                         if ( bitpos == _DbgData->List[_DbgData->CurrentBrowsedItem].BitPos ) // works only with a vector!
00306                         {
00307                                 *eventId = (sint32)_DbgData->CurrentBrowsedItem;
00308                                 ++_DbgData->CurrentBrowsedItem;
00309                                 return toString( "(%u)", _DbgData->CurrentBrowsedItem - 1 );
00310                         }
00311                         //nlassert( bitpos < (*_List)[_CurrentBrowsedItem].BitPos ); // occurs if stream overflow
00312                 }
00313 #endif
00314                 *eventId = -1;
00315                 return std::string();
00316         }

std::string NLMISC::CBMSDbgInfo::getEventLegendAtBitPos CBitMemStream bms,
sint32  eventId
[inline]
 

Return full info about a serial event, or "" if eventId is -1.

Definition at line 765 of file bit_mem_stream.h.

References NLMISC::TBMSSerialInfo::BitPos, NLMISC::TBMSSerialInfo::BitSize, NLMISC::CBitMemStream::getSerialItem(), nlassert, NLMISC::SerialTypeToCStr, sint32, NLMISC::TBMSSerialInfo::Symbol, NLMISC::toString(), and NLMISC::TBMSSerialInfo::Type.

Referenced by NLMISC::CBitMemStream::displayStream().

00766 {
00767 #ifdef NL_DEBUG
00768         if ( eventId == -1 )
00769         {
00770                 return std::string();
00771         }
00772         else
00773         {
00774                 nlassert( eventId < (sint32)_DbgData->List.size() );
00775                 TBMSSerialInfo& serialItem = _DbgData->List[eventId]; // works only with a vector!
00776                 return toString( "(%d) BitPos %3u Type %s BitSize %2u Value %s %s\n",
00777                                         eventId, serialItem.BitPos, SerialTypeToCStr[serialItem.Type], serialItem.BitSize,
00778                                         bms.getSerialItem( serialItem ).c_str(), (serialItem.Symbol!=NULL)?serialItem.Symbol:"" );
00779         }
00780 #else
00781         return std::string();
00782 #endif
00783 }

void NLMISC::CBMSDbgInfo::setSymbolOfNextSerialEvent const char *  symbol  )  [inline]
 

Set the symbol for the next event that will be added (optional).

Definition at line 267 of file bit_mem_stream.h.

00268         {
00269 #ifdef NL_DEBUG
00270                 _DbgData->NextSymbol = symbol;
00271 #endif
00272         }


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 13:05:21 2004 for NeL by doxygen 1.3.6