degate  0.1.2
Public Member Functions | Private Attributes
degate::ObjectIDRewriter Class Reference

This class is used to defragment object IDs from a logic model. More...

#include <ObjectIDRewriter.h>

List of all members.

Public Member Functions

 ObjectIDRewriter (bool _enable_id_rewrite=true)
 Construct a new Rewriter.
virtual ~ObjectIDRewriter ()
 The destructor.
object_id_t get_new_object_id (object_id_t old_id)
 Get an object ID replacement.

Private Attributes

std::map< object_id_t,
object_id_t
table
object_id_t oid_counter
bool enable_id_rewrite

Detailed Description

This class is used to defragment object IDs from a logic model.

Each logic model object has a uniquie identifier. The logic model keeps track which object IDs are in use and which are free. Internally there are cases where we want to reorganize the object IDs. The ObjectIDRewriter is used therefore.

Definition at line 42 of file ObjectIDRewriter.h.


Constructor & Destructor Documentation

degate::ObjectIDRewriter::ObjectIDRewriter ( bool  _enable_id_rewrite = true) [inline]

Construct a new Rewriter.

Parameters:
_enable_id_rewriteIf this parameter is set to false, then there is no object ID rewriting.

Definition at line 57 of file ObjectIDRewriter.h.

                                                   :
    oid_counter(2342),
    enable_id_rewrite(_enable_id_rewrite) {};
virtual degate::ObjectIDRewriter::~ObjectIDRewriter ( ) [inline, virtual]

The destructor.

Definition at line 65 of file ObjectIDRewriter.h.

{};

Member Function Documentation

Get an object ID replacement.

If you called the ctor with 'false', then you will get the the same object ID back. This is somehow a pass through mode.

Parameters:
old_idFor this object ID yoy will get a defragmented object ID.
Returns:
Returns another object ID.

Definition at line 74 of file ObjectIDRewriter.h.

References enable_id_rewrite, oid_counter, and table.

                                                    {
    if(!enable_id_rewrite) return old_id;
    else {
      if(table.find(old_id) == table.end()) {
        table[old_id] = oid_counter;
        return oid_counter++;
      }
      else return table[old_id];
    }
  }

Member Data Documentation

Definition at line 49 of file ObjectIDRewriter.h.

Referenced by get_new_object_id().

Definition at line 47 of file ObjectIDRewriter.h.

Referenced by get_new_object_id().

Definition at line 46 of file ObjectIDRewriter.h.

Referenced by get_new_object_id().


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