mirror of
https://github.com/nasa/trick.git
synced 2024-12-30 18:07:00 +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
67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
|
|
#include <iostream>
|
|
#include <unistd.h>
|
|
|
|
#include "trick/MessageFile.hh"
|
|
#include "trick/command_line_protos.h"
|
|
|
|
/**
|
|
@details
|
|
-# Initializes everything
|
|
*/
|
|
Trick::MessageFile::MessageFile() {
|
|
|
|
enabled = 1 ;
|
|
color = 0 ;
|
|
file_name = "send_hs" ;
|
|
name = "file" ;
|
|
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# Overwrites the file name
|
|
*/
|
|
int Trick::MessageFile::set_file_name(std::string in_name) {
|
|
|
|
file_name = in_name ;
|
|
return(0) ;
|
|
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# Deletes the current output file
|
|
-# Opens a new file with the name "file_name"
|
|
*/
|
|
int Trick::MessageFile::init() {
|
|
|
|
unlink((std::string(command_line_args_get_output_dir()) + "/" + file_name).c_str()) ;
|
|
out_stream.open((std::string(command_line_args_get_output_dir()) + "/" + file_name).c_str() , std::fstream::out | std::fstream::app ) ;
|
|
return(0) ;
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# If enabled and level < 100
|
|
-# Write the header and message to the file stream
|
|
-# Flush the stream
|
|
*/
|
|
void Trick::MessageFile::update( unsigned int level , std::string header, std::string message ) {
|
|
|
|
if ( enabled && level < 100 ) {
|
|
out_stream << header << message ;
|
|
out_stream.flush() ;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# Close the file stream
|
|
*/
|
|
Trick::MessageFile::~MessageFile() {
|
|
out_stream.close() ;
|
|
}
|
|
|