~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to source/METADATA/MetaInfoRegistry.C

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2013-12-20 11:30:16 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131220113016-wre5g9bteeheq6he
Tags: 1.11.1-3
* remove version number from libbost development package names;
* ensure that AUTHORS is correctly shipped in all packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- mode: C++; tab-width: 2; -*-
2
 
// vi: set ts=2:
3
 
//
4
 
// --------------------------------------------------------------------------
5
 
//                   OpenMS Mass Spectrometry Framework 
6
 
// --------------------------------------------------------------------------
7
 
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
8
 
//
9
 
//  This library is free software; you can redistribute it and/or
10
 
//  modify it under the terms of the GNU Lesser General Public
11
 
//  License as published by the Free Software Foundation; either
12
 
//  version 2.1 of the License, or (at your option) any later version.
13
 
//
14
 
//  This library is distributed in the hope that it will be useful,
15
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 
//  Lesser General Public License for more details.
18
 
//
19
 
//  You should have received a copy of the GNU Lesser General Public
20
 
//  License along with this library; if not, write to the Free Software
21
 
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
1
// --------------------------------------------------------------------------
 
2
//                   OpenMS -- Open-Source Mass Spectrometry
 
3
// --------------------------------------------------------------------------
 
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
 
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
 
6
//
 
7
// This software is released under a three-clause BSD license:
 
8
//  * Redistributions of source code must retain the above copyright
 
9
//    notice, this list of conditions and the following disclaimer.
 
10
//  * Redistributions in binary form must reproduce the above copyright
 
11
//    notice, this list of conditions and the following disclaimer in the
 
12
//    documentation and/or other materials provided with the distribution.
 
13
//  * Neither the name of any author or any participating institution
 
14
//    may be used to endorse or promote products derived from this software
 
15
//    without specific prior written permission.
 
16
// For a full list of authors, refer to the file AUTHORS.
 
