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

Addr.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Addr.h
00006  *
00007  *  $Id: Addr.h,v 1.1.1.4 2003/02/21 18:36:32 chad 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 /**
00025  * @class ACE_Addr
00026  *
00027  * @brief Defines the base class for the "address family independent"
00028  * address format.
00029  */
00030 class ACE_Export ACE_Addr
00031 {
00032 public:
00033   // = Initialization and termination methods.
00034   /// Initializes instance variables.
00035   ACE_Addr (int type = -1,
00036             int size = -1);
00037 
00038   /// Destructor.
00039   virtual ~ACE_Addr (void);
00040 
00041   // = Get/set the size of the address.
00042 
00043   /// Return the size of the address.
00044   int get_size (void) const;
00045 
00046   /// Sets the size of the address.
00047   void set_size (int size);
00048 
00049   // = Get/set the type of the address.
00050 
00051   /// Get the type of the address.
00052   int get_type (void) const;
00053 
00054   /// Set the type of the address.
00055   void set_type (int type);
00056 
00057   /// Return a pointer to the address.
00058   virtual void *get_addr (void) const;
00059 
00060   /// Set a pointer to the address.
00061   virtual void set_addr (void *, int len);
00062 
00063   // = Equality/inequality tests
00064   /// Check for address equality.
00065   int operator == (const ACE_Addr &sap) const;
00066 
00067   /// Check for address inequality.
00068   int operator != (const ACE_Addr &sap) const;
00069 
00070   /// Initializes instance variables.
00071   void base_set (int type, int size);
00072 
00073 #if defined (ACE_HAS_BROKEN_SAP_ANY)
00074   /// Wild-card address.
00075   static const ACE_Addr &sap_any (void);
00076 
00077   // This #define works around broken C++ compilers...
00078 #define sap_any sap_any()
00079 #else
00080   /// Wild-card address.
00081   static const ACE_Addr sap_any;
00082 #endif /* ACE_HAS_BROKEN_SAP_ANY */
00083 
00084   /// Returns a hash value.  This should be overwritten by a subclass
00085   /// that can produce a better hash value.
00086   virtual unsigned long hash (void) const;
00087 
00088   /// Dump the state of an object.
00089   void dump (void) const;
00090 
00091   /// Declare the dynamic allocation hooks.
00092   ACE_ALLOC_HOOK_DECLARE;
00093 
00094 protected:
00095   /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.
00096   int addr_type_;
00097 
00098   /// Number of bytes in the address.
00099   int addr_size_;
00100 };
00101 
00102 #if defined (__ACE_INLINE__)
00103 #include "ace/Addr.i"
00104 #endif /* __ACE_INLINE__ */
00105 
00106 #include "ace/post.h"
00107 
00108 #endif /* ACE_ADDR_H */

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