ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/types/AtomStamp.cpp
Revision: 1490
Committed: Fri Sep 24 04:16:43 2004 UTC (19 years, 9 months ago) by gezelter
File size: 1418 byte(s)
Log Message:
Import of OOPSE v. 2.0

File Contents

# User Rev Content
1 gezelter 1490 #include <stdlib.h>
2     #include <stdio.h>
3     #include <string.h>
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 phi, double theta, double psi ){
32    
33     ornt[0] = phi;
34     ornt[1] = theta;
35     ornt[2] = psi;
36    
37     have_orientation = 1;
38     }
39    
40     char* 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     return NULL;
52     }
53    
54     char* 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     return NULL;
60     }
61    
62     char* AtomStamp::assignInt( char* lhs, int rhs ){
63    
64     if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs );
65     else unhandled->add( lhs, rhs );
66     have_extras = 1;
67     return NULL;
68     }
69    
70     char* AtomStamp::checkMe( void ){
71    
72     if( !have_type ){
73     return strdup( "AtomStamp error. Atom was untyped." );
74     }
75     return NULL;
76     }