|
| 1 | +// SPDX-License-Identifier: LGPL-3.0-or-later |
| 2 | +#pragma once |
| 3 | + |
| 4 | +#include "anticipation_velocity_model.h" |
| 5 | +#include "collision_free_speed_model.h" |
| 6 | +#include "collision_free_speed_model_v2.h" |
| 7 | +#include "error.h" |
| 8 | +#include "export.h" |
| 9 | +#include "generalized_centrifugal_force_model.h" |
| 10 | +#include "social_force_model.h" |
| 11 | +#include "types.h" |
| 12 | + |
| 13 | +#include <stdbool.h> /*NOLINT(modernize-deprecated-headers)*/ |
| 14 | + |
| 15 | +#ifdef __cplusplus |
| 16 | +extern "C" { |
| 17 | +#endif |
| 18 | + |
| 19 | +/** |
| 20 | + * Opaque type of an agent |
| 21 | + */ |
| 22 | +typedef struct JPS_Agent_t* JPS_Agent; |
| 23 | + |
| 24 | +/** |
| 25 | + * Access the agents id. |
| 26 | + * @param handle of the agent to access. |
| 27 | + * @return the id |
| 28 | + */ |
| 29 | +JUPEDSIM_API JPS_AgentId JPS_Agent_GetId(JPS_Agent handle); |
| 30 | + |
| 31 | +/** |
| 32 | + * Access the agents journey id. |
| 33 | + * @param handle of the agent to access. |
| 34 | + * @return the id of this agents journey |
| 35 | + */ |
| 36 | +JUPEDSIM_API JPS_JourneyId JPS_Agent_GetJourneyId(JPS_Agent handle); |
| 37 | + |
| 38 | +/** |
| 39 | + * Access the agents currently targeted stage id. |
| 40 | + * @param handle of the agent to access. |
| 41 | + * @return the id of the stage currently targeted |
| 42 | + */ |
| 43 | +JUPEDSIM_API JPS_StageId JPS_Agent_GetStageId(JPS_Agent handle); |
| 44 | + |
| 45 | +/** |
| 46 | + * Access the agents position. |
| 47 | + * @param handle of the agent to access. |
| 48 | + * @return position |
| 49 | + */ |
| 50 | +JUPEDSIM_API JPS_Point JPS_Agent_GetPosition(JPS_Agent handle); |
| 51 | + |
| 52 | +/** |
| 53 | + * Access the agents current target. |
| 54 | + * @param handle of the agent to access. |
| 55 | + * @return target of the agent |
| 56 | + */ |
| 57 | +JUPEDSIM_API JPS_Point JPS_Agent_GetTarget(JPS_Agent handle); |
| 58 | + |
| 59 | +JUPEDSIM_API bool |
| 60 | +JPS_Agent_SetTarget(JPS_Agent handle, JPS_Point target, JPS_ErrorMessage* errorMessage); |
| 61 | + |
| 62 | +/** |
| 63 | + * Access the agents orientation. |
| 64 | + * The orientation is unit length. |
| 65 | + * @param handle of the agent to access. |
| 66 | + * @return the orientation |
| 67 | + */ |
| 68 | +JUPEDSIM_API JPS_Point JPS_Agent_GetOrientation(JPS_Agent handle); |
| 69 | + |
| 70 | +/** |
| 71 | + * Access the agets model type information. |
| 72 | + * @param handle of the agent to access. |
| 73 | + * @return type of model in use |
| 74 | + */ |
| 75 | +JUPEDSIM_API JPS_ModelType JPS_Agent_GetModelType(JPS_Agent handle); |
| 76 | + |
| 77 | +/** |
| 78 | + * Access Generalized Centrifugal Force model state. |
| 79 | + * Precondition: Agent needs to use Generalized Centrifugal Force model |
| 80 | + * @param handle of the agent to access. |
| 81 | + * @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error. |
| 82 | + * @return state or NULL on error |
| 83 | + */ |
| 84 | +JUPEDSIM_API JPS_GeneralizedCentrifugalForceModelState |
| 85 | +JPS_Agent_GetGeneralizedCentrifugalForceModelState( |
| 86 | + JPS_Agent handle, |
| 87 | + JPS_ErrorMessage* errorMessage); |
| 88 | + |
| 89 | +/** |
| 90 | + * Access Collision Free Speed model state. |
| 91 | + * Precondition: Agent needs to use Collision Free Speed model |
| 92 | + * @param handle of the agent to access. |
| 93 | + * @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error. |
| 94 | + * @return state or NULL on error |
| 95 | + */ |
| 96 | +JUPEDSIM_API JPS_CollisionFreeSpeedModelState |
| 97 | +JPS_Agent_GetCollisionFreeSpeedModelState(JPS_Agent handle, JPS_ErrorMessage* errorMessage); |
| 98 | + |
| 99 | +/** |
| 100 | + * Access Social Force model state. |
| 101 | + * Precondition: Agent needs to use Social Force model |
| 102 | + * @param handle of the agent to access. |
| 103 | + * @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error. |
| 104 | + * @return state or NULL on error |
| 105 | + */ |
| 106 | +JUPEDSIM_API JPS_SocialForceModelState |
| 107 | +JPS_Agent_GetSocialForceModelState(JPS_Agent handle, JPS_ErrorMessage* errorMessage); |
| 108 | + |
| 109 | +/** |
| 110 | + * Access Collision Free Speed model V2 state. |
| 111 | + * Precondition: Agent needs to use Collision Free Speed model V2 |
| 112 | + * @param handle of the agent to access. |
| 113 | + * @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error. |
| 114 | + * @return state or NULL on error |
| 115 | + */ |
| 116 | +JUPEDSIM_API JPS_CollisionFreeSpeedModelV2State |
| 117 | +JPS_Agent_GetCollisionFreeSpeedModelV2State(JPS_Agent handle, JPS_ErrorMessage* errorMessage); |
| 118 | + |
| 119 | +/** |
| 120 | + * Access Anticipation Velocity Model state. |
| 121 | + * Precondition: Agent needs to use Anticipation Velocity Model |
| 122 | + * @param handle of the agent to access. |
| 123 | + * @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error. |
| 124 | + * @return state or NULL on error |
| 125 | + */ |
| 126 | +JUPEDSIM_API JPS_AnticipationVelocityModelState |
| 127 | +JPS_Agent_GetAnticipationVelocityModelState(JPS_Agent handle, JPS_ErrorMessage* errorMessage); |
| 128 | + |
| 129 | +/** |
| 130 | + * Opaque type of an iterator over agents |
| 131 | + */ |
| 132 | +typedef struct JPS_AgentIterator_t* JPS_AgentIterator; |
| 133 | + |
| 134 | +/** |
| 135 | + * Access the next element in the iterator. |
| 136 | + * Calling JPS_AgentIterator_Next repeatedly on a finished iterator is save. |
| 137 | + * @param handle of the iterator to advance and access |
| 138 | + * @return an agent or NULL if the iterator is at the end. The pointer returned does not need to be |
| 139 | + * freed and is invalidated on the next call to this function! |
| 140 | + */ |
| 141 | +JUPEDSIM_API JPS_Agent JPS_AgentIterator_Next(JPS_AgentIterator handle); |
| 142 | + |
| 143 | +/** |
| 144 | + * Free the iterator. |
| 145 | + * @param handle to the JPS_AgentIterator to free. |
| 146 | + */ |
| 147 | +JUPEDSIM_API void JPS_AgentIterator_Free(JPS_AgentIterator handle); |
| 148 | + |
| 149 | +/** |
| 150 | + * Opaque type of an iterator over agent ids |
| 151 | + */ |
| 152 | +typedef struct JPS_AgentIdIterator_t* JPS_AgentIdIterator; |
| 153 | + |
| 154 | +/** |
| 155 | + * Access the next element in the iterator. |
| 156 | + * Calling JPS_AgentIterator_Next repeatedly on a finished iterator is save. |
| 157 | + * @param handle of the iterator to advance and access |
| 158 | + * @return an agentId, Zero in case the iterator has reachedits end. |
| 159 | + */ |
| 160 | +JUPEDSIM_API JPS_AgentId JPS_AgentIdIterator_Next(JPS_AgentIdIterator handle); |
| 161 | + |
| 162 | +/** |
| 163 | + * Free the iterator. |
| 164 | + * @param handle to the JPS_AgentIterator to free. |
| 165 | + */ |
| 166 | +JUPEDSIM_API void JPS_AgentIdIterator_Free(JPS_AgentIdIterator handle); |
| 167 | +#ifdef __cplusplus |
| 168 | +} |
| 169 | +#endif |
0 commit comments