From: Marek P. <ma...@us...> - 2002-04-04 00:48:06
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun In directory usw-pr-cvs1:/tmp/cvs-serv31505/net/sourceforge/javaprofiler/jpiimpl/commun Modified Files: IProf.java Log Message: new getParents() method added to communication interface Index: IProf.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun/IProf.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** IProf.java 12 Mar 2002 22:57:57 -0000 1.16 --- IProf.java 4 Apr 2002 00:48:01 -0000 1.17 *************** *** 154,157 **** --- 154,160 ---- private static final int F_GET_CALLTREE = 12; + /// remote getParents() method identifier + private static final int F_GET_PARENTS = 13; + /// internal I/O buffer private Buffer _buf = new Buffer(); *************** *** 2538,2541 **** --- 2541,2627 ---- return iterator; + } + + /** Parent objects of an object. This structure contains object IDs + ** of parents of given object. */ + + public class sParents { + + /// ID of parent #1 (on the left side in the structure) + public int parentLeftObjId; + + /// ID of parent #2 (on up in the structure) + public int parentUpObjId; + + /// ID of parent #3 (on the right side in the structure) + public int parentRightObjId; + }; + + /** Get parent nodes of the object. This method returns + ** object IDs of parents of given object identified by 'objId'. + ** The result is stored to output 'parents' buffer, old value + ** of this buffer will be overwritten by new one. + ** + ** @param objId object ID + ** @param parents output buffer (preallocated) */ + + public synchronized void getParents( int objId, sParents parents) + + throws COMMUN_Exception, + BAD_OBJ_ID_Exception, + UNKNOWN_Exception { + + _buf.clear(); + _buf.putInt( F_GET_PARENTS); + _buf.putInt( objId); + + _commun.write( _buf); + if( _commun.hasFailed()) throw new COMMUN_Exception(); + + _commun.read( _buf); + if( _commun.hasFailed()) throw new COMMUN_Exception(); + + int pos = 0; + + int rc = _buf.getInt( pos); + pos += 4; + + if( rc != RC_OK) { + + if( rc == RC_BAD_OBJ_ID) + throw new BAD_OBJ_ID_Exception(); + + throw new UNKNOWN_Exception(); + } + + parents.parentLeftObjId = _buf.getInt( pos); + pos += 4; + + parents.parentUpObjId = _buf.getInt( pos); + pos += 4; + + parents.parentRightObjId = _buf.getInt( pos); + } + + /** Get parent nodes of the object. This method returns + ** object IDs of parents of given object identified by 'objId'. + ** The result is returned as a return value, so each time this + ** method is called, new #sParents structure is allocated and + ** filled by received data. + ** + ** @param objId object ID + ** + ** @return #sParent structure */ + + public synchronized sParents getParents( int objId) + + throws COMMUN_Exception, + BAD_OBJ_ID_Exception, + UNKNOWN_Exception { + + sParents parents = new sParents(); + getParents( objId, parents); + + return parents; } }; |