GDCM  2.2.0
gdcmULEvent.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef GDCMULEVENT_H
00019 #define GDCMULEVENT_H
00020 
00021 #include "gdcmNetworkStateID.h"
00022 #include "gdcmNetworkEvents.h"
00023 #include "gdcmBasePDU.h"
00024 #include <vector>
00025 
00026 namespace gdcm {
00027   namespace network {
00028 
00037 class ULEvent {
00038       EEventID mEvent;
00039       std::vector<BasePDU*> mBasePDU;
00040 
00041       void DeletePDUVector(){
00042         std::vector<BasePDU*>::iterator baseItor;
00043         for (baseItor = mBasePDU.begin(); baseItor < mBasePDU.end(); baseItor++){
00044           if (*baseItor != NULL){
00045             delete *baseItor;
00046             *baseItor = NULL;
00047           }
00048         }
00049       }
00050 
00051     public:
00052       ULEvent(const EEventID& inEventID, std::vector<BasePDU*> inBasePDU){
00053         mEvent = inEventID;
00054         mBasePDU = inBasePDU;
00055       }
00056       ULEvent(const EEventID& inEventID, BasePDU* inBasePDU){
00057         mEvent = inEventID;
00058         mBasePDU.push_back(inBasePDU);
00059       }
00060       ~ULEvent(){
00061         DeletePDUVector();
00062       }
00063 
00064       EEventID GetEvent() const { return mEvent; }
00065       std::vector<BasePDU*> GetPDUs() const { return mBasePDU; }
00066 
00067       void SetEvent(const EEventID& inEvent) { mEvent = inEvent; }
00068       void SetPDU(std::vector<BasePDU*> inPDU) {
00069         DeletePDUVector();
00070         mBasePDU = inPDU;
00071       }
00072     };
00073   }
00074 }
00075 
00076 #endif //GDCMULEVENT_H

Generated on Fri May 25 2012 13:12:44 for GDCM by doxygen 1.8.0
SourceForge.net Logo