CPN
Computational Process Networks
Main Page
Namespaces
Classes
Files
File List
File Members
include
cpn
Context.h
Go to the documentation of this file.
1
//=============================================================================
2
// Computational Process Networks class library
3
// Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4
//
5
// This library is free software; you can redistribute it and/or modify it
6
// under the terms of the GNU Library General Public License as published
7
// by the Free Software Foundation; either version 2 of the License, or
8
// (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Library General Public License for more details.
14
//
15
// The GNU Public License is available in the file LICENSE, or you
16
// can write to the Free Software Foundation, Inc., 59 Temple Place -
17
// Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18
// World Wide Web at http://www.fsf.org.
19
//=============================================================================
24
#ifndef CPNDB_CONTEXT_H
25
#define CPNDB_CONTEXT_H
26
#pragma once
27
#include <
cpn/common.h
>
28
#include <
cpn/utils/Logger.h
>
29
#include <string>
30
31
namespace
CPN {
32
47
class
CPN_API
Context
:
public
LoggerOutput
{
48
public
:
49
53
static
shared_ptr<Context> Local();
54
55
virtual
~
Context
();
56
68
virtual
Key_t
SetupKernel(
const
std::string &name,
const
std::string &hostname,
69
const
std::string &servname,
KernelBase
*kernel) = 0;
75
virtual
Key_t
SetupKernel(
const
std::string &name,
KernelBase
*kernel) = 0;
81
virtual
Key_t
GetKernelKey(
const
std::string &kernel) = 0;
87
virtual
std::string GetKernelName(
Key_t
kernelkey) = 0;
95
virtual
void
GetKernelConnectionInfo(
Key_t
kernelkey, std::string &hostname, std::string &servname) = 0;
100
virtual
void
SignalKernelEnd(
Key_t
kernelkey) = 0;
105
virtual
Key_t
WaitForKernelStart(
const
std::string &kernel) = 0;
111
virtual
void
SignalKernelStart(
Key_t
kernelkey) = 0;
112
118
virtual
void
SendCreateWriter(
Key_t
kernelkey,
const
SimpleQueueAttr
&attr) = 0;
124
virtual
void
SendCreateReader(
Key_t
kernelkey,
const
SimpleQueueAttr
&attr) = 0;
130
virtual
void
SendCreateQueue(
Key_t
kernelkey,
const
SimpleQueueAttr
&attr) = 0;
136
virtual
void
SendCreateNode(
Key_t
kernelkey,
const
NodeAttr
&attr) = 0;
137
145
virtual
Key_t
CreateNodeKey(
Key_t
kernelkey,
const
std::string &nodename) = 0;
150
virtual
Key_t
GetNodeKey(
const
std::string &nodename) = 0;
155
virtual
std::string GetNodeName(
Key_t
nodekey) = 0;
161
virtual
Key_t
GetNodeKernel(
Key_t
nodekey) = 0;
167
virtual
void
SignalNodeStart(
Key_t
nodekey) = 0;
172
virtual
void
SignalNodeEnd(
Key_t
nodekey) = 0;
173
180
virtual
Key_t
WaitForNodeStart(
const
std::string &nodename) = 0;
185
virtual
void
WaitForNodeEnd(
const
std::string &nodename) = 0;
190
virtual
void
WaitForAllNodeEnd() = 0;
191
192
200
virtual
Key_t
GetCreateReaderKey(
Key_t
nodekey,
const
std::string &portname) = 0;
206
virtual
Key_t
GetReaderNode(
Key_t
portkey) = 0;
212
virtual
Key_t
GetReaderKernel(
Key_t
portkey) = 0;
218
virtual
std::string GetReaderName(
Key_t
portkey) = 0;
219
221
virtual
Key_t
GetCreateWriterKey(
Key_t
nodekey,
const
std::string &portname) = 0;
223
virtual
Key_t
GetWriterNode(
Key_t
portkey) = 0;
225
virtual
Key_t
GetWriterKernel(
Key_t
portkey) = 0;
227
virtual
std::string GetWriterName(
Key_t
portkey) = 0;
228
237
virtual
void
ConnectEndpoints(
Key_t
writerkey,
Key_t
readerkey,
const
std::string &qname) = 0;
243
virtual
Key_t
GetReadersWriter(
Key_t
readerkey) = 0;
249
virtual
Key_t
GetWritersReader(
Key_t
writerkey) = 0;
250
254
virtual
void
Terminate() = 0;
257
virtual
bool
IsTerminated() = 0;
258
263
void
CheckTerminated();
264
270
virtual
bool
RequireRemote();
271
275
virtual
unsigned
CalculateGrowSize
(
unsigned
currentsize,
unsigned
request) {
return
currentsize + request; }
276
277
protected
:
278
Context
();
279
280
};
281
282
}
283
284
#endif
285
CPN::NodeAttr
Attributes for a node.
Definition:
NodeAttr.h:58
CPN::Key_t
uint64_t Key_t
Definition:
common.h:79
CPN::Context
The CPN::Context abstraction that holds all the global state for the process network.
Definition:
Context.h:47
LoggerOutput
Abstract base class for logger outputers. Any object who wishes to be a place for logging messages to...
Definition:
Logger.h:37
CPN::Context::CalculateGrowSize
virtual unsigned CalculateGrowSize(unsigned currentsize, unsigned request)
Calculate the new queue size when a queue needs to grow.
Definition:
Context.h:275
CPN::KernelBase
Definition:
KernelBase.h:39
Logger.h
A very simple logging interface.
common.h
CPN_API
#define CPN_API
Definition:
common.h:36
CPN::SimpleQueueAttr
This is a simplified internal representation of the queue attributes needed to create a queue...
Definition:
QueueAttr.h:237
Generated by
1.8.5