| 1 | #include <cstdlib> | 
| 2 | #include <cstring> | 
| 3 |  | 
| 4 | #include "TorsionStamp.hpp" | 
| 5 |  | 
| 6 | TorsionStamp::TorsionStamp(){ | 
| 7 |  | 
| 8 | have_mbrs = 0; | 
| 9 | have_constraint = 0; | 
| 10 |  | 
| 11 | unhandled = NULL; | 
| 12 | have_extras = 0; | 
| 13 | } | 
| 14 |  | 
| 15 | TorsionStamp::~TorsionStamp(){ | 
| 16 |  | 
| 17 | if( unhandled != NULL ) delete unhandled; | 
| 18 | } | 
| 19 |  | 
| 20 | void TorsionStamp::members( int the_a, int the_b, int the_c, int the_d ){ | 
| 21 |  | 
| 22 | a = the_a; | 
| 23 | b = the_b; | 
| 24 | c = the_c; | 
| 25 | d = the_d; | 
| 26 | have_mbrs = 1; | 
| 27 | } | 
| 28 |  | 
| 29 | void TorsionStamp::constrain( double the_constraint ){ | 
| 30 |  | 
| 31 | constraint = the_constraint; | 
| 32 | have_constraint = 1; | 
| 33 | } | 
| 34 |  | 
| 35 | void TorsionStamp::assignString( char* lhs, char* rhs ){ | 
| 36 |  | 
| 37 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 38 | else unhandled->add( lhs, rhs ); | 
| 39 | have_extras = 1; | 
| 40 | } | 
| 41 |  | 
| 42 | void TorsionStamp::assignDouble( char* lhs, double rhs ){ | 
| 43 |  | 
| 44 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 45 | else unhandled->add( lhs, rhs ); | 
| 46 | have_extras = 1; | 
| 47 | } | 
| 48 |  | 
| 49 | void TorsionStamp::assignInt( char* lhs, int rhs ){ | 
| 50 |  | 
| 51 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 52 | else unhandled->add( lhs, rhs ); | 
| 53 | have_extras = 1; | 
| 54 | } | 
| 55 |  | 
| 56 | char* TorsionStamp::checkMe(){ | 
| 57 |  | 
| 58 | if( !have_mbrs ){ | 
| 59 | return strdup( "TorsionStamp error. Torsion was not given members." ); | 
| 60 | } | 
| 61 |  | 
| 62 | return NULL; | 
| 63 | } |