|
CPN
Computational Process Networks
|
The CPN::Context abstraction that holds all the global state for the process network. More...
#include <Context.h>
Inheritance diagram for CPN::Context:
Collaboration diagram for CPN::Context:Public Member Functions | |
| virtual | ~Context () |
| virtual Key_t | SetupKernel (const std::string &name, const std::string &hostname, const std::string &servname, KernelBase *kernel)=0 |
| Called by the Kernel when it has successfully set it self up. This gives the Context a way to notify the Kernel of events and lets other Kernels look up the connection information for this Kernel. More... | |
| virtual Key_t | SetupKernel (const std::string &name, KernelBase *kernel)=0 |
| Called by the kernel when it is not in remote mode. More... | |
| virtual Key_t | GetKernelKey (const std::string &kernel)=0 |
| virtual std::string | GetKernelName (Key_t kernelkey)=0 |
| virtual void | GetKernelConnectionInfo (Key_t kernelkey, std::string &hostname, std::string &servname)=0 |
| obtain the connection information for the given kernel More... | |
| virtual void | SignalKernelEnd (Key_t kernelkey)=0 |
| Signal to the Context that the given kernel is dead. More... | |
| virtual Key_t | WaitForKernelStart (const std::string &kernel)=0 |
| Does not return until the given kernel has started. More... | |
| virtual void | SignalKernelStart (Key_t kernelkey)=0 |
| Signal to the context that the given kernel has started. More... | |
| virtual void | SendCreateWriter (Key_t kernelkey, const SimpleQueueAttr &attr)=0 |
| Tell a given kernel that it needs to create a queue write end. More... | |
| virtual void | SendCreateReader (Key_t kernelkey, const SimpleQueueAttr &attr)=0 |
| Tell a given kernel that it needs to create a queue read end. More... | |
| virtual void | SendCreateQueue (Key_t kernelkey, const SimpleQueueAttr &attr)=0 |
| Tell a given kernel that it needs to create a queue. More... | |
| virtual void | SendCreateNode (Key_t kernelkey, const NodeAttr &attr)=0 |
| Tell a given kernel that it needs to create a node. More... | |
| virtual Key_t | CreateNodeKey (Key_t kernelkey, const std::string &nodename)=0 |
| Tell the context to allocate a new node key and data structure for a node with nodename which is on kernelkey. More... | |
| virtual Key_t | GetNodeKey (const std::string &nodename)=0 |
| virtual std::string | GetNodeName (Key_t nodekey)=0 |
| virtual Key_t | GetNodeKernel (Key_t nodekey)=0 |
| virtual void | SignalNodeStart (Key_t nodekey)=0 |
| Called by the node startup routine to indicate that the node has started. More... | |
| virtual void | SignalNodeEnd (Key_t nodekey)=0 |
| Called by the node cleanup routine to indicate that the node has ended. More... | |
| virtual Key_t | WaitForNodeStart (const std::string &nodename)=0 |
| Waits until the node starts and returns the key, if the node is already started returns the key. More... | |
| virtual void | WaitForNodeEnd (const std::string &nodename)=0 |
| Waits for the given node to signal end. More... | |
| virtual void | WaitForAllNodeEnd ()=0 |
| Convenience method which waits until there are no nodes running. If no node have started then this will return immediately. More... | |
| virtual Key_t | GetCreateReaderKey (Key_t nodekey, const std::string &portname)=0 |
| Get the key associated with the given endpoint for the given node. Creates the information if it does not exist. More... | |
| virtual Key_t | GetReaderNode (Key_t portkey)=0 |
| virtual Key_t | GetReaderKernel (Key_t portkey)=0 |
| virtual std::string | GetReaderName (Key_t portkey)=0 |
| virtual Key_t | GetCreateWriterKey (Key_t nodekey, const std::string &portname)=0 |
| virtual Key_t | GetWriterNode (Key_t portkey)=0 |
| virtual Key_t | GetWriterKernel (Key_t portkey)=0 |
| virtual std::string | GetWriterName (Key_t portkey)=0 |
| virtual void | ConnectEndpoints (Key_t writerkey, Key_t readerkey, const std::string &qname)=0 |
| Called by the kernel when a queue is created. Note that the endpoints may have been created when the node requests them but the queue may be created long after that. More... | |
| virtual Key_t | GetReadersWriter (Key_t readerkey)=0 |
| virtual Key_t | GetWritersReader (Key_t writerkey)=0 |
| virtual void | Terminate ()=0 |
| Signal to the Context that the network is terminating. After this call most methods will throw a ShutdownException. More... | |
| virtual bool | IsTerminated ()=0 |
| void | CheckTerminated () |
| Convenience method that checks IsTerminated and if so throws a ShutdownException. More... | |
| virtual bool | RequireRemote () |
| Lets the kernel know that this context type requires remote activity. This overrides the kernel option for remote activity. Default value is false. More... | |
| virtual unsigned | CalculateGrowSize (unsigned currentsize, unsigned request) |
| Calculate the new queue size when a queue needs to grow. More... | |
| virtual int | LogLevel () const =0 |
| virtual int | LogLevel (int level)=0 |
| virtual void | Log (int level, const std::string &msg)=0 |
| Log a message to this outputer. More... | |
Static Public Member Functions | |
| static shared_ptr< Context > | Local () |
| Create a local context. More... | |
Protected Member Functions | |
| Context () | |
The CPN::Context abstraction that holds all the global state for the process network.
All methods may through a CPN::ShutdownException.
Note that all key values should be unique across all objects. That is to say that even though a node and a kernel are of different types none of there keys should ever be equal.
Note that the only function here that should be called outside of the library (i.e. by the user of the library) are the log level functions the Get functions and the Wait functions and the Terminate functions.
|
virtual |
Definition at line 37 of file Context.cc.
|
protected |
Definition at line 33 of file Context.cc.
|
inlinevirtual |
| void CPN::Context::CheckTerminated | ( | ) |
Convenience method that checks IsTerminated and if so throws a ShutdownException.
| ShutdownException |
Definition at line 44 of file Context.cc.
References IsTerminated().
Here is the call graph for this function:
|
pure virtual |
Called by the kernel when a queue is created. Note that the endpoints may have been created when the node requests them but the queue may be created long after that.
| writerkey | the unique key for the writer endpoint |
| readerkey | the unique key for the reader endpoint |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Tell the context to allocate a new node key and data structure for a node with nodename which is on kernelkey.
| kernelkey | the id of the kernel that the node will run on |
| nodename | the name of the node |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Get the key associated with the given endpoint for the given node. Creates the information if it does not exist.
| nodekey | the unique id for the node |
| portname | the name of the endpoint. |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
obtain the connection information for the given kernel
| kernelkey | the unique id for the kernel |
| hostname | (output) string to be filled with the hostname |
| servname | (output) string to be filled with the service name |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
| kernel | the name of the kernel |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
| kernelkey | the key to the kernel |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
| nodekey | the unique key for the node |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
| portkey | the unique id for the port |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
| portkey | the unique id for the port |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
| portkey | the unique id for the port |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
| readerkey | a unique reader key |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
| writerkey | a unique writer key |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
Referenced by CheckTerminated().
Here is the caller graph for this function:
|
static |
Create a local context.
Definition at line 29 of file Context.cc.
Referenced by CPN::Kernel::Kernel(), and CPN::VariantCPNLoader::LoadContext().
Here is the caller graph for this function:
|
pure virtualinherited |
Log a message to this outputer.
| level | the level of this message |
| msg | the message |
Implemented in LoggerStdOutput, Logger, CPN::LocalContext, and CPN::RemoteContextClient.
Referenced by Logger::Log().
Here is the caller graph for this function:
|
pure virtualinherited |
Implemented in LoggerStdOutput, CPN::LocalContext, Logger, and CPN::RemoteContextClient.
Referenced by Logger::Logger().
Here is the caller graph for this function:| level | the new log level |
Implemented in LoggerStdOutput, CPN::LocalContext, Logger, and CPN::RemoteContextClient.
|
virtual |
Lets the kernel know that this context type requires remote activity. This overrides the kernel option for remote activity. Default value is false.
Reimplemented in CPN::RemoteContextClient.
Definition at line 40 of file Context.cc.
Tell a given kernel that it needs to create a node.
| kernelkey | the id of the kernel |
| attr | the node attribute |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Tell a given kernel that it needs to create a queue.
| kernelkey | the id of the kernel |
| attr | the queue attribute |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Tell a given kernel that it needs to create a queue read end.
| kernelkey | the id of the kernel |
| attr | the queue attribute |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Tell a given kernel that it needs to create a queue write end.
| kernelkey | the id of the kernel |
| attr | the queue attribute |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Called by the Kernel when it has successfully set it self up. This gives the Context a way to notify the Kernel of events and lets other Kernels look up the connection information for this Kernel.
| name | the kernel name |
| hostname | the hostname to use to connect to this kernel |
| servname | the service name the kernel is listening on |
| kernel | callback reference |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Called by the kernel when it is not in remote mode.
| name | the kernel name |
| kernel | callback reference |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Signal to the Context that the given kernel is dead.
| kernelkey | id of the kernel that died |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Signal to the context that the given kernel has started.
| kernelkey | the id for the kernel |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Called by the node cleanup routine to indicate that the node has ended.
| nodekey | the unique key for the node |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Called by the node startup routine to indicate that the node has started.
| nodekey | the unique key for the node |
| ShutdownException | |
| std::invalid_argument |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Signal to the Context that the network is terminating. After this call most methods will throw a ShutdownException.
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Convenience method which waits until there are no nodes running. If no node have started then this will return immediately.
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Does not return until the given kernel has started.
| kernel | the name of the kernel (the key may not be known yet) |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Waits for the given node to signal end.
| nodename | the name of the node |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
|
pure virtual |
Waits until the node starts and returns the key, if the node is already started returns the key.
| nodename | the name of the node to wait for |
| ShutdownException |
Implemented in CPN::LocalContext, and CPN::RemoteContextClient.
1.8.5