Commit d85cbf207f268028c0d45b0a7a61bc5314245239
1 parent
9efd40b5
Replace C-style casts by C++ style casts
Showing
4 changed files
with
5 additions
and
5 deletions
src/ctbin/ctbin.cpp
| @@ -529,7 +529,7 @@ void ctbin::bin_events(GCTAObservation* obs) | @@ -529,7 +529,7 @@ void ctbin::bin_events(GCTAObservation* obs) | ||
| 529 | int num_in_map = 0; | 529 | int num_in_map = 0; |
| 530 | 530 | ||
| 531 | // Fill sky map | 531 | // Fill sky map |
| 532 | - GCTAEventList* events = (GCTAEventList*)obs->events(); | 532 | + GCTAEventList* events = static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 533 | for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { | 533 | for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { |
| 534 | 534 | ||
| 535 | // Determine sky pixel | 535 | // Determine sky pixel |
src/ctobssim/ctobssim.cpp
| @@ -618,7 +618,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | @@ -618,7 +618,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | ||
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | // Get pointer on event list (circumvent const correctness) | 620 | // Get pointer on event list (circumvent const correctness) |
| 621 | - GCTAEventList* events = (GCTAEventList*)(obs->events()); | 621 | + GCTAEventList* events = static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 622 | 622 | ||
| 623 | // Extract ROI | 623 | // Extract ROI |
| 624 | GSkyDir dir = events->roi().centre().skydir(); | 624 | GSkyDir dir = events->roi().centre().skydir(); |
| @@ -839,7 +839,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models, | @@ -839,7 +839,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models, | ||
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | // Get pointer on event list (circumvent const correctness) | 841 | // Get pointer on event list (circumvent const correctness) |
| 842 | - GCTAEventList* events = (GCTAEventList*)(obs->events()); | 842 | + GCTAEventList* events = static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 843 | 843 | ||
| 844 | // Loop over all models | 844 | // Loop over all models |
| 845 | for (int i = 0; i < models.size(); ++i) { | 845 | for (int i = 0; i < models.size(); ++i) { |
src/ctselect/ctselect.cpp
| @@ -621,7 +621,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) | @@ -621,7 +621,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) | ||
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | // Get CTA event list pointer | 623 | // Get CTA event list pointer |
| 624 | - GCTAEventList* list = (GCTAEventList*)(obs->events()); | 624 | + GCTAEventList* list = static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 625 | 625 | ||
| 626 | // Set ROI | 626 | // Set ROI |
| 627 | GCTARoi roi; | 627 | GCTARoi roi; |
src/ctskymap/ctskymap.cpp
| @@ -481,7 +481,7 @@ void ctskymap::map_events(GCTAObservation* obs) | @@ -481,7 +481,7 @@ void ctskymap::map_events(GCTAObservation* obs) | ||
| 481 | int num_in_map = 0; | 481 | int num_in_map = 0; |
| 482 | 482 | ||
| 483 | // Fill sky map | 483 | // Fill sky map |
| 484 | - GCTAEventList* events = (GCTAEventList*)obs->events(); | 484 | + GCTAEventList* events = static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 485 | for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { | 485 | for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { |
| 486 | 486 | ||
| 487 | // Skip if energy is out of range | 487 | // Skip if energy is out of range |