added Environment::nodeId()

This commit is contained in:
Guenter Obiltschnig
2008-09-18 15:49:05 +00:00
parent b5b35cb173
commit 5ae8225ece
17 changed files with 359 additions and 236 deletions

View File

@@ -1,7 +1,7 @@
//
// Environment.h
//
// $Id: //poco/svn/Foundation/include/Poco/Environment.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment.h#2 $
//
// Library: Foundation
// Package: Core
@@ -51,6 +51,8 @@ class Foundation_API Environment
/// and some general system information.
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string get(const std::string& name);
/// Returns the value of the environment variable
/// with the given name. Throws a NotFoundException
@@ -80,6 +82,18 @@ public:
static std::string nodeName();
/// Returns the node (or host) name.
static void nodeId(NodeId& id);
/// Returns the Ethernet address of the first Ethernet
/// adapter found on the system.
///
/// Throws a SystemException if no Ethernet adapter is available.
static std::string nodeId();
/// Returns the Ethernet address (format "xx:xx:xx:xx:xx:xx")
/// of the first Ethernet adapter found on the system.
///
/// Throws a SystemException if no Ethernet adapter is available.
};

View File

@@ -1,7 +1,7 @@
//
// Environment_UNIX.h
//
// $Id: //poco/svn/Foundation/include/Poco/Environment_UNIX.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_UNIX.h#2 $
//
// Library: Foundation
// Package: Core
@@ -51,6 +51,8 @@ namespace Poco {
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string& name);
static bool hasImpl(const std::string& name);
static void setImpl(const std::string& name, const std::string& value);
@@ -58,6 +60,7 @@ public:
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId& id);
private:
typedef std::map<std::string, std::string> StringMap;

View File

@@ -1,7 +1,7 @@
//
// Environment_VMS.h
//
// $Id: //poco/svn/Foundation/include/Poco/Environment_VMS.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_VMS.h#2 $
//
// Library: Foundation
// Package: Core
@@ -50,6 +50,8 @@ namespace Poco {
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string& name);
static bool hasImpl(const std::string& name);
static void setImpl(const std::string& name, const std::string& value);
@@ -57,6 +59,7 @@ public:
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId& id);
static std::string getsyi(unsigned short code);
/// a wrapper for $GETSYIW

View File

@@ -1,7 +1,7 @@
//
// Environment_WIN32.h
//
// $Id: //poco/svn/Foundation/include/Poco/Environment_WIN32.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32.h#2 $
//
// Library: Foundation
// Package: Core
@@ -49,6 +49,8 @@ namespace Poco {
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string& name);
static bool hasImpl(const std::string& name);
static void setImpl(const std::string& name, const std::string& value);
@@ -56,6 +58,7 @@ public:
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId& id);
};

View File

@@ -1,7 +1,7 @@
//
// Environment_WIN32U.h
//
// $Id: //poco/svn/Foundation/include/Poco/Environment_WIN32U.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32U.h#2 $
//
// Library: Foundation
// Package: Core
@@ -49,6 +49,8 @@ namespace Poco {
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string& name);
static bool hasImpl(const std::string& name);
static void setImpl(const std::string& name, const std::string& value);
@@ -56,6 +58,7 @@ public:
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId& id);
};

View File

@@ -1,7 +1,7 @@
//
// File.h
//
// $Id: //poco/svn/Foundation/include/Poco/File.h#3 $
// $Id: //poco/1.3/Foundation/include/Poco/File.h#6 $
//
// Library: Foundation
// Package: Filesystem
@@ -141,6 +141,12 @@ public:
Timestamp created() const;
/// Returns the creation date of the file.
///
/// Not all platforms or filesystems (e.g. Linux and most Unix
/// platforms with the exception of FreeBSD and Mac OS X)
/// maintain the creation date of a file.
/// On such platforms, created() returns
/// the time of the last inode modification.
Timestamp getLastModified() const;
/// Returns the modification date of the file.

View File

@@ -1,7 +1,7 @@
//
// UUIDGenerator.h
//
// $Id: //poco/svn/Foundation/include/Poco/UUIDGenerator.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/UUIDGenerator.h#3 $
//
// Library: Foundation
// Package: UUID
@@ -45,6 +45,7 @@
#include "Poco/Mutex.h"
#include "Poco/Random.h"
#include "Poco/Timestamp.h"
#include "Poco/Environment.h"
namespace Poco {
@@ -100,12 +101,12 @@ protected:
void getNode();
private:
FastMutex _mutex;
Random _random;
Timestamp _lastTime;
int _ticks;
UInt8 _node[6];
bool _haveNode;
FastMutex _mutex;
Random _random;
Timestamp _lastTime;
int _ticks;
Environment::NodeId _node;
bool _haveNode;
UUIDGenerator(const UUIDGenerator&);
UUIDGenerator& operator = (const UUIDGenerator&);