Internal class used to manage Networking related resources and hide platform dependent calls from the higher level API.
More...
#include <src/main/decaf/internal/net/Network.h>
Static Public Member Functions |
static Network * | getNetworkRuntime () |
| Gets the one and only instance of the Network class, if this is called before the Network layer has been initialized or after it has been shutdown then an IllegalStateException is thrown.
|
static void | initializeNetworking () |
| Initialize the Networking layer.
|
static void | shutdownNetworking () |
| Shutdown the Network layer and free any associated resources, classes in the Decaf library that use the networking layer will now fail if used after calling the shutdown method.
|
Protected Member Functions |
| Network () |
Detailed Description
Internal class used to manage Networking related resources and hide platform dependent calls from the higher level API.
- Since
- 1.0
Constructor & Destructor Documentation
decaf::internal::net::Network::Network |
( |
| ) |
|
|
protected |
virtual decaf::internal::net::Network::~Network |
( |
| ) |
|
|
virtual |
Member Function Documentation
template<typename T >
void decaf::internal::net::Network::addAsResource |
( |
T * |
value | ) |
|
|
inline |
Adds a Resource to the Network Runtime, this resource will be held by the runtime until the Library shutdown method is called at which time all the Resources held by the Network Runtime are destroyed.
- Parameters
-
value | The Resource to add to the Network Runtime. |
- Exceptions
-
NullPointerException | if the Resource value passed is null. |
Register a Runnable to be called when the Network Runtime is shutdown to provide a chance to cleanup any data or references that could cause problems should the Network Runtime be re-initialized.
The Runnable pointer ownership is transfered to the NetworkRuntime to guarantee the timing of resource cleanup.
The cleanup tasks are run at a critical time in the Shutdown process and should be as simple as possible and make every attempt to no throw any exceptions. If an exception is thrown it is ignored and processing of the next task is started.
The tasks should not assume that any Network resources are still available and should execute as quickly as possible.
- Parameters
-
task | Pointer to a Runnable object that will now be owned by the Network Runtime. |
static Network* decaf::internal::net::Network::getNetworkRuntime |
( |
| ) |
|
|
static |
Gets the one and only instance of the Network class, if this is called before the Network layer has been initialized or after it has been shutdown then an IllegalStateException is thrown.
- Returns
- pointer to the Network runtime for the Decaf library.
Gets a pointer to the Network Runtime's Lock object, this can be used by Network layer APIs to synchronize around certain actions such as adding a resource to the Network layer, etc.
The pointer returned is owned by the Network runtime and should not be deleted or copied by the caller.
- Returns
- a pointer to the Network Runtime's single Lock instance.
static void decaf::internal::net::Network::initializeNetworking |
( |
| ) |
|
|
static |
Initialize the Networking layer.
static void decaf::internal::net::Network::shutdownNetworking |
( |
| ) |
|
|
static |
Shutdown the Network layer and free any associated resources, classes in the Decaf library that use the networking layer will now fail if used after calling the shutdown method.
The documentation for this class was generated from the following file: