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

Local_Name_Space.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // Local_Name_Space.cpp
00003 // $Id: Local_Name_Space.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:21 chad Exp $
00004 
00005 #if !defined (ACE_LOCAL_NAME_SPACE_C)
00006 #define ACE_LOCAL_NAME_SPACE_C
00007 
00008 #include "ace/ACE.h"
00009 #include "ace/Local_Name_Space.h"
00010 #include "ace/RW_Process_Mutex.h"
00011 
00012 ACE_RCSID(ace, Local_Name_Space, "$Id: Local_Name_Space.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:21 chad Exp $")
00013 
00014 ACE_NS_String::~ACE_NS_String (void)
00015 {
00016   if (this->delete_rep_)
00017     delete [] this->rep_;
00018 }
00019 
00020 ACE_USHORT16 *
00021 ACE_NS_String::fast_rep (void) const
00022 {
00023   ACE_TRACE ("ACE_NS_String::fast_rep");
00024   return this->rep_;
00025 }
00026 
00027 ACE_NS_String::operator ACE_NS_WString () const
00028 {
00029   ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
00030   return ACE_NS_WString (this->rep_,
00031                          (this->len_ / sizeof (ACE_USHORT16)) - 1);
00032 }
00033 
00034 size_t
00035 ACE_NS_String::len (void) const
00036 {
00037   ACE_TRACE ("ACE_NS_String::len");
00038   return this->len_;
00039 }
00040 
00041 char *
00042 ACE_NS_String::char_rep (void) const
00043 {
00044   ACE_TRACE ("ACE_NS_String::char_rep");
00045   ACE_NS_WString w_string (this->rep_,
00046                            (this->len_ / sizeof (ACE_USHORT16)) - 1);
00047   return w_string.char_rep ();
00048 }
00049 
00050 ACE_NS_String::ACE_NS_String (void)
00051   : len_ (0),
00052     rep_ (0),
00053     delete_rep_ (0)
00054 {
00055   ACE_TRACE ("ACE_NS_String::ACE_NS_String");
00056 }
00057 
00058 ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s)
00059   : len_ ((s.length () + 1) * sizeof (ACE_USHORT16)),
00060     rep_ (s.ushort_rep ()),
00061     delete_rep_ (1)
00062 {
00063   ACE_TRACE ("ACE_NS_String::ACE_NS_String");
00064 }
00065 
00066 int
00067 ACE_NS_String::strstr (const ACE_NS_String &s) const
00068 {
00069   ACE_TRACE ("ACE_NS_String::strstr");
00070 
00071   if (this->len_ < s.len_)
00072     // If they're larger than we are they can't be a substring of us!
00073     return -1;
00074   else if (this->len_ == s.len_)
00075     // Check if we're equal.
00076     return *this == s ? 0 : -1;
00077   else
00078     {
00079       // They're smaller than we are...
00080       size_t len = (this->len_ - s.len_) / sizeof (ACE_USHORT16);
00081       size_t pat_len = s.len_ / sizeof (ACE_USHORT16) - 1;
00082 
00083       for (size_t i = 0; i <= len; i++)
00084         {
00085           size_t j;
00086 
00087           for (j = 0; j < pat_len; j++)
00088             if (this->rep_[i + j] != s.rep_[j])
00089               break;
00090 
00091           if (j == pat_len)
00092             // Found a match!  Return the index.
00093             return ACE_static_cast (int, i);
00094         }
00095 
00096       return -1;
00097     }
00098 }
00099 
00100 int
00101 ACE_NS_String::operator == (const ACE_NS_String &s) const
00102 {
00103   ACE_TRACE ("ACE_NS_String::operator ==");
00104   return this->len_ == s.len_
00105     && ACE_OS::memcmp ((void *) this->rep_,
00106                        (void *) s.rep_, this->len_) == 0;
00107 }
00108 
00109 int
00110 ACE_NS_String::operator != (const ACE_NS_String &s) const
00111 {
00112   ACE_TRACE ("ACE_NS_String::operator !=");
00113   return !this->operator == (s);
00114 }
00115 
00116 ACE_NS_String::ACE_NS_String (ACE_USHORT16 *dst,
00117                               const ACE_USHORT16 *src,
00118                               size_t bytes)
00119   : len_ (bytes),
00120     rep_ (dst),
00121     delete_rep_ (0)
00122 {
00123   ACE_TRACE ("ACE_NS_String::ACE_NS_String");
00124   ACE_OS::memcpy (this->rep_, src, bytes);
00125 }
00126 
00127 u_long
00128 ACE_NS_String::hash (void) const
00129 {
00130   return ACE::hash_pjw
00131     (ACE_reinterpret_cast (char *, ACE_const_cast (ACE_USHORT16 *,
00132                                                    this->rep_)),
00133      this->len_);
00134 }
00135 
00136 ACE_NS_Internal::ACE_NS_Internal (void)
00137 {
00138 }
00139 
00140 ACE_NS_Internal::ACE_NS_Internal (ACE_NS_String &value, const char *type)
00141   : value_ (value),
00142     type_ (type)
00143 {
00144   ACE_TRACE ("ACE_NS_Internal::ACE_NS_Internal");
00145 }
00146 
00147 int
00148 ACE_NS_Internal::operator == (const ACE_NS_Internal &s) const
00149 {
00150   ACE_TRACE ("ACE_NS_Internal::operator ==");
00151   return this->value_ == s.value_;
00152 }
00153 
00154 ACE_NS_String
00155 ACE_NS_Internal::value (void)
00156 {
00157   ACE_TRACE ("ACE_NS_Internal::value");
00158   return this->value_;
00159 }
00160 
00161 const char *
00162 ACE_NS_Internal::type (void)
00163 {
00164   ACE_TRACE ("ACE_NS_Internal::type");
00165   return this->type_;
00166 }
00167 
00168 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
00169 #if (1)
00170 template class ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal>;
00171 template class ACE_Hash<ACE_NS_String>;
00172 template class ACE_Equal_To<ACE_NS_String>;
00173 template class ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00174 template class ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00175 template class ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00176 template class ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>;
00177 template class ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>;
00178 template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>;
00179 template class ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>;
00180 #else
00181 template class ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal>;
00182 template class ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00183 template class ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00184 template class ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00185 template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>;
00186 #endif
00187 template class ACE_Unbounded_Set<ACE_Name_Binding>;
00188 template class ACE_Unbounded_Set_Iterator<ACE_Name_Binding>;
00189 template class ACE_Unbounded_Set<ACE_NS_WString>;
00190 template class ACE_Unbounded_Set_Iterator<ACE_NS_WString>;
00191 template class ACE_Node<ACE_NS_WString>;
00192 template class ACE_Node<ACE_Name_Binding>;
00193 template class ACE_Guard<ACE_RW_Process_Mutex>;
00194 template class ACE_Read_Guard<ACE_RW_Process_Mutex>;
00195 template class ACE_Write_Guard<ACE_RW_Process_Mutex>;
00196 #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
00197 #if (1)
00198 #pragma instantiate ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal>
00199 #pragma instantiate ACE_Hash<ACE_NS_String>
00200 #pragma instantiate ACE_Equal_To<ACE_NS_String>
00201 #pragma instantiate ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00202 #pragma instantiate ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00203 #pragma instantiate ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00204 #pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>
00205 #pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>
00206 #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>
00207 #pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>
00208 #else
00209 #pragma instantiate ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal>
00210 #pragma instantiate ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00211 #pragma instantiate ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00212 #pragma instantiate ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00213 #pragma instantiate ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>
00214 #endif
00215 #pragma instantiate ACE_Unbounded_Set<ACE_Name_Binding>
00216 #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Name_Binding>
00217 #pragma instantiate ACE_Unbounded_Set<ACE_NS_WString>
00218 #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_NS_WString>
00219 #pragma instantiate ACE_Node<ACE_NS_WString>
00220 #pragma instantiate ACE_Node<ACE_Name_Binding>
00221 #pragma instantiate ACE_Guard<ACE_RW_Process_Mutex>
00222 #pragma instantiate ACE_Read_Guard<ACE_RW_Process_Mutex>
00223 #pragma instantiate ACE_Write_Guard<ACE_RW_Process_Mutex>
00224 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
00225 
00226 #endif /* ACE_LOCAL_NAME_SPACE_C */

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