Skip to content

Commit

Permalink
remove using namespace std from header files
Browse files Browse the repository at this point in the history
  • Loading branch information
TimmRuppert committed Oct 11, 2024
1 parent 961f01a commit 2baa4e9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
26 changes: 12 additions & 14 deletions examples/OSMPDummySensor/OSMPDummySensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#include "OSMPDummySensorConfig.h"

using namespace std;

#ifndef FMU_SHARED_OBJECT
#define FMI2_FUNCTION_PREFIX OSMPDummySensor_
#endif
Expand Down Expand Up @@ -122,7 +120,7 @@ class COSMPDummySensor {
protected:
/* Private File-based Logging just for Debugging */
#ifdef PRIVATE_LOG_PATH
static ofstream private_log_file;
static std::ofstream private_log_file;
#endif

static void fmi_verbose_log_global(const char* format, ...) {
Expand Down Expand Up @@ -157,9 +155,9 @@ class COSMPDummySensor {
#endif
#ifdef PRIVATE_LOG_PATH
if (!private_log_file.is_open())
private_log_file.open(PRIVATE_LOG_PATH, ios::out | ios::app);
private_log_file.open(PRIVATE_LOG_PATH, std::ios::out | std::ios::app);
if (private_log_file.is_open()) {
private_log_file << "OSMPDummySensor" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << endl;
private_log_file << "OSMPDummySensor" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << std::endl;
private_log_file.flush();
}
#endif
Expand Down Expand Up @@ -191,23 +189,23 @@ class COSMPDummySensor {

protected:
/* Members */
string instanceName;
std::string instanceName;
fmi2Type fmuType;
string fmuGUID;
string fmuResourceLocation;
std::string fmuGUID;
std::string fmuResourceLocation;
bool visible;
bool loggingOn;
set<string> loggingCategories;
std::set<std::string> loggingCategories;
fmi2CallbackFunctions functions;
fmi2Boolean boolean_vars[FMI_BOOLEAN_VARS];
fmi2Integer integer_vars[FMI_INTEGER_VARS];
fmi2Real real_vars[FMI_REAL_VARS];
string string_vars[FMI_STRING_VARS];
std::string string_vars[FMI_STRING_VARS];
bool simulation_started;
string* currentOutputBuffer;
string* lastOutputBuffer;
string* currentConfigRequestBuffer;
string* lastConfigRequestBuffer;
std::string* currentOutputBuffer;
std::string* lastOutputBuffer;
std::string* currentConfigRequestBuffer;
std::string* lastConfigRequestBuffer;

/* Simple Accessors */
fmi2Boolean fmi_valid() { return boolean_vars[FMI_BOOLEAN_VALID_IDX]; }
Expand Down
22 changes: 10 additions & 12 deletions examples/OSMPDummySource/OSMPDummySource.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#include "OSMPDummySourceConfig.h"

using namespace std;

#ifndef FMU_SHARED_OBJECT
#define FMI2_FUNCTION_PREFIX OSMPDummySource_
#endif
Expand Down Expand Up @@ -111,7 +109,7 @@ class COSMPDummySource {
protected:
/* Private File-based Logging just for Debugging */
#ifdef PRIVATE_LOG_PATH
static ofstream private_log_file;
static std::ofstream private_log_file;
#endif

static void fmi_verbose_log_global(const char* format, ...) {
Expand Down Expand Up @@ -146,9 +144,9 @@ class COSMPDummySource {
#endif
#ifdef PRIVATE_LOG_PATH
if (!private_log_file.is_open())
private_log_file.open(PRIVATE_LOG_PATH, ios::out | ios::app);
private_log_file.open(PRIVATE_LOG_PATH, std::ios::out | std::ios::app);
if (private_log_file.is_open()) {
private_log_file << "OSMPDummySource" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << endl;
private_log_file << "OSMPDummySource" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << std::endl;
private_log_file.flush();
}
#endif
Expand Down Expand Up @@ -180,20 +178,20 @@ class COSMPDummySource {

protected:
/* Members */
string instanceName;
std::string instanceName;
fmi2Type fmuType;
string fmuGUID;
string fmuResourceLocation;
std::string fmuGUID;
std::string fmuResourceLocation;
bool visible;
bool loggingOn;
set<string> loggingCategories;
std::set<std::string> loggingCategories;
fmi2CallbackFunctions functions;
fmi2Boolean boolean_vars[FMI_BOOLEAN_VARS];
fmi2Integer integer_vars[FMI_INTEGER_VARS];
fmi2Real real_vars[FMI_REAL_VARS];
string string_vars[FMI_STRING_VARS];
string* currentBuffer;
string* lastBuffer;
std::string string_vars[FMI_STRING_VARS];
std::string* currentBuffer;
std::string* lastBuffer;

/* Simple Accessors */
fmi2Boolean fmi_valid() { return boolean_vars[FMI_BOOLEAN_VALID_IDX]; }
Expand Down

0 comments on commit 2baa4e9

Please sign in to comment.