source:
src/ControlStruct/LabelGenerator.cc@
c7ed6d0
| Last change on this file since c7ed6d0 was 27de955, checked in by , 10 years ago | |
|---|---|
|
|
| File size: 1.1 KB | |
| Rev | Line | |
|---|---|---|
| [51587aa] | 1 | // |
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | |
| 3 | // | |
| 4 | // The contents of this file are covered under the licence agreement in the | |
| 5 | // file "LICENCE" distributed with Cforall. | |
| 6 | // | |
| [a08ba92] | 7 | // LabelGenerator.cc -- |
| [51587aa] | 8 | // |
| [843054c2] | 9 | // Author : Rodolfo G. Esteves |
| [51587aa] | 10 | // Created On : Mon May 18 07:44:20 2015 |
| [27de955] | 11 | // Last Modified By : Rob Schluntz |
| 12 | // Last Modified On : Wed Jun 03 14:23:26 2015 | |
| 13 | // Update Count : 9 | |
| [51587aa] | 14 | // |
| [a08ba92] | 15 | |
| [51b73452] | 16 | #include <iostream> |
| 17 | #include <strstream> | |
| 18 | ||
| 19 | #include "LabelGenerator.h" | |
| 20 | ||
| 21 | namespace ControlStruct { | |
| [a08ba92] | 22 | LabelGenerator *LabelGenerator::labelGenerator = 0; |
| [51b73452] | 23 | |
| [a08ba92] | 24 | LabelGenerator *LabelGenerator::getGenerator() { |
| 25 | if ( LabelGenerator::labelGenerator == 0 ) | |
| 26 | LabelGenerator::labelGenerator = new LabelGenerator(); | |
| [51b73452] | 27 | |
| [a08ba92] | 28 | return labelGenerator; |
| 29 | } | |
| [51b73452] | 30 | |
| [27de955] | 31 | Label LabelGenerator::newLabel(std::string suffix) { |
| [a08ba92] | 32 | std::ostrstream os; |
| [27de955] | 33 | os << "__L" << current++ << "__" << suffix; |
| [a08ba92] | 34 | os.freeze( false ); |
| 35 | std::string ret = std::string (os.str(), os.pcount()); | |
| 36 | return Label( ret ); | |
| 37 | } | |
| [51b73452] | 38 | } // namespace ControlStruct |
| [a08ba92] | 39 | |
| [51587aa] | 40 | // Local Variables: // |
| 41 | // tab-width: 4 // | |
| 42 | // mode: c++ // | |
| 43 | // compile-command: "make install" // | |
| 44 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.