SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Friends | Related Functions
RWTSocketAttribute< Socket > Class Template Reference

Represents a set of attributes on a socket. More...

#include <rw/network/RWTSocketAttribute.h>

Public Types

enum  Attribute {
  NIL, CANREAD, CANWRITE, RWEXCEPTION,
  ISEXCEPTION, EXCEPTION, ISCONNECTED, CANACCEPT,
  ANY, sock_attr_nil, sock_attr_canread, sock_attr_canwrite,
  sock_attr_exception, sock_attr_isconnected, sock_attr_canaccept, sock_attr_any
}
 

Public Member Functions

 RWTSocketAttribute ()
 
 RWTSocketAttribute (const Socket &socket, Attribute attribute=sock_attr_nil)
 
 RWTSocketAttribute (const RWTSocketAttribute &rhs)
 
 ~RWTSocketAttribute (void)
 
Attribute getAttribute () const
 
Socket getSocket () const
 
RWTSocketAttributeoperator= (const RWTSocketAttribute &rhs)
 

Friends

Attribute operator& (Attribute lhs, Attribute rhs)
 
Attributeoperator&= (Attribute &lhs, Attribute rhs)
 
Attribute operator^ (Attribute lhs, Attribute rhs)
 
Attributeoperator^= (Attribute &lhs, Attribute rhs)
 
Attribute operator| (Attribute lhs, Attribute rhs)
 
Attributeoperator|= (Attribute &lhs, Attribute rhs)
 
Attribute operator~ (Attribute rhs)
 

Related Functions

(Note that these are not member functions.)

template<class Socket >
bool operator== (const RWTSocketAttribute< Socket > &x, const RWTSocketAttribute< Socket > &y)
 

Detailed Description

template<class Socket>
class RWTSocketAttribute< Socket >

RWTSocketAttribute encapsulates conditions that may be true for a socket. An RWTSocketAttribute serves two purposes: it is used to represent a set of attributes on a socket, and it is used to indicate that a particular attribute is true. It consists of two parts: the socket and the attribute.

Member Enumeration Documentation

template<class Socket >
enum RWTSocketAttribute::Attribute

The Attribute type indicates the condition(s) on the socket. Attributes are used to indicate conditions of interest and to indicate what has happened on the socket. Attributes can be aggregated by ORing them together. For example, the attribute sock_attr_canread|sock_attr_canwrite on a socket indicates that the socket can either read or write.

The later enum values (NIL, CANREAD, CANWRITE, RWEXCEPTION, ISEXCEPTION, EXCEPTION, ISCONNECTED, CANACCEPT, ANY) have been retained, but are deprecated. You can refuse support for these values by defining the macro RW_DISABLE_DEPRECATED.

Enumerator
NIL 
Deprecated:
As of SourcePro 1, use sock_attr_nil instead.

No attributes.

CANREAD 
Deprecated:
As of SourcePro 1, use sock_attr_canread instead.

Data is available for reading.

CANWRITE 
Deprecated:
As of SourcePro 1, use sock_attr_canwrite instead.

Data is available for writing.

RWEXCEPTION 
Deprecated:
As of SourcePro 1, use sock_attr_exception instead.

An exception, such as an error or out-of-band data.

ISEXCEPTION 
Deprecated:
As of SourcePro 1, use sock_attr_exception instead.

An exception, such as an error or out-of-band data.

EXCEPTION 
Deprecated:
As of SourcePro 1, use sock_attr_exception instead.

An exception, such as an error or out-of-band data.

ISCONNECTED 
Deprecated:
As of SourcePro 1, use sock_attr_isconnected instead.

Connect has completed.

CANACCEPT 
Deprecated:
As of SourcePro 1, use sock_attr_canaccept instead.

A new connection is ready to be accepted.

ANY 
Deprecated:
As of SourcePro 1, use sock_attr_any instead.

Any Attribute

sock_attr_nil 

No attributes.

sock_attr_canread 

Data is available for reading.

sock_attr_canwrite 

Data is available for writing.

sock_attr_exception 

An exception, such as an error or out-of-band data.

sock_attr_isconnected 

Connect has completed.

sock_attr_canaccept 

A new connection is ready to be accepted.

sock_attr_any 

Any Attribute

Constructor & Destructor Documentation

template<class Socket >
RWTSocketAttribute< Socket >::RWTSocketAttribute ( )
inline

Constructs a null attribute on the undefined socket.

template<class Socket >
RWTSocketAttribute< Socket >::RWTSocketAttribute ( const Socket &  socket,
Attribute  attribute = sock_attr_nil 
)
inline

Constructs an attribute for a particular socket.

template<class Socket >
RWTSocketAttribute< Socket >::RWTSocketAttribute ( const RWTSocketAttribute< Socket > &  rhs)
inline

Copy constructor.

template<class Socket >
RWTSocketAttribute< Socket >::~RWTSocketAttribute ( void  )
inline

Destructor.

Member Function Documentation

template<class Socket >
RWTSocketAttribute< Socket >::Attribute RWTSocketAttribute< Socket >::getAttribute ( ) const
inline

The attribute with which this is associated. The attribute may be a set of several Attribute values ORed together.

template<class Socket >
Socket RWTSocketAttribute< Socket >::getSocket ( ) const
inline

The socket with which the attribute is associated.

template<class Socket >
RWTSocketAttribute< Socket > & RWTSocketAttribute< Socket >::operator= ( const RWTSocketAttribute< Socket > &  rhs)
inline

Assignment operator.

Friends And Related Function Documentation

template<class Socket >
Attribute operator& ( Attribute  lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise or operation, and returns the result.

template<class Socket >
Attribute& operator&= ( Attribute lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise and operation, stores the result into lhs, and returns the result.

template<class Socket >
bool operator== ( const RWTSocketAttribute< Socket > &  x,
const RWTSocketAttribute< Socket > &  y 
)
related

Returns true if x and y refer to the same attribute(s) on the same socket. Requires that Socket provide an equality operator.

template<class Socket >
Attribute operator^ ( Attribute  lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise exclusive or operation, and returns the result.

template<class Socket >
Attribute& operator^= ( Attribute lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise exclusive or operation, stores the result into lhs, and returns the result.

template<class Socket >
Attribute operator| ( Attribute  lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise or operation, and returns the result.

template<class Socket >
Attribute& operator|= ( Attribute lhs,
Attribute  rhs 
)
friend

Combines the attribute lhs with rhs using a bitwise or operation, stores the result into lhs, and returns the result.

template<class Socket >
Attribute operator~ ( Attribute  rhs)
friend

Inverts the value of the attribute rhs using a bitwise not operation, and returns the result.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.