Rename the project from "MyLibrary" to "MedicalLib" to better reflect its intended purpose as a library for medical simulations.

- Rename all files, directories, and internal project names to "MedicalLib".
- Replace the generic `add` function with a more domain-specific `calculateBMI` function as an initial example of the library's capabilities.
- Update the `AGENTS.md` file to describe the new purpose and scope of the MedicalLib library.
This commit is contained in:
google-labs-jules[bot]
2025-08-18 09:02:01 +00:00
parent bdfed240f3
commit 518277356a
9 changed files with 85 additions and 30 deletions
+40
View File
@@ -0,0 +1,40 @@
# Agent Instructions for MedicalLib
This document provides instructions for developers and agents working on the MedicalLib C++ project.
## Project Purpose
MedicalLib is a C++ library for detailed mathematical simulations of various medical information. Its goal is to provide a robust set of tools for applications that require calculations related to:
- Heart rate and EKG readings
- Body metrics (e.g., BMI, body fat percentage)
- Physiological responses to injuries
- Other life-requirement math simulations
## Project Structure
This project is structured as a software-agnostic C++ library, designed for easy integration into various larger projects, including game engines like Unreal Engine.
- `/include`: Contains all public header files.
- `/include/MedicalLib`: Headers for the MedicalLib library are placed here to prevent naming conflicts.
- `/src`: Contains the implementation (.cpp) files for the library.
- `/examples`: Contains example code showing how to use the library.
- `/build`: This directory is created by the build scripts and contains the compiled library and example executables. It is not tracked by git.
- `CMakeLists.txt`: The root CMake file for building the project.
## Building the Project
To build the project, use the provided build scripts:
- On Linux or macOS: `./build.sh`
- On Windows: `build.bat`
The compiled library will be placed in `build/lib`, and the example executable will be in `build/examples/`.
## Integration with Unreal Engine
To use this library in an Unreal Engine plugin:
1. Copy the contents of the `include` directory into your plugin's `ThirdParty/MedicalLib/include` directory.
2. Compile the library for the desired platforms (e.g., Win64, Linux) and copy the compiled library files (e.g., `.lib`, `.so`, `.a`) into your plugin's `ThirdParty/MedicalLib/lib/<Platform>` directory.
3. In your plugin's `.Build.cs` file, add the necessary paths for the include files and link against the compiled library.
+6 -6
View File
@@ -2,19 +2,19 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# Project name # Project name
project(MyLibrary) project(MedicalLib)
# Add the library # Add the library
add_library(MyLibrary SHARED src/Library.cpp) add_library(MedicalLib SHARED src/MedicalLib.cpp)
# Define MY_LIB_EXPORT, so that __declspec(dllexport) is used # Define MEDICAL_LIB_EXPORT, so that __declspec(dllexport) is used
target_compile_definitions(MyLibrary PRIVATE MY_LIB_EXPORT) target_compile_definitions(MedicalLib PRIVATE MEDICAL_LIB_EXPORT)
# Public headers # Public headers
target_include_directories(MyLibrary PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) target_include_directories(MedicalLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Set the output directory for the library # Set the output directory for the library
set_target_properties(MyLibrary PROPERTIES set_target_properties(MedicalLib PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
Regular → Executable
View File
+1 -1
View File
@@ -2,4 +2,4 @@
add_executable(Example main.cpp) add_executable(Example main.cpp)
# Link against the library # Link against the library
target_link_libraries(Example MyLibrary) target_link_libraries(Example MedicalLib)
+6 -3
View File
@@ -1,8 +1,11 @@
#include <iostream> #include <iostream>
#include "Library.h" #include "MedicalLib/MedicalLib.h"
int main() { int main() {
int result = add(2, 3); double weight = 70.0; // kg
std::cout << "2 + 3 = " << result << std::endl; double height = 1.75; // meters
double bmi = calculateBMI(weight, height);
std::cout << "Weight: " << weight << " kg, Height: " << height << " m" << std::endl;
std::cout << "Calculated BMI: " << bmi << std::endl;
return 0; return 0;
} }
+20
View File
@@ -0,0 +1,20 @@
#pragma once
// Define MEDICAL_LIB_EXPORT for exporting symbols from the DLL
#if defined(_WIN32)
#if defined(MEDICAL_LIB_EXPORT)
#define MEDICAL_LIB_API __declspec(dllexport)
#else
#define MEDICAL_LIB_API __declspec(dllimport)
#endif
#else
#define MEDICAL_LIB_API
#endif
/**
* @brief Calculates the Body Mass Index (BMI).
* @param weight_kg The weight in kilograms.
* @param height_m The height in meters.
* @return The calculated BMI.
*/
MEDICAL_LIB_API double calculateBMI(double weight_kg, double height_m);
-5
View File
@@ -1,5 +0,0 @@
#include "Library.h"
int add(int a, int b) {
return a + b;
}
-15
View File
@@ -1,15 +0,0 @@
#pragma once
// Define MY_LIB_EXPORT for exporting symbols from the DLL
#if defined(_WIN32)
#if defined(MY_LIB_EXPORT)
#define MY_LIB_API __declspec(dllexport)
#else
#define MY_LIB_API __declspec(dllimport)
#endif
#else
#define MY_LIB_API
#endif
// A simple function to be exported
MY_LIB_API int add(int a, int b);
+12
View File
@@ -0,0 +1,12 @@
#include "MedicalLib/MedicalLib.h"
#include <stdexcept>
double calculateBMI(double weight_kg, double height_m) {
if (height_m <= 0) {
throw std::invalid_argument("Height must be positive.");
}
if (weight_kg <= 0) {
throw std::invalid_argument("Weight must be positive.");
}
return weight_kg / (height_m * height_m);
}