Lumiera  0.pre.03
»edit your freedom«
genfunc.cpp
Go to the documentation of this file.
1 /*
2  GenFunc - generic identification functions (raw)
3 
4  Copyright (C)
5  2015, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
20 #include "lib/idi/genfunc.hpp"
21 #include "lib/format-string.hpp"
22 #include "lib/format-obj.hpp"
23 #include "lib/util.hpp"
24 
25 #include <string>
26 #include <boost/functional/hash.hpp>
27 
28 
29 using util::_Fmt;
30 using std::string;
31 
32 
33 namespace lib {
34 namespace idi {
35 
36 
37  namespace format { // generic entry points / integration helpers...
38 
39  string
40  instance_format (string const& prefix, size_t instanceNr)
41  {
42  return _Fmt("%s.%03d")
43  % prefix % instanceNr;
44  }
45 
46  string
47  instance_hex_format (string const& prefix, size_t instanceNr)
48  {
49  return _Fmt("%s.%04X")
50  % prefix % instanceNr;
51  }
52 
53  } //(End)integration helpers...
54 
55 
56  TypedCounter&
57  sharedInstanceCounter()
58  { // Meyer's Singleton
59  static TypedCounter instanceCounter;
60  return instanceCounter;
61  }
62 
63 }} // namespace lib::idi
Front-end for printf-style string template interpolation.
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Generic functions to build identification schemes.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Simple functions to represent objects, for debugging and diagnostics.