mirror of
https://github.com/nasa/trick.git
synced 2024-12-21 06:03:10 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
#include "trick/STLManager.hh"
|
|
|
|
Trick::STLManager * trick_stl_manager = NULL ;
|
|
|
|
Trick::STLManager::STLManager() : count(1) {
|
|
trick_stl_manager = this ;
|
|
}
|
|
|
|
Trick::STLManager::~STLManager() {
|
|
}
|
|
|
|
Trick::STLManager * Trick::STLManager::getSTLManager() {
|
|
if ( trick_stl_manager == NULL ) {
|
|
trick_stl_manager = new STLManager ;
|
|
}
|
|
return trick_stl_manager ;
|
|
}
|
|
|
|
void Trick::STLManager::checkpoint() {
|
|
std::vector<STLInterface *>::iterator it ;
|
|
for ( it = stlObjects.begin() ; it != stlObjects.end() ; it++ ) {
|
|
(*it)->checkpoint(std::string("trick_stl_manager")) ;
|
|
}
|
|
}
|
|
|
|
void Trick::STLManager::post_checkpoint() {
|
|
std::vector<STLInterface *>::iterator it ;
|
|
for ( it = stlObjects.begin() ; it != stlObjects.end() ; it++ ) {
|
|
(*it)->post_checkpoint(std::string("trick_stl_manager")) ;
|
|
}
|
|
}
|
|
|
|
void Trick::STLManager::restart() {
|
|
std::vector<STLInterface *>::iterator it ;
|
|
|
|
// Mark all of the stls that currently are registered. These are the ones to restore.
|
|
for ( it = stlObjects.begin() ; it != stlObjects.end() ; it++ ) {
|
|
(*it)->restore = true ;
|
|
}
|
|
// restore the STLs that existed before we called restart.
|
|
// The restore flag will be false for newly created STLs
|
|
for ( it = stlObjects.begin() ; it != stlObjects.end() ; it++ ) {
|
|
if ( (*it)->restore ) {
|
|
(*it)->restart(std::string("trick_stl_manager")) ;
|
|
}
|
|
|
|
}
|
|
|
|
// Run the post_checkpoint routine to remove MemoryManager allocations.
|
|
for ( it = stlObjects.begin() ; it != stlObjects.end() ; it++ ) {
|
|
(*it)->post_checkpoint(std::string("trick_stl_manager")) ;
|
|
}
|
|
}
|
|
|
|
unsigned int Trick::STLManager::addSTL( STLInterface & stlIn ) {
|
|
//TODO: This needs mutex protection
|
|
stlObjects.push_back(&stlIn) ;
|
|
return count++ ;
|
|
}
|
|
|
|
void Trick::STLManager::removeSTL( STLInterface & stlIn ) {
|
|
//TODO: This needs mutex protection
|
|
std::vector<STLInterface *>::iterator it = find( stlObjects.begin(), stlObjects.end(), &stlIn );
|
|
stlObjects.erase( it );
|
|
}
|