コード例 #1
0
OldBusRouteItem::OldBusRouteItem(uint32 id)
   : OldRouteableItem(ItemTypes::busRouteItem, id) 
{
   DEBUG_DB(mc2dbg << "OldBusRouteItem created" << endl);
   m_busRouteID = MAX_UINT32;
   m_offsetInClosestStreet = 0;
}
コード例 #2
0
void
OldNode::createFromDataBuffer(DataBuffer* dataBuffer, OldGenericMap* theMap) 
{
   // The first byte...
   uint8 bitField = dataBuffer->readNextByte();
   m_majorRoad = BitUtility::getBit(bitField, MAJOR_ROAD_BIT_NBR);
   m_roadToll = BitUtility::getBit(bitField, ROAD_TOLL_BIT_NBR);
   m_entryRestrictions = ItemTypes::entryrestriction_t((bitField & 0x0C) >> 2);
   // space previously used for number of lanes:
   // m_nbrLanes = ItemTypes::entryrestriction_t((bitField & 0x03));
   DEBUG_DB(mc2dbg << "OldNode::createFromDataBuffer bitfield: 0x" 
                 << hex << uint32(bitField) << dec << endl);
   DEBUG_DB(mc2dbg << "      majorRoad="
                 << Utility::convertBoolToString(m_majorRoad) << endl);
   DEBUG_DB(mc2dbg << "      roadToll=" 
                 << Utility::convertBoolToString(m_roadToll) << endl);
   DEBUG_DB(mc2dbg << "      entryRest=" << (uint32) m_entryRestrictions
            << endl);
   // The next three bytes
   m_level = (int8) dataBuffer->readNextByte();
   m_maximumWeight = dataBuffer->readNextByte();
   m_maximumHeight = dataBuffer->readNextByte();
   DEBUG_DB(mc2dbg << "      level=" << (uint32) m_level << endl);
   DEBUG_DB(mc2dbg << "      maxWidth=" << (uint32) m_maximumWeight << endl);
   DEBUG_DB(mc2dbg << "      maxHidth=" << (uint32) m_maximumHeight << endl);

   m_speedLimit = dataBuffer->readNextByte();
   m_junctionType = ItemTypes::junction_t(dataBuffer->readNextByte());
   uint32 nbrEntryConnections = dataBuffer->readNextShort();   
   DEBUG_DB(mc2dbg << "      speedLimit=" << (uint32) m_speedLimit << endl);
   DEBUG_DB(mc2dbg << "      junctionType=" << (uint32) m_junctionType <<endl);
   DEBUG_DB(mc2dbg << "      nbrConnections=" << (uint32)nbrEntryConnections
                 << endl);

   m_entryConnections = NULL;
   if ( nbrEntryConnections > 0 ) {
      m_entryConnections =
         theMap->getConnectionAllocator().getNewArray( nbrEntryConnections );
      for (uint32 i=0; i < nbrEntryConnections; ++i) {
         m_entryConnections[i] = theMap->createNewConnection(dataBuffer);
      }
   }
   
   m_nbrEntryConnections = nbrEntryConnections;
}
コード例 #3
0
OldNode::OldNode(DataBuffer* dataBuffer, uint32 nodeID, bool fullCreate) 
   : m_entryConnections(NULL)
{
   DEBUG_DB(mc2dbg << "OldNode created, nodeID=" << nodeID << endl);

   m_nodeID = nodeID;

   if (fullCreate)
      createFromDataBuffer(dataBuffer, NULL);
}
コード例 #4
0
ファイル: SDK_util.c プロジェクト: mikmakmuk/syncevolution_n9
void DEBUG_EndThread( void* aCB )
{
  #ifdef SYDEBUG
    DB_Callback cb=  aCB;
    if (Callback_OK( aCB, 2,DBG_PLUGIN_ALL ) &&
        cb->DB_DebugEndThread)
        cb->DB_DebugEndThread( cb->callbackRef );
    else /* old */
      DEBUG_DB( aCB, MyDB, "THREAD", "END" );
  #endif
} /* DEBUG_EndThread */
コード例 #5
0
ファイル: SDK_util.c プロジェクト: mikmakmuk/syncevolution_n9
/* End of sub block */
void DEBUG_EndBlock( void* aCB, cAppCharP aTag )
{
  #ifdef SYDEBUG
    DB_Callback cb=  aCB;
    if (Callback_OK( aCB, 2,DBG_PLUGIN_ALL ) &&
        cb->DB_DebugEndBlock)
        cb->DB_DebugEndBlock( cb->callbackRef, aTag );
    else /* old */
      DEBUG_DB( aCB, MyDB, aTag, "END" );
  #endif
} /* DEBUG_EndBlock */
コード例 #6
0
ファイル: SDK_util.c プロジェクト: mikmakmuk/syncevolution_n9
/* Start of sub block */
void DEBUG_Block( void* aCB, cAppCharP aTag,
                             cAppCharP aDesc,
                             cAppCharP aAttrText )
{
  /* callbackVersion >= 2 support for blocks */
  #ifdef SYDEBUG
    DB_Callback cb=  aCB;
    if (Callback_OK( aCB, 2,DBG_PLUGIN_ALL ) &&
        cb->DB_DebugBlock)
        cb->DB_DebugBlock( cb->callbackRef, aTag,aDesc,aAttrText );
    else /* old */
      DEBUG_DB( aCB, MyDB, aTag, "%s (%s) BEGIN", aAttrText,aDesc );
  #endif
} /* DEBUG_Block */
コード例 #7
0
bool
OldNode::save(DataBuffer *dataBuffer) const
{
   uint8 bitField = 0;
   bitField = BitUtility::setBit(bitField, MAJOR_ROAD_BIT_NBR, m_majorRoad);
   bitField = BitUtility::setBit(bitField, ROAD_TOLL_BIT_NBR, m_roadToll);
   bitField |= ( uint32(m_entryRestrictions) << 2);
   // Not using number of lanes anymore. bitField |= (m_nbrLanes);
   DEBUG_DB(mc2dbg << "OldNode::save bitfield: 0x" << hex << uint32(bitField) 
                 << dec << endl);
   DEBUG_DB(mc2dbg << "   majorRoad="
                 << Utility::convertBoolToString(m_majorRoad) << endl);
   DEBUG_DB(mc2dbg << "   roadToll=" 
                 << Utility::convertBoolToString(m_roadToll) << endl);
   DEBUG_DB(mc2dbg << "   entryRest=" << (uint32) m_entryRestrictions << endl);
   // The next three bytes
   dataBuffer->writeNextByte(bitField);
   dataBuffer->writeNextByte(m_level);
   dataBuffer->writeNextByte(m_maximumWeight);
   dataBuffer->writeNextByte(m_maximumHeight);
   DEBUG_DB(mc2dbg << "   level=" << (uint32) m_level << endl);
   DEBUG_DB(mc2dbg << "   maxWidth=" << (uint32) m_maximumWeight << endl);
   DEBUG_DB(mc2dbg << "   maxHidth=" << (uint32) m_maximumHeight << endl);

   dataBuffer->writeNextByte(m_speedLimit);
   dataBuffer->writeNextByte(m_junctionType);
   dataBuffer->writeNextShort(m_nbrEntryConnections);
   DEBUG_DB(mc2dbg << "   speedLimit=" << (uint32) m_speedLimit << endl);
   DEBUG_DB(mc2dbg << "   junctionType=" << (uint32) m_junctionType << endl);
   DEBUG_DB(mc2dbg << "   nbrConnections=" << nbrConnections << endl);
   
   for (uint32 i=0; i<m_nbrEntryConnections; i++) {
      m_entryConnections[i]->save(dataBuffer);
   }
   
   return (true);
}
コード例 #8
0
bool
OldZipCodeItem::createFromDataBuffer(DataBuffer *dataBuffer,
                                  OldGenericMap* theMap)
{
   DEBUG_DB(mc2dbg << "OldZipCodeItem is being created." << endl);

   m_type = ItemTypes::zipCodeItem;
   if (OldGroupItem::createFromDataBuffer(dataBuffer, theMap)) {
      // Empty strings not to break the mcm file format
      // These can be removed from the file-format when suitable...
      dataBuffer->readNextString();
      dataBuffer->readNextString();
      return true;
   } else {
      return false;
   }
}
コード例 #9
0
Item*
Item::createNewItem(DataBuffer& dataBuffer, GenericMap& theMap)
{
   
   // Read the type, length and ID of the new item
   uint32 startIndex = dataBuffer.getCurrentOffset();
   uint32 typeAndLength = dataBuffer.readNextLong();
   ItemTypes::itemType type = ItemTypes::itemType( 
                                    (typeAndLength >> 24) & 0xff);
   uint32 itemLength = typeAndLength & 0xffffff;
   uint32 itemID = dataBuffer.readNextLong();

   DEBUG_DB(mc2dbg << "Creating Item, type=" << int(type) << ", id=" 
            << itemID << ", length=" << itemLength << endl);


   Item* item = createItemFromType( type, theMap, itemID );
   
   if ( item != NULL ) {
      // Make sure the ID is set and create the item
      item->setID( itemID );
      item->load( dataBuffer, theMap );

      MC2_ASSERT(item->getID() == itemID);
      MC2_ASSERT(item->getItemType() == type);

      // Skip possible extra bytes at the end of the item
      int skipBytes = itemLength - 
                      (dataBuffer.getCurrentOffset() - startIndex);

      mc2dbg4 << "itemLength=" << itemLength << ", skipBytes=" << skipBytes
              << ", startIdx=" << startIndex << ", curOffset=" 
              << dataBuffer.getCurrentOffset() << endl;

      MC2_ASSERT(skipBytes >= 0);
      dataBuffer.readPastBytes( skipBytes );
      DEBUG1(
         if (skipBytes > 0) 
            mc2dbg2 << "Skipping " << skipBytes << " bytes data for item, ID="
                    << itemID << ", type=" << int(type) << endl;
      );
コード例 #10
0
OldBusRouteItem::~OldBusRouteItem()
{
   DEBUG_DB(mc2dbg << "OldBusRouteItem destructed" << endl);
}