Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Attributes

ACE_RMCast::NRTM Struct Reference

#include <Protocol.h>

Inheritance diagram for ACE_RMCast::NRTM:
Inheritance graph
[legend]
Collaboration diagram for ACE_RMCast::NRTM:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NRTM (Header const &h, istream &is)
 NRTM ()
NRTM_ptr clone ()
void insert (Address const &addr, u64 sn)
u64 find (Address const &addr) const
bool empty () const
virtual void serialize_body (ostream &os) const
virtual void serialize_body (sstream &ss) const

Static Public Member Functions

static u32 max_count (u32 max_size)

Static Public Attributes

static u16 const id = 0x0006

Protected Member Functions

virtual Profile_ptr clone_ ()
 NRTM (NRTM const &nrtm)

Private Types

typedef
ACE_Hash_Map_Manager_Ex
< Address, u64, AddressHasher,
ACE_Equal_To< Address >
, ACE_Null_Mutex
Map

Private Attributes

Map map_

Detailed Description

Definition at line 953 of file Protocol.h.


Member Typedef Documentation

Definition at line 1113 of file Protocol.h.


Constructor & Destructor Documentation

ACE_RMCast::NRTM::NRTM ( Header const &  h,
istream is 
) [inline]

Definition at line 958 of file Protocol.h.

        : Profile (h), map_ (10)
    {
      u32 addr (0);
      u16 port (0);
      u64 sn (0);

      sstream ss;

      ss << sn;
      ss << addr;
      ss << port;

      size_t block_size (ss.total_length ());


      // num_of_blocks = size / block_size
      //
      for (size_t i (0); i < (h.size () / block_size); ++i)
      {
        is >> sn;
        is >> addr;
        is >> port;

        map_.bind (Address (port, addr), sn);
      }
    }

ACE_RMCast::NRTM::NRTM (  )  [inline]

Definition at line 986 of file Protocol.h.

        : Profile (id), map_ (10)
    {
      size (calculate_size ());
    }

ACE_RMCast::NRTM::NRTM ( NRTM const &  nrtm  )  [inline, protected]

Definition at line 1006 of file Protocol.h.

        : Profile (nrtm)
    {
      for (Map::const_iterator i (nrtm.map_); !i.done (); i.advance ())
      {
        map_.bind ((*i).ext_id_, (*i).int_id_);
      }
    }


Member Function Documentation

NRTM_ptr ACE_RMCast::NRTM::clone ( void   )  [inline]

Reimplemented from ACE_RMCast::Profile.

Definition at line 993 of file Protocol.h.

    {
      return NRTM_ptr (clone_ ());
    }

virtual Profile_ptr ACE_RMCast::NRTM::clone_ (  )  [inline, protected, virtual]

Implements ACE_RMCast::Profile.

Definition at line 1000 of file Protocol.h.

    {
      Profile_ptr p (new NRTM (*this));
      return p;
    }

bool ACE_RMCast::NRTM::empty ( void   )  const [inline]

Definition at line 1035 of file Protocol.h.

    {
      return map_.current_size () == 0;
    }

u64 ACE_RMCast::NRTM::find ( Address const &  addr  )  const [inline]

Definition at line 1025 of file Protocol.h.

    {
      u64 sn;

      if (map_.find (addr, sn) == -1) return 0;

      return sn;
    }

void ACE_RMCast::NRTM::insert ( Address const &  addr,
u64  sn 
) [inline]

Definition at line 1017 of file Protocol.h.

    {
      map_.bind (addr, sn);

      size (calculate_size ());
    }

static u32 ACE_RMCast::NRTM::max_count ( u32  max_size  )  [inline, static]

Definition at line 1045 of file Protocol.h.

    {
      u32 n (0);

      sstream ss;

      Profile::Header hdr (0, 0);
      ss << hdr;

      while (true)
      {
        u32 addr (0);
        u16 port (0);
        u64 sn (0);

        ss << sn;
        ss << addr;
        ss << port;

        if (ss.total_length () <= max_size)
          ++n;

        if (ss.total_length () >= max_size)
          break;
      }

      return n;
    }

virtual void ACE_RMCast::NRTM::serialize_body ( sstream ss  )  const [inline, virtual]

Implements ACE_RMCast::Profile.

Definition at line 1092 of file Protocol.h.

    {
      for (Map::const_iterator i (map_), e (map_, 1); i != e; ++i)
      {
        u32 addr (0);
        u16 port (0);
        u64 sn (0);

        ss << sn;
        ss << addr;
        ss << port;
      }
    }

virtual void ACE_RMCast::NRTM::serialize_body ( ostream os  )  const [inline, virtual]

Implements ACE_RMCast::Profile.

Definition at line 1076 of file Protocol.h.

    {
      for (Map::const_iterator i (map_), e (map_, 1); i != e; ++i)
      {
        u32 addr ((*i).ext_id_.get_ip_address ());
        u16 port ((*i).ext_id_.get_port_number ());
        u64 sn ((*i).int_id_);

        os << sn;
        os << addr;
        os << port;

      }
    }


Member Data Documentation

u16 const ACE_RMCast::NRTM::id = 0x0006 [static]

Definition at line 955 of file Protocol.h.

Definition at line 1115 of file Protocol.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines