Jpp
software
JLang
JSTDToolkit.hh
Go to the documentation of this file.
1
#ifndef __JLANG__JSTDTOOLKIT__
2
#define __JLANG__JSTDTOOLKIT__
3
4
#include "
JLang/JSTDTypes.hh
"
5
#include "
JLang/JStreamAvailable.hh
"
6
#include "
JLang/JException.hh
"
7
8
9
/**
10
* \author mdejong
11
*/
12
13
/**
14
* Auxiliary classes and methods for STD containers.
15
*/
16
namespace
JLANG
{}
17
namespace
JPP
{
using namespace
JLANG
; }
18
19
namespace
JLANG
{
20
21
/**
22
* Get value in map.
23
*
24
* Note that this method throws an exception if the given key is absent.
25
*
26
* \param map map
27
* \param key key
28
* \return value
29
*/
30
template
<
class
JKey_t,
class
JValue_t,
class
JComparator_t,
class
JAllocator_t>
31
inline
const
JValue_t&
get_key
(
const
std::map<JKey_t, JValue_t, JComparator_t, JAllocator_t>
&
map
,
const
JKey_t key)
32
{
33
typename
std::map<JKey_t, JValue_t, JComparator_t, JAllocator_t>::const_iterator
i =
map
.find(key);
34
35
if
(i !=
map
.end()) {
36
37
return
i->second;
38
39
}
else
{
40
41
THROW
(
JTypeInformationException
,
"Invalid key <"
<<
STREAM
(
"?"
) << key <<
">"
);
42
}
43
}
44
}
45
46
#endif
JException.hh
JSTDTypes.hh
JStreamAvailable.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition:
JException.hh:669
std::map
Definition:
JSTDTypes.hh:16
map
const char * map
Definition:
elog.cc:87
JLANG::get_key
const JValue_t & get_key(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &map, const JKey_t key)
Get value in map.
Definition:
JSTDToolkit.hh:31
JLANG::JTypeInformationException
Exception for absence of type information.
Definition:
JException.hh:612
JLANG
Auxiliary classes and methods for language specific functionality.
Definition:
JAbstractClass.hh:10
STREAM
Auxiliary data structure for handling std::ostream.
Definition:
JStreamAvailable.hh:81
Generated by
1.8.16