48 for(
auto iter = dataDirectoryList.begin( ); iter != dataDirectoryList.end( ); ++iter )
57 auto iter = dataDirectories.cbegin();
59 while( targets.size( ) > 0 ) {
60 target = targets.back( );
65 while( iter != dataDirectories.cend() ) {
67 dataDirectories.pop_front( );
77 projectile = string(
"g" ); }
79 projectile = string(
"n" ); }
81 projectile = string(
"p" ); }
83 projectile = string(
"d" ); }
85 projectile = string(
"t" ); }
87 projectile = string(
"h" ); }
89 projectile = string(
"a" ); }
91 printf(
"Invalid projectile ID = %d\n", ip );
101 return (
G4int)dataDirectories.size( );
108 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter ) {
109 if( (*iter)->path( ) == dataDirectory )
return( 0 );
113 dataDirectories.push_back( map );
122 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter ) {
123 if( dataDirectory == (*iter)->path( ) ) {
134 unsigned i = (unsigned) index;
137 if( i >= dataDirectories.size( ) )
return(
"" );
138 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter, --index )
139 if( index == 0 )
return( (*iter)->fileName( ) );
152 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter, ++i )
153 (*v)[i] = string( (*iter)->fileName( ) );
164 if( targetName ==
nullptr )
return(
false );
165 string targetSymbol( targetName );
177 if( path !=
nullptr ) {
190 if( targetName ==
nullptr )
return(
nullptr );
191 string targetSymbol( targetName );
203 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter )
204 if( ( path =
MCGIDI_map_findTarget(
nullptr, (*iter)->map, lib_name.c_str(), projectile.c_str( ), targetSymbol.c_str( ) ) ) !=
nullptr )
215 vector<string> *listOfLibraries;
217 if( targetName ==
nullptr )
return(
new vector<string>( ) );
218 string targetSymbol( targetName );
221 return( listOfLibraries );
228 vector<string> *listOfLibraries =
new vector<string>( );
233 for(
auto iter = dataDirectories.cbegin( ); iter != dataDirectories.cend( ); ++iter ) {
236 listOfLibraries->push_back( entry->
evaluation );
240 return( listOfLibraries );
247 vector<string> *listOfTargets;
249 listOfTargets =
new vector<string>( );
250 if( listOfTargets ==
nullptr )
return(
nullptr );
251 for(
auto iter_map = dataDirectories.cbegin( ); iter_map != dataDirectories.cend( ); ++iter_map ) {
253 delete listOfTargets;
257 return( listOfTargets );
267 if( targetName ==
nullptr )
return(
nullptr );
268 string targetSymbol( targetName );
269 target =
readTarget( lib_name, targetSymbol, bind );
278 for(
auto iter_targets = targets.cbegin( ); iter_targets != targets.cend( ); ++iter_targets ) {
279 if( (*iter_targets)->name == targetName )
return(
nullptr );
282 if( path ==
nullptr )
return(
nullptr );
285 if( bind ) targets.push_back( target );
297 if( targetName ==
nullptr )
return(
nullptr );
298 string targetSymbol( targetName );
308 for(
auto iter_targets = targets.cbegin( ); iter_targets != targets.cend( ); ++iter_targets ) {
309 if( ( (*iter_targets)->name == targetSymbol ) )
return( *iter_targets );
318 for(
auto iter_targets = targets.cbegin( ); iter_targets != targets.cend( ); ++iter_targets ) {
319 if( *iter_targets == target ) {
320 targets.erase( iter_targets );
335 if( targetName ==
nullptr )
return( 1 );
336 string targetSymbol( targetName );
346 for(
auto iter_targets = targets.cbegin( ); iter_targets != targets.cend( ); ++iter_targets ) {
347 if( (*iter_targets)->name == targetSymbol )
return(
freeTarget( *iter_targets ) );
356 vector<string> *listOfTargets;
358 listOfTargets =
new vector<string>( );
359 if( listOfTargets ==
nullptr )
return(
nullptr );
360 for(
auto iter_targets = targets.cbegin( ); iter_targets != targets.cend( ); ++iter_targets ) {
361 listOfTargets->push_back( *(*iter_targets)->getName( ) );
363 return( listOfTargets );
int getNamesOfAvailableTargets_walker(GIDI::MCGIDI_mapEntry *entry, int level, void *userData)
char * G4GIDI_Misc_Z_A_m_ToName(int iZ, int iA, int im=0)
int MCGIDI_map_walkTree(statusMessageReporting *smr, MCGIDI_map *map, int(*handler)(MCGIDI_mapEntry *entry, int level, void *userData), void *userData)
void * MCGIDI_map_free(statusMessageReporting *smr, MCGIDI_map *map)
char * MCGIDI_map_findTarget(statusMessageReporting *smr, MCGIDI_map *map, const char *evaluation, const char *projectile, const char *targetName)
MCGIDI_mapEntry * MCGIDI_map_getFirstEntry(MCGIDI_map *map)
MCGIDI_mapEntry * MCGIDI_map_getNextEntry(MCGIDI_mapEntry *entry)
MCGIDI_map * MCGIDI_map_findAllOfTarget(statusMessageReporting *smr, MCGIDI_map *map, const char *projectile, const char *targetName)
G4int removeDataDirectory(std::string &dataDirectory)
char * dataFilename(std::string &lib_name, G4int iZ, G4int iA, G4int iM=0)
G4GIDI_target * readTarget(std::string &lib_name, G4int iZ, G4int iA, G4int iM=0, G4bool bind=true)
G4GIDI_target * getAlreadyReadTarget(G4int iZ, G4int iA, G4int iM=0)
G4int addDataDirectory(std::string &dataDirectory)
G4GIDI(G4int ip, std::string &dataDirectory)
std::vector< std::string > * getNamesOfAvailableTargets(void)
std::vector< std::string > * getDataDirectories(void)
std::vector< std::string > * getListOfReadTargetsNames(void)
std::string getDataDirectoryAtIndex(G4int index)
std::vector< std::string > * getNamesOfAvailableLibraries(G4int iZ, G4int iA, G4int iM=0)
G4int freeTarget(G4int iZ, G4int iA, G4int iM=0)
G4bool isThisDataAvailable(std::string &lib_name, G4int iZ, G4int iA, G4int iM=0)
G4int numberOfDataDirectories(void)
void * smr_freeMemory(void **p)