# | Line 31 | Line 31 | MoleculeStamp* LinkedMolStamp::match( char* id ){ | |
---|---|---|
31 | if(next != NULL ){ | |
32 | if( next->match( id ) != NULL){ | |
33 | sprintf( painCave.errMsg, | |
34 | < | "Molecule Stamp Error. Two separate of declarations of %s present.\n", |
34 | > | "Molecule Stamp Error. Two separate of declarations of " |
35 | > | "%s present.\n", |
36 | id ); | |
37 | painCave.isFatal = 1; | |
38 | simError(); | |
# | Line 48 | Line 49 | MoleculeStamp* LinkedMolStamp::match( char* id ){ | |
49 | } | |
50 | ||
51 | if( next != NULL ) return next->match( id ); | |
52 | + | |
53 | + | return NULL; |
54 | + | } |
55 | + | |
56 | + | LinkedMolStamp* LinkedMolStamp::extract( char* id ){ |
57 | + | |
58 | + | if( mol_stamp != NULL ){ |
59 | + | if(!strcmp( mol_stamp->getID(), id )){ |
60 | + | |
61 | + | // make sure we aren't hiding somebody else with the same name |
62 | + | if(next != NULL ){ |
63 | + | if( next->match( id ) != NULL){ |
64 | + | sprintf( painCave.errMsg, |
65 | + | "Molecule Stamp Error. Two separate of declarations of " |
66 | + | "%s present.\n", |
67 | + | id ); |
68 | + | painCave.isFatal = 1; |
69 | + | simError(); |
70 | + | #ifdef IS_MPI |
71 | + | if( painCave.isEventLoop ){ |
72 | + | if( worldRank == 0 ) mpiInterfaceExit(); |
73 | + | } |
74 | + | #endif //is_mpi |
75 | + | } |
76 | + | } |
77 | + | |
78 | + | prev->setNext( next ); |
79 | + | if( next != NULL ) next->setPrev( prev ); |
80 | + | return this; |
81 | + | } |
82 | + | } |
83 | ||
84 | + | if( next != NULL ) return next->extract( id ); |
85 | + | |
86 | return NULL; | |
87 | } | |
88 | ||
# | Line 103 | Line 137 | int MakeStamps::hash( char* text ){ | |
137 | return key; | |
138 | } | |
139 | ||
140 | < | MoleculeStamp* MakeStamps::getMolecule( char* the_id ){ |
140 | > | LinkedMolStamp* MakeStamps::extractMolStamp( char* the_id ){ |
141 | int key; | |
142 | ||
143 | key = hash( the_id ); | |
144 | if( my_mols[key] != NULL ){ | |
145 | < | return my_mols[key]->match( the_id ); |
145 | > | return my_mols[key]->extract( the_id ); |
146 | } | |
147 | ||
148 | return NULL; |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |