Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
2c7cca8
Fixing issues with CSV files when remote DataRequestFiles are used
StevenAWhite Jul 5, 2024
7050334
Updated CMake Logic for finding packages and adjusted filtering of Un…
StevenAWhite Jul 9, 2024
409e028
Fixing HowTo Hemorrhage so it does not exit early
StevenAWhite Jul 9, 2024
e1a1d88
Creating CDM Enum equivilants in the BioGears Namespace
StevenAWhite Jul 10, 2024
cd915f8
Breaking out ElectricalLedger to make imports easier so Circuits can …
StevenAWhite Jul 10, 2024
cc1ed58
Corrected use of Marshall/UnMarshall some preperation for use of biog…
StevenAWhite Jul 11, 2024
a832649
Updated UnitTest for Marshall/UnMarshall Correction
StevenAWhite Jul 11, 2024
089a04b
Exporting Circuit and Compartment Types. Introducing SE Enums in to t…
StevenAWhite Jul 11, 2024
5a68c03
Enums to Stablization
StevenAWhite Jul 11, 2024
9c25207
Patient Actions use SEEnums and Marshall/UnMarshall Code
StevenAWhite Jul 12, 2024
12b8463
Updating HowTos and CLI to support recent changes to Actions
StevenAWhite Jul 12, 2024
fa241f9
Updated Patient Conditions to use SE Enums and Marshall/UnMarshall Code
StevenAWhite Jul 12, 2024
b9eeda2
Patient Assessment now use SEEnums and Marshall/UnMarshall Code
StevenAWhite Jul 12, 2024
e01c8bd
Environment Classe snow use SEEnums and Marshall/UnMarshall Code
StevenAWhite Jul 12, 2024
2182ac2
Equipment now uses SEEnums and Marshall/UnMarshall code
StevenAWhite Jul 12, 2024
b12cfc3
CircuitTest and Profiler fixes
StevenAWhite Jul 12, 2024
550506c
biogears::properties updated to support SEEnums and io::Marshall code
StevenAWhite Jul 13, 2024
9dd338a
Substances now support SEEnums and io::Marshall code
StevenAWhite Jul 13, 2024
7f61fe7
Systems now support SEEnums and io::Marshall code
StevenAWhite Jul 13, 2024
14fca9e
Request and Engine now support SEEnums and io::Marshall
StevenAWhite Jul 13, 2024
6341ac8
Modified Showcase/AsthmaAttack.xml
StevenAWhite Apr 3, 2024
4dc34d0
Adding DS_Store to .gitignore
StevenAWhite Jul 13, 2024
d4e7a35
Modifying Showcase/AsthmaAttack.xml
StevenAWhite Jul 13, 2024
f22a7fc
Fixing Preprocessor directive in angles.cpp
StevenAWhite Jul 13, 2024
16ffdfd
Updating CMake CXX_STANDARD to C++20
StevenAWhite Jul 13, 2024
3abd16d
Improvments to io::Marshall/UnMarshall code
StevenAWhite Jul 13, 2024
93ddfe8
Template Improvments and various keyword annotations
StevenAWhite Jul 13, 2024
10ed654
Improving the Behavior of SEEnums and modifying some namespace refere…
StevenAWhite Jul 13, 2024
2173655
Patching CaclulateBMI which was loss on pull request
StevenAWhite Jul 2, 2024
fcb2d66
DataRequest can now load from an external file
StevenAWhite Jul 3, 2024
593e2ca
Adding AcuteRespitoryDistress to ActionFactory code
StevenAWhite Jul 13, 2024
94d4e28
Fixing Format of some Verify Scnarios
StevenAWhite Jul 13, 2024
5973f04
Fixing Action_Factory and some monior Verify Scenarios
StevenAWhite Jul 13, 2024
42b02e7
Impriving Scenarios and action_factory
StevenAWhite Jul 13, 2024
9d1c071
Impriving Scenarios and action_factory
StevenAWhite Jul 13, 2024
1ce5e43
Impriving Action_factory and Scenario Loading
StevenAWhite Jul 13, 2024
d2a9f05
EnvironmentalConditions will now default to SurrondingType Air when S…
StevenAWhite Jul 14, 2024
f2259f7
Removing some DataRequest until I can talk to Nathan. Additionally re…
StevenAWhite Jul 14, 2024
943f3ae
Update README.md
ntatum94 Oct 21, 2024
fe4ebed
Removing Load/UnLoad functions that do not expect a file path from ou…
StevenAWhite Jul 24, 2024
d41f7ca
Fixing Circuit Test to use Marshall/UnMarshall code
StevenAWhite Aug 7, 2024
6837e85
PatientActions
StevenAWhite Aug 9, 2024
5b8fba9
Removing Load/UnLoad from Patient Assessments
StevenAWhite Aug 9, 2024
a9194aa
Fixing Issue with Seralization of EngineConfigurations
StevenAWhite Aug 9, 2024
c68f8d8
PatientActions/Conditions/ Removing Load/UnLoad functions
StevenAWhite Aug 12, 2024
a3a3544
Removing Unload/Load functiosn from Conditions/EnvConditions/PatientC…
StevenAWhite Aug 27, 2024
10885fd
Fixes to UnitTest
StevenAWhite Aug 27, 2024
e87d132
UPdated State Test and fixed issues with State Saving and Loading
StevenAWhite Aug 28, 2024
b9e3735
Fixed issues with Patient Assessments Marshalling code after new Enum…
StevenAWhite Aug 28, 2024
6f9b966
Removing Load/UnLoad From Substances and Circuits
StevenAWhite Sep 17, 2024
0b996df
Removing Load/UnLoad from Requests
StevenAWhite Sep 18, 2024
4e7af58
Removing Unload from Anesthesia machine. Anesthesia machine is a SESy…
StevenAWhite Sep 18, 2024
e7a9898
Removed Load/UnLoad from Systems
StevenAWhite Sep 18, 2024
9670e0a
Anesthesia Actions removed Load/UnLoad
StevenAWhite Sep 18, 2024
d743841
Removed Environment Load/UnLoad
StevenAWhite Sep 19, 2024
bc602f4
Removed Load/UnLoad from ElectroCardioGram
StevenAWhite Sep 19, 2024
e453613
Removed all Load( from the CDM classes
StevenAWhite Sep 19, 2024
ecb15d5
Removed all CDM References and includes that can be done with out add…
StevenAWhite Sep 20, 2024
56aa231
In the process of fixing a Save State Error which indicates a MARSHAL…
StevenAWhite Sep 20, 2024
565dd87
New States and some bug fixes
StevenAWhite Sep 21, 2024
973947b
Fixed Driver issues allowing it to find .xsd if its on disk. TODO: Re…
StevenAWhite Sep 21, 2024
374a552
UPgraded Environment with IsValid
StevenAWhite Sep 25, 2024
3790cd2
Removed CDM references from Circuit Templates
StevenAWhite Sep 26, 2024
3db6350
Broke out SESubstance to Definition and State. Part of a larger refac…
StevenAWhite Oct 5, 2024
a073d92
Modifying Substance Definition and Prototyping making all types copyable
StevenAWhite Oct 9, 2024
3bc3484
Bug Fixes related to Substance Definition. TODO: Remove all Substance…
StevenAWhite Oct 9, 2024
adb4e90
Fixed Double Deleting in PharmaDynamics . Need to address SubstanceD…
StevenAWhite Oct 10, 2024
81de8a1
Fixed Memory Leak
StevenAWhite Oct 10, 2024
dc5ab49
Fixed Unit Test
StevenAWhite Oct 10, 2024
b201955
Memory Leak Fixes across various issues
StevenAWhite Oct 15, 2024
ad400ce
Migrating Clear to Invalidate functions and removing DELETES from any…
StevenAWhite Nov 1, 2024
56cef7b
Converted all SEScalarTypes from Inherited Classes to Explicit tempal…
StevenAWhite Nov 1, 2024
83dfd42
Migrated String Literal Substance fetching to constexr. Hoping to mig…
StevenAWhite Nov 1, 2024
364e574
Restoring the ability to read from Imbeded Data when loading Scenario…
StevenAWhite Nov 6, 2024
f838b5f
Updated CircuitTest to support clear->Invalidate
StevenAWhite Nov 7, 2024
a4357f2
abaird - updates to needle resistance to get more accurate physiology
ajbaird Sep 19, 2024
206d402
abaird - new linear severity scale for pneumo
ajbaird Sep 24, 2024
98f30e4
resolving merge conflicts, removing redundancies and then incorperati…
ajbaird Nov 13, 2024
856b968
abaird - adding chest tube simple implementation
ajbaird Sep 25, 2024
4b1bd84
abaird - chest tube is working in some capacity
ajbaird Sep 26, 2024
0778497
abaird - forgot to patch chesttube function in last if check
ajbaird Sep 26, 2024
5930912
abaird - some minor adjustments, still some testing to do
ajbaird Nov 4, 2024
759944d
abaird - updates to chest tube behaviour, still some cleanup needed
ajbaird Nov 5, 2024
28c85c4
abaird - removing probes and finalizing pleural space changes
ajbaird Nov 12, 2024
72141ba
abaird - minor changes
ajbaird Nov 13, 2024
2ca0260
abaird - fixing some rebase issues
ajbaird Nov 13, 2024
8c36272
Adding Unit Test for ChestTube
StevenAWhite Dec 9, 2024
410e508
abaird - making sure that the patient name and file name are the same…
ajbaird Mar 8, 2024
3b1182a
abaird - patient generator generates too many broken patients, commen…
ajbaird Apr 19, 2024
f43fb75
adding new induction howto for paper
ajbaird Apr 19, 2024
6449eeb
abaird - induction scenario testing old and young people
ajbaird Jul 3, 2024
e913e9b
Fixes to HowTo-Induction
StevenAWhite Dec 12, 2024
4195c28
GCC Fixes for 8.2.0
StevenAWhite Dec 16, 2024
03c9908
Adding Utility to SEScalarQuantity.ink
StevenAWhite Dec 19, 2024
c5227b6
Fixes for Clang
StevenAWhite Jan 7, 2025
5e09af2
Updated README.md with release notes
StevenAWhite Jan 13, 2025
3c9aff7
Typo in the code
Anishs2931 Jan 22, 2025
fad8e80
Fixing IsValid condition for SEEnvironmentalConditions
StevenAWhite Feb 25, 2025
696dfb5
Initial implementation of amputation
culsh Feb 26, 2025
021e2c5
NOTE: Does not build. Added patient action for bone fracture and asso…
ntatum94 Feb 17, 2025
1f53b12
Adding additional calls for new enums to properly build.
ntatum94 Feb 21, 2025
b4ad01c
NOTE: Throws an error when initializing BioGears engine. Added fractu…
acreel-github Feb 27, 2025
95da3b8
Fixing calls to prevent read error on calling Fracture action
ntatum94 Mar 2, 2025
56a679a
Tuning model parameters
ntatum94 Mar 3, 2025
4f78be1
More tuning
ntatum94 Mar 4, 2025
cc3acc6
adding chrono tag to prevent error from VS update
ntatum94 Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ build*/
CMakeUserPresets.json
*~*.TMP

.DS_Store

.idea/*
.vs/*
.vscode/*
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ We have made available to the medical simulation community a large set of burn i

## Release Notes

### 8.0.0 (November 2024)
### 8.2.0 (January 2025)
- Marshall / UnMarshall code migrated from Load/UnLoad functions to private API
- Additioanl Unit Test for all Seralization code
- Equality operators
- Refactored SEScalarTypes
- Added Enums for all CDM Enums
- Seperated SESubstance between Definition and State
- ~~~~
### 8.0.0
- Modified Scenario CDM to require <ACTIONS> Tag around individual actions
- Allowed import of external ActionList and DataRequestList
- Updated CMAKE to minimum 3.20
- Improved various features

### 7.6.0 (December 2023)
### 7.6.0
- Improved SWIG bindings
- Improved Various Models

Expand Down Expand Up @@ -92,12 +100,10 @@ We support the [contributor covenant](https://github.com/BioGearsEngine/Engine/b

Contributing
-------------
Details will be filled in shortly. In the meantime, if you have a contribution or issue to post/push feel free to contact abaird@ara.com with the details.
Details will be filled in shortly. In the meantime, if you have a contribution or issue to post/push feel free to contact biogears@ara.com with the details.

You can access our public Slack through our [development website](https://www.biogears.dev/).

Additional Documentation
--------------------------
For more detailed documentation including model discussions and implementation details can be found at www.BioGearsEngine.com


4 changes: 2 additions & 2 deletions cmake/cmake-common_logic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated")
####
function(verify_package package)
cmake_parse_arguments(_l
REQUIRED
"REQUIRED;QUIET"
""
""
${ARGN})
find_package(${package} CONFIG ${_l_UNPARSED_ARGUMENTS} QUIET)
if(NOT ${package}_FOUND)
find_package(${package} ${_l_UNPARSED_ARGUMENTS} QUIET)
if(NOT ${package}_FOUND)
if(NOT ${package}_FOUND AND NOT _l_QUIET)
message(WARNING "The following packages ${package} were not found."
"For native compilations setting CMAKE_PREFIX_PATH can solve this problem"
"For cross complilation try expanding your CMAKE_FIND_ROOT_PATH"
Expand Down
6 changes: 5 additions & 1 deletion projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ STRING(APPEND VS_DEBUGGER_ENV_PATH "%PATH%")

LIST(APPEND VS_DEBUGGER_ENVIRONMENT_LIST "${VS_DEBUGGER_ENV_PATH}")
message(STATUS "VS_DEBUGGER_ENVIRONMENT_LIST=${VS_DEBUGGER_ENVIRONMENT_LIST}")
# add_subdirectory(unit)


add_subdirectory(unit)


add_subdirectory(biogears-common)
add_subdirectory(biogears)
add_subdirectory(test_driver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ T Result<T, E>::unwrap() {
static_assert(!std::is_same<T, E>::value, "Result and Error can not be the same type.");
assert(is_ok());
return dump_ok();
};
};

template<typename T, typename E>
E Result<T, E>::unwrap_err() {
Expand Down
2 changes: 1 addition & 1 deletion projects/biogears-common/src/math/angles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static_assert(Anglef(1.f) + Anglef(2.f) == 3.f, "");
static_assert(0.f + 1.0_f_i + 2.0_f_j + 3.0_f_k == Quaternionf(0.f, 1.f, 2.f, 3.f), "");
static_assert(Quaternionf(1.f, 2.f, 3.f, 4.f).real() + Quaternionf(1.f, 2.f, 3.f, 4.f).pure() == Quaternionf(1.f, 2.f, 3.f, 4.f), "");
static_assert((Quaternionf(1.f, 1.f, 1.f, 1.f) * Quaternionf(1.f, 1.f, 1.f, 1.f).conj()).w() == 4.0f, "");
#endif()
#endif

//------------------------------------------------------------------------------
auto azimuth_uncert_from_quat(const Quaternionf& q
Expand Down
1 change: 1 addition & 0 deletions projects/biogears-common/unit/test_common_OwningMutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Unit Test for Biogears-common Config
//!
#include <thread>
#include <chrono>

#include <gtest/gtest.h>

Expand Down
12 changes: 8 additions & 4 deletions projects/biogears/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ file(GLOB_RECURSE biogears_xsd_list "${PROJECT_SOURCE_DIR}/share/xsd/biogears/*.
file(GLOB_RECURSE cdm_xsd_list "${PROJECT_SOURCE_DIR}/share/xsd/cdm/*.xsd")

set (BIOGEARS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set (BIOGEARS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/$<CONFIG>)
set (BIOGEARS_BINARY_BARE_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/)

if (NOT APPLE)
set (GENERATED_PREFIX generated/$<CONFIG>)
else()
set (GENERATED_PREFIX generated/)
endif()
set (BIOGEARS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${GENERATED_PREFIX})
set (BIOGEARS_BINARY_BARE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${GENERATED_PREFIX})

REGISTER_XSD_DIR( "${PROJECT_SOURCE_DIR}/share/xsd/"
CONFIG "${PROJECT_SOURCE_DIR}/share/xsd/BioGearsDataModel.cfg"
PROJECT "generated/$<CONFIG>/biogears" COMPONENT "schema" RESOURCE_FOLDER "resources/schema"
PROJECT "${GENERATED_PREFIX}/biogears" COMPONENT "schema" RESOURCE_FOLDER "resources/schema"
NO_TARGETS SOURCES_VAR XSD_SRCS HEADERS_VAR XSD_HDRS VERBOSITY 1)


Expand Down
6 changes: 3 additions & 3 deletions projects/biogears/libBiogears/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ message(STATUS " Configuring libbiogears")

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/biogears/config.h.in contents)
string(CONFIGURE "${contents}" contents @ONLY)
FILE(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../generated/$<CONFIG>/biogears/config.h
FILE(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../${GENERATED_PREFIX}/biogears/config.h
CONTENT "${contents}"
NEWLINE_STYLE LF)

Expand Down Expand Up @@ -62,7 +62,7 @@ if(Biogears_BUILD_STATIC)
if(biogears_USE_OVERRIDE_CONTROL)
target_compile_definitions( libbiogears PRIVATE BIOGEARS_USE_OVERRIDE_CONTROL)
endif()
if(UNITTEST_biogears-core)
if(Biogears_BUILD_TEST)
target_compile_definitions( libbiogears PUBLIC ENABLE_UNIT_TEST_API)
endif()
if(WIN32)
Expand Down Expand Up @@ -139,7 +139,7 @@ else()
CXX_STANDARD 20
)
set_target_properties(libbiogears PROPERTIES SOVERSION "${Biogears_LIB_VERSION}")
if(UNITTEST_biogears-core)
if(Biogears_BUILD_TEST)
target_compile_definitions( libbiogears PUBLIC ENABLE_UNIT_TEST_API)
endif()
###############################################################################
Expand Down
30 changes: 30 additions & 0 deletions projects/biogears/libBiogears/include/biogears/BiogearsEnums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**************************************************************************************
Copyright 2019 Applied Research Associates, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the License
at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
**************************************************************************************/

#pragma once

#include <ostream>

#include "cdm/enums/SEActionEnums.h"
#include "cdm/enums/SEAnesthesiaEnums.h"
#include "cdm/enums/SECircuitEnums.h"
#include "cdm/enums/SECompartmentEnums.h"
#include "cdm/enums/SEEnvironmentEnums.h"
#include "cdm/enums/SEPatientActionsEnums.h"
#include "cdm/enums/SEPatientAssessmentEnums.h"
#include "cdm/enums/SEPatientEnums.h"
#include "cdm/enums/SEPhysiologyEnums.h"
#include "cdm/enums/SEPropertyEnums.h"
#include "cdm/enums/SESubstanceEnums.h"

#include "engine/Controller/BioGearsEnums.h"

Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@ namespace tatrc {
}
}
}
//using namespace mil::tatrc::phsyiology::datamodel;
#define CDM_BIND_DECL(type) \
namespace mil { \
namespace tatrc { \
namespace physiology { \
namespace datamodel { \
class type; \
} \
} \
} \
}

