[Home]BoostSocket/SocketOptionConcept

BOOST WIKI | BoostSocket | RecentChanges | Preferences | Page List | Links List

Difference (from prior major revision) (no other diffs)

Changed: 1,102c1,33

SocketOption concept




A SocketOption? would wrap the arguments to possible get/setsockopt calls.

* level() - the level to be passed to the get/setsockopt call
* option() - the command to be passed to the get/setsockopt call
* can_get() - can the option be passed to getsockopt
* can_set() - can the option be passed to setsockopt
* void* data() - the data to be passed to the sockopt call
* size() - the size of data to be passed


e.g.
template <int LevelValue?, int OptionValue?, bool CanGet?, bool CanSet?,
typename ValueType?>
struct socket_option
{
socket_option() {}
socket_option(const ValueType?& ov)
: value(ov)
{}

BOOST_STATIC_CONSTANT(int, level = LevelValue?);
BOOST_STATIC_CONSTANT(int, option = OptionValue?);
BOOST_STATIC_CONSTANT(bool, can_get = CanGet?);
BOOST_STATIC_CONSTANT(bool, can_set = CanSet?);
ValueType? value;
static int size() {return sizeof(ValueType?); }
};

typedef socket_option<SOL_SOCKET, SO_ERROR, true, false, bool>
socket_option_error;


SocketOption concept

A SocketOption? would wrap the arguments to possible get/setsockopt calls.

e.g.

    template <int LevelValue?, int OptionValue?, bool CanGet?, bool CanSet?,
              typename ValueType?>
    struct socket_option
    {
      socket_option() {}
      socket_option(const ValueType?& ov)
          : value(ov)
      {}

      BOOST_STATIC_CONSTANT(int, level = LevelValue?);
      BOOST_STATIC_CONSTANT(int, option = OptionValue?);
      BOOST_STATIC_CONSTANT(bool, can_get = CanGet?);
      BOOST_STATIC_CONSTANT(bool, can_set = CanSet?);
      ValueType? value;
      static int size() {return sizeof(ValueType?); }
    };

    typedef socket_option<SOL_SOCKET, SO_ERROR, true, false, bool>
      socket_option_error;


BOOST WIKI | BoostSocket | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited December 18, 2004 12:25 pm (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers