Addition of source files related to control flow graph etc
[dyninst.git] / dyninstAPI / src / BPatch_sourceBlock.C
1 #include <stdio.h>
2 #include <iostream.h>
3 #include "BPatch_sourceBlock.h"
4
5 //constructor
6 BPatch_sourceBlock::BPatch_sourceBlock() 
7 {}
8
9 //constructor
10 BPatch_sourceBlock::BPatch_sourceBlock(BPatch_Set<unsigned short>& sln)
11         : sourceLines(sln) {}
12
13 //method to return vector of lines in the source block 
14 void 
15 BPatch_sourceBlock::getLines(BPatch_Vector<unsigned short>& lines){
16         unsigned short* elements = new unsigned short[sourceLines.size()];
17         sourceLines.elements(elements);
18         for(int i=0;i<sourceLines.size();i++)
19                 lines.push_back(elements[i]);
20         delete[] elements;
21 }
22
23 //print method 
24 ostream& operator<<(ostream& os,BPatch_sourceBlock& sb){
25         os << "{";
26         unsigned short* elements = new unsigned short[sb.sourceLines.size()];
27         sb.sourceLines.elements(elements);
28         for(int i=0;i<sb.sourceLines.size();i++)
29                 os << " " << elements[i];
30         delete[] elements;
31         os << " }\n";
32         return os;
33 }