SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_name_gen.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_name_gen.h -- Unique name generator.
21 
22  Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
23 
24  CHANGE LOG AT THE END OF THE FILE
25  *****************************************************************************/
26 
27 
28 #ifndef SC_NAME_GEN
29 #define SC_NAME_GEN
30 
31 
32 #include <cstdio>
33 
34 #include "sysc/utils/sc_hash.h"
35 
36 namespace sc_core{
37 
38 // ----------------------------------------------------------------------------
39 // CLASS : sc_name_gen
40 //
41 // Unique name generator class.
42 // ----------------------------------------------------------------------------
43 
45 {
46 public:
47 
48  sc_name_gen();
49  ~sc_name_gen();
50 
51  const char* gen_unique_name( const char* basename_,
52  bool preserve_first = false
53  );
54 
55 private:
56 
57  sc_strhash<int*> m_unique_name_map;
58  char m_unique_name[BUFSIZ];
59 
60 private:
61 
62  // disabled
63  sc_name_gen( const sc_name_gen& );
64  sc_name_gen& operator = ( const sc_name_gen& );
65 };
66 
67 } // namespace sc_core
68 
69 // $Log: sc_name_gen.h,v $
70 // Revision 1.5 2011/08/26 20:46:10 acg
71 // Andy Goodrich: moved the modification log to the end of the file to
72 // eliminate source line number skew when check-ins are done.
73 //
74 // Revision 1.4 2011/02/18 20:27:14 acg
75 // Andy Goodrich: Updated Copyrights.
76 //
77 // Revision 1.3 2011/02/13 21:47:37 acg
78 // Andy Goodrich: update copyright notice.
79 //
80 // Revision 1.2 2008/05/22 17:06:26 acg
81 // Andy Goodrich: updated copyright notice to include 2008.
82 //
83 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
84 // SystemC 2.3
85 //
86 // Revision 1.3 2006/01/13 18:44:30 acg
87 // Added $Log to record CVS changes into the source.
88 
89 #endif
90 
91 // Taf!
const char * gen_unique_name(const char *basename_, bool preserve_first=false)