17
// --------------------------------------------------------------------------
 
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
 
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
29
//
23
30
// --------------------------------------------------------------------------
24
31
// $Maintainer: Andreas Bertsch $
34
41
namespace OpenMS
35
42
{
36
43
 
37
 
        MetaInfoRegistry::MetaInfoRegistry(): next_index_(1024), name_to_index_(), index_to_name_(), index_to_description_(), index_to_unit_()
38
 
        {
39
 
                name_to_index_["isotopic_range"] = 1;
40
 
                index_to_name_[1] = "isotopic_range";
41
 
                index_to_description_[1] = "consecutive numbering of the peaks in an isotope pattern. 0 is the monoisotopic peak";
42
 
                index_to_unit_[1] = "";
43
 
                
44
 
                name_to_index_["cluster_id"] = 2;
45
 
                index_to_name_[2] = "cluster_id";
46
 
                index_to_description_[2] = "consecutive numbering of isotope clusters in a spectrum";
47
 
                index_to_unit_[2] = "";
48
 
 
49
 
                name_to_index_["label"] = 3;
50
 
                index_to_name_[3] = "label";
51
 
                index_to_description_[3] = "label e.g. shown in visialization";
52
 
                index_to_unit_[3] = "";
53
 
 
54
 
                name_to_index_["icon"] = 4;
55
 
                index_to_name_[4] = "icon";
56
 
                index_to_description_[4] = "icon shown in visialization";
57
 
                index_to_unit_[4] = "";
58
 
                
59
 
                name_to_index_["color"] = 5;
60
 
                index_to_name_[5] = "color";
61
 
                index_to_description_[5] = "color used for visialization e.g. #FF00FF for purple";
62
 
                index_to_unit_[5] = "";
63
 
 
64
 
                name_to_index_["RT"] = 6;
65
 
                index_to_name_[6] = "RT";
66
 
                index_to_description_[6] = "the retention time of an identification";
67
 
                index_to_unit_[6] = "";
68
 
 
69
 
                name_to_index_["MZ"] = 7;
70
 
                index_to_name_[7] = "MZ";
71
 
                index_to_description_[7] = "the MZ of an identification";
72
 
                index_to_unit_[7] = "";
73
 
 
74
 
                name_to_index_["predicted_RT"] = 8;
75
 
                index_to_name_[8] = "predicted_RT";
76
 
                index_to_description_[8] = "the predicted retention time of a peptide hit";
77
 
                index_to_unit_[8] = "";
78
 
 
79
 
                name_to_index_["predicted_RT_p_value"] = 9;
80
 
                index_to_name_[9] = "predicted_RT_p_value";
81
 
                index_to_description_[9] = "the predicted RT p-value of a peptide hit";
82
 
                index_to_unit_[9] = "";
83
 
 
84
 
                name_to_index_["spectrum_reference"] = 10;
85
 
                index_to_name_[10] = "spectrum_reference";
86
 
                index_to_description_[10] = "Refenference to a spectrum or feature number";
87
 
                index_to_unit_[10] = "";
88
 
 
89
 
                name_to_index_["ID"] = 11;
90
 
                index_to_name_[11] = "ID";
91
 
                index_to_description_[11] = "Some type of identifier";
92
 
                index_to_unit_[11] = "";
93
 
 
94
 
                name_to_index_["low_quality"] = 12;
95
 
                index_to_name_[12] = "low_quality";
96
 
                index_to_description_[12] = "Flag which indicatest that some entity has a low quality (e.g. a feature pair)";
97
 
                index_to_unit_[12] = "";
98
 
 
99
 
                name_to_index_["charge"] = 13;
100
 
                index_to_name_[13] = "charge";
101
 
                index_to_description_[13] = "Charge of a feature or peak";
102
 
                index_to_unit_[13] = "";
103
 
        }
104
 
        
105
 
 
106
 
        MetaInfoRegistry::MetaInfoRegistry(const MetaInfoRegistry& rhs)
107
 
        {
108
 
                *this = rhs;
109
 
        }
110
 
        
111
 
        MetaInfoRegistry::~MetaInfoRegistry()
112
 
        {
113
 
                
114
 
        }
115
 
        
116
 
        MetaInfoRegistry& MetaInfoRegistry::operator = (const MetaInfoRegistry& rhs)
117
 
        {
118
 
    if (this==&rhs) return *this;
119
 
    #pragma omp critical (MetaInfoRegistry)
 
44
  MetaInfoRegistry::MetaInfoRegistry() :
 
45
    next_index_(1024), name_to_index_(), index_to_name_(), index_to_description_(), index_to_unit_()
 
46
  {
 
47
    name_to_index_["isotopic_range"] = 1;
 
48
    index_to_name_[1] = "isotopic_range";
 
49
    index_to_description_[1] = "consecutive numbering of the peaks in an isotope pattern. 0 is the monoisotopic peak";
 
50
    index_to_unit_[1] = "";
 
51
 
 
52
    name_to_index_["cluster_id"] = 2;
 
53
    index_to_name_[2] = "cluster_id";
 
54
    index_to_description_[2] = "consecutive numbering of isotope clusters in a spectrum";
 
55
    index_to_unit_[2] = "";
 
56
 
 
57
    name_to_index_["label"] = 3;
 
58
    index_to_name_[3] = "label";
 
59
    index_to_description_[3] = "label e.g. shown in visialization";
 
60
    index_to_unit_[3] = "";
 
61
 
 
62
    name_to_index_["icon"] = 4;
 
63
    index_to_name_[4] = "icon";
 
64
    index_to_description_[4] = "icon shown in visialization";
 
65
    index_to_unit_[4] = "";
 
66
 
 
67
    name_to_index_["color"] = 5;
 
68
    index_to_name_[5] = "color";
 
69
    index_to_description_[5] = "color used for visialization e.g. #FF00FF for purple";
 
70
    index_to_unit_[5] = "";
 
71
 
 
72
    name_to_index_["RT"] = 6;
 
73
    index_to_name_[6] = "RT";
 
74
    index_to_description_[6] = "the retention time of an identification";
 
75
    index_to_unit_[6] = "";
 
76
 
 
77
    name_to_index_["MZ"] = 7;
 
78
    index_to_name_[7] = "MZ";
 
79
    index_to_description_[7] = "the MZ of an identification";
 
80
    index_to_unit_[7] = "";
 
81
 
 
82
    name_to_index_["predicted_RT"] = 8;
 
83
    index_to_name_[8] = "predicted_RT";
 
84
    index_to_description_[8] = "the predicted retention time of a peptide hit";
 
85
    index_to_unit_[8] = "";
 
86
 
 
87
    name_to_index_["predicted_RT_p_value"] = 9;
 
88
    index_to_name_[9] = "predicted_RT_p_value";
 
89
    index_to_description_[9] = "the predicted RT p-value of a peptide hit";
 
90
    index_to_unit_[9] = "";
 
91
 
 
92
    name_to_index_["spectrum_reference"] = 10;
 
93
    index_to_name_[10] = "spectrum_reference";
 
94
    index_to_description_[10] = "Refenference to a spectrum or feature number";
 
95
    index_to_unit_[10] = "";
 
96
 
 
97
    name_to_index_["ID"] = 11;
 
98
    index_to_name_[11] = "ID";
 
99
    index_to_description_[11] = "Some type of identifier";
 
100
    index_to_unit_[11] = "";
 
101
 
 
102
    name_to_index_["low_quality"] = 12;
 
103
    index_to_name_[12] = "low_quality";
 
104
    index_to_description_[12] = "Flag which indicatest that some entity has a low quality (e.g. a feature pair)";
 
105
    index_to_unit_[12] = "";
 
106
 
 
107
    name_to_index_["charge"] = 13;
 
108
    index_to_name_[13] = "charge";
 
109
    index_to_description_[13] = "Charge of a feature or peak";
 
110
    index_to_unit_[13] = "";
 
111
  }
 
112
 
 
113
  MetaInfoRegistry::MetaInfoRegistry(const MetaInfoRegistry & rhs)
 
114
  {
 
115
    *this = rhs;
 
116
  }
 
117
 
 
118
  MetaInfoRegistry::~MetaInfoRegistry()
 
119
  {
 
120
 
 
121
  }
 
122
 
 
123
  MetaInfoRegistry & MetaInfoRegistry::operator=(const MetaInfoRegistry & rhs)
 
124
  {
 
125
    if (this == &rhs)
 
126
      return *this;
 
127
 
 
128
#pragma omp critical (MetaInfoRegistry)
120
129
    {
121
 
                  next_index_ = rhs.next_index_;
122
 
                  name_to_index_ = rhs.name_to_index_;
123
 
                  index_to_name_ = rhs.index_to_name_;
124
 
                  index_to_description_ = rhs.index_to_description_;
125
 
                  index_to_unit_ = rhs.index_to_unit_;
 
130
      next_index_ = rhs.next_index_;
 
131
      name_to_index_ = rhs.name_to_index_;
 
132
      index_to_name_ = rhs.index_to_name_;
 
133
      index_to_description_ = rhs.index_to_description_;
 
134
      index_to_unit_ = rhs.index_to_unit_;
126
135
    }
127
 
          return *this;
 
136
    return *this;
128
137
  }
129
 
                
130
138
 
131
 
        UInt MetaInfoRegistry::registerName(const String& name, const String& description, const String& unit) const
132
 
        {
 
139
  UInt MetaInfoRegistry::registerName(const String & name, const String & description, const String & unit) const
 
140
  {
133
141
    UInt rv;
134
 
    #pragma omp critical (MetaInfoRegistry)
 
142
#pragma omp critical (MetaInfoRegistry)
135
143
    {
136
 
                  map<String,UInt>::iterator it = name_to_index_.find(name);
137
 
                  if (it == name_to_index_.end())
138
 
                  {
139
 
                          name_to_index_[name] = next_index_;
140
 
                          index_to_name_[next_index_] = name;
141
 
                          index_to_description_[next_index_] = description;
142
 
                          index_to_unit_[next_index_] = unit;
143
 
                          rv = next_index_++;
144
 
                  }
145
 
                  else
146
 
                  {
147
 
                          rv = it->second;
148
 
                  }
 
144
      map<String, UInt>::iterator it = name_to_index_.find(name);
 
145
      if (it == name_to_index_.end())
 
146
      {
 
147
        name_to_index_[name] = next_index_;
 
148
        index_to_name_[next_index_] = name;
 
149
        index_to_description_[next_index_] = description;
 
150
        index_to_unit_[next_index_] = unit;
 
151
        rv = next_index_++;
 
152
      }
 
153
      else
 
154
      {
 
155
        rv = it->second;
 
156
      }
149
157
    }
150
158
    return rv;
151
 
        }
152
 
        
153
 
        void MetaInfoRegistry::setDescription(UInt index, const String& description)
154
 
        {
 
159
  }
 
160
 
 
161
  void MetaInfoRegistry::setDescription(UInt index, const String & description)
 
162
  {
155
163
    bool found;
156
 
    #pragma omp critical (MetaInfoRegistry)
 
164
#pragma omp critical (MetaInfoRegistry)
157
165
    {
158
166
      found = (index_to_name_.find(index) != index_to_name_.end());
159
167
      if (found)
163
171
    }
164
172
    if (!found)
165
173
    {
166
 
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered index!",String(index));
 
174
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered index!", String(index));
167
175
    }
168
 
        }
169
 
                        
170
 
        void MetaInfoRegistry::setDescription(const String& name, const String& description)
171
 
        {
 
176
  }
 
177
 
 
178
  void MetaInfoRegistry::setDescription(const String & name, const String & description)
 
179
  {
172
180
    bool found;
173
 
    #pragma omp critical (MetaInfoRegistry)
 
181
#pragma omp critical (MetaInfoRegistry)
174
182
    {
175
183
      found = (name_to_index_.find(name) != name_to_index_.end());
176
184
    }
177
185
    if (found)
178
186
    {
179
 
            UInt index = getIndex(name);
180
 
            setDescription(index, description);
181
 
    }
182
 
          if (!found)
183
 
          {
184
 
                  throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered name!",name);
185
 
          }
186
 
        }
187
 
        
188
 
        void MetaInfoRegistry::setUnit(UInt index, const String& unit)
189
 
        {
 
187
      UInt index = getIndex(name);
 
188
      setDescription(index, description);
 
189
    }
 
190
    if (!found)
 
191
    {
 
192
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered name!", name);
 
193
    }
 
194
  }
 
195
 
 
196
  void MetaInfoRegistry::setUnit(UInt index, const String & unit)
 
197
  {
190
198
    bool found;
191
 
    #pragma omp critical (MetaInfoRegistry)
 
199
#pragma omp critical (MetaInfoRegistry)
192
200
    {
193
201
      found = (index_to_name_.end() != index_to_name_.find(index));
194
202
      if (found)
198
206
    }
199
207
    if (!found)
200
208
    {
201
 
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered index!",String(index));
 
209
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered index!", String(index));
202
210
    }
203
 
        }
204
 
        
205
 
        void MetaInfoRegistry::setUnit(const String& name, const String& unit)
206
 
        {
 
211
  }
 
212
 
 
213
  void MetaInfoRegistry::setUnit(const String & name, const String & unit)
 
214
  {
207
215
    bool found;
208
 
    #pragma omp critical (MetaInfoRegistry)
 
216
#pragma omp critical (MetaInfoRegistry)
209
217
    {
210
218
      found = (name_to_index_.find(name) != name_to_index_.end());
211
219
    }
212
220
    if (found)
213
221
    {
214
 
            UInt index = getIndex(name);
215
 
            setUnit(index, unit);
216
 
    }
217
 
          if (!found)
218
 
          {
219
 
                  throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered name!",name);
220
 
          }
221
 
        }
222
 
        
223
 
        UInt MetaInfoRegistry::getIndex(const String& name) const
224
 
        {
 
222
      UInt index = getIndex(name);
 
223
      setUnit(index, unit);
 
224
    }
 
225
    if (!found)
 
226
    {
 
227
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered name!", name);
 
228
    }
 
229
  }
 
230
 
 
231
  UInt MetaInfoRegistry::getIndex(const String & name) const
 
232
  {
225
233
    UInt rv;
226
234
    bool found = false;
227
 
    #pragma omp critical (MetaInfoRegistry)
 
235
#pragma omp critical (MetaInfoRegistry)
228
236
    {
229
 
      map<String,UInt>::const_iterator it = name_to_index_.find(name);
230
 
                  if (it != name_to_index_.end())
231
 
                  {
232
 
                          rv = it->second;
 
237
      map<String, UInt>::const_iterator it = name_to_index_.find(name);
 
238
      if (it != name_to_index_.end())
 
239
      {
 
240
        rv = it->second;
233
241
        found = true;
234
 
                  }
235
 
    }
236
 
          if (!found)
237
 
    {
238
 
                  registerName(name, String::EMPTY, String::EMPTY);
239
 
                  rv = getIndex(name);
240
 
          }
241
 
    return rv;
242
 
        }
243
 
 
244
 
 
245
 
        String MetaInfoRegistry::getDescription(UInt index) const
246
 
        {
247
 
    String result;
248
 
    #pragma omp critical (MetaInfoRegistry)
249
 
    {
250
 
      map<UInt,String>::const_iterator it = index_to_description_.find(index);
251
 
                  if (it == index_to_description_.end())
252
 
                  {
253
 
                          throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered index!",String(index));
254
 
                  }
255
 
      result = it->second;
256
 
    }
257
 
    return result;
258
 
        }
259
 
 
260
 
        String MetaInfoRegistry::getDescription(const String& name) const
261
 
        {
262
 
    String rv;
263
 
    UInt index = getIndex(name);
264
 
          if  (index==0)
265
 
          {
266
 
                  throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered Name!",name);
267
 
          }
268
 
    #pragma omp critical (MetaInfoRegistry)
269
 
    {
270
 
                  rv = (index_to_description_.find(index))->second;
271
 
    }
272
 
    return rv;
273
 
        }
274
 
 
275
 
        String MetaInfoRegistry::getUnit(UInt index) const
276
 
        {
277
 
    String result;
278
 
    #pragma omp critical (MetaInfoRegistry)
279
 
    {
280
 
      map<UInt,String>::const_iterator it = index_to_unit_.find(index);
281
 
                  if (it == index_to_unit_.end())
282
 
                  {
283
 
                          throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered index!",String(index));
284
 
                  }
285
 
      result = it->second;
286
 
    }
287
 
    return result;
288
 
        }
289
 
        
290
 
        String MetaInfoRegistry::getUnit(const String& name) const
291
 
        {
292
 
    String rv;
293
 
    UInt index = getIndex(name);
294
 
          if  (index==0)
295
 
          {
296
 
                  throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered Name!",name);
297
 
          }
298
 
    #pragma omp critical (MetaInfoRegistry)
299
 
    {
300
 
                  rv = (index_to_unit_.find(index))->second;
301
 
    }
302
 
    return rv;
303
 
        }
 
242
      }
 
243
    }
 
