idep_binrel.cxx File Reference

#include "idep_binrel.h"
#include <memory.h>
#include <iostream>
#include <cassert>

Go to the source code of this file.

Enumerations

enum  { START_SIZE = 1, GROW_FACTOR = 2 }

Functions

static void clean (char **p)
static char ** alloc (int size)
static void clear (char *const *rel, int size)
static void copy (char **left, const char *const *right, int size)
std::ostream & operator<< (std::ostream &o, const idep_BinRel &rel)

Enumeration Type Documentation

anonymous enum
Enumerator:
START_SIZE 
GROW_FACTOR 

Definition at line 23 of file idep_binrel.cxx.

00023 { START_SIZE = 1, GROW_FACTOR = 2 };


Function Documentation

static char** alloc ( int  size  )  [static]

Definition at line 31 of file idep_binrel.cxx.

Referenced by idep_BinRel::compress(), idep_BinRel::grow(), idep_BinRel::idep_BinRel(), and idep_BinRel::operator=().

00032 {
00033     register int s = size;
00034     char **rel = new char *[s];
00035     register char *p = new char[s * s];
00036     for (register int i = 0; i < s; ++i, p += s) {
00037         rel[i] = p;
00038     }
00039     return rel;
00040 }

static void clean ( char **  p  )  [static]

Definition at line 25 of file idep_binrel.cxx.

Referenced by idep_BinRel::compress(), idep_BinRel::grow(), idep_BinRel::operator=(), and idep_BinRel::~idep_BinRel().

00026 {
00027     delete [] *p;               // only one 2-d block is allocated
00028     delete [] p;                // delete single block  
00029 }

static void clear ( char *const *  rel,
int  size 
) [static]
static void copy ( char **  left,
const char *const *  right,
int  size 
) [static]
std::ostream& operator<< ( std::ostream &  o,
const idep_BinRel rel 
)

Definition at line 208 of file idep_binrel.cxx.

References idep_BinRel::get(), and idep_BinRel::length().

00209 {
00210     int r, c;
00211     const int GAP_GRID = 10;
00212     const char *SP = rel.length() < 30 ? " " : "";
00213     for (r = 0; r < rel.length(); ++r) {
00214         if (r && 0 == r % GAP_GRID) { 
00215             o << std::endl;
00216         }
00217         
00218         for (c = 0; c < rel.length(); ++c) {
00219             if (c && 0 == c % GAP_GRID) { 
00220                 o << ' ' << SP;
00221             }
00222             o << (rel.get(r,c) ? '1' : '_') << SP;
00223         }
00224         o << std::endl;
00225     }
00226     return o;
00227 }


Generated on 8 Nov 2018 for loon by  doxygen 1.6.1