Addr.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Addr.h
00006  *
00007  *  $Id: Addr.h 81030 2008-03-20 12:43:29Z johnnyw $
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, int size = -1);
00038 
00039   /// Destructor.
00040   virtual ~ACE_Addr (void);
00041 
00042   // = Get/set the size of the address.
00043 
00044   /// Return the size of the address.
00045   int get_size (void) const;
00046 
00047   /// Sets the size of the address.
00048   void set_size (int size);
00049 
00050   // = Get/set the type of the address.
00051 
00052   /// Get the type of the address.
00053   int get_type (void) const;
00054 
00055   /// Set the type of the address.
00056   void set_type (int type);
00057 
00058   /// Return a pointer to the address.
00059   virtual void *get_addr (void) const;
00060 
00061   /// Set a pointer to the address.
00062   virtual void set_addr (void *, int len);
00063 
00064   // = Equality/inequality tests
00065   /// Check for address equality.
00066   bool operator == (const ACE_Addr &sap) const;
00067 
00068   /// Check for address inequality.
00069   bool operator != (const ACE_Addr &sap) const;
00070 
00071   /// Initializes instance variables.
00072   void base_set (int type, int size);
00073 
00074   /// Wild-card address.
00075   static const ACE_Addr sap_any;
00076 
00077   /// Returns a hash value.  This should be overwritten by a subclass
00078   /// that can produce a better hash value.
00079   virtual unsigned long hash (void) const;
00080 
00081   /// Dump the state of an object.
00082   void dump (void) const;
00083 
00084   /// Declare the dynamic allocation hooks.
00085   ACE_ALLOC_HOOK_DECLARE;
00086 
00087 protected:
00088   /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.
00089   int addr_type_;
00090 
00091   /// Number of bytes in the address.
00092   int addr_size_;
00093 };
00094 
00095 ACE_END_VERSIONED_NAMESPACE_DECL
00096 
00097 #if defined (__ACE_INLINE__)
00098 #include "ace/Addr.inl"
00099 #endif /* __ACE_INLINE__ */
00100 
00101 #include /**/ "ace/post.h"
00102 
00103 #endif /* ACE_ADDR_H */

Generated on Tue Feb 2 17:18:38 2010 for ACE by  doxygen 1.4.7