33#ifndef WOSS_CREATOR_CONTAINER_DEFINITIONS_H
34#define WOSS_CREATOR_CONTAINER_DEFINITIONS_H
62 CustomTransducer(
const std::string& name =
"",
double bearing = 0.0,
double vert_rot = 0.0,
double horiz_rot = 0.0,
double mult = 1.0,
double add = 0.0 )
112 template<
typename Data >
150 bool insert(
const Data& data,
const std::shared_ptr<Location>& tx,
const std::shared_ptr<Location>& rx );
167 Data
get(
const std::shared_ptr<Location>& tx,
const std::shared_ptr<Location>& rx )
const;
189 void erase(
const std::shared_ptr<Location>& tx,
const std::shared_ptr<Location>& rx );
205 void replace(
const Data& data,
const std::shared_ptr<Location>& tx,
const std::shared_ptr<Location>& rx );
239 using ICIter =
typename InnerContainer::iterator;
240 using ICRIter =
typename InnerContainer::reverse_iterator;
241 using ICCIter =
typename InnerContainer::const_iterator;
242 using ICCRIter =
typename InnerContainer::const_reverse_iterator;
248 using DCIter =
typename DataContainer::iterator;
249 using DCCIter =
typename DataContainer::const_iterator;
250 using DCRIter =
typename DataContainer::reverse_iterator;
251 using DCRCIter =
typename DataContainer::const_reverse_iterator;
290 template<
typename Data >
294 template<
typename Data >
298 template<
typename Data >
304 template<
typename Data >
310 template<
typename Data >
318 template<
typename Data >
330 if ( it->first->isEquivalentTo( coordinates ) ) {
332 std::cout <<
"WossCreatorContainer::find() tx coordinates found = "
333 << coordinates << std::endl;
340 std::cout <<
"WossCreatorContainer::find() tx ALL_COORDZ found" << std::endl;
345 std::cout <<
"WossCreatorContainer::find() tx coordinates not found = "
346 << coordinates << std::endl;
349 std::cout <<
"WossCreatorContainer::find() tx ALL_COORDZ not found" << std::endl;
354 template<
typename Data >
356 auto it_all_loc = iter->second.end();
358 for (
auto it = iter->second.begin(); it != iter->second.end(); it++ ) {
366 if ( it->first->isEquivalentTo( coordinates ) ) {
368 std::cout <<
"WossCreatorContainer::find() rx coordinates found = "
369 << coordinates << std::endl;
374 if ( coordinates ==
ALL_COORDZ && it_all_loc != iter->second.end() ) {
376 std::cout <<
"WossCreatorContainer::find() rx ALL_COORDZ found" << std::endl;
381 std::cout <<
"WossCreatorContainer::find() rx coordinates not found = "
382 << coordinates << std::endl;
385 std::cout <<
"WossCreatorContainer::find() rx ALL_COORDZ not found" << std::endl;
386 return iter->second.end();
390 template<
typename Data >
397 auto it2 = it->second.find(rx);
398 if ( it2 == it->second.end() ) {
399 (it->second)[rx] = data;
406 template<
typename Data >
408 auto it =
find( tx );
413 auto it2 =
find( rx, it );
414 if ( it2 == it->second.end() ) {
422 template<
typename Data >
425 bool tx_changed_to_all_locations =
false;
430 std::cout <<
"WossCreatorContainer::get() no tx location found = " << *tx
431 <<
"; trying ALL_LOCATIONS"<< std::endl;
434 tx_changed_to_all_locations =
true;
438 std::cout <<
"WossCreatorContainer::get() tx location found = " << *tx << std::endl;
442 auto it2 = it->second.find( rx );
445 if ( it2 == it->second.end() ) {
447 std::cout <<
"WossCreatorContainer::get() no rx location found = " << *rx
448 <<
"; trying ALL_LOCATIONS"<< std::endl;
454 std::cout <<
"WossCreatorContainer::get() rx location found = " << *rx << std::endl;
457 if ( it2 != it->second.end() ) {
459 if constexpr (std::is_same_v<Data, CustomTransducer>) {
461 const auto& original_data = it2->second;
462 if (tx_changed_to_all_locations ==
true) {
466 std::cout <<
"WossCreatorContainer::get() rotating angle" << std::endl;
470 it->first->getBearing(),
471 (original_data.initial_vert_rotation + it->first->getVerticalOrientation()),
472 (original_data.initial_horiz_rotation + it->first->getHorizontalOrientation()),
473 original_data.multiply_costant,
474 original_data.add_costant
483 std::cerr <<
"WARNING: WossCreatorContainer::get() no tx nor rx location found, returning default constructor!!" << std::endl;
489 template<
typename Data >
495 template<
typename Data >
498 bool tx_changed_to_all_coordz =
false;
503 std::cout <<
"WossCreatorContainer::get() no tx coord found = " << tx
504 <<
"; trying ALL_COORDZ"<< std::endl;
507 tx_changed_to_all_coordz =
true;
511 std::cout <<
"WossCreatorContainer::get() tx coord found = " << tx << std::endl;
518 if ( it2 == it->second.end() ) {
520 std::cout <<
"WossCreatorContainer::get() no rx coord found = " << rx
521 <<
"; trying ALL_COORDZ"<< std::endl;
527 std::cout <<
"WossCreatorContainer::get() rx coord found = " << rx << std::endl;
530 if ( it2 != it->second.end() ) {
532 std::cout <<
"WossCreatorContainer::get() value found = " << it2->second << std::endl;
535 if constexpr (std::is_same_v<Data, CustomTransducer>) {
537 const auto& original_data = it2->second;
538 if (tx_changed_to_all_coordz ==
true) {
542 std::cout <<
"WossCreatorContainer::get() rotating angle" << std::endl;
546 it->first->getBearing(),
547 (original_data.initial_vert_rotation + it->first->getVerticalOrientation()),
548 (original_data.initial_horiz_rotation + it->first->getHorizontalOrientation()),
549 original_data.multiply_costant,
550 original_data.add_costant
558 std::cerr <<
"WARNING: WossCreatorContainer::get() no tx nor rx coordinates found, returning default constructor!!" << std::endl;
564 template<
typename Data >
568 it->second.erase( rx );
569 if ( it->second.empty() )
575 template<
typename Data >
578 bool tx_found =
false;
581 if ( it->first->isEquivalentTo( tx ) )
589 for (
auto it2 = it->second.begin(); it2 != it->second.end(); ) {
590 bool rx_found =
false;
593 if ( it2->first->isEquivalentTo( rx ) )
601 it->second.erase(it2++);
608 if ( it->second.empty() )
615 template<
typename Data >
621 template<
typename Data >
623 auto it =
find( tx );
628 auto it2 =
find( rx, it );
629 if ( it2 == it->second.end() ) {
637 template<
typename Data >
3D-Coordinates (lat, long, depth) class definitions and functions library
Definition coordinates-definitions.h:384
static DefHandler & instance()
std::map< std::shared_ptr< Location >, CustomAngles > InnerContainer
Definition woss-creator-container.h:238
static const CoordZ ALL_COORDZ
Definition woss-creator-container.h:125
typename DataContainer::const_iterator DCCIter
Definition woss-creator-container.h:249
WossCreatorContainer()=default
Data get(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator-container.h:496
bool insert(const Data &data, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator-container.h:407
~WossCreatorContainer()=default
typename DataContainer::iterator DCIter
Definition woss-creator-container.h:248
DCIter find(const CoordZ &coordinates)
Definition woss-creator-container.h:319
typename InnerContainer::reverse_iterator ICRIter
Definition woss-creator-container.h:240
Data & accessAllLocations()
Definition woss-creator-container.h:490
typename InnerContainer::const_reverse_iterator ICCRIter
Definition woss-creator-container.h:242
bool debug
Definition woss-creator-container.h:285
bool insert(const Data &data, const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx)
Definition woss-creator-container.h:391
Data get(const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx) const
Definition woss-creator-container.h:423
DataContainer data_container
Definition woss-creator-container.h:280
void clear()
Definition woss-creator-container.h:638
void replace(const Data &data, const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx)
Definition woss-creator-container.h:616
std::shared_ptr< Location > createLocation(const CoordZ &coordinates)
Definition woss-creator-container.h:311
typename InnerContainer::iterator ICIter
Definition woss-creator-container.h:239
typename DataContainer::reverse_iterator DCRIter
Definition woss-creator-container.h:250
typename DataContainer::const_reverse_iterator DCRCIter
Definition woss-creator-container.h:251
ICIter find(const CoordZ &coordinates, const DCIter &iter)
Definition woss-creator-container.h:355
static std::shared_ptr< Location > ALL_LOCATIONS
Definition woss-creator-container.h:120
typename InnerContainer::const_iterator ICCIter
Definition woss-creator-container.h:241
void setDebug(bool flag)
Definition woss-creator-container.h:225
int size() const
Definition woss-creator-container.h:305
void replace(const Data &data, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator-container.h:622
void erase(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator-container.h:576
std::map< std::shared_ptr< Location >, InnerContainer > DataContainer
Definition woss-creator-container.h:247
bool isUsingDebug() const
Definition woss-creator-container.h:231
void erase(const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx)
Definition woss-creator-container.h:565
bool isEmpty() const
Definition woss-creator-container.h:299
Provides the interface for woss::DefHandler class.
Definition ac-toolbox-arr-asc-reader.h:44
Initial set up of a transducer.
Definition woss-creator-container.h:53
double initial_vert_rotation
Definition woss-creator-container.h:87
double initial_bearing
Definition woss-creator-container.h:82
double add_costant
Definition woss-creator-container.h:102
friend std::ostream & operator<<(std::ostream &os, const CustomTransducer &instance)
Definition woss-creator-container.h:65
CustomTransducer(const std::string &name="", double bearing=0.0, double vert_rot=0.0, double horiz_rot=0.0, double mult=1.0, double add=0.0)
Definition woss-creator-container.h:62
double initial_horiz_rotation
Definition woss-creator-container.h:92
std::string type
Definition woss-creator-container.h:77
double multiply_costant
Definition woss-creator-container.h:97