Panda3D
Loading...
Searching...
No Matches
datagramGeneratorNet.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file datagramGeneratorNet.h
10 * @author drose
11 * @date 2009-02-15
12 */
13
14#ifndef DATAGRAMGENERATORNET_H
15#define DATAGRAMGENERATORNET_H
16
17#include "pandabase.h"
18
19#include "datagramGenerator.h"
20#include "connectionReader.h"
21#include "queuedReturn.h"
22#include "pmutex.h"
23#include "conditionVar.h"
24#include "netDatagram.h"
25
26EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_NET, EXPTP_PANDA_NET, QueuedReturn<Datagram>);
27
28/**
29 * This class provides datagrams one-at-a-time as read directly from the net,
30 * via a TCP connection. If a datagram is not available, get_datagram() will
31 * block until one is.
32 */
33class EXPCL_PANDA_NET DatagramGeneratorNet : public DatagramGenerator, public ConnectionReader, public QueuedReturn<Datagram> {
34PUBLISHED:
35 explicit DatagramGeneratorNet(ConnectionManager *manager, int num_threads);
36 virtual ~DatagramGeneratorNet();
37
38 // Inherited from DatagramGenerator
39 virtual bool get_datagram(Datagram &data);
40 virtual bool is_eof();
41 virtual bool is_error();
42
43protected:
44 // Inherited from ConnectionReader
45 virtual void receive_datagram(const NetDatagram &datagram);
46
47 Mutex _dg_lock;
48 ConditionVar _dg_received; // notified when a new datagram is received.
49 ConditionVar _dg_processed; // notified when a new datagram is processed.
50};
51
53
54#endif
A condition variable, usually used to communicate information about changing state to a thread that i...
The primary interface to the low-level networking layer in this package.
This is an abstract base class for a family of classes that listen for activity on a socket and respo...
This class provides datagrams one-at-a-time as read directly from the net, via a TCP connection.
This class defines the abstract interace to any source of datagrams, whether it be from a file or fro...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
A standard mutex, or mutual exclusion lock.
Definition pmutex.h:40
A specific kind of Datagram, especially for sending across or receiving from a network.
Definition netDatagram.h:40
This is the implementation of a family of things that queue up their return values for later retrieva...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.