00001 /* 00002 * File: BaseOneOperation.cpp 00003 * Author: nick 00004 * 00005 * Created on 26 Сентябрь 2011 г., 18:30 00006 */ 00007 00008 #include "BaseOneOperation.h" 00009 #include "OpenFiles.h" 00010 00011 template <class T> 00012 BaseOneOperation<T>::BaseOneOperation(Server &protocol, ServerConfig* sc,string tagNS) { 00013 this->sc = sc; 00014 this->protocol = &protocol; 00015 protocol.addIQHandler(this, tagNS); 00016 } 00017 00018 template <class T> 00019 void BaseOneOperation<T>::handleTag(TagIQ &tag) { 00020 if (tag.getType() == TagIQ::Get) { 00021 cout<<"B1"<<endl; 00022 T t(tag); 00023 cout<<"B2"<<endl; 00024 int res=this->fileFunc(&t); 00025 cout<<"B3"<<endl; 00026 T ftag(protocol->getCurNodeSend() ,"server",t.getFrom(),TagIQ::Result,t.getID()); 00027 cout<<"B4"<<endl; 00028 ftag.setResult(res); 00029 cout<<"B5"<<endl; 00030 protocol->sendNode(ftag); 00031 cout<<"B6"<<endl; 00032 } 00033 } 00034 00035 template <class T> 00036 BaseOneOperation<T>::~BaseOneOperation() { 00037 this->protocol->removeIQHandler(this); 00038 } 00039
1.7.1