PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PNetwork.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/devices/PNetwork.h
4// Purpose: Class for handling network communication (tcpip)
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2006-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PNETWORK_H__
28#define __PNETWORK_H__
29
30#include "PDevice.h"
31#include "../base/PEBLObject.h"
32#include <fstream>
33#include <string>
34
35
36
42
43class PNetwork: public PDevice, virtual public PEBLObjectBase
44{
45
46public:
47
48
50 PNetwork();
51
53 virtual ~PNetwork();
54
55 virtual void SetHostIP(unsigned int host);
56 virtual unsigned int GetHost();
57
58 virtual void SetHostName(std::string hostname);
59 virtual std::string GetHostName();
60
61 virtual void SetPort(unsigned int port);
62 virtual unsigned int GetPort();
63
64 virtual bool IsOpen();
65 virtual Variant ConvertAddress(unsigned long int address);
66
67 virtual void SetOpen(bool open);
68protected:
69
70 //Inheritable printing Method.
71 virtual std::ostream& SendToStream(std::ostream& out)const;
72
73 std::string mHostName;
74 unsigned int mHost;
75 unsigned int mPort;
76
77 bool mIsOpen;
78
79private:
80
81
82};
83
84
85
86#endif
bool mIsOpen
Definition PNetwork.h:77
virtual void SetHostIP(unsigned int host)
Definition PNetwork.cpp:81
virtual std::string GetHostName()
Definition PNetwork.cpp:103
virtual bool IsOpen()
Definition PNetwork.cpp:119
virtual ~PNetwork()
The Standard destructor.
Definition PNetwork.cpp:52
virtual void SetOpen(bool open)
Definition PNetwork.cpp:91
std::string mHostName
Definition PNetwork.h:73
unsigned int mPort
Definition PNetwork.h:75
PNetwork()
The Standard constructor.
Definition PNetwork.cpp:37
virtual unsigned int GetPort()
Definition PNetwork.cpp:114
virtual std::ostream & SendToStream(std::ostream &out) const
Definition PNetwork.cpp:73
unsigned int mHost
Definition PNetwork.h:74
virtual Variant ConvertAddress(unsigned long int address)
Definition PNetwork.cpp:57
virtual void SetHostName(std::string hostname)
Definition PNetwork.cpp:97
virtual void SetPort(unsigned int port)
Definition PNetwork.cpp:108
virtual unsigned int GetHost()
Definition PNetwork.cpp:86