namespace CDM = mil::tatrc::physiology::datamodel;

#include <stdexcept>
Expand All @@ -47,8 +37,8 @@ namespace CDM = mil::tatrc::physiology::datamodel;
#include <biogears/exports.h>
namespace biogears {

#pragma warning(disable: 4251)
#pragma warning(push,0)
#pragma warning(disable: 4251)
#pragma warning(disable: 4275)
struct BIOGEARS_API CommonDataModelException : public std::runtime_error {
CommonDataModelException();
Expand All @@ -60,4 +50,5 @@ struct BIOGEARS_API CommonDataModelException : public std::runtime_error {
}
// Basics
#include <biogears/cdm/Macros.h>
#include <biogears/cdm/enums/SEPropertyEnums.h>
#include <biogears/cdm/utils/Logger.h>
65 changes: 54 additions & 11 deletions projects/biogears/libBiogears/include/biogears/cdm/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ specific language governing permissions and limitations under the License.
**************************************************************************************/

#pragma once
#include <algorithm>
#include <concepts>
#include <map>
#include <type_traits>
#include <vector>
#include <algorithm>

namespace biogears {
#define BLIM(input, min, max) (input = (input > max) ? max : ((input < min) ? min : input))
Expand Down Expand Up @@ -58,12 +60,40 @@ inline size_t _Hash_value(_InIt _Begin, _InIt _End)
if (from.Has##name()) \
Get##name().Merge(*from.m_##name);

#define CDM_COPY(from, to) \
{ \
auto* bind = from->Unload(); \
to->Load(*bind); \
delete bind; \
}
template <class ContainerType>
concept Container = requires(ContainerType a) {
requires std::regular<ContainerType>;
requires std::swappable<ContainerType>;
requires std::destructible<typename ContainerType::value_type>;
requires std::same_as<typename ContainerType::reference, typename ContainerType::value_type&>;
requires std::same_as<typename ContainerType::const_reference, const typename ContainerType::value_type&>;
requires std::forward_iterator<typename ContainerType::iterator>;
requires std::forward_iterator<typename ContainerType::const_iterator>;
requires std::signed_integral<typename ContainerType::difference_type>;
requires std::same_as<typename ContainerType::difference_type, typename std::iterator_traits<typename ContainerType::iterator>::difference_type>;
requires std::same_as<typename ContainerType::difference_type, typename std::iterator_traits<typename ContainerType::const_iterator>::difference_type>;
{
a.begin()
} -> std::same_as<typename ContainerType::iterator>;
{
a.end()
} -> std::same_as<typename ContainerType::iterator>;
{
a.cbegin()
} -> std::same_as<typename ContainerType::const_iterator>;
{
a.cend()
} -> std::same_as<typename ContainerType::const_iterator>;
{
a.size()
} -> std::same_as<typename ContainerType::size_type>;
{
a.max_size()
} -> std::same_as<typename ContainerType::size_type>;
{
a.empty()
} -> std::same_as<bool>;
};

template <class T>
inline void Copy(const std::vector<T*>& from, std::vector<T*>& to)
Expand Down Expand Up @@ -109,12 +139,25 @@ inline void DELETE_VECTOR(std::vector<T>& vec)
}
vec.clear();
}
//This will delete all of the second items in a map and then clear the map to destroy all dangling pointers

template <typename ContainerType>
requires Container<ContainerType> && std::is_pointer_v<typename ContainerType::value_type>
inline void DELETE_CONTAINER_OF_POINTERS(ContainerType& container)
{
for (auto& element : container) {
delete element;
element = nullptr;
}
container.clear();
}
// Th
// This will delete all of the second items in a map and then clear the map to destroy all dangling pointers
template <class T, class K>
inline void DELETE_MAP_SECOND(std::map<T, K>& map)
inline void DELETE_MAP_OF_POINTERS(std::map<T, K>& map)
{
for (typename std::map<T, K>::iterator it = map.begin(); it != map.end(); ++it) {
delete it->second;
for (auto& [key,value] : map) {
delete value;
value = nullptr;
}
map.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ specific language governing permissions and limitations under the License.
#include <biogears/cdm/CommonDataModel.h>
#include <biogears/exports.h>

CDM_BIND_DECL(ObjectData)

namespace biogears {
class Serializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ specific language governing permissions and limitations under the License.
#include <biogears/cdm/circuit/SECircuitNode.h>
#include <biogears/cdm/circuit/SECircuitPath.h>

#define CIRCUIT_TEMPLATE typename CircuitBindType, typename NodeType, typename CircuitNodeBindType, typename PathType, typename CircuitPathBindType
#define CIRCUIT_TYPES CircuitBindType, NodeType, CircuitNodeBindType, PathType, CircuitPathBindType
#define CIRCUIT_TEMPLATE typename NodeType, typename PathType
#define CIRCUIT_TYPES NodeType, PathType

CDM_BIND_DECL(CircuitData)

namespace biogears {
namespace io {
class Circuit;
}

#pragma warning(disable : 4661)
template <CIRCUIT_TEMPLATE>
class SECircuit : public Loggable {
friend io::Circuit;
Expand All @@ -34,13 +33,7 @@ class SECircuit : public Loggable {
SECircuit(const std::string& name, Logger* logger);
virtual ~SECircuit();

virtual void Clear(); //clear memory

virtual bool Load(const CircuitBindType& in, const std::map<std::string, NodeType*>& nodes, const std::map<std::string, PathType*>& paths);
virtual CircuitBindType* Unload() const;

protected:
virtual void Unload(CircuitBindType& data) const;
virtual void Invalidate(); // clear memory

public:
virtual std::string GetName() const;
Expand Down Expand Up @@ -105,5 +98,5 @@ class SECircuit : public Loggable {
std::vector<PathType*> m_PolarizedElementPaths;
std::map<const NodeType*, size_t> m_CalculatorIndex; // A unique id (starting at 0) for all nodes except the reference node
};
#pragma warning(default : 4661)
}
#include <biogears/cdm/circuit/SECircuit.inl>
Loading