Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CORBA_String.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 
00004 //=============================================================================
00005 /**
00006  *  @file    CORBA_String.h
00007  *
00008  *  $Id: CORBA_String.h,v 1.1.1.2 2003/02/21 18:36:44 chad Exp $
00009  *
00010  *   Header file for the CORBA string types.
00011  *
00012  *
00013  */
00014 //=============================================================================
00015 
00016 
00017 
00018 #ifndef TAO_CORBA_STRING_H
00019 #define TAO_CORBA_STRING_H
00020 
00021 #include "ace/pre.h"
00022 
00023 #include "tao/corbafwd.h"
00024 #include "tao/Managed_Types.h"
00025 
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif /* ACE_LACKS_PRAGMA_ONCE */
00029 
00030 
00031 // For the (W)String_var and (W)String_out iostream operators.
00032 #if defined (ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION)
00033 #include "ace/streams.h"
00034 #endif /* ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION */
00035 
00036 /**
00037  * @class CORBA_String_var
00038  *
00039  * @brief CORBA_String var class. Provides automatic deallocation of storage
00040  * for the string once it goes out of scope.
00041  */
00042 class TAO_Export CORBA_String_var
00043 {
00044 public:
00045   /// default constructor.
00046   CORBA_String_var (void);
00047 
00048   /// constructor, owns p.
00049   CORBA_String_var (char *p);
00050 
00051   /// constructor. Makes a copy of p.
00052   CORBA_String_var (const char *p);
00053 
00054   /// copy constructor.
00055   CORBA_String_var (const CORBA_String_var &s);
00056 
00057   /// destructor.
00058   ~CORBA_String_var (void);
00059 
00060   /// assignment operator.
00061   CORBA_String_var &operator= (char *p);
00062 
00063   /// assignment to a const char*.  Makes a copy.
00064   CORBA_String_var &operator= (const char *p);
00065 
00066   /// assignment operator.
00067   CORBA_String_var &operator= (const CORBA_String_var &s);
00068 
00069   /// Read/write version.
00070   operator char *&();
00071 
00072   /// Only read privileges.
00073   operator const char *() const;
00074 
00075   /// allows access and modification using an slot.
00076   char &operator[] (CORBA::ULong slot);
00077 
00078   /// allows only accessing thru an slot.
00079   char operator[] (CORBA::ULong slot) const;
00080 
00081     // = in, out, out, and _retn operations.
00082     // ORBOS/97-05-15, Appendix C.2
00083 
00084   /// for in parameter.
00085   const char *in (void) const;
00086 
00087   /// for inout parameter.
00088   char *&inout (void);
00089 
00090   /// for out parameter.
00091   char *&out (void);
00092 
00093   /// for string of return type.
00094   char *_retn (void);
00095 
00096 private:
00097   /// instance.
00098   char *ptr_;
00099 };
00100 
00101 /**
00102  * @class CORBA_String_out
00103  *
00104  * @brief CORBA_String_out
00105  *
00106  * To support the memory management for "out" parameter passing
00107  * mode.  ORBOS/97-05-15, Appendix C.2 defines a CORBA_String_out class
00108  */
00109 class TAO_Export CORBA_String_out
00110 {
00111 public:
00112   // = operations.
00113 
00114   /// Construction from a reference to a string.
00115   CORBA_String_out (char *&p);
00116 
00117   /// Construction from a var.
00118   CORBA_String_out (CORBA_String_var &p);
00119 
00120   /// Construction from a var.
00121   CORBA_String_out (TAO_String_Manager &p);
00122 
00123   /// Copy constructor.
00124   CORBA_String_out (const CORBA_String_out &s);
00125 
00126   /// Assignment from a string_out.
00127   CORBA_String_out &operator= (const CORBA_String_out &s);
00128 
00129   /// Assignment from a string.
00130   CORBA_String_out &operator= (char *p);
00131 
00132   /// Assignment from a constant char*.
00133   CORBA_String_out& operator= (const char* p);
00134 
00135   /// Cast.
00136   operator char *&();
00137 
00138   /// Return underlying instance.
00139   char *&ptr (void);
00140 
00141 private:
00142   /// Instance.
00143   char *&ptr_;
00144 
00145   // assignment from _var disallowed
00146   void operator= (const CORBA_String_var &);
00147 };
00148 
00149 // ****************************************************************
00150 
00151 /**
00152  * @class CORBA_WString_var
00153  *
00154  * @brief CORBA_WString var class. Provides automatic deallocation of
00155  * storage for wide strings
00156  */
00157 class TAO_Export CORBA_WString_var
00158 {
00159 public:
00160   /// default constructor.
00161   CORBA_WString_var (void);
00162 
00163   /// constructor, owns p.
00164   CORBA_WString_var (CORBA::WChar *p);
00165 
00166   /// constructor. Makes a copy of p.
00167   CORBA_WString_var (const CORBA::WChar *p);
00168 
00169   /// copy constructor.
00170   CORBA_WString_var (const CORBA_WString_var &s);
00171 
00172   /// destructor.
00173   ~CORBA_WString_var (void);
00174 
00175   /// assignment operator.
00176   CORBA_WString_var &operator= (CORBA::WChar *p);
00177 
00178   /// assignment to a const char*.  Makes a copy.
00179   CORBA_WString_var &operator= (const CORBA::WChar *p);
00180 
00181   /// assignment operator.
00182   CORBA_WString_var &operator= (const CORBA_WString_var &s);
00183 
00184   /// access and modify.
00185   operator CORBA::WChar *();
00186 
00187   /// only read privileges.
00188   operator const CORBA::WChar *() const;
00189 
00190   /// allows access and modification using an slot.
00191   CORBA::WChar &operator[] (CORBA::ULong slot);
00192 
00193   /// allows only accessing thru an slot.
00194   CORBA::WChar operator[] (CORBA::ULong slot) const;
00195 
00196     // = in, out, out, and _retn operations.
00197     // ORBOS/97-05-15, Appendix C.2
00198 
00199   /// for in parameter.
00200   const CORBA::WChar *in (void) const;
00201 
00202   /// for inout parameter.
00203   CORBA::WChar *&inout (void);
00204 
00205   /// for out parameter.
00206   CORBA::WChar *&out (void);
00207 
00208   /// for string of return type.
00209   CORBA::WChar *_retn (void);
00210 
00211 private:
00212   /// instance.
00213   CORBA::WChar *ptr_;
00214 };
00215 
00216 /**
00217  * @class CORBA_WString_out
00218  *
00219  * @brief CORBA_WString_out
00220  *
00221  * To support the memory management for "out" parameter passing
00222  * mode.  ORBOS/97-05-15, Appendix C.2 defines a CORBA_WString_out
00223  * class
00224  */
00225 class TAO_Export CORBA_WString_out
00226 {
00227 public:
00228   // = operations.
00229 
00230   /// Construction from a reference to a string.
00231   CORBA_WString_out (CORBA::WChar *&p);
00232 
00233   /// Construction from a var.
00234   CORBA_WString_out (CORBA_WString_var &p);
00235 
00236   /// Copy constructor.
00237   CORBA_WString_out (const CORBA_WString_out &s);
00238 
00239   /// Assignment from a string_out.
00240   CORBA_WString_out &operator= (const CORBA_WString_out &s);
00241 
00242   /// Assignment from a string.
00243   CORBA_WString_out &operator= (CORBA::WChar *p);
00244 
00245   /// Cast.
00246   operator CORBA::WChar *&();
00247 
00248   /// Return underlying instance.
00249   CORBA::WChar *&ptr (void);
00250 
00251 private:
00252   /// Instance.
00253   CORBA::WChar *&ptr_;
00254 
00255   // assignment from _var disallowed
00256   void operator= (const CORBA_WString_var &);
00257 };
00258 
00259 # if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00260 
00261 TAO_Export ostream &
00262 operator<< (ostream &, const CORBA::String_var &);
00263 TAO_Export istream &
00264 operator>> (istream &, CORBA::String_var &);
00265 TAO_Export ostream &
00266 operator<< (ostream &, CORBA::String_out &);
00267 TAO_Export istream &
00268 operator>> (istream &, CORBA::String_out &);
00269 TAO_Export ostream &
00270 operator<< (ostream &, const CORBA::WString_var &);
00271 TAO_Export istream &
00272 operator>> (istream &, CORBA::WString_var &);
00273 TAO_Export ostream &
00274 operator<< (ostream &, CORBA::WString_out &);
00275 TAO_Export istream &
00276 operator>> (istream &, CORBA::WString_out &);
00277 
00278 # endif /* ACE_LACKS_IOSTREAM_TOTALLY */
00279 
00280 #if defined (__ACE_INLINE__)
00281 # include "tao/CORBA_String.inl"
00282 #endif /* ! __ACE_INLINE__ */
00283 
00284 
00285 #include "ace/post.h"
00286 
00287 #endif  /* TAO_CORBA_STRING_H */

Generated on Mon Jun 16 13:48:10 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002