Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bitmap Class Reference

#include <util.h>

Public Member Functions

 bitmap ()
 
 ~bitmap ()
 
 bitmap (const bitmap &b)
 
bitmapoperator= (const bitmap &b)
 
void set_size (int n)
 
int get_size ()
 
void set_value (int n)
 
void unset_value (int n)
 
bool check_value (int n)
 

Private Attributes

int * map
 
bool map_set
 
int size
 

Detailed Description

Definition at line 93 of file utilities/rc_cmp/util.h.

Constructor & Destructor Documentation

bitmap ( )

Definition at line 454 of file utilities/rc_cmp/util.cpp.

References map_set.

454  {
455  map_set = false;
456  return;
457 }
~bitmap ( )

Definition at line 459 of file utilities/rc_cmp/util.cpp.

References map, and map_set.

459  {
460  if(map_set)
461  delete[] map;
462 }
bitmap ( const bitmap b)

Definition at line 464 of file utilities/rc_cmp/util.cpp.

References i, map, map_set, and size.

464  {
465  size = b.size;
466  map_set = b.map_set;
467 
468  int arr_size = size / (sizeof(int)*8);
469  arr_size++;
470 
471  if(map_set){
472  map = new int[arr_size];
473 
474  for(int i=0; i<arr_size; i++){
475  map[i] = b.map[i];
476  }
477  }
478 }
blockLoc i
Definition: read.cpp:79

Member Function Documentation

bool check_value ( int  n)

Definition at line 579 of file utilities/rc_cmp/util.cpp.

References map, and size.

Referenced by points::get_point(), points::operator=(), points::points(), points::set_num_points(), points::set_point_val(), and points::~points().

579  {
580 
581  if(n >= size || n < 0)
582  return false;
583 
584  int index = n / (sizeof(int) * 8);
585  int num = n % (sizeof(int) * 8);
586 
587  int entry = map[index];
588 
589  entry = entry >> num;
590  entry = entry & 0x00000001;
591 
592  if(entry == 0x00000001)
593  return true;
594 
595  return false;
596 }
const NT & n

Here is the caller graph for this function:

int get_size ( )

Definition at line 542 of file utilities/rc_cmp/util.cpp.

References size.

542  {
543  return size;
544 }
bitmap & operator= ( const bitmap b)

Definition at line 480 of file utilities/rc_cmp/util.cpp.

References i, map, map_set, and size.

480  {
481 
482  if(this != &b){
483 
484  if(map_set)
485  delete[] map;
486 
487  size = b.size;
488  map_set = b.map_set;
489 
490  int arr_size = size / (sizeof(int)*8);
491  arr_size++;
492 
493  if(map_set){
494  map = new int[arr_size];
495 
496  for(int i=0; i<arr_size; i++){
497  int temp = b.map[i];
498  map[i] = temp;
499  }
500  }
501  }
502 
503  return *this;
504 }
blockLoc i
Definition: read.cpp:79
void set_size ( int  n)

Definition at line 506 of file utilities/rc_cmp/util.cpp.

References i, map, map_set, n, and size.

Referenced by points::set_num_points().

506  {
507 
508  int new_size = n / (sizeof(int)*8);
509  new_size++;
510 
511  int old_size = size / (sizeof(int)*8);
512  old_size++;
513 
514  if(!map_set){
515 
516  map = new int[ new_size ];
517 
518  for(int i=0; i < new_size; i++){
519  map[i] = 0;
520  }
521  }
522  else{
523  int *temp;
524  temp = new int[ new_size ];
525 
526  for(int i=0; i < new_size; i++){
527  temp[i] = 0;
528  }
529 
530  for(int i=0; i < old_size; i++){
531  temp[i] = map[i];
532  }
533 
534  delete[] map;
535  map = temp;
536  }
537 
538  size = n;
539  map_set = true;
540 }
blockLoc i
Definition: read.cpp:79
const NT & n

Here is the caller graph for this function:

void set_value ( int  n)

Definition at line 546 of file utilities/rc_cmp/util.cpp.

References map.

Referenced by points::set_point_val().

546  {
547 
548  int index = n / (sizeof(int) * 8);
549  int num = n % (sizeof(int) * 8);
550 
551  int entry = map[index];
552 
553  int set = 0x00000001;
554  set = set << num;
555 
556  entry = entry | set;
557 
558  map[index] = entry;
559 
560 }
const NT & n

Here is the caller graph for this function:

void unset_value ( int  n)

Definition at line 562 of file utilities/rc_cmp/util.cpp.

References map.

562  {
563 
564  int index = n / (sizeof(int) * 8);
565  int num = n % (sizeof(int) * 8);
566 
567  int entry = map[index];
568 
569  int set = 0x00000001;
570  set = set << num;
571  set = ~set;
572 
573  entry = entry & set;
574 
575  map[index] = entry;
576 
577 }
const NT & n

Member Data Documentation

int* map
private
bool map_set
private

Definition at line 120 of file utilities/rc_cmp/util.h.

Referenced by bitmap(), operator=(), set_size(), and ~bitmap().

int size
private

Definition at line 123 of file utilities/rc_cmp/util.h.

Referenced by bitmap(), check_value(), get_size(), operator=(), and set_size().


The documentation for this class was generated from the following files: