Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ConfigConnection.C

Go to the documentation of this file.
00001 #include "ConfigConnection.h"
00005 #define CBUFFSIZE 4096
00006 
00007 
00008 ConfigConnection::ConfigConnection(BufferedFile * f): Connection<char>::Connection() {
00009         //Connection<char>::Connection();
00010         init(f,string(""));
00011         buffer = new char[CBUFFSIZE+1];
00012 }
00013 bool ConfigConnection::readReady() {
00014         return file->readReady();
00015 }
00016 bool ConfigConnection::writeReady() {
00017         return file->writeReady();
00018 }
00019 int ConfigConnection::getFileHandle() {
00020         return file->getFileHandle();
00021 }
00022 ConfigConnection::~ConfigConnection() {
00023         delete [] buffer;
00024 }
00025 bool ConfigConnection::isMessage() {
00026         return this->readReady();
00027 }
00028 Message * ConfigConnection::getMessage() {
00029         int total = this->read(buffer,CBUFFSIZE);
00030         if (total <= 0) {
00031                 disconnect();
00032                 throw new string("Connection Closed");
00033         }
00034         buffer[total] = '\0';
00035         string xml = ""+ string(buffer);
00036         while (total == CBUFFSIZE) {
00037                 total = this->read(buffer,CBUFFSIZE);
00038                 xml += buffer;
00039         }
00040         return new Message(xml);
00041 }
00042 string ConfigConnection::getType() {
00043         return "config";
00044 }
00045 int ConfigConnection::write(const char * data, int size) {
00046         return Connection<char>::write(data,size);
00047 }
00048 void ConfigConnection::setType(string type) {};
00049 void ConfigConnection::update() {
00050         //Why does this exist
00051         //Foreach connection make the XML and send!
00052         //vector<Connection<class T> *> * connectionList = Connector.getConnector()->getConnections();
00053         //vector<Connection<class T> *>::iterator iter;
00054         //char * str = "<update>";
00055         //int size = strlen(str);
00056         //this.write(str,size);
00057         //for (iter = connectionList->begin(); iter < connectionList->end(); iter++) {
00058         //       str = (*iter)->getXML()->c_str();
00059         //       size = strlen(str);
00060         //       this.write(str,size);
00061         //}
00062         //string s = "<time>"+Connector.lastUpdate()+"</time></update>";
00063         //str = s.c_str();
00064         //int size = strlen(str);
00065         //this.write(str,size);
00066 }

Generated on Tue Dec 17 21:14:13 2002 for AUSS_Connector by doxygen1.2.18