Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PoPs_private.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  unitsDB_s
 
struct  PoPs_s
 

Typedefs

typedef struct unitsDB_s unitsDB
 
typedef struct PoPs_s PoPs
 

Functions

int PoPs_releasePrivate (statusMessageReporting *smr)
 
char const * unitsDB_addUnitIfNeeded (statusMessageReporting *smr, char const *unit)
 
int unitsDB_index (statusMessageReporting *smr, char const *unit)
 
char const * unitsDB_stringFromIndex (statusMessageReporting *smr, int index)
 

Typedef Documentation

typedef struct PoPs_s PoPs

Definition at line 15 of file PoPs_private.h.

typedef struct unitsDB_s unitsDB

Definition at line 14 of file PoPs_private.h.

Function Documentation

int PoPs_releasePrivate ( statusMessageReporting smr)

Definition at line 98 of file PoPs.cc.

98  {
99 
100  int i;
101 
102  for( i = 0; i < popsRoot.numberOfParticles; i++ ) PoP_free( popsRoot.pops[i] );
103  smr_freeMemory( (void **) &(popsRoot.pops) );
104  popsRoot.sorted = NULL;
106  popsRoot.allocated = 0;
107  unitsDB_release( );
108  return( 0 );
109 }
int allocated
Definition: PoPs_private.h:25
PoP ** sorted
Definition: PoPs_private.h:27
static int unitsDB_release(void)
Definition: PoPs.cc:687
PoP * PoP_free(PoP *pop)
Definition: PoPs.cc:558
void * smr_freeMemory(void **p)
int numberOfParticles
Definition: PoPs_private.h:24
PoP ** pops
Definition: PoPs_private.h:26
static PoPs popsRoot
Definition: PoPs.cc:43

Here is the call graph for this function:

Here is the caller graph for this function:

char const* unitsDB_addUnitIfNeeded ( statusMessageReporting smr,
char const *  unit 
)

Definition at line 700 of file PoPs.cc.

700  {
701 
702  int i;
703 
704  for( i = 0; i < unitsRoot.numberOfUnits; i++ ) {
705  if( strcmp( unit, unitsRoot.unsorted[i] ) == 0 ) return( unitsRoot.unsorted[i] );
706  }
708  int size = unitsRoot.allocated + 20;
709  char const **unsorted = (char const **) smr_malloc2( smr, size * sizeof( char * ), 0, "unsorted" );
710 
711  if( unsorted == NULL ) return( NULL );
712  for( i = 0; i < unitsRoot.numberOfUnits; i++ ) unsorted[i] = unitsRoot.unsorted[i];
713  smr_freeMemory( (void **) &(unitsRoot.unsorted) );
714  unitsRoot.unsorted = unsorted;
715  unitsRoot.allocated = size;
716  }
717  if( ( unitsRoot.unsorted[unitsRoot.numberOfUnits] = smr_allocateCopyString2( smr, unit, "unitsRoot.unsorted[unitsRoot.numberOfUnits]" ) ) == NULL )
718  return( NULL );
720  return( unitsRoot.unsorted[unitsRoot.numberOfUnits - 1] );
721 }
#define smr_allocateCopyString2(smr, s, forItem)
int allocated
Definition: PoPs_private.h:19
int numberOfUnits
Definition: PoPs_private.h:18
#define smr_malloc2(smr, size, zero, forItem)
char const ** unsorted
Definition: PoPs_private.h:20
void * smr_freeMemory(void **p)
static unitsDB unitsRoot
Definition: PoPs.cc:42

Here is the call graph for this function:

Here is the caller graph for this function:

int unitsDB_index ( statusMessageReporting smr,
char const *  unit 
)

Definition at line 725 of file PoPs.cc.

725  {
726 
727  int i;
728 
729  for( i = 0; i < unitsRoot.numberOfUnits; i++ ) {
730  if( !strcmp( unit, unitsRoot.unsorted[i] ) ) return( i );
731  }
732  return( -1 );
733 }
int numberOfUnits
Definition: PoPs_private.h:18
char const ** unsorted
Definition: PoPs_private.h:20
static unitsDB unitsRoot
Definition: PoPs.cc:42
char const* unitsDB_stringFromIndex ( statusMessageReporting smr,
int  index 
)

Definition at line 737 of file PoPs.cc.

737  {
738 
739  if( ( index < 0 ) || ( index >= unitsRoot.numberOfUnits ) ) {
740  smr_setReportError2( smr, PoPs_smr_ID, 1, "index = %d out of baounds [0 to %d)", index, unitsRoot.numberOfUnits );
741  return( NULL );
742  }
743  return( unitsRoot.unsorted[index] );
744 }
int numberOfUnits
Definition: PoPs_private.h:18
int PoPs_smr_ID
Definition: PoPs.cc:35
#define smr_setReportError2(smr, libraryID, code, fmt,...)
char const ** unsorted
Definition: PoPs_private.h:20
static unitsDB unitsRoot
Definition: PoPs.cc:42