nrac_resource_create()
Abstract
Create a resource object within a network.
Syntax
nrac_resource_create (net_handle, name, capacity, client_state_ptr)
| Argument | Type | Description |
|---|---|---|
net_handle |
Nrac_Net_Handle |
handle for the network context of interest |
name |
const char * |
name of the resource (used only for reporting) |
capacity |
double |
nominal number of consumer units the resource can support |
client_state_ptr |
void * |
a way to link the resource to other states in the client application. Use OPC_NIL if not needed. |
Return Type
Nrac_Resource_Handle
handle representing the new resource object. OPC_NIL means that creation failed, typically due to insufficient memory.
Header
nrac.h
Details
Resources represent physical or logical building blocks of the network, such as nodes, links, or channels. A resource can then be used to support resource consumers, typically traffic. Initially, the resource object simply exists within the network and is unassociated with any consumers. The object has three properties that can be queried at any time via other NRAC functions:
nameis used only for reporting. (This field can be empty if desired.)capacityspecifies, in a way that is meaningful to the client application, how many units of consumer load can nominally be supported by the resource. No enforcement of this limit is performed. It is merely used for accounting.client_state_ptris a pointer to any data that the application wishes to associate with this resource. For example, if the resource represents a link, this could be a pointer to a corresponding link data structure. The NRAC package does not use this pointer itself—pass inOPC_NILif it is not needed.