idep_ldep.cxx File Reference

#include "idep_linkdep.h"
#include "idep_namearray.h"
#include "idep_nameindexmap.h"
#include "idep_binrel.h"
#include "idep_string.h"
#include "idep_tokeniter.h"
#include "idep_aliastable.h"
#include "idep_aliasutil.h"
#include <cmath>
#include <ctype.h>
#include <cstring>
#include <memory>
#include <fstream>
#include <sstream>
#include <iostream>
#include <cassert>

Go to the source code of this file.

Classes

struct  idep_LinkDep_i
struct  idep_AliasIter_i
struct  idep_UnaliasIter_i
struct  idep_CycleIter_i
struct  idep_MemberIter_i
struct  idep_LevelIter_i
struct  idep_ComponentIter_i
struct  idep_DependencyIter_i

Typedefs

typedef int FmtFlags_t

Functions

static std::ostream & warn (std::ostream &ing, int index)
static std::ostream & err (std::ostream &orr)
static const char * stripDotSlash (const char *originalPath)
static int isLocal (const char *dirFile)
static char * removeFileName (char *dirPath)
static char * removeSuffix (char *dirPath)
static int digits (int n)
static double logBase2 (double x)
static double ccdBalencedBinaryTree (int n)
const char * s (int n)
std::ostream & operator<< (std::ostream &o, const idep_LinkDep &dep)

Typedef Documentation

typedef int FmtFlags_t

Definition at line 26 of file idep_ldep.cxx.


Function Documentation

static double ccdBalencedBinaryTree ( int  n  )  [static]

Definition at line 100 of file idep_ldep.cxx.

References logBase2().

Referenced by idep_LinkDep::nccd().

00101 {
00102     // CCD(n)         = (n + 1) * (log (n + 1) - 1) + 1
00103     //       balanced                 2
00104     //       binary
00105     //       tree
00106 
00107     assert(n >= 0);
00108     return (n + 1) * (logBase2(n + 1) - 1) + 1;
00109 }

static int digits ( int  n  )  [static]
static std::ostream& err ( std::ostream &  orr  )  [static]

Definition at line 38 of file idep_ldep.cxx.

Referenced by idep_LinkDep_i::calculate().

00039 {
00040     return orr << "Error: ";
00041 }

static int isLocal ( const char *  dirFile  )  [static]

Definition at line 53 of file idep_ldep.cxx.

Referenced by idep_LinkDep_i::entry().

00054 {
00055     return !strchr(dirFile, '/');
00056 }

static double logBase2 ( double  x  )  [static]

Definition at line 91 of file idep_ldep.cxx.

Referenced by ccdBalencedBinaryTree().

00092 {
00093     // log (x) = ln(x)/ln(a) 
00094     //    a
00095 
00096     assert(x > 0.0);
00097     return log(x)/log(2);
00098 }

std::ostream& operator<< ( std::ostream &  o,
const idep_LinkDep dep 
)

Definition at line 1110 of file idep_ldep.cxx.

References idep_LinkDep::printAliases(), idep_LinkDep::printCycles(), idep_LinkDep::printLevels(), idep_LinkDep::printSummary(), and idep_LinkDep::printUnaliases().

01111 {
01112     dep.printAliases(o);
01113     dep.printUnaliases(o);
01114     dep.printCycles(o);
01115     dep.printLevels(o, 1);
01116     dep.printSummary(o);
01117     return o;
01118 }

static char* removeFileName ( char *  dirPath  )  [static]

Definition at line 58 of file idep_ldep.cxx.

Referenced by idep_LinkDep_i::entry().

00059 {
00060     char *slash = strrchr(dirPath, '/');
00061     if (slash) {
00062         slash[1] = '\0';
00063     }
00064     else {
00065         dirPath[0] = '\0';
00066     }
00067     return dirPath;
00068 }

static char* removeSuffix ( char *  dirPath  )  [static]

Definition at line 70 of file idep_ldep.cxx.

Referenced by idep_LinkDep_i::entry().

00071 {
00072     char *dot = strrchr(dirPath, '.');
00073     if (dot && !strchr(dot, '/')) {
00074         dot[0] = '\0';
00075     }
00076     return dirPath;
00077 }

const char* s ( int  n  )  [inline]
static const char* stripDotSlash ( const char *  originalPath  )  [static]

Definition at line 43 of file idep_ldep.cxx.

Referenced by idep_LinkDep::addUnaliasDirectory().

00044 {
00045     if (originalPath) {
00046         while ('.' == originalPath[0] && '/' == originalPath[1]) {
00047             originalPath += 2;
00048         }
00049     }
00050     return originalPath;
00051 }

static std::ostream& warn ( std::ostream &  ing,
int  index 
) [static]

Definition at line 33 of file idep_ldep.cxx.

Referenced by idep_LinkDep::printCycles().

00034 {
00035     return ing << "Warning<" << index << ">: "; // '<' and '>' match cycle  
00036 }


Generated on 19 Jan 2018 for loon by  doxygen 1.6.1