Hurricane VLSI Database


List of all members | Public Member Functions
Hurricane::Name Class Reference

Name description (API) More...

Public Member Functions

 Name ()
 
 Name (const char *c)
 
 Name (const string &s)
 
 Name (const Name &name)
 
 ~Name ()
 
Nameoperator= (const Name &name)
 
bool operator== (const Name &name) const
 
bool operator!= (const Name &name) const
 
bool operator< (const Name &name) const
 
bool operator<= (const Name &name) const
 
bool operator> (const Name &name) const
 
bool operator>= (const Name &name) const
 
char operator[] (unsigned index) const
 
bool isEmpty () const
 

Detailed Description

Name description (API)

Introduction

Those objects provide an automatic management of shared name (character strings).

The underlying representation is based on a string shared by the different names. Each shared string is automatically released when the last name referencing it disapears (managed by a reference count technic).

Constructor & Destructor Documentation

◆ Name() [1/4]

Hurricane::Name::Name ( )

Default constructor (initialized with an empty string).

◆ Name() [2/4]

Hurricane::Name::Name ( const char *  s)

Standard constructor, from a C like character string.

◆ Name() [3/4]

Hurricane::Name::Name ( const string &  s)

Standard constructor, from a STL string.

◆ Name() [4/4]

Hurricane::Name::Name ( const Name name)

Copy constructor.

◆ ~Name()

Hurricane::Name::~Name ( )

The destructor releases the shared string if it no longer referenced.

Member Function Documentation

◆ operator=()

Name & Hurricane::Name::operator= ( const Name name)

Assignment operator. Very fast because there is only an assignement of pointer to the shared string and an incrementation of its reference counter.

◆ operator==()

bool Hurricane::Name::operator== ( const Name name) const

Equality operator. Very fast because it only tests the equality of pointers to the two shared strings (and not the equality of the two strings).

Remarks
Don't loose on one side what you save on the other as shown in the following code :
Cell* cell = ...; // we get the cell
for_each_net(net, cellGetNets()) {
if (netGetName() == "vdd") {
... ;
}
end_for;
}
Indeed, for each equality test, a name will be created from the string "vdd". If the equality test is very fast, it is not the same for the name construction. So it is faster to write :
Cell* cell = ...; // we get the cell
Name vdd = "vdd";
for_each_net(net, cellGetNets()) {
if (netGetName() == vdd) {
...
}
end_for;
}
Or yet faster :
Cell* cell = ...; // we get the cell
static Name VDD = "vdd";
for_each_net(net, cellGetNets()) {
if (netGetName() == VDD) {
...
}
end_for;
}

◆ operator!=()

bool Hurricane::Name::operator!= ( const Name name) const

Difference operator. Very fast because it only tests the difference of pointers to the two shared strings (and not the difference of the two strings).

◆ operator<()

bool Hurricane::Name::operator< ( const Name name) const

No description.

◆ operator<=()

bool Hurricane::Name::operator<= ( const Name name) const

No description.

◆ operator>()

bool Hurricane::Name::operator> ( const Name name) const

No description.

◆ operator>=()

bool Hurricane::Name::operator>= ( const Name name) const

Those operators need to process the two shared strings and are not as fast as the previous ones.

◆ operator[]()

char Hurricane::Name::operator[] ( unsigned  index) const

Indexation operator (for reading the character of rank index). Throws an exception if index is out of bounds.

◆ isEmpty()

bool Hurricane::Name::isEmpty ( ) const

Returns: true if the shared string is empty, else false.


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


Generated by doxygen 1.9.1 on Thu Aug 11 2022 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved