Skip to content

Commit 2baa4e9

Browse files
committed
remove using namespace std from header files
1 parent 961f01a commit 2baa4e9

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

examples/OSMPDummySensor/OSMPDummySensor.h

+12-14
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include "OSMPDummySensorConfig.h"
1212

13-
using namespace std;
14-
1513
#ifndef FMU_SHARED_OBJECT
1614
#define FMI2_FUNCTION_PREFIX OSMPDummySensor_
1715
#endif
@@ -122,7 +120,7 @@ class COSMPDummySensor {
122120
protected:
123121
/* Private File-based Logging just for Debugging */
124122
#ifdef PRIVATE_LOG_PATH
125-
static ofstream private_log_file;
123+
static std::ofstream private_log_file;
126124
#endif
127125

128126
static void fmi_verbose_log_global(const char* format, ...) {
@@ -157,9 +155,9 @@ class COSMPDummySensor {
157155
#endif
158156
#ifdef PRIVATE_LOG_PATH
159157
if (!private_log_file.is_open())
160-
private_log_file.open(PRIVATE_LOG_PATH, ios::out | ios::app);
158+
private_log_file.open(PRIVATE_LOG_PATH, std::ios::out | std::ios::app);
161159
if (private_log_file.is_open()) {
162-
private_log_file << "OSMPDummySensor" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << endl;
160+
private_log_file << "OSMPDummySensor" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << std::endl;
163161
private_log_file.flush();
164162
}
165163
#endif
@@ -191,23 +189,23 @@ class COSMPDummySensor {
191189

192190
protected:
193191
/* Members */
194-
string instanceName;
192+
std::string instanceName;
195193
fmi2Type fmuType;
196-
string fmuGUID;
197-
string fmuResourceLocation;
194+
std::string fmuGUID;
195+
std::string fmuResourceLocation;
198196
bool visible;
199197
bool loggingOn;
200-
set<string> loggingCategories;
198+
std::set<std::string> loggingCategories;
201199
fmi2CallbackFunctions functions;
202200
fmi2Boolean boolean_vars[FMI_BOOLEAN_VARS];
203201
fmi2Integer integer_vars[FMI_INTEGER_VARS];
204202
fmi2Real real_vars[FMI_REAL_VARS];
205-
string string_vars[FMI_STRING_VARS];
203+
std::string string_vars[FMI_STRING_VARS];
206204
bool simulation_started;
207-
string* currentOutputBuffer;
208-
string* lastOutputBuffer;
209-
string* currentConfigRequestBuffer;
210-
string* lastConfigRequestBuffer;
205+
std::string* currentOutputBuffer;
206+
std::string* lastOutputBuffer;
207+
std::string* currentConfigRequestBuffer;
208+
std::string* lastConfigRequestBuffer;
211209

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

examples/OSMPDummySource/OSMPDummySource.h

+10-12
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include "OSMPDummySourceConfig.h"
1212

13-
using namespace std;
14-
1513
#ifndef FMU_SHARED_OBJECT
1614
#define FMI2_FUNCTION_PREFIX OSMPDummySource_
1715
#endif
@@ -111,7 +109,7 @@ class COSMPDummySource {
111109
protected:
112110
/* Private File-based Logging just for Debugging */
113111
#ifdef PRIVATE_LOG_PATH
114-
static ofstream private_log_file;
112+
static std::ofstream private_log_file;
115113
#endif
116114

117115
static void fmi_verbose_log_global(const char* format, ...) {
@@ -146,9 +144,9 @@ class COSMPDummySource {
146144
#endif
147145
#ifdef PRIVATE_LOG_PATH
148146
if (!private_log_file.is_open())
149-
private_log_file.open(PRIVATE_LOG_PATH, ios::out | ios::app);
147+
private_log_file.open(PRIVATE_LOG_PATH, std::ios::out | std::ios::app);
150148
if (private_log_file.is_open()) {
151-
private_log_file << "OSMPDummySource" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << endl;
149+
private_log_file << "OSMPDummySource" << "::" << instanceName << "<" << ((void*)this) << ">:" << category << ": " << buffer << std::endl;
152150
private_log_file.flush();
153151
}
154152
#endif
@@ -180,20 +178,20 @@ class COSMPDummySource {
180178

181179
protected:
182180
/* Members */
183-
string instanceName;
181+
std::string instanceName;
184182
fmi2Type fmuType;
185-
string fmuGUID;
186-
string fmuResourceLocation;
183+
std::string fmuGUID;
184+
std::string fmuResourceLocation;
187185
bool visible;
188186
bool loggingOn;
189-
set<string> loggingCategories;
187+
std::set<std::string> loggingCategories;
190188
fmi2CallbackFunctions functions;
191189
fmi2Boolean boolean_vars[FMI_BOOLEAN_VARS];
192190
fmi2Integer integer_vars[FMI_INTEGER_VARS];
193191
fmi2Real real_vars[FMI_REAL_VARS];
194-
string string_vars[FMI_STRING_VARS];
195-
string* currentBuffer;
196-
string* lastBuffer;
192+
std::string string_vars[FMI_STRING_VARS];
193+
std::string* currentBuffer;
194+
std::string* lastBuffer;
197195

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

0 commit comments

Comments
 (0)