2 //=============================================================================
3 // File : DataFlowBase_Port.cxx
5 // Author : Jean Rahuel, CEA
8 //=============================================================================
10 #include "DataFlowBase_Port.hxx"
12 //GraphBase::Port::~Port() {
13 // cout << "Port::~Port()" << endl ;
16 bool GraphBase::Port::AddCoord( const int nxy , const int *x ,
19 if ( IsEndSwitch() ) {
25 for ( i = 0 ; i < nxy ; i++ ) {
33 bool GraphBase::Port::AddCoord( const int index ,
34 const int x , const int y ) {
35 if ( IsEndSwitch() ) {
39 if ( index <= 0 || index > _X.size()+1 )
41 _X.resize( _X.size()+1 ) ;
42 _Y.resize( _Y.size()+1 ) ;
44 for ( i = _X.size() - 1 ; i >= index ; i-- ) {
50 // cdebug << "AddCoord " << NodeName() << "(" << PortName() << ") ["
51 // << index-1 << "] " << x << " " << y << endl ;
52 // for ( i = 0 ; i < _X.size() ; i++ ) {
53 // cdebug << " [" << i << "] " << _X[ i ] << " " << _Y[ i ] << endl ;
59 bool GraphBase::Port::ChangeCoord( const int index ,
62 if ( IsEndSwitch() ) {
66 if ( index <= 0 || index > _X.size() )
70 // cdebug << "ChangeCoord " << NodeName() << "(" << PortName() << ") ["
71 // << index-1 << "] " << x << " " << y << endl ;
73 // for ( i = 0 ; i < _X.size() ; i++ ) {
74 // cdebug << " [" << i << "] " << _X[ i ] << " " << _Y[ i ] << endl ;
80 bool GraphBase::Port::RemoveCoord( const int index ) {
81 if ( IsEndSwitch() ) {
85 if ( index <= 0 || index > _X.size() )
88 for ( i = index - 1 ; i < _X.size() - 1 ; i++ ) {
92 _X.resize( _X.size()-1 ) ;
93 _Y.resize( _Y.size()-1 ) ;
98 bool GraphBase::Port::RemoveCoords() {
99 if ( IsEndSwitch() ) {
109 int GraphBase::Port::GetCoord() const {
111 if ( IsEndSwitch() ) {
120 bool GraphBase::Port::GetCoord( int *x , int *y ) const {
122 if ( IsEndSwitch() ) {
126 for ( i = 0 ; i < _X.size() ; i++ ) {
134 const GraphBase::ListOfCoords * GraphBase::Port::Coords() const {
135 GraphBase::ListOfCoords * _list_Coords = new GraphBase::ListOfCoords ;
137 if ( !IsEndSwitch() ) {
138 _list_Coords->resize( _X.size() );
139 for ( i = 0 ; i < _X.size() ; i++ ) {
140 (*_list_Coords)[ i ].theX = _X[ i ] ;
141 (*_list_Coords)[ i ].theY = _Y[ i ] ;
144 return _list_Coords ;
147 bool GraphBase::Port::GetCoord( const int index , long &x , long &y ) const {
148 if ( IsEndSwitch() ) {
152 if ( index <= 0 || index > _X.size() )
154 x = _X[ index - 1 ] ;
155 y = _Y[ index - 1 ] ;
156 // cdebug << "GetCoord " << NodeName() << "(" << PortName() << ") ["
157 // << index-1 << "] " << x << " " << y << endl ;
159 // for ( i = 0 ; i < _X.size() ; i++ ) {
160 // cdebug << " [" << i << "] " << _X[ i ] << " " << _Y[ i ] << endl ;
166 ostream & operator<< (ostream & f ,const SUPERV::KindOfPort & s ) {
168 case SUPERV::ServiceParameter :
169 f << "ServiceParameter";
171 case SUPERV::GateParameter :
172 f << "GateParameter";
174 case SUPERV::LoopParameter :
175 f << "LoopParameter";
177 case SUPERV::InLineParameter :
178 f << "InLineParameter";
180 case SUPERV::SwitchParameter :
181 f << "SwitchParameter";
183 case SUPERV::EndSwitchParameter :
184 f << "EndSwitchParameter";
187 f << "UnknownKindOfPort";