Ovis_Entity_From_Objid_Create()
Abstract
Creates the Ovis entity from the simulation object ID.
Syntax
Ovis_Entity_From_Objid_Create (des_objid, callback, state_ptr)
| Argument | Type | Description |
|---|---|---|
des_objid |
Objid |
Simulation object ID of a site |
callback |
OvisT_Entity_State_Destroy_Proc |
Callback function that will destroy the entity's state when the entity is destroyed |
state_ptr |
void * |
Optional user-provided state |
Return Type
OvisT_Entity *
Returns the entity or OVISC_NIL.
Header
ovis_entity.h
Details
This function creates an Ovis entity using the site specified by the simulation object ID. If an entity is already associated with that site, the function returns the entity (its state and destroy process are not modified by the provided arguments). This can only be used in the context of a simulation.
Example
OvisT_Entity * ent_ptr;
OvisT_DIS_Type dis [] { 1, 2, 225, 20, 2, 10, 0 };
/* Create entity associated with node containing that process model */
ent_ptr = Ovis_Entity_From_Objid_Create (op_topo_parent (op_id_self ()),
OPC_NIL, OPC_NIL);
Ovis_Entity_Animation_Set (ent_ptr, OPC_NIL, OvisC_Aggregation_Entity, dis,
OvisC_DIS_Force_Friendly, OvisC_DIS_DR_Static);
Ovis_Entity_Animation_Enable (ent_ptr);
Errors
- Object ID (
<id>) is out-of-range. - Object ID (
<id>) refers to a restricted object. - Object
<hname>is not a fixed or mobile node or subnet.
Reference
- Use the function
Ovis_Entity_Create()to generate an entity based on the hierarchical name of a site.