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


C++ LList::PutDataAtEnd方法代码示例

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


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

示例1: ParseMemoryLeakFile


//.........这里部分代码省略.........
            
            BTree <int> *freq = frequency.LookupTree ( lowercasesourcelocation );
            if ( freq ) ((int) freq->data) ++;
            else frequency.PutData ( lowercasesourcelocation, 1 );

            delete lowercasesourcelocation;
        }
        else 
        {
            char *lastcomma = strrchr ( thisline, ',' );
            
            if ( lastcomma ) 
            {

                char *ssize = lastcomma+2;
                int size;
                char unused [32];
                if( sscanf ( ssize, "%d %s", &size, unused ) == 2 )
	                unrecognised += size;
            }
        }
    }

    memoryfile.close ();

    
    //
    // Sort the results into a list
    //

    DArray <int> *sizes = combined.ConvertToDArray ();
    DArray <char *> *sources = combined.ConvertIndexToDArray ();
    LList <char *> sorted;
    int totalsize = 0;

    for ( int i = 0; i < sources->Size (); ++i )
    {
        char *newsource = sources->GetData (i);
        int newsize = sizes->GetData (i);
        totalsize += newsize;
        bool inserted = false;

        for ( int j = 0; j < sorted.Size (); ++j ) {

            char *existingsource = sorted.GetData (j);
            int existingsize = combined.GetData ( existingsource );

            if ( newsize <= existingsize ) {

                sorted.PutDataAtIndex ( newsource, j );
                inserted = true;
                break;

            }

        }

        if ( !inserted ) sorted.PutDataAtEnd ( newsource );
    }


    //
    // Open the output file
    //

    FILE *output = fopen( _outputFilename, "wt" );

    //
    // Print out our sorted list
    // 

    fprintf ( output, "Total recognised memory leaks   : %d Kbytes\n", int(totalsize/1024)  );
    fprintf ( output, "Total unrecognised memory leaks : %d Kbytes\n\n", int(unrecognised/1024) );
    
    for ( int k = sorted.Size () - 1; k >= 0; --k ) 
    {

        char *source = sorted.GetData (k);
        int size = combined.GetData ( source );
        int freq = frequency.GetData ( source );

        if( size > 2048 )
        {
            fprintf ( output, "%-95s (%d Kbytes in %d leaks)\n", source, int(size/1024), freq );
        }
        else
        {
            fprintf ( output, "%-95s (%d  bytes in %d leaks)\n", source, size, freq );
        }
    }


    //
    // Clear up

    fclose( output );

    delete sources;
    delete sizes;
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:101,代码来源:memory_leak.cpp


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