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

Local_Name_Space.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Local_Name_Space.h
00006  *
00007  *  $Id: Local_Name_Space.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Prashant Jain (pjain@cs.wustl.edu)
00010  *  @author Irfan Pyarali (irfan@wuerl.wustl.edu)
00011  *  @author and Douglas C. Schmidt (schmidt@cs.wustl.edu).
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACE_LOCAL_NAME_SPACE_H
00016 #define ACE_LOCAL_NAME_SPACE_H
00017 #include "ace/pre.h"
00018 
00019 #include "ace/SString.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/Malloc_T.h"
00026 #include "ace/Synch.h"
00027 
00028 /**
00029  * @class ACE_NS_String
00030  *
00031  * @brief This class and ACE_NS_Internal are used as Adapters to work
00032  * with the Map_Manager.
00033  *
00034  * In order to work correctly, this class must be able to
00035  * convert back and forth with <ACE_NS_WStrings>.
00036  */
00037 class ACE_Export ACE_NS_String
00038 {
00039 public:
00040   // = Initialization.
00041   /// Default "no-op" constructor.
00042   ACE_NS_String (void);
00043 
00044   /// Initialization method.
00045   ACE_NS_String (ACE_USHORT16 *dst,
00046                  const ACE_USHORT16 *src,
00047                  size_t len);
00048 
00049   /// Converts an ACE_NS_WString to an ACE_NS_String;
00050   ACE_NS_String (const ACE_NS_WString &);
00051 
00052   /// Destructor
00053   ~ACE_NS_String (void);
00054 
00055   /// Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;
00056   operator ACE_NS_WString () const;
00057 
00058   /// Return the ASCII character representation.
00059   char *char_rep (void) const;
00060 
00061   /// Matches on substrings.
00062   int strstr (const ACE_NS_String &) const;
00063 
00064   /// Compare an ACE_NS_String.
00065   int operator == (const ACE_NS_String &) const;
00066 
00067   /// Compare an ACE_NS_String.
00068   int operator != (const ACE_NS_String &) const;
00069 
00070   /// Returns length of the string
00071   size_t len (void) const;
00072 
00073   /// Returns the underlying representation.
00074   ACE_USHORT16 *fast_rep (void) const;
00075 
00076   /// Returns a hash value for this string.
00077   u_long hash (void) const;
00078 
00079 private:
00080   /// Length of the string.
00081   size_t len_;
00082 
00083   /// This actually points into shared/persistent memory.
00084   ACE_USHORT16 *rep_;
00085 
00086   /// Should rep_ be deleted when destructed (only used
00087   /// for WString conversions)
00088   int delete_rep_;
00089 };
00090 
00091 /**
00092  * @class ACE_NS_Internal
00093  *
00094  * @brief This class and ACE_NS_String are used as Adapters to work
00095  * with the Map_Manager.
00096  */
00097 class ACE_Export ACE_NS_Internal
00098 {
00099 public:
00100   /// No-op constructor.
00101   ACE_NS_Internal (void);
00102 
00103   /// Constructor.
00104   ACE_NS_Internal (ACE_NS_String &value, const char *type);
00105 
00106   /// Compare an ACE_NS_Internal
00107   int operator == (const ACE_NS_Internal &) const;
00108 
00109   /// Return value.
00110   ACE_NS_String value (void);
00111 
00112   /// Return type.
00113   const char *type (void);
00114 
00115 private:
00116   /// Contains the value of the string.
00117   ACE_NS_String value_;
00118 
00119   /// Contains the type of the string.
00120   const char *type_;
00121 };
00122 
00123 // Include the ACE_Local_Name_Space templates stuff at this point.
00124 #include "ace/Local_Name_Space_T.h"
00125 
00126 #include "ace/post.h"
00127 #endif /* ACE_LOCAL_NAME_SPACE_H */

Generated on Mon Jun 16 11:19:55 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002