Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGITTags.hh
Go to the documentation of this file.
1 #ifndef __JEEP__JGITTAGS__
2 #define __JEEP__JGITTAGS__
3 
4 #include <string>
5 #include <map>
6 
7 #include "Jeep/JDate.hh"
8 
9 
10 /**
11  * \file
12  *
13  * Dates GIT tags.
14  * \author mdejong
15  */
16 
17 namespace JEEP {}
18 namespace JPP { using namespace JEEP; }
19 
20 namespace JEEP {
21 
22  /**
23  * Type definition of dated GIT tags.
24  */
25  typedef std::map<JDate<'-'>, std::string> JGITTags_t;
26 
27 
28  /**
29  * Get GIT version for given GIT tag.
30  *
31  * \param tag GIT tag
32  * \return GIT version
33  */
34  inline std::string getGITVersion(const std::string& tag)
35  {
36  if (!tag.empty()) {
37 
38  if (tag[0] == 'v' ||
39  tag[0] == 'V') {
40 
41  return tag.substr(1);
42  }
43  }
44 
45  return tag;
46  }
47 
48 
49  /**
50  * Get GIT dated tags.
51  *
52  * \return dated GIT tags
53  */
54  inline const JGITTags_t& getGITTags()
55  {
56  using namespace std;
57  using namespace JPP;
58 
59  static JGITTags_t buffer;
60 
61  if (buffer.empty()) {
62 
63 #ifdef GIT_TAGS
64 
65  istringstream in(GIT_TAGS);
66 
67  JDate<'-'> date;
68  string tag;
69 
70  while (in >> tag >> date) {
71  buffer[date] = tag;
72  }
73 #endif
74  }
75 
76  return buffer;
77  }
78 }
79 
80 #endif
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
std::map< JDate<'-'>, std::string > JGITTags_t
Type definition of dated GIT tags.
Definition: JGITTags.hh:25
std::string getGITVersion(const std::string &tag)
Get GIT version for given GIT tag.
Definition: JGITTags.hh:34
Auxiliary class for simple date.
Definition: Jeep/JDate.hh:30
const JGITTags_t & getGITTags()
Get GIT dated tags.
Definition: JGITTags.hh:54