Jpp
20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
software
JAcoustics
JEKey.hh
Go to the documentation of this file.
1
#ifndef __JACOUSTICS__JEKEY__
2
#define __JACOUSTICS__JEKEY__
3
4
#include <ostream>
5
#include <iomanip>
6
7
#include "JLang/JObjectID.hh"
8
#include "JLang/JMultiComparable.hh"
9
#include "
JAcoustics/JCounter.hh
"
10
11
12
/**
13
* \file
14
*
15
* Emitter hash key.
16
* \author mdejong
17
*/
18
namespace
JACOUSTICS
{}
19
namespace
JPP
{
using namespace
JACOUSTICS
; }
20
21
namespace
JACOUSTICS
{
22
23
using
JLANG::JMultiComparable;
24
using
JLANG::JObjectID;
25
26
27
/**
28
* Emitter key.
29
*
30
* The emitter key can be used to umambiguously address an event in a data set.
31
*/
32
struct
JEKey
:
33
public
JObjectID,
34
public
JCounter
,
35
public
JMultiComparable<JEKey, JLANG::JTYPELIST<JObjectID, JCounter>::typelist>
36
{
37
/**
38
* Multiplication factor applied to the event counter for the evaluation of the hash key.\n
39
* Note that the object identifier of any emitter should not exceed this value.
40
*/
41
static
const
int
COUNTER
= 100;
42
43
44
/**
45
* Default constructor.
46
*/
47
JEKey
()
48
{}
49
50
51
/**
52
* Constructor.
53
*
54
* \param id emitter identifier
55
* \param counter event counter
56
*/
57
JEKey
(
const
JObjectID&
id
,
58
const
JCounter
&
counter
) :
59
JObjectID(id),
60
JCounter
(
counter
)
61
{}
62
63
64
/**
65
* Get hash key.
66
*
67
* \return hash key
68
*/
69
int
getKey
()
const
70
{
71
return
getCounter
() *
COUNTER
+ getID();
72
}
73
74
75
/**
76
* Write emitter key to output stream.
77
*
78
* \param out output stream
79
* \param key emitter key
80
* \return output stream
81
*/
82
friend
inline
std::ostream&
operator<<
(std::ostream& out,
const
JEKey
& key)
83
{
84
using namespace
std;
85
86
return
out << setw(3) << key.getID() <<
' '
87
<< setw(4) << key.
getCounter
();
88
}
89
};
90
}
91
92
#endif
JCounter.hh
Acoustic counter.
JACOUSTICS
Auxiliary classes and methods for acoustic position calibration.
Definition
JAbstractSoundVelocity.hh:10
JPP
Definition
JAbstractSoundVelocity.hh:11
JACOUSTICS::JCounter
Acoustic counter.
Definition
JCounter.hh:26
JACOUSTICS::JCounter::counter
int counter
Definition
JCounter.hh:88
JACOUSTICS::JCounter::getCounter
int getCounter() const
Get counter.
Definition
JCounter.hh:50
JACOUSTICS::JEKey
Emitter key.
Definition
JEKey.hh:36
JACOUSTICS::JEKey::JEKey
JEKey(const JObjectID &id, const JCounter &counter)
Constructor.
Definition
JEKey.hh:57
JACOUSTICS::JEKey::JEKey
JEKey()
Default constructor.
Definition
JEKey.hh:47
JACOUSTICS::JEKey::getKey
int getKey() const
Get hash key.
Definition
JEKey.hh:69
JACOUSTICS::JEKey::operator<<
friend std::ostream & operator<<(std::ostream &out, const JEKey &key)
Write emitter key to output stream.
Definition
JEKey.hh:82
JACOUSTICS::JEKey::COUNTER
static const int COUNTER
Multiplication factor applied to the event counter for the evaluation of the hash key.
Definition
JEKey.hh:41
Generated by
1.10.0