Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / TsoEdge.cc
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: TsoEdge.cc
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License version 2 as published by the Free Software Foundation.
//
// The above named program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this work; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
// ========== Copyright Header End ============================================
/************************************************************************
**
** Copyright (C) 2002, Sun Microsystems, Inc.
**
** Sun considers its source code as an unpublished, proprietary
** trade secret and it is available only under strict license provisions.
** This copyright notice is placed here only to protect Sun in the event
** the source is deemed a published work. Disassembly, decompilation,
** or other means of reducing the object code to human readable form
** is prohibited by the license agreement under which this code is
** provided to the user or company in possession of this copy."
**
*************************************************************************/
#include "TsoEdge.h"
#include <sstream>
using namespace std;
using namespace Tso;
////////////////////////////////////////////////
TsoEdge::TsoEdge()
{
}
////////////////////////////////////////////////
TsoEdge::TsoEdge( const TsoEdge & orig )
{
type_ = orig.type_;
src_ = orig.src_;
dst_ = orig.dst_;
}
////////////////////////////////////////////////
TsoEdge::~TsoEdge()
{
}
////////////////////////////////////////////////
const TsoEdge &
TsoEdge::operator=( const TsoEdge & rhs )
{
return *this;
}
////////////////////////////////////////////////
bool
TsoEdge::operator==( const TsoEdge & rhs ) const
{
return false;
}
////////////////////////////////////////////////
string
TsoEdge::toString() const
{
ostringstream os;
return os.str();
}
TsoEdge*
TsoEdge::addEdge (enum EDGE_TYPE type, TsoNode* src, TsoNode* dst)
{
list<TsoEdge*>::iterator ii;
TsoEdge* edge;
ii = findEdge(src, dst, type);
if ((ii != src->outEnd())) {
return *ii; // find same type edge between these two nodes
}
edge = new TsoEdge();
edge->type_= type;
edge->src_= src;
edge->dst_= dst;
src->outPushFront(edge); // add this edge pointer to src's out edge group
dst->inPushFront(edge); // add this edge pointer to dst's in edge group
return edge;
}
list<TsoEdge*>::iterator
TsoEdge::findEdge (TsoNode* src, TsoNode* dst, enum EDGE_TYPE type)
{
list<TsoEdge*>::iterator ii;
if (src->outSize() == 0) return src->outEnd();
for (ii = src->outBegin(); ii != src->outEnd(); ii++) {
if (((*ii)->dst_ == dst) && ((*ii)->getType() == type)) {
return ii;
}
}
return src->outEnd();
}