1 |
#include <cstdlib> |
2 |
#include <cstdio> |
3 |
#include <cstring> |
4 |
#include <iostream> |
5 |
|
6 |
#include "AtomStamp.hpp" |
7 |
|
8 |
|
9 |
AtomStamp::AtomStamp(){ |
10 |
|
11 |
unhandled = NULL; |
12 |
have_position = 0; |
13 |
have_orientation = 0; |
14 |
have_type = 0; |
15 |
have_extras = 0; |
16 |
} |
17 |
|
18 |
AtomStamp::~AtomStamp(){ |
19 |
|
20 |
if( unhandled != NULL ) delete unhandled; |
21 |
} |
22 |
|
23 |
void AtomStamp::setPosition( double x, double y, double z ){ |
24 |
|
25 |
pos[0] = x; |
26 |
pos[1] = y; |
27 |
pos[2] = z; |
28 |
|
29 |
have_position = 1; |
30 |
} |
31 |
|
32 |
void AtomStamp::setOrientation( double x, double y, double z ){ |
33 |
|
34 |
ornt[0] = x; |
35 |
ornt[1] = y; |
36 |
ornt[2] = z; |
37 |
|
38 |
have_orientation = 1; |
39 |
} |
40 |
|
41 |
void AtomStamp::assignString( char* lhs, char* rhs ){ |
42 |
|
43 |
if( !strcmp( lhs, "type" ) ){ |
44 |
strcpy( type, rhs ); |
45 |
have_type = 1; |
46 |
} |
47 |
else{ |
48 |
if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); |
49 |
else unhandled->add( lhs, rhs ); |
50 |
have_extras = 1; |
51 |
} |
52 |
} |
53 |
|
54 |
void AtomStamp::assignDouble( char* lhs, double rhs ){ |
55 |
|
56 |
if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); |
57 |
else unhandled->add( lhs, rhs ); |
58 |
have_extras = 1; |
59 |
} |
60 |
|
61 |
void AtomStamp::assignInt( char* lhs, int rhs ){ |
62 |
|
63 |
if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); |
64 |
else unhandled->add( lhs, rhs ); |
65 |
have_extras = 1; |
66 |
} |
67 |
|
68 |
char* AtomStamp::checkMe( void ){ |
69 |
|
70 |
if( !have_type ){ |
71 |
return strdup( "AtomStamp error. Atom was untyped." ); |
72 |
} |
73 |
return NULL; |
74 |
} |