mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-18 00:57:23 +08:00
Avoid using namespace in headers.
This commit is contained in:
+50
-51
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "../master/ioctl.h"
|
||||
|
||||
@@ -35,34 +34,34 @@ class MasterDevice;
|
||||
/****************************************************************************/
|
||||
|
||||
class InvalidUsageException:
|
||||
public runtime_error
|
||||
public std::runtime_error
|
||||
{
|
||||
friend class Command;
|
||||
|
||||
protected:
|
||||
/** Constructor with stringstream parameter. */
|
||||
InvalidUsageException(
|
||||
const stringstream &s /**< Message. */
|
||||
): runtime_error(s.str()) {}
|
||||
const std::stringstream &s /**< Message. */
|
||||
): std::runtime_error(s.str()) {}
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
class CommandException:
|
||||
public runtime_error
|
||||
public std::runtime_error
|
||||
{
|
||||
friend class Command;
|
||||
|
||||
protected:
|
||||
/** Constructor with char * parameter. */
|
||||
CommandException(
|
||||
const string &msg /**< Message. */
|
||||
): runtime_error(msg) {}
|
||||
const std::string &msg /**< Message. */
|
||||
): std::runtime_error(msg) {}
|
||||
|
||||
/** Constructor with stringstream parameter. */
|
||||
CommandException(
|
||||
const stringstream &s /**< Message. */
|
||||
): runtime_error(s.str()) {}
|
||||
const std::stringstream &s /**< Message. */
|
||||
): std::runtime_error(s.str()) {}
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -70,14 +69,14 @@ class CommandException:
|
||||
class Command
|
||||
{
|
||||
public:
|
||||
Command(const string &, const string &);
|
||||
Command(const std::string &, const std::string &);
|
||||
virtual ~Command();
|
||||
|
||||
const string &getName() const;
|
||||
const string &getBriefDescription() const;
|
||||
const std::string &getName() const;
|
||||
const std::string &getBriefDescription() const;
|
||||
|
||||
typedef list<unsigned int> MasterIndexList;
|
||||
void setMasters(const string &);
|
||||
typedef std::list<unsigned int> MasterIndexList;
|
||||
void setMasters(const std::string &);
|
||||
MasterIndexList getMasterIndices() const;
|
||||
unsigned int getSingleMasterIndex() const;
|
||||
|
||||
@@ -89,15 +88,15 @@ class Command
|
||||
void setVerbosity(Verbosity);
|
||||
Verbosity getVerbosity() const;
|
||||
|
||||
void setAliases(const string &);
|
||||
void setPositions(const string &);
|
||||
void setAliases(const std::string &);
|
||||
void setPositions(const std::string &);
|
||||
|
||||
void setDomains(const string &);
|
||||
typedef list<unsigned int> DomainIndexList;
|
||||
void setDomains(const std::string &);
|
||||
typedef std::list<unsigned int> DomainIndexList;
|
||||
DomainIndexList getDomainIndices() const;
|
||||
|
||||
void setDataType(const string &);
|
||||
const string &getDataType() const;
|
||||
void setDataType(const std::string &);
|
||||
const std::string &getDataType() const;
|
||||
|
||||
void setEmergency(bool);
|
||||
bool getEmergency() const;
|
||||
@@ -105,67 +104,67 @@ class Command
|
||||
void setForce(bool);
|
||||
bool getForce() const;
|
||||
|
||||
void setOutputFile(const string &);
|
||||
const string &getOutputFile() const;
|
||||
void setOutputFile(const std::string &);
|
||||
const std::string &getOutputFile() const;
|
||||
|
||||
void setSkin(const string &);
|
||||
const string &getSkin() const;
|
||||
void setSkin(const std::string &);
|
||||
const std::string &getSkin() const;
|
||||
|
||||
bool matchesSubstr(const string &) const;
|
||||
bool matchesAbbrev(const string &) const;
|
||||
bool matchesSubstr(const std::string &) const;
|
||||
bool matchesAbbrev(const std::string &) const;
|
||||
|
||||
virtual string helpString(const string &) const = 0;
|
||||
virtual std::string helpString(const std::string &) const = 0;
|
||||
|
||||
typedef vector<string> StringVector;
|
||||
typedef std::vector<std::string> StringVector;
|
||||
virtual void execute(const StringVector &) = 0;
|
||||
|
||||
static string numericInfo();
|
||||
static std::string numericInfo();
|
||||
|
||||
protected:
|
||||
enum {BreakAfterBytes = 16};
|
||||
|
||||
void throwInvalidUsageException(const stringstream &) const;
|
||||
void throwCommandException(const string &) const;
|
||||
void throwCommandException(const stringstream &) const;
|
||||
void throwInvalidUsageException(const std::stringstream &) const;
|
||||
void throwCommandException(const std::string &) const;
|
||||
void throwCommandException(const std::stringstream &) const;
|
||||
void throwSingleSlaveRequired(unsigned int) const;
|
||||
|
||||
typedef list<ec_ioctl_slave_t> SlaveList;
|
||||
typedef std::list<ec_ioctl_slave_t> SlaveList;
|
||||
SlaveList selectedSlaves(MasterDevice &);
|
||||
typedef list<ec_ioctl_config_t> ConfigList;
|
||||
typedef std::list<ec_ioctl_config_t> ConfigList;
|
||||
ConfigList selectedConfigs(MasterDevice &);
|
||||
typedef list<ec_ioctl_domain_t> DomainList;
|
||||
typedef std::list<ec_ioctl_domain_t> DomainList;
|
||||
DomainList selectedDomains(MasterDevice &, const ec_ioctl_master_t &);
|
||||
int emergencySlave() const;
|
||||
|
||||
static string alStateString(uint8_t);
|
||||
static std::string alStateString(uint8_t);
|
||||
|
||||
private:
|
||||
string name;
|
||||
string briefDesc;
|
||||
string masters;
|
||||
std::string name;
|
||||
std::string briefDesc;
|
||||
std::string masters;
|
||||
Verbosity verbosity;
|
||||
string aliases;
|
||||
string positions;
|
||||
string domains;
|
||||
string dataType;
|
||||
std::string aliases;
|
||||
std::string positions;
|
||||
std::string domains;
|
||||
std::string dataType;
|
||||
bool emergency;
|
||||
bool force;
|
||||
string outputFile;
|
||||
string skin;
|
||||
std::string outputFile;
|
||||
std::string skin;
|
||||
|
||||
Command();
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
inline const string &Command::getName() const
|
||||
inline const std::string &Command::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
inline const string &Command::getBriefDescription() const
|
||||
inline const std::string &Command::getBriefDescription() const
|
||||
{
|
||||
return briefDesc;
|
||||
}
|
||||
@@ -179,7 +178,7 @@ inline Command::Verbosity Command::getVerbosity() const
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
inline const string &Command::getDataType() const
|
||||
inline const std::string &Command::getDataType() const
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
@@ -200,14 +199,14 @@ inline bool Command::getForce() const
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
inline const string &Command::getOutputFile() const
|
||||
inline const std::string &Command::getOutputFile() const
|
||||
{
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
inline const string &Command::getSkin() const
|
||||
inline const std::string &Command::getSkin() const
|
||||
{
|
||||
return skin;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
@@ -23,7 +23,6 @@
|
||||
#define __COMMANDCONFIG_H__
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
#include "Command.h"
|
||||
#include "SoeCommand.h"
|
||||
@@ -37,16 +36,16 @@ class CommandConfig:
|
||||
public:
|
||||
CommandConfig();
|
||||
|
||||
string helpString(const string &) const;
|
||||
std::string helpString(const std::string &) const;
|
||||
void execute(const StringVector &);
|
||||
|
||||
protected:
|
||||
struct Info {
|
||||
string alias;
|
||||
string pos;
|
||||
string ident;
|
||||
string slavePos;
|
||||
string state;
|
||||
std::string alias;
|
||||
std::string pos;
|
||||
std::string ident;
|
||||
std::string slavePos;
|
||||
std::string state;
|
||||
};
|
||||
|
||||
void showDetailedConfigs(MasterDevice &, const ConfigList &, bool);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "FoeCommand.h"
|
||||
#include "foe.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
FoeCommand::FoeCommand(const string &name, const string &briefDesc):
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class FoeCommand:
|
||||
public Command
|
||||
{
|
||||
public:
|
||||
FoeCommand(const string &, const string &);
|
||||
FoeCommand(const std::string &, const std::string &);
|
||||
|
||||
protected:
|
||||
static std::string resultText(int);
|
||||
|
||||
+6
-7
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "ecrt.h"
|
||||
#include "ioctl.h"
|
||||
@@ -32,20 +31,20 @@ using namespace std;
|
||||
/****************************************************************************/
|
||||
|
||||
class MasterDeviceException:
|
||||
public runtime_error
|
||||
public std::runtime_error
|
||||
{
|
||||
friend class MasterDevice;
|
||||
|
||||
protected:
|
||||
/** Constructor with string parameter. */
|
||||
MasterDeviceException(
|
||||
const string &s /**< Message. */
|
||||
): runtime_error(s) {}
|
||||
const std::string &s /**< Message. */
|
||||
): std::runtime_error(s) {}
|
||||
|
||||
/** Constructor with stringstream parameter. */
|
||||
MasterDeviceException(
|
||||
const stringstream &s /**< Message. */
|
||||
): runtime_error(s.str()) {}
|
||||
const std::stringstream &s /**< Message. */
|
||||
): std::runtime_error(s.str()) {}
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "SdoCommand.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
SdoCommand::SdoCommand(const string &name, const string &briefDesc):
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class SdoCommand:
|
||||
public DataTypeHandler
|
||||
{
|
||||
public:
|
||||
SdoCommand(const string &, const string &);
|
||||
SdoCommand(const std::string &, const std::string &);
|
||||
|
||||
static const char *abortText(uint32_t);
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
class SoeCommand
|
||||
{
|
||||
protected:
|
||||
static uint16_t parseIdn(const string &);
|
||||
static uint16_t parseIdn(const std::string &);
|
||||
static std::string outputIdn(uint16_t);
|
||||
static std::string errorMsg(uint16_t);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user