43 addDataDirectory( dataDirectory );
50 list<string>::iterator iter;
53 for( iter = dataDirectoryList.begin( ); iter != dataDirectoryList.end( ); ++iter ) addDataDirectory( *iter );
61 list<G4GIDI_map *>::iterator iter;
63 while( targets.size( ) > 0 ) {
64 target = targets.back( );
69 while( ( iter = dataDirectories.begin( ) ) != dataDirectories.end( ) ) {
71 dataDirectories.pop_front( );
81 projectile = string(
"g" ); }
83 projectile = string(
"n" ); }
85 projectile = string(
"p" ); }
87 projectile = string(
"d" ); }
89 projectile = string(
"t" ); }
91 projectile = string(
"h" ); }
93 projectile = string(
"a" ); }
95 printf(
"Invalid projectile ID = %d\n", ip );
105 return( dataDirectories.size( ) );
112 list<G4GIDI_map *>::iterator iter;
114 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
115 if( (*iter)->path( ) == dataDirectory )
return( 0 );
119 dataDirectories.push_back( map );
128 list<G4GIDI_map *>::iterator iter;
130 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
131 if( dataDirectory == (*iter)->path( ) ) {
142 list<G4GIDI_map *>::iterator iter;
143 unsigned i = (unsigned) index;
146 if( i >= dataDirectories.size( ) )
return(
"" );
147 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, index-- ) {
148 if( index == 0 )
return( (*iter)->fileName( ) );
160 list<G4GIDI_map *>::iterator iter;
161 vector<string> *v =
new vector<string>( numberOfDataDirectories( ) );
163 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++, i++ ) (*v)[i] = string( (*iter)->fileName( ) );
174 if( targetName == NULL )
return(
false );
175 string targetSymbol( targetName );
176 b = isThisDataAvailable( lib_name, targetSymbol );
185 char *path = dataFilename( lib_name, targetName );
200 if( targetName == NULL )
return( NULL );
201 string targetSymbol( targetName );
202 fileName = dataFilename( lib_name, targetSymbol );
225 list<G4GIDI_map *>::iterator iter;
227 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
228 if( ( path =
MCGIDI_map_findTarget( NULL, (*iter)->map, lib_name.c_str(), projectile.c_str( ), targetSymbol.c_str( ) ) ) != NULL ) {
240 vector<string> *listOfLibraries;
242 if( targetName == NULL )
return(
new vector<string>( ) );
243 string targetSymbol( targetName );
244 listOfLibraries = getNamesOfAvailableLibraries( targetSymbol );
246 return( listOfLibraries );
253 list<G4GIDI_map *>::iterator iter;
254 vector<string> *listOfLibraries =
new vector<string>( );
259 for( iter = dataDirectories.begin( ); iter != dataDirectories.end( ); iter++ ) {
262 listOfLibraries->push_back( entry->
evaluation );
266 return( listOfLibraries );
273 vector<string> *listOfTargets;
274 list<G4GIDI_map *>::iterator iter_map;
276 listOfTargets =
new vector<string>( );
277 if( listOfTargets == NULL )
return( NULL );
278 for( iter_map = dataDirectories.begin( ); iter_map != dataDirectories.end( ); iter_map++ ) {
280 delete listOfTargets;
284 return( listOfTargets );
294 if( targetName == NULL )
return( NULL );
295 string targetSymbol( targetName );
296 target = readTarget( lib_name, targetSymbol, bind );
305 vector<G4GIDI_target *>::iterator iter_targets;
307 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
308 if( (*iter_targets)->name == targetName )
return( NULL );
310 char *path = dataFilename( lib_name, targetName );
311 if( path == NULL )
return( NULL );
314 if( bind ) targets.push_back( target );
326 if( targetName == NULL )
return( NULL );
327 string targetSymbol( targetName );
328 target = getAlreadyReadTarget( targetSymbol );
337 vector<G4GIDI_target *>::iterator iter_targets;
339 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
340 if( ( (*iter_targets)->name == targetSymbol ) )
return( *iter_targets );
349 vector<G4GIDI_target *>::iterator iter_targets;
351 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
352 if( *iter_targets == target ) {
353 targets.erase( iter_targets );
368 if( targetName == NULL )
return( 1 );
369 string targetSymbol( targetName );
370 status = freeTarget( targetSymbol );
379 vector<G4GIDI_target *>::iterator iter_targets;
381 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
382 if( (*iter_targets)->name == targetSymbol )
return( freeTarget( *iter_targets ) );
391 vector<G4GIDI_target *>::iterator iter_targets;
392 vector<string> *listOfTargets;
394 listOfTargets =
new vector<string>( );
395 if( listOfTargets == NULL )
return( NULL );
396 for( iter_targets = targets.begin( ); iter_targets != targets.end( ); iter_targets++ ) {
397 listOfTargets->push_back( *(*iter_targets)->getName( ) );
399 return( listOfTargets );
G4GIDI(int ip, std::string &dataDirectory)
int freeTarget(int iZ, int iA, int iM=0)
std::string getDataDirectoryAtIndex(int index)
int addDataDirectory(std::string &dataDirectory)
bool isThisDataAvailable(std::string &lib_name, int iZ, int iA, int iM=0)
G4GIDI_target * getAlreadyReadTarget(int iZ, int iA, int iM=0)
std::vector< std::string > * getNamesOfAvailableTargets(void)
std::vector< std::string > * getListOfReadTargetsNames(void)
void * MCGIDI_map_free(statusMessageReporting *smr, MCGIDI_map *map)
std::vector< std::string > * getNamesOfAvailableLibraries(int iZ, int iA, int iM=0)
char * MCGIDI_map_findTarget(statusMessageReporting *smr, MCGIDI_map *map, const char *evaluation, const char *projectile, const char *targetName)
printf("%d Experimental points found\n", nlines)
MCGIDI_map * MCGIDI_map_findAllOfTarget(statusMessageReporting *smr, MCGIDI_map *map, const char *projectile, const char *targetName)
int numberOfDataDirectories(void)
void * smr_freeMemory(void **p)
MCGIDI_mapEntry * MCGIDI_map_getFirstEntry(MCGIDI_map *map)
MCGIDI_mapEntry * MCGIDI_map_getNextEntry(MCGIDI_mapEntry *entry)
int getNamesOfAvailableTargets_walker(GIDI::MCGIDI_mapEntry *entry, int level, void *userData)
G4GIDI_target * readTarget(std::string &lib_name, int iZ, int iA, int iM=0, bool bind=true)
std::vector< std::string > * getDataDirectories(void)
int MCGIDI_map_walkTree(statusMessageReporting *smr, MCGIDI_map *map, int(*handler)(MCGIDI_mapEntry *entry, int level, void *userData), void *userData)
char * G4GIDI_Misc_Z_A_m_ToName(int iZ, int iA, int im=0)
int removeDataDirectory(std::string &dataDirectory)
char * dataFilename(std::string &lib_name, int iZ, int iA, int iM=0)