Addr.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Addr.h
00006  *
00007  *  Addr.h,v 4.24 2005/10/28 16:14:51 ossama Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_ADDR_H
00014 #define ACE_ADDR_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class ACE_Addr
00028  *
00029  * @brief Defines the base class for the "address family independent"
00030  * address format.
00031  */
00032 class ACE_Export ACE_Addr
00033 {
00034 public:
00035   // = Initialization and termination methods.
00036   /// Initializes instance variables.
00037   ACE_Addr (int type = -1,
00038             int size = -1);
00039 
00040   /// Destructor.
00041   virtual ~ACE_Addr (void);
00042 
00043   // = Get/set the size of the address.
00044 
00045   /// Return the size of the address.
00046   int get_size (void) const;
00047 
00048   /// Sets the size of the address.
00049   void set_size (int size);
00050 
00051   // = Get/set the type of the address.
00052 
00053   /// Get the type of the address.
00054   int get_type (void) const;
00055 
00056   /// Set the type of the address.
00057   void set_type (int type);
00058 
00059   /// Return a pointer to the address.
00060   virtual void *get_addr (void) const;
00061 
00062   /// Set a pointer to the address.
00063   virtual void set_addr (void *, int len);
00064 
00065   // = Equality/inequality tests
00066   /// Check for address equality.
00067   bool operator == (const ACE_Addr &sap) const;
00068 
00069   /// Check for address inequality.
00070   bool operator != (const ACE_Addr &sap) const;
00071 
00072   /// Initializes instance variables.
00073   void base_set (int type, int size);
00074 
00075   /// Wild-card address.
00076   static const ACE_Addr sap_any;
00077 
00078   /// Returns a hash value.  This should be overwritten by a subclass
00079   /// that can produce a better hash value.
00080   virtual unsigned long hash (void) const;
00081 
00082   /// Dump the state of an object.
00083   void dump (void) const;
00084 
00085   /// Declare the dynamic allocation hooks.
00086   ACE_ALLOC_HOOK_DECLARE;
00087 
00088 protected:
00089   /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.
00090   int addr_type_;
00091 
00092   /// Number of bytes in the address.
00093   int addr_size_;
00094 };
00095 
00096 ACE_END_VERSIONED_NAMESPACE_DECL
00097 
00098 #if defined (__ACE_INLINE__)
00099 #include "ace/Addr.inl"
00100 #endif /* __ACE_INLINE__ */
00101 
00102 #include /**/ "ace/post.h"
00103 
00104 #endif /* ACE_ADDR_H */

Generated on Thu Nov 9 09:41:45 2006 for ACE by doxygen 1.3.6