#include <sstream>
#include "assa/Socket.h"
#include "assa/XDRHack.h"
Include dependency graph for Socket.cpp:
Go to the source code of this file.
Defines | |
#define | LONGEST long |
#define | READ_INT(TYPE) |
#define | WRITE_INT(TYPE) |
|
Definition at line 428 of file Socket.cpp. |
|
Value: Socket& Socket::operator>>(TYPE& n_) \ {\ LONGEST val;\ int typesz = sizeof(TYPE);\ if (read ( (char* ) &val, typesz) == typesz) {\ if (sizeof(int32_t) <= typesz) {\ n_ = (TYPE) ntohl (val); \ }\ else {\ if (Socket::is_little_endian ()) {\ *((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val)) );\ *((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val))+1);\ }\ else {\ *((int32_t*)(&n_) ) = ntohl (*((int32_t*)(&val)) );\ *((int32_t*)(&n_)+1) = ntohl (*((int32_t*)(&val))+1);\ }\ }\ }\ else {\ setstate (Socket::eofbit|Socket::failbit);\ }\ return *this;\ } Definition at line 436 of file Socket.cpp. |
|
Value: Socket& Socket::operator<< (TYPE n_) \ { \ LONGEST val;\ int typesz = sizeof(TYPE);\ if (sizeof(int32_t) <= typesz) {\ val = (TYPE) ntohl (n_); \ }\ else {\ if (Socket::is_little_endian ()) {\ *((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_)) );\ *((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_))+1);\ }\ else {\ *((int32_t*)(&val) ) = htonl (*((int32_t*)(&n_)) );\ *((int32_t*)(&val)+1) = htonl (*((int32_t*)(&n_))+1);\ }\ }\ if (write ((const char*) &val, typesz) != typesz) {\ setstate (Socket::eofbit|Socket::failbit);\ }\ return *this;\ } Definition at line 588 of file Socket.cpp. |