Skip to content

Commit

Permalink
Split jupedsim.h/cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozaq authored and schroedtert committed Dec 15, 2023
1 parent 6caa3f0 commit 293db14
Show file tree
Hide file tree
Showing 32 changed files with 3,360 additions and 3,005 deletions.
33 changes: 30 additions & 3 deletions libjupedsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ add_library(jupedsim_obj OBJECT
src/Conversion.cpp
src/Conversion.hpp
src/ErrorMessage.hpp
src/jupedsim.cpp
src/agent.cpp
src/build_info.cpp
src/collision_free_speed_model.cpp
src/error.cpp
src/generalized_centrifugal_force_model.cpp
src/geometry.cpp
src/journey.cpp
src/logging.cpp
src/operational_model.cpp
src/simulation.cpp
src/stage.cpp
src/routing.cpp
)

target_compile_options(jupedsim_obj PRIVATE
Expand Down Expand Up @@ -92,10 +103,26 @@ install(TARGETS jupedsim
INCLUDES DESTINATION include
)

set(header_dest include/jupedsim)
install(
FILES
include/jupedsim/jupedsim.h
DESTINATION include/jupedsim
${header_dest}/agent.h
${header_dest}/error.h
${header_dest}/geometry.h
${header_dest}/logging.h
${header_dest}/simulation.h
${header_dest}/types.h
${header_dest}/build_info.h
${header_dest}/export.h
${header_dest}/journey.h
${header_dest}/operational_model.h
${header_dest}/stage.h
${header_dest}/collision_free_speed_model.h
${header_dest}/generalized_centrifugal_force_model.h
${header_dest}/jupedsim.h
${header_dest}/routing.h
${header_dest}/transition.h
DESTINATION ${header_dest}
)

install(EXPORT jupedsimTargets
Expand Down
137 changes: 137 additions & 0 deletions libjupedsim/include/jupedsim/agent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/* Copyright © 2012-2023 Forschungszentrum Jülich GmbH */
/* SPDX-License-Identifier: LGPL-3.0-or-later */
#pragma once

#include "collision_free_speed_model.h"
#include "error.h"
#include "export.h"
#include "generalized_centrifugal_force_model.h"
#include "types.h"

#include <stdbool.h> /*NOLINT(modernize-deprecated-headers)*/

#ifdef __cplusplus
extern "C" {
#endif

/**
* Opaque type of an agent
*/
typedef struct JPS_Agent_t* JPS_Agent;

/**
* Access the agents id.
* @param handle of the agent to access.
* @return the id
*/
JUPEDSIM_API JPS_AgentId JPS_Agent_GetId(JPS_Agent handle);

/**
* Access the agents journey id.
* @param handle of the agent to access.
* @return the id of this agents journey
*/
JUPEDSIM_API JPS_JourneyId JPS_Agent_GetJourneyId(JPS_Agent handle);

/**
* Access the agents currently targeted stage id.
* @param handle of the agent to access.
* @return the id of the stage currently targeted
*/
JUPEDSIM_API JPS_StageId JPS_Agent_GetStageId(JPS_Agent handle);

/**
* Access the agents position.
* @param handle of the agent to access.
* @return position
*/
JUPEDSIM_API JPS_Point JPS_Agent_GetPosition(JPS_Agent handle);

/**
* Access the agents current target.
* @param handle of the agent to access.
* @return target of the agent
*/
JUPEDSIM_API JPS_Point JPS_Agent_GetTarget(JPS_Agent handle);

JUPEDSIM_API bool
JPS_Agent_SetTarget(JPS_Agent handle, JPS_Point target, JPS_ErrorMessage* errorMessage);

/**
* Access the agents orientation.
* The orientation is unit length.
* @param handle of the agent to access.
* @return the orientation
*/
JUPEDSIM_API JPS_Point JPS_Agent_GetOrientation(JPS_Agent handle);

/**
* Access the agets model type information.
* @param handle of the agent to access.
* @return type of model in use
*/
JUPEDSIM_API JPS_ModelType JPS_Agent_GetModelType(JPS_Agent handle);

/**
* Access Generalized Centrifugal Force model state.
* Precondition: Agent needs to use Generalized Centrifugal Force model
* @param handle of the agent to access.
* @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error.
* @return state or NULL on error
*/
JUPEDSIM_API JPS_GeneralizedCentrifugalForceModelState
JPS_Agent_GetGeneralizedCentrifugalForceModelState(
JPS_Agent handle,
JPS_ErrorMessage* errorMessage);

/**
* Access Collision Free Speed model state.
* Precondition: Agent needs to use Collision Free Speed model
* @param handle of the agent to access.
* @param[out] errorMessage if not NULL: will be set to a JPS_ErrorMessage in case of an error.
* @return state or NULL on error
*/
JUPEDSIM_API JPS_CollisionFreeSpeedModelState
JPS_Agent_GetCollisionFreeSpeedModelState(JPS_Agent handle, JPS_ErrorMessage* errorMessage);

/**
* Opaque type of an iterator over agents
*/
typedef struct JPS_AgentIterator_t* JPS_AgentIterator;

/**
* Access the next element in the iterator.
* Calling JPS_AgentIterator_Next repeatedly on a finished iterator is save.
* @param handle of the iterator to advance and access
* @return an agent or NULL if the iterator is at the end. The pointer returned does not need to be
* freed and is invalidated on the next call to this function!
*/
JUPEDSIM_API JPS_Agent JPS_AgentIterator_Next(JPS_AgentIterator handle);

/**
* Free the iterator.
* @param handle to the JPS_AgentIterator to free.
*/
JUPEDSIM_API void JPS_AgentIterator_Free(JPS_AgentIterator handle);

/**
* Opaque type of an iterator over agent ids
*/
typedef struct JPS_AgentIdIterator_t* JPS_AgentIdIterator;

/**
* Access the next element in the iterator.
* Calling JPS_AgentIterator_Next repeatedly on a finished iterator is save.
* @param handle of the iterator to advance and access
* @return an agentId, Zero in case the iterator has reachedits end.
*/
JUPEDSIM_API JPS_AgentId JPS_AgentIdIterator_Next(JPS_AgentIdIterator handle);

/**
* Free the iterator.
* @param handle to the JPS_AgentIterator to free.
*/
JUPEDSIM_API void JPS_AgentIdIterator_Free(JPS_AgentIdIterator handle);
#ifdef __cplusplus
}
#endif
49 changes: 49 additions & 0 deletions libjupedsim/include/jupedsim/build_info.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* Copyright © 2012-2023 Forschungszentrum Jülich GmbH */
/* SPDX-License-Identifier: LGPL-3.0-or-later */
#pragma once

#include "export.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* Contains build information about this library
*/
typedef struct JPS_BuildInfo {
/**
* Shortened commit id from which this version was build
*/
const char* git_commit_hash;
/**
* Date the last commit was made
*/
const char* git_commit_date;
/**
* Branch name from which this libabry was build
*/
const char* git_branch;
/**
* Compiler identifier used to build this library
*/
const char* compiler;
/**
* Compiler version used to build this library
*/
const char* compiler_version;
/**
* Version of this library
*/
const char* library_version;
} JPS_BuildInfo;

/**
* Access meta information about the library.
* @return build information about this library
*/
JUPEDSIM_API JPS_BuildInfo JPS_GetBuildInfo();

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 293db14

Please sign in to comment.