244
    if (!found)
 
245
    {
 
246
      registerName(name, String::EMPTY, String::EMPTY);
 
247
      rv = getIndex(name);
 
248
    }
 
249
    return rv;
 
250
  }
 
251
 
 
252
  String MetaInfoRegistry::getDescription(UInt index) const
 
253
  {
 
254
    String result;
 
255
#pragma omp critical (MetaInfoRegistry)
 
256
    {
 
257
      map<UInt, String>::const_iterator it = index_to_description_.find(index);
 
258
      if (it == index_to_description_.end())
 
259
      {
 
260
        throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered index!", String(index));
 
261
      }
 
262
      result = it->second;
 
263
    }
 
264
    return result;
 
265
  }
 
266
 
 
267
  String MetaInfoRegistry::getDescription(const String & name) const
 
268
  {
 
269
    String rv;
 
270
    UInt index = getIndex(name);
 
271
    if (index == 0)
 
272
    {
 
273
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered Name!", name);
 
274
    }
 
275
#pragma omp critical (MetaInfoRegistry)
 
276
    {
 
277
      rv = (index_to_description_.find(index))->second;
 
278
    }
 
279
    return rv;
 
280
  }
 
281
 
 
282
  String MetaInfoRegistry::getUnit(UInt index) const
 
