Jpp  19.1.0-rc.1
the software that should make you happy
KM3NeT_DOM.h
Go to the documentation of this file.
1 #ifndef KM3NET_DOM_H_
2 #define KM3NET_DOM_H_
3 /**
4  * \author fsimeone
5  */
6 
7 
8 #include <map>
9 #include <vector>
10 
11 #include <boost/asio.hpp>
12 #include <boost/bind.hpp>
13 #include <boost/shared_ptr.hpp>
14 
16 #include "KM3NeT_Audio_Channel.h"
17 #include "toalib/km3_toa_lib.hpp"
18 
19 
20 #define BSWAP_64(x) (((uint64_t)(x) << 56) |\
21  (((uint64_t)(x) << 40) & 0xff000000000000ULL) |\
22  (((uint64_t)(x) << 24) & 0xff0000000000ULL) |\
23  (((uint64_t)(x) << 8) & 0xff00000000ULL) |\
24  (((uint64_t)(x) >> 8) & 0xff000000ULL) |\
25  (((uint64_t)(x) >> 24) & 0xff0000ULL) |\
26  (((uint64_t)(x) >> 40) & 0xff00ULL) |\
27  ((uint64_t)(x) >> 56))
28 
29 //#define DEBUG_KM3NET_DOM
30 
31 
33 {
34 public:
35  static const int DEBUG_LEVEL=2;
36 
37  KM3NeT_DOM( boost::asio::io_service& io_service,\
38  callback_send_toa callback,\
39  std::string& debug_path,\
40  std::size_t window=STD_WINDOW,\
41  std::size_t overlap=STD_OVERLAP);
42  virtual ~KM3NeT_DOM();
43 
44  void Add_probe(pProbe probe, std::size_t id, std::size_t threshold);
45  void Check_time_async(Audio_Header header) { strand_.post(boost::bind(&KM3NeT_DOM::Check_time,this,header)); };
46  void Handle_samples_async(uint8_t* buffer,uint32_t length) { strand_.post(boost::bind(&KM3NeT_DOM::Handle_samples,this,buffer,length)); };
47 
48  void Set_test(uint32_t id){ch_n1.Set_test(id);ch_n2.Set_test(id);};
49 private:
50  void Check_time(Audio_Header header);
51  void Handle_samples(uint8_t* buffer,uint32_t length);
52 
53  boost::asio::io_service::strand strand_;
54 
56  bool ch1_;
57  bool ch2_;
58  uint32_t audio_word_size_;
59 
62 
63 };
64 
65 typedef boost::shared_ptr<KM3NeT_DOM> pDOM;
66 
67 #endif
boost::shared_ptr< KM3::TOALIB::CTOAFinder::probeSignalT > pProbe
boost::function< void(ToA_Packet packet)> callback_send_toa
#define STD_WINDOW
#define STD_OVERLAP
boost::shared_ptr< KM3NeT_DOM > pDOM
Definition: KM3NeT_DOM.h:65
void Set_test(uint32_t id)
void Handle_samples_async(uint8_t *buffer, uint32_t length)
Definition: KM3NeT_DOM.h:46
bool ch2_
Definition: KM3NeT_DOM.h:57
void Check_time_async(Audio_Header header)
Definition: KM3NeT_DOM.h:45
void Set_test(uint32_t id)
Definition: KM3NeT_DOM.h:48
boost::asio::io_service::strand strand_
Definition: KM3NeT_DOM.h:53
Audio_Header header_
Definition: KM3NeT_DOM.h:55
void Handle_samples(uint8_t *buffer, uint32_t length)
Definition: KM3NeT_DOM.cc:65
KM3NeT_Audio_Channel ch_n2
Definition: KM3NeT_DOM.h:61
KM3NeT_DOM(boost::asio::io_service &io_service, callback_send_toa callback, std::string &debug_path, std::size_t window=STD_WINDOW, std::size_t overlap=STD_OVERLAP)
Definition: KM3NeT_DOM.cc:17
uint32_t audio_word_size_
Definition: KM3NeT_DOM.h:58
static const int DEBUG_LEVEL
Definition: KM3NeT_DOM.h:35
virtual ~KM3NeT_DOM()
Definition: KM3NeT_DOM.cc:31
KM3NeT_Audio_Channel ch_n1
Definition: KM3NeT_DOM.h:60
void Check_time(Audio_Header header)
Definition: KM3NeT_DOM.cc:42
void Add_probe(pProbe probe, std::size_t id, std::size_t threshold)
Definition: KM3NeT_DOM.cc:36
bool ch1_
Definition: KM3NeT_DOM.h:56
bool overlap(const JRange< T, JComparator_t > &first, const JRange< T, JComparator_t > &second)
Test overlap between ranges.
Definition: JRange.hh:641