ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/generic_stamps/AtomStamp.cpp
Revision: 160
Committed: Wed Oct 30 22:38:22 2002 UTC (21 years, 10 months ago) by mmeineke
File size: 1351 byte(s)
Log Message:
*** empty log message ***

File Contents

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