Molmodel

VmdConnection.h

Go to the documentation of this file.
00001 #ifndef SimTK_MOLMODEL_VMDCONNECTION_H_
00002 #define SimTK_MOLMODEL_VMDCONNECTION_H_
00003 
00004 #include "molmodel/internal/common.h"
00005 #include <vector>
00006 
00007 namespace SimTK {
00008     
00009 class SimTK_MOLMODEL_EXPORT VmdFloat3 
00010 {
00011 public:
00012     VmdFloat3(float x, float y, float z)
00013     {
00014         d[0] = x;
00015         d[1] = y;
00016         d[2] = z;
00017     }
00018         
00019     float& operator[](int i) {return d[i];}
00020     const float& operator[](int i) const {return d[i];}
00021 
00022 private:
00023     float d[3];
00024 };
00025 
00026 class SimTK_MOLMODEL_EXPORT VmdConnection
00027 {
00028 public:
00029     
00030     explicit VmdConnection(int portNumber);
00031     
00032     ~VmdConnection();
00033     
00034     bool checkForConnection() ;
00035     
00036     bool clientIsConnected() const;
00037     
00038     void sendCoordinates(std::vector<VmdFloat3> coords);
00039 
00040     void closeClientConnection();
00041 
00042     int getSocketNumber() const;
00043 
00044 private:
00045     int socketNumber;
00046     void *socket;
00047     void *clientSocket;
00048 };
00049 
00050 } // namespace SimTK
00051 
00052 #endif // SimTK_MOLMODEL_VMDCONNECTION_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines