• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

cdbDAOProxy.h

Go to the documentation of this file.
00001 #ifndef cdbDAOProxy_H_
00002 #define cdbDAOProxy_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: cdbDAOProxy.h,v 1.5 2008/10/09 04:47:53 cparedes Exp $"
00026  *
00027  * who       when        what
00028  * --------  ----------  ----------------------------------------------
00029  * msekoran  2005/09/08  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 #include <vector>
00039 
00040 #include <cdbDALS.h>
00041 #include <cdbErrType.h>
00042 
00043 namespace cdb {
00044 
00048     class CXMLTreeNode
00049     {
00050       public:
00051 
00056         CXMLTreeNode( CXMLTreeNode *pParent );
00057 
00061         ~CXMLTreeNode();
00062 
00067         void getAttributeNames(std::string &names);
00068 
00070         std::string m_name;
00071 
00073         CXMLTreeNode* m_parent;
00074 
00075         typedef std::map<std::string, CXMLTreeNode*> MapStringToNode;
00077         MapStringToNode m_subNodesMap;
00078 
00079         typedef std::map<std::string, std::string> MapStringToString;
00081         MapStringToString m_fieldMap;
00082 
00083     };
00084 
00088     class DAOProxy : public virtual POA_CDB::DAO
00089     {
00090       public:
00091 
00095         DAOProxy(const char * nodeName, CDB::DAO_ptr dao);
00096 
00101         DAOProxy(const char * nodeName, const char* xml);
00102 
00106         virtual ~DAOProxy();
00107 
00108 
00115         void get_field(const char* name, std::string &value);
00116       
00117         typedef std::vector<std::string> VectorString;
00118 
00125         static bool split(const std::string& str, VectorString& array);
00126 
00127         //----------------------------------------------------
00128         // CORBA interface
00129         //----------------------------------------------------
00130 
00131     /*
00132     * @throw cdbErrType::WrongCDBDataTypeEx
00133         * @throw cdbErrType::CDBFieldDoesNotExistEx
00134     */
00135         virtual CORBA::Long get_long (const char * propertyName);
00136 
00137     /*
00138     * @throw cdbErrType::WrongCDBDataTypeEx
00139         * @throw cdbErrType::CDBFieldDoesNotExistEx
00140     */
00141         virtual CORBA::Double get_double (const char * propertyName);
00142 
00143     /*
00144     * @throw cdbErrType::WrongCDBDataTypeEx
00145         * @throw cdbErrType::CDBFieldDoesNotExistEx
00146     */
00147         virtual char * get_string (const char * propertyName );
00148 
00149     /*
00150     * @throw cdbErrType::WrongCDBDataTypeEx
00151         * @throw cdbErrType::CDBFieldDoesNotExistEx
00152     */
00153         virtual char * get_field_data (const char * propertyName);
00154 
00155     /*
00156     * @throw cdbErrType::WrongCDBDataTypeEx
00157         * @throw cdbErrType::CDBFieldDoesNotExistEx
00158     */
00159         virtual ::CDB::stringSeq * get_string_seq (const char * propertyName);
00160 
00161     /*
00162     * @throw cdbErrType::WrongCDBDataTypeEx
00163         * @throw cdbErrType::CDBFieldDoesNotExistEx
00164     */
00165         virtual ::CDB::longSeq * get_long_seq (const char * propertyName);
00166 
00167     /*
00168     * @throw cdbErrType::WrongCDBDataTypeEx
00169         * @throw cdbErrType::CDBFieldDoesNotExistEx
00170     */
00171         virtual ::CDB::doubleSeq * get_double_seq (const char * propertyName );
00172 
00173         virtual void destroy();
00174 
00175       public:
00176 
00178         std::string m_nodeName;
00179 
00181         std::string m_errorMessage;
00182 
00183       // expat (XML parser) internal operations
00184       protected:
00185 
00186         void    Start(const char *el, const char **attr);
00187         void    End(const char *el);
00188 
00189         static void start(void *data, const char *el, const char **attr);
00190         static void end(void *data, const char *el);
00191 
00192       // implementation
00193       protected:
00194 
00195         // destruction status flag.
00196         bool m_destroyed;
00197 
00198         // temporary variables for array handling
00199         bool m_inArray;
00200         std::string m_arrayName;
00201         std::string m_arrayContent;
00202 
00203         // XML tree handling
00204         CXMLTreeNode* m_rootNode;
00205         CXMLTreeNode* m_currNode;
00206 
00207         // CDB DAO (non-nil if remote)
00208         CDB::DAO_var m_dao;
00209     };
00210 
00211 } /* namespace cdb */
00212 
00213 #endif /* cdbDAOProxy_H_  */
00214 
00215 
00216 // -------------------------------------------------------
00217 /*___oOo___*/
00218 
00219 
00220 
00221 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0