SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceId.h
Go to the documentation of this file.
1
17/*
18 * SourceId.h
19 *
20 * Created on: Apr 26, 2017
21 * Author: mschefer
22 */
23
24#ifndef _SEIMPLEMENTATION_PROPERTY_SOURCEID_H_
25#define _SEIMPLEMENTATION_PROPERTY_SOURCEID_H_
26
28#include <atomic>
29
30namespace SourceXtractor {
31
32class SourceId : public Property {
33
34public:
35
36 explicit SourceId(unsigned int detection_id)
37 : m_source_id(getNewId()), m_detection_id(detection_id) {
38 }
39
43
44 virtual ~SourceId() = default;
45
46 unsigned int getSourceId() const {
47 return m_source_id;
48 }
49
50 unsigned int getDetectionId() const {
51 return m_detection_id;
52 }
53
54private:
56
57 static unsigned int getNewId() {
58 static std::atomic<uint32_t> s_id(1);
59 return s_id++;
60 }
61
62
63
64}; /* End of SourceId class */
65
66}
67
68
69#endif /* _SEIMPLEMENTATION_PROPERTY_SOURCEID_H_ */
Base class for all Properties. (has no actual content).
Definition Property.h:33
static unsigned int getNewId()
Definition SourceId.h:57
unsigned int m_source_id
Definition SourceId.h:55
unsigned int m_detection_id
Definition SourceId.h:55
virtual ~SourceId()=default
unsigned int getDetectionId() const
Definition SourceId.h:50
unsigned int getSourceId() const
Definition SourceId.h:46
SourceId(unsigned int detection_id)
Definition SourceId.h:36