Commit ecb6b0d7 authored by Aaron Bray's avatar Aaron Bray
Browse files

2.0 Sync

parents fbd5ba6e 9939d5c8
......@@ -186,7 +186,7 @@ bool PBAnesthesiaMachine::SerializeToString(const SEAnesthesiaMachine& src, std:
{
cdm::AnesthesiaMachineData data;
PBAnesthesiaMachine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBAnesthesiaMachine::SerializeToFile(const SEAnesthesiaMachine& src, const std::string& filename, SerializationFormat m)
{
......@@ -200,7 +200,7 @@ bool PBAnesthesiaMachine::SerializeToFile(const SEAnesthesiaMachine& src, const
bool PBAnesthesiaMachine::SerializeFromString(const std::string& src, SEAnesthesiaMachine& dst, SerializationFormat m)
{
cdm::AnesthesiaMachineData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBAnesthesiaMachine::Load(data, dst);
return true;
......
......@@ -122,7 +122,7 @@ bool PBCircuit::LoadCircuitManagerFile(SECircuitManager& mgr, const std::string&
cdm::CircuitManagerData src;
std::ifstream file_stream(filename, std::ios::in);
std::string fmsg((std::istreambuf_iterator<char>(file_stream)), std::istreambuf_iterator<char>());
if (!PBUtils::SerializeFromString(fmsg, src, JSON))
if (!PBUtils::SerializeFromString(fmsg, src, JSON, mgr.GetLogger()))
return false;
PBCircuit::Load(src, mgr);
return true;
......@@ -136,7 +136,7 @@ void PBCircuit::SaveCircuitManagerFile(const SECircuitManager& mgr, const std::s
{
std::string content;
cdm::CircuitManagerData* src = PBCircuit::Unload(mgr);
PBUtils::SerializeToString(*src, content, JSON);
PBUtils::SerializeToString(*src, content, JSON, mgr.GetLogger());
std::ofstream ascii_ostream(filename, std::ios::out | std::ios::trunc);
ascii_ostream << content;
ascii_ostream.flush();
......
......@@ -51,7 +51,7 @@ bool PBCompartment::LoadCompartmentManagerFile(SECompartmentManager& mgr, const
cdm::CompartmentManagerData src;
std::ifstream file_stream(filename, std::ios::in);
std::string fmsg((std::istreambuf_iterator<char>(file_stream)), std::istreambuf_iterator<char>());
if (!PBUtils::SerializeFromString(fmsg, src, JSON))
if (!PBUtils::SerializeFromString(fmsg, src, JSON, mgr.GetLogger()))
return false;
PBCompartment::Load(src, mgr, circuits);
return true;
......@@ -65,7 +65,7 @@ void PBCompartment::SaveCompartmentManagerFile(const SECompartmentManager& mgr,
{
std::string content;
cdm::CompartmentManagerData* src = PBCompartment::Unload(mgr);
PBUtils::SerializeToString(*src, content,JSON);
PBUtils::SerializeToString(*src, content,JSON, mgr.GetLogger());
std::ofstream ascii_ostream(filename, std::ios::out | std::ios::trunc);
ascii_ostream << content;
ascii_ostream.flush();
......
......@@ -150,7 +150,7 @@ bool PBElectroCardioGram::SerializeToString(const SEElectroCardioGramWaveformInt
{
cdm::ElectroCardioGramWaveformListData data;
PBElectroCardioGram::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBElectroCardioGram::SerializeToFile(const SEElectroCardioGramWaveformInterpolator& src, const std::string& filename, SerializationFormat m)
{
......@@ -163,7 +163,7 @@ bool PBElectroCardioGram::SerializeToFile(const SEElectroCardioGramWaveformInter
bool PBElectroCardioGram::SerializeFromString(const std::string& src, SEElectroCardioGramWaveformInterpolator& dst, SerializationFormat m)
{
cdm::ElectroCardioGramWaveformListData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBElectroCardioGram::Load(data, dst);
return true;
......
......@@ -302,7 +302,7 @@ bool PBEngine::SerializeToString(const SEPatientConfiguration& src, std::string&
{
cdm::PatientConfigurationData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SEPatientConfiguration& src, const std::string& filename, SerializationFormat m)
{
......@@ -315,7 +315,7 @@ bool PBEngine::SerializeToFile(const SEPatientConfiguration& src, const std::str
bool PBEngine::SerializeFromString(const std::string& src, SEPatientConfiguration& dst, SerializationFormat m, SESubstanceManager& subMgr)
{
cdm::PatientConfigurationData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst, subMgr);
return true;
......@@ -443,7 +443,7 @@ bool PBEngine::SerializeToString(const SEConditionManager& src, std::string& out
{
cdm::ConditionListData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SEConditionManager& src, const std::string& filename, SerializationFormat m)
{
......@@ -456,7 +456,7 @@ bool PBEngine::SerializeToFile(const SEConditionManager& src, const std::string&
bool PBEngine::SerializeFromString(const std::string& src, SEConditionManager& dst, SerializationFormat m)
{
cdm::ConditionListData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst);
return true;
......@@ -473,7 +473,7 @@ bool PBEngine::SerializeToString(const SEActionManager& src, std::string& output
{
cdm::ActionListData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SEActionManager& src, const std::string& filename, SerializationFormat m)
{
......@@ -486,7 +486,7 @@ bool PBEngine::SerializeToFile(const SEActionManager& src, const std::string& fi
bool PBEngine::SerializeFromString(const std::string& src, SEActionManager& dst, SerializationFormat m)
{
cdm::ActionListData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst);
return true;
......@@ -502,7 +502,7 @@ bool PBEngine::SerializeFromFile(const std::string& filename, SEActionManager& d
bool PBEngine::SerializeFromString(const std::string& src, std::vector<SEAction*>& dst, SerializationFormat m, SESubstanceManager& subMgr)
{
cdm::ActionListData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, subMgr.GetLogger()))
return false;
PBEngine::Load(data, dst, subMgr);
return true;
......@@ -524,7 +524,7 @@ bool PBEngine::SerializeToString(const SEDataRequestManager& src, std::string& o
{
cdm::DataRequestManagerData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SEDataRequestManager& src, const std::string& filename, SerializationFormat m)
{
......@@ -537,7 +537,7 @@ bool PBEngine::SerializeToFile(const SEDataRequestManager& src, const std::strin
bool PBEngine::SerializeFromString(const std::string& src, SEDataRequestManager& dst, SerializationFormat m, const SESubstanceManager& subMgr)
{
cdm::DataRequestManagerData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst, subMgr);
return true;
......@@ -723,7 +723,7 @@ bool PBEngine::SerializeToString(const SEDynamicStabilization& src, std::string&
{
cdm::DynamicStabilizationData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SEDynamicStabilization& src, const std::string& filename, SerializationFormat m)
{
......@@ -736,7 +736,7 @@ bool PBEngine::SerializeToFile(const SEDynamicStabilization& src, const std::str
bool PBEngine::SerializeFromString(const std::string& src, SEDynamicStabilization& dst, SerializationFormat m)
{
cdm::DynamicStabilizationData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst);
return true;
......@@ -753,7 +753,7 @@ bool PBEngine::SerializeToString(const SETimedStabilization& src, std::string& o
{
cdm::TimedStabilizationData data;
PBEngine::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEngine::SerializeToFile(const SETimedStabilization& src, const std::string& filename, SerializationFormat m)
{
......@@ -766,7 +766,7 @@ bool PBEngine::SerializeToFile(const SETimedStabilization& src, const std::strin
bool PBEngine::SerializeFromString(const std::string& src, SETimedStabilization& dst, SerializationFormat m)
{
cdm::TimedStabilizationData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEngine::Load(data, dst);
return true;
......
......@@ -272,7 +272,7 @@ bool PBEnvironment::SerializeToString(const SEEnvironmentalConditions& src, std:
{
cdm::EnvironmentalConditionsData data;
PBEnvironment::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBEnvironment::SerializeToFile(const SEEnvironmentalConditions& src, const std::string& filename, SerializationFormat m)
{
......@@ -286,7 +286,7 @@ bool PBEnvironment::SerializeToFile(const SEEnvironmentalConditions& src, const
bool PBEnvironment::SerializeFromString(const std::string& src, SEEnvironmentalConditions& dst, SerializationFormat m)
{
cdm::EnvironmentalConditionsData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBEnvironment::Load(data, dst);
return true;
......
......@@ -53,7 +53,7 @@ bool PBInhaler::SerializeToString(const SEInhaler& src, std::string& output, Ser
{
cdm::InhalerData data;
PBInhaler::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBInhaler::SerializeToFile(const SEInhaler& src, const std::string& filename, SerializationFormat m)
{
......@@ -67,7 +67,7 @@ bool PBInhaler::SerializeToFile(const SEInhaler& src, const std::string& filenam
bool PBInhaler::SerializeFromString(const std::string& src, SEInhaler& dst, SerializationFormat m)
{
cdm::InhalerData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBInhaler::Load(data, dst);
return true;
......
......@@ -189,7 +189,7 @@ bool PBPatient::SerializeToString(const SEPatient& src, std::string& output, Ser
{
cdm::PatientData data;
PBPatient::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatient::SerializeToFile(const SEPatient& src, const std::string& filename, SerializationFormat m)
{
......@@ -203,7 +203,7 @@ bool PBPatient::SerializeToFile(const SEPatient& src, const std::string& filenam
bool PBPatient::SerializeFromString(const std::string& src, SEPatient& dst, SerializationFormat m)
{
cdm::PatientData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBPatient::Load(data, dst);
return true;
......
......@@ -28,7 +28,7 @@ bool PBPatientAssessment::SerializeToString(const SECompleteBloodCount& src, std
{
cdm::CompleteBloodCountData data;
PBPatientAssessment::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientAssessment::SerializeToFile(const SECompleteBloodCount& src, const std::string& filename, SerializationFormat m)
{
......@@ -95,7 +95,7 @@ bool PBPatientAssessment::SerializeToString(const SEComprehensiveMetabolicPanel&
{
cdm::ComprehensiveMetabolicPanelData data;
PBPatientAssessment::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientAssessment::SerializeToFile(const SEComprehensiveMetabolicPanel& src, const std::string& filename, SerializationFormat m)
{
......@@ -187,7 +187,7 @@ bool PBPatientAssessment::SerializeToString(const SEPulmonaryFunctionTest& src,
{
cdm::PulmonaryFunctionTestData data;
PBPatientAssessment::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientAssessment::SerializeToFile(const SEPulmonaryFunctionTest& src, const std::string& filename, SerializationFormat m)
{
......@@ -277,7 +277,7 @@ bool PBPatientAssessment::SerializeToString(const SEUrinalysis& src, std::string
{
cdm::UrinalysisData data;
PBPatientAssessment::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientAssessment::SerializeToFile(const SEUrinalysis& src, const std::string& filename, SerializationFormat m)
{
......
......@@ -75,7 +75,7 @@ bool PBPatientNutrition::SerializeToString(const SENutrition& src, std::string&
{
cdm::NutritionData data;
PBPatientNutrition::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientNutrition::SerializeToFile(const SENutrition& src, const std::string& filename, SerializationFormat m)
{
......@@ -89,7 +89,7 @@ bool PBPatientNutrition::SerializeToFile(const SENutrition& src, const std::stri
bool PBPatientNutrition::SerializeFromString(const std::string& src, SENutrition& dst, SerializationFormat m)
{
cdm::NutritionData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBPatientNutrition::Load(data, dst);
return true;
......@@ -136,7 +136,7 @@ bool PBPatientNutrition::SerializeToString(const SEMeal& src, std::string& outpu
{
cdm::MealData data;
PBPatientNutrition::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBPatientNutrition::SerializeToFile(const SEMeal& src, const std::string& filename, SerializationFormat m)
{
......@@ -150,7 +150,7 @@ bool PBPatientNutrition::SerializeToFile(const SEMeal& src, const std::string& f
bool PBPatientNutrition::SerializeFromString(const std::string& src, SEMeal& dst, SerializationFormat m)
{
cdm::MealData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBPatientNutrition::Load(data, dst);
return true;
......
......@@ -69,7 +69,7 @@ bool PBScenario::SerializeToString(const SEScenario& src, std::string& output, S
{
cdm::ScenarioData data;
PBScenario::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBScenario::SerializeToFile(const SEScenario& src, const std::string& filename, SerializationFormat m)
{
......@@ -82,7 +82,7 @@ bool PBScenario::SerializeToFile(const SEScenario& src, const std::string& filen
bool PBScenario::SerializeFromString(const std::string& src, SEScenario& dst, SerializationFormat m)
{
cdm::ScenarioData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBScenario::Load(data, dst);
return true;
......
......@@ -596,7 +596,7 @@ bool PBSubstance::SerializeToString(const SESubstance& src, std::string& output,
{
cdm::SubstanceData data;
PBSubstance::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBSubstance::SerializeToFile(const SESubstance& src, const std::string& filename, SerializationFormat m)
{
......@@ -610,7 +610,7 @@ bool PBSubstance::SerializeToFile(const SESubstance& src, const std::string& fil
bool PBSubstance::SerializeFromString(const std::string& src, SESubstance& dst, SerializationFormat m)
{
cdm::SubstanceData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBSubstance::Load(data, dst);
return true;
......@@ -627,7 +627,7 @@ bool PBSubstance::SerializeToString(const SESubstanceCompound& src, std::string&
{
cdm::SubstanceCompoundData data;
PBSubstance::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBSubstance::SerializeToFile(const SESubstanceCompound& src, const std::string& filename, SerializationFormat m)
{
......@@ -641,7 +641,7 @@ bool PBSubstance::SerializeToFile(const SESubstanceCompound& src, const std::str
bool PBSubstance::SerializeFromString(const std::string& src, SESubstanceCompound& dst, const SESubstanceManager& subMgr, SerializationFormat m)
{
cdm::SubstanceCompoundData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBSubstance::Load(data, dst, subMgr);
return true;
......
......@@ -204,7 +204,7 @@ bool PBTestReport::SerializeToString(const SETestReport& src, std::string& outpu
{
cdm::TestReportData data;
PBTestReport::Serialize(src, data);
return PBUtils::SerializeToString(data, output, m);
return PBUtils::SerializeToString(data, output, m, src.GetLogger());
}
bool PBTestReport::SerializeToFile(const SETestReport& src, const std::string& filename, SerializationFormat m)
{
......@@ -217,7 +217,7 @@ bool PBTestReport::SerializeToFile(const SETestReport& src, const std::string& f
bool PBTestReport::SerializeFromString(const std::string& src, SETestReport& dst, SerializationFormat m)
{
cdm::TestReportData data;
if (!PBUtils::SerializeFromString(src, data, m))
if (!PBUtils::SerializeFromString(src, data, m, dst.GetLogger()))
return false;
PBTestReport::Load(data, dst);
return true;
......
......@@ -6,37 +6,74 @@
#include <google/protobuf/text_format.h>
#include <google/protobuf/util/json_util.h>
void MyLogHandler(google::protobuf::LogLevel level, const char* filename, int line, const std::string& message)
std::mutex log_mutex;
Logger* g_logger = nullptr;
void PBUtils::ProtobufLogHandler(google::protobuf::LogLevel level, const char* filename, int line, const std::string& message)
{
std::cout << message << std::endl;
std::stringstream ss;
ss << filename << "::" << line;
switch (level)
{
case google::protobuf::LOGLEVEL_INFO:
g_logger->Info(message, ss.str());
break;
// Going to treat everything else as a warning, as Pulse will try to handle Errors/Fatal messages
// Pulse will report an error/fatal when it feels it did everything it could but still is unable to serialize
case google::protobuf::LOGLEVEL_WARNING:
g_logger->Warning(message, ss.str());
break;
case google::protobuf::LOGLEVEL_ERROR:
g_logger->Warning(message, ss.str());
break;
case google::protobuf::LOGLEVEL_FATAL:
g_logger->Warning(message, ss.str());
break;
}
g_logger = nullptr;
}
bool PBUtils::SerializeToString(const google::protobuf::Message& src, std::string& output, SerializationFormat m)
bool PBUtils::SerializeToString(const google::protobuf::Message& src, std::string& output, SerializationFormat m, Logger* logger)
{
std::lock_guard<std::mutex> guard(log_mutex);
if (m == JSON)
{
google::protobuf::SetLogHandler(MyLogHandler);
return google::protobuf::util::MessageToJsonString(src, &output).ok();
g_logger = logger;
google::protobuf::SetLogHandler(static_cast<google::protobuf::LogHandler*>(PBUtils::ProtobufLogHandler));
bool ret = google::protobuf::util::MessageToJsonString(src, &output).ok();
g_logger = nullptr;
return ret;
//return google::protobuf::TextFormat::PrintToString(data, &output);
}
else
return src.SerializeToString(&output);
}
bool PBUtils::SerializeFromString(const std::string& src, google::protobuf::Message& dst, SerializationFormat m)
bool PBUtils::SerializeFromString(const std::string& src, google::protobuf::Message& dst, SerializationFormat m, Logger* logger)
{
std::lock_guard<std::mutex> guard(log_mutex);
if (m == JSON)
{
google::protobuf::SetLogHandler(MyLogHandler);
bool ret = true;
g_logger = logger;
google::protobuf::SetLogHandler(static_cast<google::protobuf::LogHandler*>(PBUtils::ProtobufLogHandler));
google::protobuf::util::JsonParseOptions opts;
google::protobuf::util::Status stat = google::protobuf::util::JsonStringToMessage(src, &dst, opts);
if (!stat.ok())
{
std::cerr << stat.ToString() << std::endl;
if (!google::protobuf::TextFormat::ParseFromString(src, &dst))
return false;
if(logger != nullptr)
logger->Warning("Protobuf " + stat.ToString());
else
std::cerr << stat.ToString() << std::endl;
ret = false;
// Old code to check if the string is in the old google text format
// We generally do not support this, but if there is some weird reason
// Here is how you would do that
// logger->Info("Checking to see if string is in google text format...");
// ret = google::protobuf::TextFormat::ParseFromString(src, &dst);
}
return true;
g_logger = nullptr;
return ret;
}
else
{
......
......@@ -2,12 +2,15 @@
See accompanying NOTICE file for details.*/
#pragma once
namespace google { namespace protobuf { class Message; } }
#include <google/protobuf/message.h>
class CDM_DECL PBUtils
{
public:
static bool SerializeFromString(const std::string& src, google::protobuf::Message& dst, SerializationFormat m);
static bool SerializeToString(const google::protobuf::Message& src, std::string& output, SerializationFormat m);
static bool SerializeFromString(const std::string& src, google::protobuf::Message& dst, SerializationFormat m, Logger* logger);
static bool SerializeToString(const google::protobuf::Message& src, std::string& output, SerializationFormat m, Logger* logger);
static void ProtobufLogHandler(google::protobuf::LogLevel level, const char* filename, int line, const std::string& message);
};
\ No newline at end of file
......@@ -32,7 +32,7 @@ bool SEScenarioExec::Execute(const std::string& scenarioFile, const std::string&
{
try
{
m_ss << "Executing scenario file : " << scenarioFile << std::endl;
m_ss << "Executing scenario file : " << scenarioFile;
Info(m_ss);
m_Cancel = false;
......
......@@ -57,6 +57,7 @@ void Logger::LogToConsole(bool b)
void Logger::ResetLogFile(const std::string& logFilename)
{
if (_log_lib->logger.getAllAppenders().empty())
_log_lib->logger.removeAllAppenders();
_log_lib->logger.setLogLevel(log4cplus::INFO_LOG_LEVEL);
......
......@@ -13,23 +13,23 @@ import com.kitware.physiology.utilities.Log;
public class Proto2Doxygen
{
static class Property
{
public String name;
public String type;
public String comment;
}
static class Message
{
public String name;
public String comment;
public List<Message> children = new ArrayList<Message>();
public List<Property> properties = new ArrayList<Property>();
}
static class Property
{
public String name;
public String type;
public String comment;
}
static class Message
{
public String name;
public String comment;
public List<Message> children = new ArrayList<Message>();
public List<Property> properties = new ArrayList<Property>();
}
public static void main(String[] args)
{
jniBridge.initialize();
public static void main(String[] args)
{
jniBridge.initialize();
Log.setFileName("Proto2Doxygen.log");
try
{
......@@ -59,189 +59,189 @@ public class Proto2Doxygen
{
Log.info("Command arguments are : <Directory of files to process> <Directory to place processed files>");
}
}
catch (Exception ex)
{
Log.error("Unable to create single validation table file.",ex);
}
}
catch (Exception ex)
{
Log.error("Unable to create single validation table file.",ex);
}
jniBridge.deinitialize();
}
}
protected static void processFile(String fName, File sDir, File dDir) throws IOException
{
String line;
int start,end;
String comment = "";
Message message = null;
Message child = null;
List<Message> messages = new ArrayList<Message>();