Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
pgraph
inc
WireCellPgraph
Port.h
Go to the documentation of this file.
1
#ifndef WIRECELL_PGRAPH_PORT
2
#define WIRECELL_PGRAPH_PORT
3
4
#include "
WireCellUtil/Exceptions.h
"
5
6
#include <boost/any.hpp>
7
8
#include <string>
9
#include <vector>
10
#include <deque>
11
#include <memory>
12
13
14
15
namespace
WireCell
{
16
namespace
Pgraph {
17
18
// The type of data passed in the graph.
19
typedef
boost::any
Data
;
20
// A buffer of data. It is a std::deque instead of a
21
// std::queue so that it may be iterated as well as pushed
22
// back into. Like a British queue, one enters it from the
23
// back and exits it from the front.
24
typedef
std::deque<Data>
Queue
;
25
26
// Edges are just queues that can be shared.
27
typedef
std::shared_ptr<Queue>
Edge
;
28
29
class
Node
;
30
31
class
Port
{
32
public
:
33
enum
Type
{
tail
=0,
output
=0,
head
=1,
input
=1,
ntypes
=2 };
34
35
Port
(
Node
*
node
,
Type
type
,
std::string
signature
,
std::string
name
=
""
);
36
37
bool
isinput
();
38
bool
isoutput
();
39
Edge
edge
();
40
41
// Connect an edge, returning any previous one.
42
Edge
plug
(Edge edge);
43
44
// return edge queue size or 0 if no edge has been plugged
45
size_t
size
();
46
47
// Return true if queue is empty or no edge has been plugged.
48
bool
empty
();
49
50
// Get the next data. By default this pops the data off
51
// the queue. To "peek" at the data, pas false.
52
Data
get
(
bool
pop =
true
);
53
54
// Put the data onto the queue.
55
void
put
(Data&
data
);
56
57
// Get back the associated Node.
58
Node
*
node
();
59
60
const
std::string
&
name
();
61
const
std::string
&
signature
();
62
63
private
:
64
Node
*
m_node
;
// node to which port belongs
65
Type
m_type
;
66
std::string
m_name
,
m_sig
;
67
Edge
m_edge
;
68
};
69
70
typedef
std::vector<Port>
PortList
;
71
}
72
}
73
74
#endif
WireCell::Pgraph::Port::ntypes
Definition:
Port.h:33
WireCell::Pgraph::Port::Type
Type
Definition:
Port.h:33
WireCell::Pgraph::Port::m_type
Type m_type
Definition:
Port.h:65
WireCell::Pgraph::Port::isinput
bool isinput()
Definition:
Port.cxx:17
WireCell::Pgraph::Port::plug
Edge plug(Edge edge)
Definition:
Port.cxx:23
Exceptions.h
WireCell::Pgraph::Port::empty
bool empty()
Definition:
Port.cxx:36
string
std::string string
Definition:
nybbler.cc:12
WireCell::Pgraph::Edge
std::shared_ptr< Queue > Edge
Definition:
Port.h:27
WireCell::Pgraph::Queue
std::deque< Data > Queue
Definition:
Port.h:24
WireCell::Pgraph::Port::input
Definition:
Port.h:33
WireCell::Pgraph::Port::name
const std::string & name()
Definition:
Port.cxx:72
WireCell::Pgraph::Port::m_name
std::string m_name
Definition:
Port.h:66
WireCell::Pgraph::Port::signature
const std::string & signature()
Definition:
Port.cxx:73
internal::data
basic_data data
Definition:
format.h:764
WireCell::Pgraph::Port::size
size_t size()
Definition:
Port.cxx:30
WireCell::Pgraph::PortList
std::vector< Port > PortList
Definition:
Port.h:70
WireCell::Pgraph::Port::Port
Port(Node *node, Type type, std::string signature, std::string name="")
Definition:
Port.cxx:9
WireCell::Pgraph::Port::tail
Definition:
Port.h:33
WireCell::Pgraph::Port::output
Definition:
Port.h:33
type
Definition:
ShowerProduedPtrsHolder.hh:46
WireCell::Pgraph::Port::m_node
Node * m_node
Definition:
Port.h:64
WireCell::Pgraph::Port::head
Definition:
Port.h:33
WireCell::Pgraph::Port::node
Node * node()
WireCell
Definition:
Main.h:22
WireCell::Pgraph::Port::m_edge
Edge m_edge
Definition:
Port.h:67
WireCell::Pgraph::Port::isoutput
bool isoutput()
Definition:
Port.cxx:18
WireCell::Pgraph::Data
boost::any Data
Definition:
Port.h:19
WireCell::Pgraph::Port::m_sig
std::string m_sig
Definition:
Port.h:66
WireCell::Pgraph::Node
Definition:
Node.h:10
WireCell::Pgraph::Port::put
void put(Data &data)
Definition:
Port.cxx:62
WireCell::Pgraph::Port::edge
Edge edge()
Definition:
Port.cxx:20
WireCell::Pgraph::Port
Definition:
Port.h:31
Generated by
1.8.11