283
  {
 
284
    String result;
 
285
#pragma omp critical (MetaInfoRegistry)
 
286
    {
 
287
      map<UInt, String>::const_iterator it = index_to_unit_.find(index);
 
288
      if (it == index_to_unit_.end())
 
289
      {
 
290
        throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered index!", String(index));
 
291
      }
 
292
      result = it->second;
 
293
    }
 
294
    return result;
 
295
  }
 
296
 
 
297
  String MetaInfoRegistry::getUnit(const String & name) const
 
298
  {
 
299
    String rv;
 
300
    UInt index = getIndex(name);
 
301
    if (index == 0)
 
302
    {
 
303
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered Name!", name);
 
304
    }
 
305
#pragma omp critical (MetaInfoRegistry)
 
306
    {
 
307
      rv = (index_to_unit_.find(index))->second;
 
308
    }
 
309
    return rv;
 
310
  }
304
311
 
305
312
  String MetaInfoRegistry::getName(UInt index) const
306
313
  {
307
314
    String rv;
308
 
    bool found=false;
309
 
    #pragma omp critical (MetaInfoRegistry)
 
315
    bool found = false;
 
316
#pragma omp critical (MetaInfoRegistry)
310
317
    {
311
 
      map<UInt,String>::const_iterator it = index_to_name_.find(index);
312
 
            if (it != index_to_name_.end())
313
 
            {
314
 
                    rv = it->second;
315
 
        found=true;
316
 
            }
 
318
      map<UInt, String>::const_iterator it = index_to_name_.find(index);
 
319
      if (it != index_to_name_.end())
 
320
      {
 
321
        rv = it->second;
 
322
        found = true;
 
323
      }
317
324
    }
318
 
    if (!found) throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__,"Unregistered index!",String(index));
 
325
    if (!found)
 
326
      throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Unregistered index!", String(index));
319
327
    return rv;
320
328
  }
321
 
        
 
329
 
322
330
} //namespace