Class to encapsulate information needed to apply conditional-transitivity. More...
#include <TransCacheEntry.h>
Public Member Functions | |
TransCacheEntry (const int estIdx=-1) | |
Constructor. | |
virtual | ~TransCacheEntry () |
The destructor. | |
void | addEntries (const CachedESTInfo &reference, const SMList &metrics, const int startIndex, const int endIndex) |
Extract and add metric entries in this cache entry. | |
bool | getMetric (const int otherESTidx, float &metric) const |
Obtain an existing metric from this cache. | |
Protected Attributes | |
int | estIdx |
The index of the EST to which this trans cache entry pertains to. | |
Private Attributes | |
TransCacheMap * | peerInfo |
The parent metrics related to estIdx EST. | |
Friends | |
class | TransMSTClusterMaker |
Class to encapsulate information needed to apply conditional-transitivity.
This class has been introduced to provide a convenient intreface to encapsulate information required to apply conditional-transitivity between a given pair of ESTs. This class contains metric information pertaining to a single EST whose index is identified by the estIdx instance variable in this class. The metric information is stored as a set of CachedESTInfo objects that are organized into the following two hash maps:
The parentInfo hash map contains CachedESTInfo objects corresponding to the parent(s) of estIdx. These entries form one set of relationships necessary to apply conditional-transitivity with various entries in the peerInfo hash map.
peerInfo hash map contains CachedESTInfo objects corresponding to other ESTs with which estIdx could potentially have conditional-transivity relationships. However, the applicability of transitivity is established only when the need arises.
The TransCacheEntry is created by the TransMSTClusterMaker after an EST has been added to the MST. Once an EST has been added to the MST, the top subset of CachedESTInfo is broadcasted to all the processes. Each process then creates a set of TransCaceEntry objects for all the newly added ESTs and updates the list of related ESTs in parentInfo and peerInfo hash maps in this class.
Definition at line 84 of file TransCacheEntry.h.
TransCacheEntry::TransCacheEntry | ( | const int | estIdx = -1 |
) |
Constructor.
The one and only constructor for this class. The constructor has been made public to enable this class to be used in conjunction STL data structures. Currently this constructor is called from the TransMSTClusterMaker::populateCaches() method.
[in] | estIdx | The index of the EST to which this TransCacheEntry is associated with. This value is simply copied into the corresponding instance variable. |
Definition at line 40 of file TransCacheEntry.cpp.
References peerInfo.
TransCacheEntry::~TransCacheEntry | ( | ) | [virtual] |
The destructor.
Currently, this class does not use any dynamic memory and all the memory is automatically managed by the encapsulated objects. Consequently, the destructor does not have any specific tasks to perform.
Definition at line 45 of file TransCacheEntry.cpp.
References peerInfo.
void TransCacheEntry::addEntries | ( | const CachedESTInfo & | reference, | |
const SMList & | metrics, | |||
const int | startIndex, | |||
const int | endIndex | |||
) |
Extract and add metric entries in this cache entry.
This method extracts information pertaining to ESTs in the range startIndex <= otherESTidx < endIndex and the parentInfo hash map must not have an existing entry for reference.refESTidx.
[in] | reference | The reference information with respect to which entries in the metrics list have to be processed. Note that reference.estIdx must be equal to this.estIdx. |
[in] | metrics | The list of metrics from which necessary entries for this cache must be extracted and stored. Note that in a distributed scenario, it is not necessary to store all the metrics because not all comparisons are performed by all the processes. |
[in] | startIndex | The index of the EST starting from which the owner process is responsible for computing metrics. |
[in] | endIndex | The index of the last EST before which the owner process is responsible for computing metrics. |
Definition at line 50 of file TransCacheEntry.cpp.
References CachedESTInfo::alignmentData, CachedESTInfo::directionData, estIdx, CachedESTInfo::estIdx, and CachedESTInfo::metric.
Referenced by TransMSTClusterMaker::processMetricList().
bool TransCacheEntry::getMetric | ( | const int | otherESTidx, | |
float & | metric | |||
) | const |
Obtain an existing metric from this cache.
This method may be used to obtain an estimated metric value between this.estIdx and otherESTidx, assuming a suitable entry is available in this cache.
[in] | otherESTidx | The index of EST to which an estimated metric value is expected. If otherESTidx == this.estIdx this method always returns true and sets metric (parameter) to 0 (zero). |
[out] | metric | If a valid entry is found in this cache then this parameter is updated with the estimated value. Otherwise this parameter is unaltered by this method. |
true
if an estimated entry could be determined using transitivity. Otherwise this method returns false. Definition at line 77 of file TransCacheEntry.cpp.
References peerInfo.
Referenced by TransMSTClusterMaker::analyze().
friend class TransMSTClusterMaker [friend] |
Definition at line 87 of file TransCacheEntry.h.
int TransCacheEntry::estIdx [protected] |
The index of the EST to which this trans cache entry pertains to.
This instance variable maintains the index of the EST to which this trans cache entry pertains to. This value is set after the object is instantiated and is never changed during the life time of this object.
Definition at line 169 of file TransCacheEntry.h.
Referenced by addEntries().
TransCacheMap* TransCacheEntry::peerInfo [private] |
The parent metrics related to estIdx EST.
This hash map contains a set of CachedESTInfo that are used to determine one of the metrics needed for computing metrics using conditional-transitivity. These are the reference entries with respect to which entries are mainted in the peerInfo hash map. Entries in this cache are added by the addEntries() method in this class. The actual cache of metrics related to estIdx EST.
This hash map contains a set of CachedESTInfo that are used to compute metrics using conditional-transitivity. Entries in this cache are added by the addEntries() method in this class.
Definition at line 189 of file TransCacheEntry.h.
Referenced by getMetric(), TransCacheEntry(), and ~TransCacheEntry().