82 list<string>::iterator iter;
85 for( iter = dataDirectoryList.begin( ); iter != dataDirectoryList.end( ); ++iter )
addDataDirectory( *iter );
93 list<G4GIDI_map *>::iterator iter;
95 while( targets.size( ) > 0 ) {
96 target = targets.back( );
101 while( ( iter = dataDirectories.begin( ) ) != dataDirectories.end( ) ) {
103 dataDirectories.pop_front( );
109int G4GIDI::init(
int ip ) {
119 return( dataDirectories.size( ) );
126 list<G4GIDI_map *>::iterator iter;
128 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
129 if( (*iter)->path( ) == dataDirectory )
return( 0 );
133 dataDirectories.push_back( map );
142 list<G4GIDI_map *>::iterator iter;
144 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
145 if( dataDirectory == (*iter)->path( ) ) {
158 list<G4GIDI_map *>::iterator iter;
159 unsigned i = (unsigned) index;
161 if( i < 0 )
return(
"" );
162 if( i >= dataDirectories.size( ) )
return(
"" );
163 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, i-- ) {
164 if( i == 0 )
return( (*iter)->fileName( ) );
175 list<G4GIDI_map *>::iterator iter;
178 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, i++ ) (*v)[i] = string( (*iter)->fileName( ) );
189 if( targetName == NULL )
return(
false );
190 string targetSymbol( targetName );
215 if( targetName == NULL )
return( NULL );
216 string targetSymbol( targetName );
227 char *path, *projectile = (
char*)
"n_1";
228 list<G4GIDI_map *>::iterator iter;
230 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
231 if( ( path =
tpia_map_findTarget( &((*iter)->smr), (*iter)->map, lib_name.c_str( ), projectile, targetSymbol.c_str( ) ) ) != NULL ) {
243 vector<string> *listOfLibraries;
245 if( targetName == NULL )
return(
new vector<string>( ) );
246 string targetSymbol( targetName );
249 return( listOfLibraries );
257 char *projectile = (
char*)
"n_1";
258 list<G4GIDI_map *>::iterator iter;
259 vector<string> *listOfLibraries =
new vector<string>( );
263 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
266 listOfLibraries->push_back( entry->
evaluation );
270 return( listOfLibraries );
277 vector<string> *listOfTargets;
278 list<G4GIDI_map *>::iterator iter_map;
280 listOfTargets =
new vector<string>( );
281 if( listOfTargets == NULL )
return( NULL );
282 for( iter_map = dataDirectories.begin( ); iter_map != dataDirectories.end( ); iter_map++ ) {
284 delete listOfTargets;
288 return( listOfTargets );
298 if( targetName == NULL )
return( NULL );
299 string targetSymbol( targetName );
300 target =
readTarget( lib_name, targetSymbol, bind );
309 vector<G4GIDI_target *>::iterator iter_targets;
311 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
312 if( (*iter_targets)->name == targetName )
return( NULL );
315 if( path == NULL )
return( NULL );
318 if( bind ) targets.push_back( target );
330 if( targetName == NULL )
return( NULL );
331 string targetSymbol( targetName );
341 vector<G4GIDI_target *>::iterator iter_targets;
343 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
344 if( ( (*iter_targets)->name == targetSymbol ) )
return( *iter_targets );
353 vector<G4GIDI_target *>::iterator iter_targets;
355 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
356 if( *iter_targets == target ) {
357 targets.erase( iter_targets );
372 if( targetName == NULL )
return( 1 );
373 string targetSymbol( targetName );
383 vector<G4GIDI_target *>::iterator iter_targets;
385 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
386 if( (*iter_targets)->name == targetSymbol )
return(
freeTarget( *iter_targets ) );
395 vector<G4GIDI_target *>::iterator iter_targets;
396 vector<string> *listOfTargets;
398 listOfTargets =
new vector<string>( );
399 if( listOfTargets == NULL )
return( NULL );
400 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
401 listOfTargets->push_back( *(*iter_targets)->getName( ) );
403 return( listOfTargets );
char * G4GIDI_Misc_Z_A_m_ToName(int iZ, int iA, int im=0)
int getNamesOfAvailableTargets_walker(GIDI::tpia_mapEntry *entry, int level, void *userData)
G4GIDI(int ip, std::string &dataDirectory)
int removeDataDirectory(std::string &dataDirectory)
G4GIDI_target * getAlreadyReadTarget(int iZ, int iA, int iM=0)
bool isThisDataAvailable(std::string &lib_name, int iZ, int iA, int iM=0)
std::vector< std::string > * getNamesOfAvailableTargets(void)
std::vector< std::string > * getDataDirectories(void)
int numberOfDataDirectories(void)
std::string getDataDirectoryAtIndex(int index)
std::vector< std::string > * getListOfReadTargetsNames(void)
G4GIDI_target * readTarget(std::string &lib_name, int iZ, int iA, int iM=0, bool bind=true)
int freeTarget(int iZ, int iA, int iM=0)
int addDataDirectory(std::string &dataDirectory)
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
char * dataFilename(std::string &lib_name, int iZ, int iA, int iM=0)
tpia_mapEntry * tpia_map_getNextEntry(tpia_mapEntry *entry)
char * tpia_map_findTarget(statusMessageReporting *smr, tpia_map *map, const char *evaluation, const char *projectile, const char *targetName)
tpia_mapEntry * tpia_map_getFirstEntry(tpia_map *map)
int tpia_map_walkTree(statusMessageReporting *smr, tpia_map *map, int(*handler)(tpia_mapEntry *entry, int level, void *userData), void *userData)
tpia_map * tpia_map_findAllOfTarget(statusMessageReporting *smr, tpia_map *map, const char *projectile, const char *targetName)
void * tpia_map_free(statusMessageReporting *smr, tpia_map *map)
void * xData_free(statusMessageReporting *smr, void *p)