Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

cdbDAONode.h

Go to the documentation of this file.
00001 #ifndef cdbDAONode_H_ 00002 #define cdbDAONode_H_ 00003 00004 /******************************************************************************* 00005 * ALMA - Atacama Large Millimiter Array 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * 00025 * "@(#) $Id: cdbDAONode.h,v 1.6 2008/09/29 09:51:19 cparedes Exp $" 00026 * 00027 * who when what 00028 * -------- ---------- ---------------------------------------------- 00029 * msekoran 2005/09/11 created 00030 */ 00031 00032 #ifndef __cplusplus 00033 #error This is a C++ include file and cannot be used from plain C 00034 #endif 00035 00036 #include <string> 00037 #include <map> 00038 00039 #include "cdbDAOProxy.h" 00040 #include <cdbDALS.h> 00041 00042 namespace cdb { 00043 00044 // forward declaration 00045 class DAONode; 00046 00050 class DALChangeListenerImplementation : 00051 public virtual PortableServer::RefCountServantBase, 00052 public virtual POA_CDB::DALChangeListener, 00053 public virtual POA_ACS::OffShoot 00054 { 00055 public: 00056 00062 DALChangeListenerImplementation(CDB::DAL_ptr, PortableServer::POA_ptr poa); 00063 00067 virtual ~DALChangeListenerImplementation(); 00068 00072 void registerNode(DAONode *node); 00073 00077 void unregisterNode(DAONode *node); 00078 00082 void destroy(); 00083 00084 //---------------------------------------------------- 00085 // CORBA DALChangeListenerImplementation interface 00086 //---------------------------------------------------- 00087 00088 virtual void object_changed (const char * curl); 00089 00090 protected: 00091 00093 CDB::DAL_var m_dal; 00094 00096 long m_changeListenerID; 00097 00098 typedef std::vector<DAONode*> VectorDAONode; 00099 typedef std::map<std::string, VectorDAONode> MapVectorDAONode; 00100 00102 MapVectorDAONode nodeMap; 00103 00105 PortableServer::POA_var m_poa; 00106 }; 00107 00111 class DAONode : 00112 public virtual POA_CDB::DAO 00113 { 00114 public: 00115 00122 DAONode(const char* nodeName, CDB::DAL_ptr dal, PortableServer::POA_ptr poa); 00123 00127 virtual ~DAONode(); 00128 00132 void readConfiguration(); 00133 00138 DAONode* createDAONode(const char * nodeName); 00139 00144 DAONode* createChild(const char* childName); 00145 00146 //---------------------------------------------------- 00147 // CORBA DAO interface 00148 //---------------------------------------------------- 00149 /* 00150 * @throw cdbErrType::WrongCDBDataTypeEx 00151 * @throw cdbErrType::CDBFieldDoesNotExistEx 00152 */ 00153 virtual CORBA::Long get_long (const char * propertyName); 00154 00155 /* 00156 * @throw cdbErrType::WrongCDBDataTypeEx 00157 * @throw cdbErrType::CDBFieldDoesNotExistEx 00158 */ 00159 virtual CORBA::Double get_double (const char * propertyName); 00160 00161 /* 00162 * @throw cdbErrType::WrongCDBDataTypeEx 00163 * @throw cdbErrType::CDBFieldDoesNotExistEx 00164 */ 00165 virtual char * get_string (const char * propertyName); 00166 00167 /* 00168 * @throw cdbErrType::WrongCDBDataTypeEx 00169 * @throw cdbErrType::CDBFieldDoesNotExistEx 00170 */ 00171 virtual char * get_field_data (const char * propertyName); 00172 00173 /* 00174 * @throw cdbErrType::WrongCDBDataTypeEx 00175 * @throw cdbErrType::CDBFieldDoesNotExistEx 00176 */ 00177 virtual ::CDB::stringSeq * get_string_seq (const char * propertyName); 00178 00179 /* 00180 * @throw cdbErrType::WrongCDBDataTypeEx 00181 * @throw cdbErrType::CDBFieldDoesNotExistEx 00182 */ 00183 virtual ::CDB::longSeq * get_long_seq (const char * propertyName); 00184 00185 /* 00186 * @throw cdbErrType::WrongCDBDataTypeEx 00187 * @throw cdbErrType::CDBFieldDoesNotExistEx 00188 */ 00189 virtual ::CDB::doubleSeq * get_double_seq (const char * propertyName); 00190 00191 virtual void destroy (); 00192 00193 protected: 00194 00198 DAONode(); 00199 00205 void connect(bool silent = true); 00206 00208 std::string m_name; 00209 00211 CDB::DAL_var m_dal; 00212 00214 PortableServer::POA_var m_poa; 00215 00217 DAOProxy* m_daoImpl; 00218 00220 bool m_remote; 00221 00223 DALChangeListenerImplementation* m_dalChangeListener; 00224 00225 // used to access m_name field and connect method 00226 friend class DALChangeListenerImplementation; 00227 }; 00228 00232 class DAOChildNode : 00233 public DAONode 00234 { 00235 public: 00236 00242 DAOChildNode(DAONode * parent, const char* childName); 00243 00247 virtual ~DAOChildNode(); 00248 00253 DAONode* createDAONode(const char * nodeName); 00254 00259 DAONode* createChild(const char* childName); 00260 00261 //---------------------------------------------------- 00262 // CORBA DAO interface 00263 //---------------------------------------------------- 00264 00265 /* 00266 * @throw cdbErrType::WrongCDBDataTypeEx 00267 * @throw cdbErrType::CDBFieldDoesNotExistEx 00268 */ 00269 virtual CORBA::Long get_long (const char * propertyName); 00270 00271 /* 00272 * @throw cdbErrType::WrongCDBDataTypeEx 00273 * @throw cdbErrType::CDBFieldDoesNotExistEx 00274 */ 00275 virtual CORBA::Double get_double (const char * propertyName); 00276 00277 /* 00278 * @throw cdbErrType::WrongCDBDataTypeEx 00279 * @throw cdbErrType::CDBFieldDoesNotExistEx 00280 */ 00281 virtual char * get_string (const char * propertyName); 00282 00283 /* 00284 * @throw cdbErrType::WrongCDBDataTypeEx 00285 * @throw cdbErrType::CDBFieldDoesNotExistEx 00286 */ 00287 virtual char * get_field_data (const char * propertyName); 00288 00289 /* 00290 * @throw cdbErrType::WrongCDBDataTypeEx 00291 * @throw cdbErrType::CDBFieldDoesNotExistEx 00292 */ 00293 virtual ::CDB::stringSeq * get_string_seq (const char * propertyName); 00294 00295 /* 00296 * @throw cdbErrType::WrongCDBDataTypeEx 00297 * @throw cdbErrType::CDBFieldDoesNotExistEx 00298 */ 00299 virtual ::CDB::longSeq * get_long_seq (const char * propertyName); 00300 00301 /* 00302 * @throw cdbErrType::WrongCDBDataTypeEx 00303 * @throw cdbErrType::CDBFieldDoesNotExistEx 00304 */ 00305 virtual ::CDB::doubleSeq * get_double_seq (const char * propertyName); 00306 00307 virtual void destroy (); 00308 00309 protected: 00310 00312 DAONode* m_parent; 00313 00315 std::string m_childName; 00316 00318 std::string m_childNamePrefix; 00319 }; 00320 00321 } /* namespace cdb */ 00322 00323 #endif /* cdbDAONode_H_ */ 00324 00325 00326 // ------------------------------------------------------- 00327 /*___oOo___*/ 00328 00329 00330 00331

Generated on Thu Apr 30 02:30:50 2009 for ACS C++ API by doxygen 1.3.8