00001 /* -*- C++ -*- */ 00002 // PSDL_Code_Gen.h,v 1.2 2003/07/21 23:51:30 dhinton Exp 00003 // 00004 // ================================================================== 00005 // 00006 // = LIBRARY 00007 // PSS 00008 // 00009 // = FILENAME 00010 // PSDL_Code_Gen 00011 // 00012 // = DESCRIPTION 00013 // This class acts as an interface to the database which is used 00014 // for the saving the state of the objects. Right now, the database 00015 // is a normal file. 00016 // 00017 // = AUTHOR 00018 // Priyanka Gontla <gontla_p@ociweb.com> 00019 // 00020 // ================================================================== 00021 00022 #ifndef TAO_PSDL_CODE_GEN_H 00023 #define TAO_PSDL_CODE_GEN_H 00024 00025 #include /**/ "ace/pre.h" 00026 00027 #include "psdl_export.h" 00028 00029 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00030 # pragma once 00031 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00032 00033 #include "tao/IOPC.h" 00034 #include "tao/ORB.h" 00035 00036 class TAO_PSDL_Datastore; 00037 00038 class TAO_PSDL_Export TAO_PSDL_Code_Gen 00039 { 00040 public: 00041 00042 TAO_PSDL_Code_Gen (CORBA::ORB_ptr orb); 00043 00044 ~TAO_PSDL_Code_Gen (void); 00045 00046 /// Initializes a IOP::CodecFactory and IOP::Codec to take care of 00047 /// the marshalling and demarshalling of data. 00048 int set_codec (void); 00049 00050 /// Method to save the name-stringified object reference pair 00051 /// to the database. Returns -1 on failure. 00052 int set_name_obj_ref (const char *name, 00053 const char *string_obj_ref 00054 ACE_ENV_ARG_DECL) 00055 ACE_THROW_SPEC ((CORBA::SystemException)); 00056 00057 /// Get the stringified form of the object reference given the name 00058 /// of the object. 00059 const char *get_obj_ref (const char *name 00060 ACE_ENV_ARG_DECL) 00061 ACE_THROW_SPEC ((CORBA::SystemException)); 00062 00063 private: 00064 00065 /// Helper method which serializes the data and saves it to the 00066 /// database. 00067 CORBA::OctetSeq *encode (const char *string_obj_ref 00068 ACE_ENV_ARG_DECL_WITH_DEFAULTS) 00069 ACE_THROW_SPEC ((CORBA::SystemException)); 00070 00071 00072 /// Helper method to get the octet sequence 00073 const char *decode (const CORBA::OctetSeq &data 00074 ACE_ENV_ARG_DECL_WITH_DEFAULTS) 00075 ACE_THROW_SPEC ((CORBA::SystemException)); 00076 00077 /// File where the persistent data is stored. 00078 const char *file_name_; 00079 00080 /// Pointer to the class which accesses the database 00081 TAO_PSDL_Datastore *psdl_datastore_; 00082 00083 /// Pointer to ORB 00084 CORBA::ORB_var orb_; 00085 00086 /// CDR encapsulation codec useful for encoding and decoding the 00087 /// data 00088 IOP::Codec_var codec_; 00089 }; 00090 00091 #include /**/ "ace/post.h" 00092 00093 #endif /* TAO_PSDL_CODE_GEN_H */