Go to the documentation of this file. 1 #ifndef __JNET__JHOSTNAME__
2 #define __JNET__JHOSTNAME__
16 namespace JPP {
using namespace JNET; }
87 void set(
const std::string& buffer)
91 const string::size_type pos = buffer.find(
SEPARATOR);
93 if (pos != string::npos) {
95 this->
hostname = buffer.substr(0, pos);
97 istringstream(buffer.substr(pos + 1)) >> this->
port;
101 bool is_number =
true;
103 for (string::const_iterator i = buffer.begin(); is_number && i != buffer.end(); ++i) {
104 is_number &= isdigit(*i);
111 istringstream(buffer) >> this->
port;
150 return out <<
object.hostname <<
SEPARATOR <<
object.port;
JHostname(const std::string &hostname, const int port)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JHostname &object)
Write hostname to output stream.
Interprocess communication.
Auxiliary data structure for hostname and port number.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const int DISPATCH_PORT
Default ControlHost port.
friend std::istream & operator>>(std::istream &in, JHostname &object)
Read hostname from input stream.
void set(const std::string &buffer)
Set hostname and port number.
JHostname()
Default constructor.
JHostname(const std::string &buffer)
Constructor.
static const char SEPARATOR
Separation character between hostname and port number.