00001 /************************************************************************ 00002 * EPP RTK C++ 00003 * Copyright (C) 2001 Global Name Registry 00004 * 00005 * This library is free software; you can redistribute it and/or modify it 00006 * under the terms of the GNU Lesser General Public License as published 00007 * by the Free Software Foundation; either version 2.1 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Contact information: epprtk@gnr.com 00020 * 00021 * EPP RTK 00022 * GNR Ltd. 00023 * 125 High Holborn 00024 * London WC1V 6QA 00025 * United Kingdom 00026 ************************************************************************/ 00027 00028 #ifndef __EPP_POLLRESDATAUNION_H 00029 #define __EPP_POLLRESDATAUNION_H 00030 00031 #include "epp_eppdata.h" 00032 #include "epp_PollDomainTransfer.h" 00033 #include "epp_PollContactTransfer.h" 00034 #include "epp_XMLException.h" 00035 00036 00037 namespace eppobject { namespace epp { 00038 00039 class epp_PollResDataUnion { 00040 private: 00041 epp_PollResDataType_ref _disc; 00042 epp_PollDomainTransfer_ref _m_domain_transfer; 00043 epp_PollContactTransfer_ref _m_contact_transfer; 00044 00045 public: 00046 00047 void _d(const epp_PollResDataType & discriminant) 00048 { 00049 _disc.ref(new epp_PollResDataType(discriminant)); 00050 } 00051 00052 epp_PollResDataType _d() const 00053 { 00054 if(_disc == NULL) 00055 { 00056 throw epp_XMLException("epp_PollResDataUnion is not initialized"); 00057 } 00058 return *_disc; 00059 } 00060 00061 epp_PollDomainTransfer_ref m_domain_transfer() const 00062 { 00063 if(_disc == NULL) 00064 { 00065 throw epp_XMLException("epp_PollResDataUnion is not initialized"); 00066 } 00067 00068 if(*_disc != DOMAIN_TRANSFER) 00069 { 00070 throw epp_XMLException("epp_PollResDataUnion is not of type DOMAIN_TRANSFER"); 00071 } 00072 00073 return _m_domain_transfer; 00074 } 00075 00076 void m_domain_transfer(const epp_PollDomainTransfer_ref & param) 00077 { 00078 _d(DOMAIN_TRANSFER); 00079 _m_domain_transfer = param; 00080 } 00081 00082 epp_PollContactTransfer_ref m_contact_transfer() const 00083 { 00084 if(_disc == NULL) 00085 { 00086 throw epp_XMLException("epp_PollResDataUnion is not initialized"); 00087 } 00088 00089 if(*_disc != CONTACT_TRANSFER) 00090 { 00091 throw epp_XMLException("epp_PollResDataUnion is not of type CONTACT_TRANSFER"); 00092 } 00093 00094 return _m_contact_transfer; 00095 } 00096 00097 void m_contact_transfer(const epp_PollContactTransfer_ref & param) 00098 { 00099 _d(CONTACT_TRANSFER); 00100 _m_contact_transfer = param; 00101 } 00102 00103 epp_PollResDataUnion() {}; 00104 00105 epp_PollResDataUnion(const epp_PollResDataUnion & u) { 00106 switch(u._d()) { 00107 case DOMAIN_TRANSFER: 00108 _m_domain_transfer = u.m_domain_transfer(); 00109 break; 00110 case CONTACT_TRANSFER: 00111 _m_contact_transfer = u.m_contact_transfer(); 00112 break; 00113 default: 00114 break; 00115 } 00116 00117 _disc = u._d(); 00118 } 00119 00120 virtual ~epp_PollResDataUnion() {}; 00121 00122 }; 00123 00124 typedef refcnt_ptr<epp_PollResDataUnion> epp_PollResDataUnion_ref; 00125 00126 }}; 00127 00128 #endif