Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 /* >> 27 # <<BEGIN-copyright>> >> 28 # Copyright (c) 2010, Lawrence Livermore National Security, LLC. >> 29 # Produced at the Lawrence Livermore National Laboratory >> 30 # Written by Bret R. Beck, beck6@llnl.gov. >> 31 # CODE-461393 >> 32 # All rights reserved. >> 33 # >> 34 # This file is part of GIDI. For details, see nuclear.llnl.gov. >> 35 # Please also read the "Additional BSD Notice" at nuclear.llnl.gov. >> 36 # >> 37 # Redistribution and use in source and binary forms, with or without modification, >> 38 # are permitted provided that the following conditions are met: >> 39 # >> 40 # 1) Redistributions of source code must retain the above copyright notice, >> 41 # this list of conditions and the disclaimer below. >> 42 # 2) Redistributions in binary form must reproduce the above copyright notice, >> 43 # this list of conditions and the disclaimer (as noted below) in the >> 44 # documentation and/or other materials provided with the distribution. >> 45 # 3) Neither the name of the LLNS/LLNL nor the names of its contributors may be >> 46 # used to endorse or promote products derived from this software without >> 47 # specific prior written permission. >> 48 # >> 49 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY >> 50 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >> 51 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT >> 52 # SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR >> 53 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> 54 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >> 55 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED >> 56 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> 57 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, >> 58 # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> 59 # <<END-copyright>> >> 60 */ 26 61 27 #include <iostream> 62 #include <iostream> 28 63 29 #include "G4GIDI.hh" 64 #include "G4GIDI.hh" 30 65 31 using namespace std; 66 using namespace std; 32 using namespace GIDI; 67 using namespace GIDI; 33 68 34 /* 69 /* 35 ********************************************** 70 *************************************************************** 36 */ 71 */ 37 G4GIDI::G4GIDI( G4int ip, const string &dataDi << 72 G4GIDI::G4GIDI( int ip, string &dataDirectory ) { 38 73 39 init( ip ); 74 init( ip ); 40 addDataDirectory( dataDirectory ); 75 addDataDirectory( dataDirectory ); 41 } 76 } 42 /* 77 /* 43 ********************************************** 78 *************************************************************** 44 */ 79 */ 45 G4GIDI::G4GIDI( G4int ip, list<string> &dataDi << 80 G4GIDI::G4GIDI( int ip, list<string> &dataDirectoryList ) { >> 81 >> 82 list<string>::iterator iter; 46 83 47 init( ip ); 84 init( ip ); 48 for( auto iter = dataDirectoryList.begin( << 85 for( iter = dataDirectoryList.begin( ); iter != dataDirectoryList.end( ); ++iter ) addDataDirectory( *iter ); 49 addDataDirectory( *iter ); << 50 } 86 } 51 /* 87 /* 52 ********************************************** 88 *************************************************************** 53 */ 89 */ 54 G4GIDI::~G4GIDI( void ) { 90 G4GIDI::~G4GIDI( void ) { 55 91 56 G4GIDI_target *target; 92 G4GIDI_target *target; 57 auto iter = dataDirectories.cbegin(); << 93 list<G4GIDI_map *>::iterator iter; 58 94 59 while( targets.size( ) > 0 ) { 95 while( targets.size( ) > 0 ) { 60 target = targets.back( ); 96 target = targets.back( ); 61 targets.pop_back( ); 97 targets.pop_back( ); 62 delete target; 98 delete target; 63 } // Loop checking, 11.06.2015, T. Koi << 99 } 64 100 65 while( iter != dataDirectories.cend() ) { << 101 while( ( iter = dataDirectories.begin( ) ) != dataDirectories.end( ) ) { 66 delete *iter; 102 delete *iter; 67 dataDirectories.pop_front( ); 103 dataDirectories.pop_front( ); 68 }// Loop checking, 11.06.2015, T. Koi << 104 } 69 } 105 } 70 /* 106 /* 71 ********************************************** 107 *************************************************************** 72 */ 108 */ 73 G4int G4GIDI::init( G4int ip ) { << 109 int G4GIDI::init( int ip ) { 74 110 75 projectileID = ip; 111 projectileID = ip; 76 if( ip == 0 ) { << 77 projectile = string( "g" ); } << 78 else if( ip == 1 ) { << 79 projectile = string( "n" ); } << 80 else if( ip == 2 ) { << 81 projectile = string( "p" ); } << 82 else if( ip == 3 ) { << 83 projectile = string( "d" ); } << 84 else if( ip == 4 ) { << 85 projectile = string( "t" ); } << 86 else if( ip == 5 ) { << 87 projectile = string( "h" ); } << 88 else if( ip == 6 ) { << 89 projectile = string( "a" ); } << 90 else { << 91 printf( "Invalid projectile ID = %d\n" << 92 throw 1; << 93 } << 94 return( 0 ); 112 return( 0 ); 95 } 113 } 96 /* 114 /* 97 ********************************************** 115 *************************************************************** 98 */ 116 */ 99 G4int G4GIDI::numberOfDataDirectories( void ) << 117 int G4GIDI::numberOfDataDirectories( void ) { 100 118 101 return (G4int)dataDirectories.size( ); << 119 return( dataDirectories.size( ) ); 102 } 120 } 103 /* 121 /* 104 ********************************************** 122 *************************************************************** 105 */ 123 */ 106 G4int G4GIDI::addDataDirectory( const string & << 124 int G4GIDI::addDataDirectory( string &dataDirectory ) { >> 125 >> 126 list<G4GIDI_map *>::iterator iter; 107 127 108 for( auto iter = dataDirectories.cbegin( ) << 128 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) { 109 if( (*iter)->path( ) == dataDirectory 129 if( (*iter)->path( ) == dataDirectory ) return( 0 ); 110 } 130 } 111 131 112 G4GIDI_map *map = new G4GIDI_map( dataDire 132 G4GIDI_map *map = new G4GIDI_map( dataDirectory ); 113 dataDirectories.push_back( map ); 133 dataDirectories.push_back( map ); 114 134 115 return( 0 ); 135 return( 0 ); 116 } 136 } 117 /* 137 /* 118 ********************************************** 138 *************************************************************** 119 */ 139 */ 120 G4int G4GIDI::removeDataDirectory( const strin << 140 int G4GIDI::removeDataDirectory( string &dataDirectory ) { 121 141 122 for( auto iter = dataDirectories.cbegin( ) << 142 list<G4GIDI_map *>::iterator iter; >> 143 >> 144 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) { 123 if( dataDirectory == (*iter)->path( ) 145 if( dataDirectory == (*iter)->path( ) ) { 124 146 125 } 147 } 126 } 148 } 127 return( 0 ); 149 return( 0 ); 128 } 150 } 129 /* 151 /* 130 ********************************************** 152 *************************************************************** 131 */ 153 */ 132 string G4GIDI::getDataDirectoryAtIndex( G4int << 154 //string G4GIDI::getDataDirectoryAtIndex( int index ) { >> 155 string G4GIDI::getDataDirectoryAtIndex( int ) { 133 156 >> 157 #if 0 >> 158 list<G4GIDI_map *>::iterator iter; 134 unsigned i = (unsigned) index; 159 unsigned i = (unsigned) index; 135 160 136 if( index >= 0 ) { << 161 if( i < 0 ) return( "" ); 137 if( i >= dataDirectories.size( ) ) ret << 162 if( i >= dataDirectories.size( ) ) return( "" ); 138 for( auto iter = dataDirectories.cbegi << 163 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, i-- ) { 139 if( index == 0 ) return( (*iter)->fi << 164 if( i == 0 ) return( (*iter)->fileName( ) ); 140 } 165 } 141 << 166 #endif 142 return( "" ); 167 return( "" ); 143 } 168 } 144 /* 169 /* 145 ********************************************** 170 *************************************************************** 146 */ 171 */ 147 vector<string> *G4GIDI::getDataDirectories( vo 172 vector<string> *G4GIDI::getDataDirectories( void ) { 148 173 149 std::size_t i = 0; << 174 int i = 0; >> 175 list<G4GIDI_map *>::iterator iter; 150 vector<string> *v = new vector<string>( nu 176 vector<string> *v = new vector<string>( numberOfDataDirectories( ) ); 151 177 152 for( auto iter = dataDirectories.cbegin( ) << 178 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, i++ ) (*v)[i] = string( (*iter)->fileName( ) ); 153 (*v)[i] = string( (*iter)->fileName( ) ) << 154 return( v ); 179 return( v ); 155 } 180 } 156 /* 181 /* 157 ********************************************** 182 *************************************************************** 158 */ 183 */ 159 G4bool G4GIDI::isThisDataAvailable( const stri << 184 bool G4GIDI::isThisDataAvailable( string &lib_name, int iZ, int iA, int iM ) { 160 185 161 G4bool b; << 186 bool b; 162 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 187 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ); 163 188 164 if( targetName == nullptr ) return( false << 189 if( targetName == NULL ) return( false ); 165 string targetSymbol( targetName ); 190 string targetSymbol( targetName ); 166 b = isThisDataAvailable( lib_name, targetS 191 b = isThisDataAvailable( lib_name, targetSymbol ); 167 smr_freeMemory( (void **) &targetName ); << 192 xData_free( NULL, targetName ); 168 return( b ); 193 return( b ); 169 } 194 } 170 /* 195 /* 171 ********************************************** 196 *************************************************************** 172 */ 197 */ 173 G4bool G4GIDI::isThisDataAvailable( const stri << 198 bool G4GIDI::isThisDataAvailable( string &lib_name, string &targetName ) { 174 199 175 char *path = dataFilename( lib_name, targe 200 char *path = dataFilename( lib_name, targetName ); 176 201 177 if( path != nullptr ) { << 202 if( path != NULL ) { 178 smr_freeMemory( (void **) &path ); << 203 xData_free( NULL, path ); 179 return( true ); 204 return( true ); 180 } 205 } 181 return( false ); 206 return( false ); 182 } 207 } 183 /* 208 /* 184 ********************************************** 209 *************************************************************** 185 */ 210 */ 186 char *G4GIDI::dataFilename( const string &lib_ << 211 char *G4GIDI::dataFilename( string &lib_name, int iZ, int iA, int iM ) { 187 212 188 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 213 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ), *fileName; 189 214 190 if( targetName == nullptr ) return( nullpt << 215 if( targetName == NULL ) return( NULL ); 191 string targetSymbol( targetName ); 216 string targetSymbol( targetName ); 192 fileName = dataFilename( lib_name, targetS 217 fileName = dataFilename( lib_name, targetSymbol ); 193 smr_freeMemory( (void **) &targetName ); << 218 xData_free( NULL, targetName ); 194 return( fileName ); 219 return( fileName ); 195 } 220 } 196 /* 221 /* 197 ********************************************** 222 *************************************************************** 198 */ 223 */ 199 char *G4GIDI::dataFilename( const string &lib_ << 224 char *G4GIDI::dataFilename( string &lib_name, string &targetSymbol ) { 200 225 201 char *path; << 226 //char *path, *projectile = "n_1"; 202 << 227 char *path, *projectile = (char*)"n_1"; 203 for( auto iter = dataDirectories.cbegin( ); << 228 list<G4GIDI_map *>::iterator iter; 204 if( ( path = MCGIDI_map_findTarget( null << 229 205 return( path ); << 230 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) { 206 << 231 if( ( path = tpia_map_findTarget( &((*iter)->smr), (*iter)->map, lib_name.c_str( ), projectile, targetSymbol.c_str( ) ) ) != NULL ) { 207 return( nullptr ); << 232 return( path ); >> 233 } >> 234 } >> 235 return( NULL ); 208 } 236 } 209 /* 237 /* 210 ********************************************** 238 *************************************************************** 211 */ 239 */ 212 vector<string> *G4GIDI::getNamesOfAvailableLib << 240 vector<string> *G4GIDI::getNamesOfAvailableLibraries( int iZ, int iA, int iM ) { 213 241 214 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 242 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ); 215 vector<string> *listOfLibraries; 243 vector<string> *listOfLibraries; 216 244 217 if( targetName == nullptr ) return( new ve << 245 if( targetName == NULL ) return( new vector<string>( ) ); 218 string targetSymbol( targetName ); 246 string targetSymbol( targetName ); 219 listOfLibraries = getNamesOfAvailableLibra 247 listOfLibraries = getNamesOfAvailableLibraries( targetSymbol ); 220 smr_freeMemory( (void **) &targetName ); << 248 xData_free( NULL, targetName ); 221 return( listOfLibraries ); 249 return( listOfLibraries ); 222 } 250 } 223 /* 251 /* 224 ********************************************** 252 *************************************************************** 225 */ 253 */ 226 vector<string> *G4GIDI::getNamesOfAvailableLib << 254 vector<string> *G4GIDI::getNamesOfAvailableLibraries( string &targetName ) { 227 255 >> 256 //char *projectile = "n_1"; >> 257 char *projectile = (char*)"n_1"; >> 258 list<G4GIDI_map *>::iterator iter; 228 vector<string> *listOfLibraries = new vect 259 vector<string> *listOfLibraries = new vector<string>( ); 229 260 230 MCGIDI_map *map; << 261 tpia_map *map; 231 MCGIDI_mapEntry *entry; << 262 tpia_mapEntry *entry; 232 << 263 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) { 233 for( auto iter = dataDirectories.cbegin( ) << 264 map = tpia_map_findAllOfTarget( &((*iter)->smr), (*iter)->map, projectile, targetName.c_str( ) ); 234 map = MCGIDI_map_findAllOfTarget( &((* << 265 for( entry = tpia_map_getFirstEntry( map ); entry != NULL; entry = tpia_map_getNextEntry( entry ) ) { 235 for( entry = MCGIDI_map_getFirstEntry( << 236 listOfLibraries->push_back( entry- 266 listOfLibraries->push_back( entry->evaluation ); 237 } 267 } 238 MCGIDI_map_free( nullptr, map ); << 268 tpia_map_free( NULL, map ); 239 } 269 } 240 return( listOfLibraries ); 270 return( listOfLibraries ); 241 } 271 } 242 /* 272 /* 243 ********************************************** 273 *************************************************************** 244 */ 274 */ 245 vector<string> *G4GIDI::getNamesOfAvailableTar 275 vector<string> *G4GIDI::getNamesOfAvailableTargets( void ) { 246 276 247 vector<string> *listOfTargets; 277 vector<string> *listOfTargets; >> 278 list<G4GIDI_map *>::iterator iter_map; 248 279 249 listOfTargets = new vector<string>( ); 280 listOfTargets = new vector<string>( ); 250 if( listOfTargets == nullptr ) return( nul << 281 if( listOfTargets == NULL ) return( NULL ); 251 for( auto iter_map = dataDirectories.cbegi << 282 for( iter_map = dataDirectories.begin( ); iter_map != dataDirectories.end( ); iter_map++ ) { 252 if( MCGIDI_map_walkTree( nullptr, (*it << 283 if( tpia_map_walkTree( NULL, (*iter_map)->map, getNamesOfAvailableTargets_walker, (void *) listOfTargets ) != 0 ) { 253 delete listOfTargets; 284 delete listOfTargets; 254 return( nullptr ); << 285 return( NULL ); 255 } 286 } 256 } 287 } 257 return( listOfTargets ); 288 return( listOfTargets ); 258 } 289 } 259 /* 290 /* 260 ********************************************** 291 *************************************************************** 261 */ 292 */ 262 G4GIDI_target *G4GIDI::readTarget( const strin << 293 G4GIDI_target *G4GIDI::readTarget( string &lib_name, int iZ, int iA, int iM, bool bind ) { 263 294 264 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 295 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ); 265 G4GIDI_target *target; 296 G4GIDI_target *target; 266 297 267 if( targetName == nullptr ) return( nullpt << 298 if( targetName == NULL ) return( NULL ); 268 string targetSymbol( targetName ); 299 string targetSymbol( targetName ); 269 target = readTarget( lib_name, targetSymbo 300 target = readTarget( lib_name, targetSymbol, bind ); 270 smr_freeMemory( (void **) &targetName ); << 301 xData_free( NULL, targetName ); 271 return( target ); 302 return( target ); 272 } 303 } 273 /* 304 /* 274 ********************************************** 305 *************************************************************** 275 */ 306 */ 276 G4GIDI_target *G4GIDI::readTarget( const strin << 307 G4GIDI_target *G4GIDI::readTarget( string &lib_name, string &targetName, bool bind ) { 277 308 278 for( auto iter_targets = targets.cbegin( ) << 309 vector<G4GIDI_target *>::iterator iter_targets; 279 if( (*iter_targets)->name == targetNam << 310 >> 311 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) { >> 312 if( (*iter_targets)->name == targetName ) return( NULL ); 280 } 313 } 281 char *path = dataFilename( lib_name, targe 314 char *path = dataFilename( lib_name, targetName ); 282 if( path == nullptr ) return( nullptr ); << 315 if( path == NULL ) return( NULL ); 283 316 284 G4GIDI_target *target = new G4GIDI_target( 317 G4GIDI_target *target = new G4GIDI_target( path ); 285 if( bind ) targets.push_back( target ); 318 if( bind ) targets.push_back( target ); 286 smr_freeMemory( (void **) &path ); << 319 xData_free( NULL, path ); 287 return( target ); 320 return( target ); 288 } 321 } 289 /* 322 /* 290 ********************************************** 323 *************************************************************** 291 */ 324 */ 292 G4GIDI_target *G4GIDI::getAlreadyReadTarget( G << 325 G4GIDI_target *G4GIDI::getAlreadyReadTarget( int iZ, int iA, int iM ) { 293 326 294 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 327 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ); 295 G4GIDI_target *target; 328 G4GIDI_target *target; 296 329 297 if( targetName == nullptr ) return( nullpt << 330 if( targetName == NULL ) return( NULL ); 298 string targetSymbol( targetName ); 331 string targetSymbol( targetName ); 299 target = getAlreadyReadTarget( targetSymbo 332 target = getAlreadyReadTarget( targetSymbol ); 300 smr_freeMemory( (void **) &targetName ); << 333 xData_free( NULL, targetName ); 301 return( target ); 334 return( target ); 302 } 335 } 303 /* 336 /* 304 ********************************************** 337 *************************************************************** 305 */ 338 */ 306 G4GIDI_target *G4GIDI::getAlreadyReadTarget( c << 339 G4GIDI_target *G4GIDI::getAlreadyReadTarget( string &targetSymbol ) { >> 340 >> 341 vector<G4GIDI_target *>::iterator iter_targets; 307 342 308 for( auto iter_targets = targets.cbegin( ) << 343 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) { 309 if( ( (*iter_targets)->name == targetS 344 if( ( (*iter_targets)->name == targetSymbol ) ) return( *iter_targets ); 310 } 345 } 311 return( nullptr ); << 346 return( NULL ); 312 } 347 } 313 /* 348 /* 314 ********************************************** 349 *************************************************************** 315 */ 350 */ 316 G4int G4GIDI::freeTarget( G4GIDI_target *targe << 351 int G4GIDI::freeTarget( G4GIDI_target *target ) { 317 352 318 for( auto iter_targets = targets.cbegin( ) << 353 vector<G4GIDI_target *>::iterator iter_targets; >> 354 >> 355 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) { 319 if( *iter_targets == target ) { 356 if( *iter_targets == target ) { 320 targets.erase( iter_targets ); 357 targets.erase( iter_targets ); 321 delete target; 358 delete target; 322 return( 0 ); 359 return( 0 ); 323 } 360 } 324 } 361 } 325 return( 1 ); 362 return( 1 ); 326 } 363 } 327 /* 364 /* 328 ********************************************** 365 *************************************************************** 329 */ 366 */ 330 G4int G4GIDI::freeTarget( G4int iZ, G4int iA, << 367 int G4GIDI::freeTarget( int iZ, int iA, int iM ) { 331 368 332 G4int status; << 369 int status; 333 char *targetName = G4GIDI_Misc_Z_A_m_ToNam 370 char *targetName = G4GIDI_Misc_Z_A_m_ToName( iZ, iA, iM ); 334 371 335 if( targetName == nullptr ) return( 1 ); << 372 if( targetName == NULL ) return( 1 ); 336 string targetSymbol( targetName ); 373 string targetSymbol( targetName ); 337 status = freeTarget( targetSymbol ); 374 status = freeTarget( targetSymbol ); 338 smr_freeMemory( (void **) &targetName ); << 375 xData_free( NULL, targetName ); 339 return( status ); 376 return( status ); 340 } 377 } 341 /* 378 /* 342 ********************************************** 379 *************************************************************** 343 */ 380 */ 344 G4int G4GIDI::freeTarget( const string &target << 381 int G4GIDI::freeTarget( string &targetSymbol ) { >> 382 >> 383 vector<G4GIDI_target *>::iterator iter_targets; 345 384 346 for( auto iter_targets = targets.cbegin( ) << 385 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) { 347 if( (*iter_targets)->name == targetSym 386 if( (*iter_targets)->name == targetSymbol ) return( freeTarget( *iter_targets ) ); 348 } 387 } 349 return( 1 ); 388 return( 1 ); 350 } 389 } 351 /* 390 /* 352 ********************************************** 391 *************************************************************** 353 */ 392 */ 354 vector<string> *G4GIDI::getListOfReadTargetsNa 393 vector<string> *G4GIDI::getListOfReadTargetsNames( void ) { 355 394 >> 395 vector<G4GIDI_target *>::iterator iter_targets; 356 vector<string> *listOfTargets; 396 vector<string> *listOfTargets; 357 397 358 listOfTargets = new vector<string>( ); 398 listOfTargets = new vector<string>( ); 359 if( listOfTargets == nullptr ) return( nul << 399 if( listOfTargets == NULL ) return( NULL ); 360 for( auto iter_targets = targets.cbegin( ) << 400 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) { 361 listOfTargets->push_back( *(*iter_targ 401 listOfTargets->push_back( *(*iter_targets)->getName( ) ); 362 } 402 } 363 return( listOfTargets ); 403 return( listOfTargets ); 364 } 404 } 365 405