source: icGREP/icgrep-devel/icgrep/re/symbol_generator.cpp @ 4197

Last change on this file since 4197 was 4197, checked in by nmedfort, 5 years ago

More refactoring of the RE system; moved the original re/RE_Compiler to compiler.cpp and the PBIX_Compiler to the re/RE_Compiler.

File size: 583 bytes
Line 
1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include "symbol_generator.h"
8
9namespace re {
10
11SymbolGenerator::SymbolGenerator()
12: pfxmap()
13{
14}
15
16std::string SymbolGenerator::get(std::string prefix) {
17    auto f = pfxmap.find(prefix);
18    unsigned count = 0;
19    if (f == pfxmap.end()) {
20        pfxmap.insert(std::make_pair(prefix, 1));
21    }
22    else {
23        count = f->second++;
24    }
25    return prefix + std::to_string(count);
26}
27
28}
Note: See TracBrowser for help on using the repository browser.