header cleanup

This commit is contained in:
Matej Sekoranja
2011-10-20 10:54:09 +02:00
parent 8c9c29a497
commit 4dcb439955
22 changed files with 607 additions and 619 deletions

View File

@@ -1,8 +1,7 @@
/*
* constants.h
*
* Created on: Oct 8, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CONSTANTS_H_
@@ -17,70 +16,70 @@ using epics::pvData::uint32;
using epics::pvData::String;
namespace epics {
namespace pvAccess {
namespace pvAccess {
/** CA protocol magic number */
const int8 CA_MAGIC = 0xCA;
/** CA protocol major revision (implemented by this library). */
const int8 CA_MAJOR_PROTOCOL_REVISION = 5;
/** CA protocol minor revision (implemented by this library). */
const int8 CA_MINOR_PROTOCOL_REVISION = 0;
/** Unknown CA protocol minor revision. */
const int8 CA_UNKNOWN_MINOR_PROTOCOL_REVISION = 0;
/** CA version signature (e.g. 0x50). */
const int8 CA_VERSION = ((uint8_t)CA_MAJOR_PROTOCOL_REVISION<<4)|CA_MINOR_PROTOCOL_REVISION;
/** CA protocol port base. */
const int32 CA_PORT_BASE = 5056;
/** Default CA server port. */
const int32 CA_SERVER_PORT = CA_PORT_BASE+2*CA_MAJOR_PROTOCOL_REVISION;
/** Default CA beacon port. */
const int32 CA_BROADCAST_PORT = CA_SERVER_PORT+1;
/** CA protocol message header size. */
const int16 CA_MESSAGE_HEADER_SIZE = 8;
/**
* UDP maximum send message size.
* MAX_UDP: 1500 (max of ethernet and 802.{2,3} MTU) - 20/40(IPv4/IPv6)
* - 8(UDP) - some reserve (the MTU of Ethernet is currently independent
* of its speed variant)
*/
const int32 MAX_UDP_SEND = 1440;
/** UDP maximum receive message size. */
const int32 MAX_UDP_RECV = 0xFFFF+16;
/** TCP maximum receive message size. */
const int32 MAX_TCP_RECV = 1024*16;
/** Maximum number of search requests in one search message. */
const int32 MAX_SEARCH_BATCH_COUNT = 0xFFFF;
/** Default priority (corresponds to POSIX SCHED_OTHER) */
const int16 CA_DEFAULT_PRIORITY = 0;
/** Unreasonable channel name length. */
const uint32 UNREASONABLE_CHANNEL_NAME_LENGTH = 500;
/** Invalid data type. */
const int16 INVALID_DATA_TYPE = (int16)0xFFFF;
/** Invalid IOID. */
const int32 INVALID_IOID = 0;
/** All messages must be aligned to 8-bytes (64-bit). */
const int32 CA_ALIGNMENT = 8;
/** Default CA provider name. */
const String PVACCESS_DEFAULT_PROVIDER = "local";
}
/** CA protocol magic number */
const int8 CA_MAGIC = 0xCA;
/** CA protocol major revision (implemented by this library). */
const int8 CA_MAJOR_PROTOCOL_REVISION = 5;
/** CA protocol minor revision (implemented by this library). */
const int8 CA_MINOR_PROTOCOL_REVISION = 0;
/** Unknown CA protocol minor revision. */
const int8 CA_UNKNOWN_MINOR_PROTOCOL_REVISION = 0;
/** CA version signature (e.g. 0x50). */
const int8 CA_VERSION = ((uint8_t)CA_MAJOR_PROTOCOL_REVISION<<4)|CA_MINOR_PROTOCOL_REVISION;
/** CA protocol port base. */
const int32 CA_PORT_BASE = 5056;
/** Default CA server port. */
const int32 CA_SERVER_PORT = CA_PORT_BASE+2*CA_MAJOR_PROTOCOL_REVISION;
/** Default CA beacon port. */
const int32 CA_BROADCAST_PORT = CA_SERVER_PORT+1;
/** CA protocol message header size. */
const int16 CA_MESSAGE_HEADER_SIZE = 8;
/**
* UDP maximum send message size.
* MAX_UDP: 1500 (max of ethernet and 802.{2,3} MTU) - 20/40(IPv4/IPv6)
* - 8(UDP) - some reserve (the MTU of Ethernet is currently independent
* of its speed variant)
*/
const int32 MAX_UDP_SEND = 1440;
/** UDP maximum receive message size. */
const int32 MAX_UDP_RECV = 0xFFFF+16;
/** TCP maximum receive message size. */
const int32 MAX_TCP_RECV = 1024*16;
/** Maximum number of search requests in one search message. */
const int32 MAX_SEARCH_BATCH_COUNT = 0xFFFF;
/** Default priority (corresponds to POSIX SCHED_OTHER) */
const int16 CA_DEFAULT_PRIORITY = 0;
/** Unreasonable channel name length. */
const uint32 UNREASONABLE_CHANNEL_NAME_LENGTH = 500;
/** Invalid data type. */
const int16 INVALID_DATA_TYPE = (int16)0xFFFF;
/** Invalid IOID. */
const int32 INVALID_IOID = 0;
/** All messages must be aligned to 8-bytes (64-bit). */
const int32 CA_ALIGNMENT = 8;
/** Default CA provider name. */
const String PVACCESS_DEFAULT_PROVIDER = "local";
}
}
#endif /* CONSTANTS_H_ */

View File

@@ -1,8 +1,12 @@
/* clientFactory.cpp */
/* Author: Matej Sekoranja Date: 2011.2.1 */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/clientFactory.h>
#include <logger.h>
#include <pv/logger.h>
#include <epicsSignal.h>
using namespace epics::pvData;

View File

@@ -1,11 +1,17 @@
/* clientFactory.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CLIENTFACTORY_H
#define CLIENTFACTORY_H
#include <pv/clientContextImpl.h>
#include <pv/lock.h>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
class ClientFactory {
public:

View File

@@ -1,8 +1,7 @@
/*
* version.cpp
*
* Created on: Oct 8, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <sstream>
@@ -13,32 +12,31 @@ using std::stringstream;
using epics::pvData::String;
namespace epics {
namespace pvAccess {
namespace pvAccess {
const String Version::getLongVersionString() const {
stringstream ret;
ret<<getProductName()<<" ["<<getImplementationLanguage();
ret<<"] v"<<getMajorVersion()<<"."<<getMinorVersion()<<".";
if(getDevelopmentVersion()>0) {
ret<<"D"<<getDevelopmentVersion();
} else
ret<<getMaintenanceVersion();
const String Version::getLongVersionString() const {
stringstream ret;
ret<<getProductName()<<" ["<<getImplementationLanguage();
ret<<"] v"<<getMajorVersion()<<"."<<getMinorVersion()<<".";
if(getDevelopmentVersion()>0) {
ret<<"D"<<getDevelopmentVersion();
} else
ret<<getMaintenanceVersion();
return ret.str();
}
const String Version::getVersionString() const {
stringstream ret;
ret<<getProductName()<<" v"<<getMajorVersion()<<".";
ret<<getMinorVersion()<<".";
if(getDevelopmentVersion()>0) {
ret<<"D"<<getDevelopmentVersion();
} else
ret<<getMaintenanceVersion();
return ret.str();
}
}
return ret.str();
}
const String Version::getVersionString() const {
stringstream ret;
ret<<getProductName()<<" v"<<getMajorVersion()<<".";
ret<<getMinorVersion()<<".";
if(getDevelopmentVersion()>0) {
ret<<"D"<<getDevelopmentVersion();
} else
ret<<getMaintenanceVersion();
return ret.str();
}
}
}

View File

@@ -1,8 +1,7 @@
/*
* version.h
*
* Created on: Oct 8, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef VERSION_H_
@@ -12,7 +11,7 @@
#include <pv/noDefaultMethods.h>
namespace epics {
namespace pvAccess {
namespace pvAccess {
using epics::pvData::String;
@@ -28,17 +27,19 @@ namespace epics {
* @param developmentVersion development version.
*/
Version(String productName, String implementationLangugage,
int majorVersion, int minorVersion, int maintenanceVersion,
int developmentVersion) :
_productName(productName), _implementationLanguage(
implementationLangugage), _majorVersion(majorVersion),
_minorVersion(minorVersion), _maintenanceVersion(
maintenanceVersion), _developmentVersion(
developmentVersion) {
int majorVersion, int minorVersion,
int maintenanceVersion, int developmentVersion) :
_productName(productName),
_implementationLanguage(implementationLangugage),
_majorVersion(majorVersion),
_minorVersion(minorVersion),
_maintenanceVersion(maintenanceVersion),
_developmentVersion(developmentVersion)
{
}
/** The name of the product */
const inline String getProductName() const {
inline const String getProductName() const {
return _productName;
}
@@ -129,7 +130,7 @@ namespace epics {
int _maintenanceVersion;
int _developmentVersion;
};
}
}
}
#endif /* VERSION_H_ */

View File

@@ -1,11 +1,14 @@
/*
* configuration.cpp
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/configuration.h>
#include <pv/epicsException.h>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
using namespace epics::pvData;
using namespace std;
@@ -193,7 +196,7 @@ void Properties::list()
SystemConfigurationImpl::SystemConfigurationImpl()
{
_envParam.name = new char[MAX_NAME_LENGHT];
_envParam.name = new char[256];
_envParam.pdflt = NULL;
// no exception, default value is taken
//_ibuffer.exceptions ( ifstream::failbit | ifstream::badbit );

View File

@@ -1,5 +1,7 @@
/*
* configuration.h
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CONFIGURATION_H
@@ -20,14 +22,9 @@
#include <map>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
#define MAX_NAME_LENGHT 300
/**
* Properties
*/
class Properties
{
public:
@@ -73,14 +70,13 @@ private:
class Configuration : private epics::pvData::NoDefaultMethods
{
public:
typedef std::tr1::shared_ptr<Configuration> shared_pointer;
typedef std::tr1::shared_ptr<const Configuration> const_shared_pointer;
POINTER_DEFINITIONS(Configuration);
/*
/**
* Destructor.
*/
virtual ~Configuration() {};
/*
/**
* Get the environment variable specified by name or return default value
* if it does not exist.
*
@@ -90,7 +86,7 @@ public:
* @return environment variable value as bool or default value if it does not exist.
*/
virtual bool getPropertyAsBoolean(const std::string name, const bool defaultValue) = 0;
/*
/**
* Get the environment variable specified by name or return default value
* if it does not exist.
*
@@ -100,7 +96,7 @@ public:
* @return environment variable value as int32 or default value if it does not exist.
*/
virtual epics::pvData::int32 getPropertyAsInteger(const std::string name, const epics::pvData::int32 defaultValue) = 0;
/*
/**
* Get the environment variable specified by name or return default value
* if it does not exist.
*
@@ -110,7 +106,7 @@ public:
* @return environment variable value as float or default value if it does not exist.
*/
virtual float getPropertyAsFloat(const std::string name, const float defaultValue) = 0;
/*
/**
* Get the environment variable specified by name or return default value
* if it does not exist.
*
@@ -120,7 +116,7 @@ public:
* @return environment variable value as double or default value if it does not exist.
*/
virtual float getPropertyAsDouble(const std::string name, const double defaultValue) = 0;
/*
/**
* Get the environment variable specified by name or return default value
* if it does not exist.
*
@@ -156,11 +152,11 @@ private:
class ConfigurationProvider : private epics::pvData::NoDefaultMethods
{
public:
/*
/**
* Destructor.
*/
virtual ~ConfigurationProvider() {};
/*
/**
* Return configuration specified by name.
*
* @param name name of the configuration to return.
@@ -168,7 +164,7 @@ public:
* @return configuration specified by name or NULL if it does not exists.
*/
virtual Configuration* getConfiguration(const std::string name) = 0;
/*
/**
* Register configuration.
*
* @param name name of the configuration to register.
@@ -181,7 +177,7 @@ class ConfigurationProviderImpl: public ConfigurationProvider
{
public:
ConfigurationProviderImpl();
/*
/**
* Destructor. Note: Registered configurations will be deleted!!
*/
~ConfigurationProviderImpl();
@@ -199,7 +195,7 @@ private:
class ConfigurationFactory : private epics::pvData::NoDefaultMethods
{
public:
/*
/**
* Lazily creates configuration provider.
*
* @param name name of the configuration to register.

View File

@@ -1,8 +1,7 @@
/*
* hexDump.cpp
*
* Created on: Nov 3, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/hexDump.h>
@@ -16,103 +15,91 @@ using std::endl;
using std::cout;
namespace epics {
namespace pvAccess {
namespace pvAccess {
String toHex(int8);
char toAscii(int8);
/// Byte to hexchar mapping.
static const char lookup[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
void hexDump(const String name, const int8 *bs, int len) {
hexDump(name, bs, 0, len);
}
/// Get hex representation of byte.
String toHex(int8 b) {
String sb;
void hexDump(const String name, const int8 *bs, int start, int len) {
hexDump("", name, bs, start, len);
}
int upper = (b>>4)&0x0F;
sb += lookup[upper];
void hexDump(const String prologue, const String name, const int8 *bs,
int start, int len) {
int lower = b&0x0F;
sb += lookup[lower];
stringstream header;
sb += ' ';
header<<prologue<<endl<<"Hexdump ["<<name<<"] size = "<<len;
String out(header.str());
String chars;
for(int i = start; i<(start+len); i++) {
if(((i-start)%16)==0) {
out += chars;
out += '\n';
chars.clear();
}
chars += toAscii(bs[i]);
out += toHex(bs[i]);
if(((i-start)%4)==3) {
chars += ' ';
out += ' ';
}
}
if(len%16!=0) {
int pad = 0;
int delta_bytes = 16-(len%16);
//rest of line (no of bytes)
//each byte takes two chars plus one ws
pad = delta_bytes*3;
//additional whitespaces after four bytes
pad += (delta_bytes/4);
pad++;
for(int i = 0; i<pad; i++)
chars.insert(0, " ");
}
out += chars;
cout<<out<<endl;
}
/**
* byte to hexchar mapping.
*/
static const char lookup[] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
/**
* Get hex representation of byte.
* @param b
* @return string hex representation of byte.
*/
String toHex(int8 b) {
String sb;
int upper = (b>>4)&0x0F;
sb += lookup[upper];
int lower = b&0x0F;
sb += lookup[lower];
sb += ' ';
return sb;
}
/**
* Get ASCII representation of byte, dot if non-readable.
* @param b
* @return ASCII representation of byte, dot if non-readable.
*/
char toAscii(int8 b) {
if(b>(int8)31&&b<(int8)127)
return (char)b;
else
return '.';
}
}
return sb;
}
/// Get ASCII representation of byte, dot if non-readable.
char toAscii(int8 b) {
if(b>(int8)31&&b<(int8)127)
return (char)b;
else
return '.';
}
void hexDump(const String name, const int8 *bs, int len) {
hexDump(name, bs, 0, len);
}
void hexDump(const String name, const int8 *bs, int start, int len) {
hexDump("", name, bs, start, len);
}
void hexDump(const String prologue, const String name, const int8 *bs,
int start, int len) {
stringstream header;
header<<prologue<<endl<<"Hexdump ["<<name<<"] size = "<<len;
String out(header.str());
String chars;
for(int i = start; i<(start+len); i++) {
if(((i-start)%16)==0) {
out += chars;
out += '\n';
chars.clear();
}
chars += toAscii(bs[i]);
out += toHex(bs[i]);
if(((i-start)%4)==3) {
chars += ' ';
out += ' ';
}
}
if(len%16!=0) {
int pad = 0;
int delta_bytes = 16-(len%16);
//rest of line (no of bytes)
//each byte takes two chars plus one ws
pad = delta_bytes*3;
//additional whitespaces after four bytes
pad += (delta_bytes/4);
pad++;
for(int i = 0; i<pad; i++)
chars.insert(0, " ");
}
out += chars;
cout<<out<<endl;
}
}
}

View File

@@ -1,8 +1,7 @@
/*
* hexDump.h
*
* Created on: Nov 3, 2010
* Author: user
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef HEXDUMP_H_
@@ -11,37 +10,37 @@
#include <pv/pvType.h>
namespace epics {
namespace pvAccess {
namespace pvAccess {
/**
* Output a buffer in hex format.
* @param name name (description) of the message.
* @param bs buffer to dump
* @param len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int len);
/**
* Output a buffer in hex format.
* @param name name (description) of the message.
* @param bs buffer to dump
* @param len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int len);
/**
* Output a buffer in hex format.
* @param[in] name name (description) of the message.
* @param[in] bs buffer to dump
* @param[in] start dump message using given offset.
* @param[in] len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int start, int len);
/**
* Output a buffer in hex format.
* @param[in] name name (description) of the message.
* @param[in] bs buffer to dump
* @param[in] start dump message using given offset.
* @param[in] len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int start, int len);
/**
* Output a buffer in hex format.
* @param[in] prologue string to prefixed to debug output, can be <code>null</code>
* @param[in] name name (description) of the message.
* @param[in] bs buffer to dump
* @param[in] start dump message using given offset.
* @param[in] len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String prologue, const epics::pvData::String name, const epics::pvData::int8 *bs,
int start, int len);
/**
* Output a buffer in hex format.
* @param[in] prologue string to prefixed to debug output, can be <code>null</code>
* @param[in] name name (description) of the message.
* @param[in] bs buffer to dump
* @param[in] start dump message using given offset.
* @param[in] len first bytes (length) to dump.
*/
void hexDump(const epics::pvData::String prologue, const epics::pvData::String name,
const epics::pvData::int8 *bs, int start, int len);
}
}
}
#endif /* HEXDUMP_H_ */

View File

@@ -1,23 +1,18 @@
/*
* inetAddressUtil.cpp
*
* Created on: Nov 12, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/* pvAccess */
#include <pv/inetAddressUtil.h>
/* pvData */
#include <pv/inetAddressUtil.h>
#include <pv/byteBuffer.h>
#include <pv/epicsException.h>
/* EPICSv3 */
#include <osiSock.h>
#include <ellLib.h>
#include <epicsAssert.h>
#include <logger.h>
/* standard */
#include <vector>
#include <cstring>
#include <cstdlib>
@@ -27,140 +22,140 @@ using namespace std;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {
namespace pvAccess {
void addDefaultBroadcastAddress(InetAddrVector* v, unsigned short p) {
osiSockAddr pNewNode;
pNewNode.ia.sin_family = AF_INET;
pNewNode.ia.sin_addr.s_addr = htonl(INADDR_BROADCAST);
pNewNode.ia.sin_port = htons(p);
v->push_back(pNewNode);
}
InetAddrVector* getBroadcastAddresses(SOCKET sock,
unsigned short defaultPort) {
ELLLIST as;
ellInit(&as);
osiSockAddr serverAddr;
memset(&serverAddr, 0, sizeof(osiSockAddr));
InetAddrVector * v = new InetAddrVector;
osiSockDiscoverBroadcastAddresses(&as, sock, &serverAddr);
for(ELLNODE * n = ellFirst(&as); n != NULL; n = ellNext(n))
{
osiSockAddrNode * sn = (osiSockAddrNode *)n;
sn->addr.ia.sin_port = htons(defaultPort);
v->push_back(sn->addr);
}
ellFree(&as);
return v;
}
void encodeAsIPv6Address(ByteBuffer* buffer, const osiSockAddr* address) {
// IPv4 compatible IPv6 address
// first 80-bit are 0
buffer->putLong(0);
buffer->putShort(0);
// next 16-bits are 1
buffer->putShort(0xFFFF);
// following IPv4 address in big-endian (network) byte order
uint32_t ipv4Addr = ntohl(address->ia.sin_addr.s_addr);
buffer->putByte((int8)((ipv4Addr>>24)&0xFF));
buffer->putByte((int8)((ipv4Addr>>16)&0xFF));
buffer->putByte((int8)((ipv4Addr>>8)&0xFF));
buffer->putByte((int8)(ipv4Addr&0xFF));
}
osiSockAddr* intToIPv4Address(int32 addr) {
osiSockAddr* ret = new osiSockAddr;
ret->ia.sin_family = AF_INET;
ret->ia.sin_addr.s_addr = htonl(addr);
ret->ia.sin_port = 0;
return ret;
}
int32 ipv4AddressToInt(const osiSockAddr& addr) {
return (int32)ntohl(addr.ia.sin_addr.s_addr);
}
int32 parseInetAddress(const String addr) {
int32 retAddr;
size_t dot = addr.find('.');
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
int byte = atoi(addr.substr(0, dot).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr = byte;
int num = dot+1;
dot = addr.find('.', num);
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
byte = atoi(addr.substr(num, dot-num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
num = dot+1;
dot = addr.find('.', num);
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
byte = atoi(addr.substr(num, dot-num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
num = dot+1;
byte = atoi(addr.substr(num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
return htonl(retAddr);
}
InetAddrVector* getSocketAddressList(String list, int defaultPort,
const InetAddrVector* appendList) {
InetAddrVector* iav = new InetAddrVector();
// parse string
size_t subStart = 0;
size_t subEnd;
while((subEnd = list.find(' ', subStart))!=String::npos) {
String address = list.substr(subStart, (subEnd-subStart));
osiSockAddr addr;
aToIPAddr(address.c_str(), defaultPort, &addr.ia);
iav->push_back(addr);
subStart = list.find_first_not_of(" \t\r\n\v", subEnd);
}
if(subStart!=String::npos&&list.length()>0) {
osiSockAddr addr;
aToIPAddr(list.substr(subStart).c_str(), defaultPort, &addr.ia);
iav->push_back(addr);
}
if(appendList!=NULL) {
for(size_t i = 0; i<appendList->size(); i++)
iav->push_back(appendList->at(i));
}
return iav;
}
const String inetAddressToString(const osiSockAddr &addr,
bool displayPort, bool displayHex) {
stringstream saddr;
int ipa = ntohl(addr.ia.sin_addr.s_addr);
saddr<<((int)(ipa>>24)&0xFF)<<'.';
saddr<<((int)(ipa>>16)&0xFF)<<'.';
saddr<<((int)(ipa>>8)&0xFF)<<'.';
saddr<<((int)ipa&0xFF);
if(displayPort) saddr<<":"<<ntohs(addr.ia.sin_port);
if(displayHex) saddr<<" ("<<hex<<ntohl(addr.ia.sin_addr.s_addr)
<<")";
return saddr.str();
}
}
void addDefaultBroadcastAddress(InetAddrVector* v, unsigned short p) {
osiSockAddr pNewNode;
pNewNode.ia.sin_family = AF_INET;
pNewNode.ia.sin_addr.s_addr = htonl(INADDR_BROADCAST);
pNewNode.ia.sin_port = htons(p);
v->push_back(pNewNode);
}
InetAddrVector* getBroadcastAddresses(SOCKET sock,
unsigned short defaultPort) {
ELLLIST as;
ellInit(&as);
osiSockAddr serverAddr;
memset(&serverAddr, 0, sizeof(osiSockAddr));
InetAddrVector * v = new InetAddrVector;
osiSockDiscoverBroadcastAddresses(&as, sock, &serverAddr);
for(ELLNODE * n = ellFirst(&as); n != NULL; n = ellNext(n))
{
osiSockAddrNode * sn = (osiSockAddrNode *)n;
sn->addr.ia.sin_port = htons(defaultPort);
v->push_back(sn->addr);
}
ellFree(&as);
return v;
}
void encodeAsIPv6Address(ByteBuffer* buffer, const osiSockAddr* address) {
// IPv4 compatible IPv6 address
// first 80-bit are 0
buffer->putLong(0);
buffer->putShort(0);
// next 16-bits are 1
buffer->putShort(0xFFFF);
// following IPv4 address in big-endian (network) byte order
uint32_t ipv4Addr = ntohl(address->ia.sin_addr.s_addr);
buffer->putByte((int8)((ipv4Addr>>24)&0xFF));
buffer->putByte((int8)((ipv4Addr>>16)&0xFF));
buffer->putByte((int8)((ipv4Addr>>8)&0xFF));
buffer->putByte((int8)(ipv4Addr&0xFF));
}
osiSockAddr* intToIPv4Address(int32 addr) {
osiSockAddr* ret = new osiSockAddr;
ret->ia.sin_family = AF_INET;
ret->ia.sin_addr.s_addr = htonl(addr);
ret->ia.sin_port = 0;
return ret;
}
int32 ipv4AddressToInt(const osiSockAddr& addr) {
return (int32)ntohl(addr.ia.sin_addr.s_addr);
}
int32 parseInetAddress(const String addr) {
int32 retAddr;
size_t dot = addr.find('.');
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
int byte = atoi(addr.substr(0, dot).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr = byte;
int num = dot+1;
dot = addr.find('.', num);
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
byte = atoi(addr.substr(num, dot-num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
num = dot+1;
dot = addr.find('.', num);
if(dot==String::npos) THROW_BASE_EXCEPTION("Not an IPv4 address.");
byte = atoi(addr.substr(num, dot-num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
num = dot+1;
byte = atoi(addr.substr(num).c_str());
if(byte<0||byte>255) THROW_BASE_EXCEPTION("Not an IPv4 address.");
retAddr <<= 8;
retAddr |= byte;
return htonl(retAddr);
}
InetAddrVector* getSocketAddressList(String list, int defaultPort,
const InetAddrVector* appendList) {
InetAddrVector* iav = new InetAddrVector();
// parse string
size_t subStart = 0;
size_t subEnd;
while((subEnd = list.find(' ', subStart))!=String::npos) {
String address = list.substr(subStart, (subEnd-subStart));
osiSockAddr addr;
aToIPAddr(address.c_str(), defaultPort, &addr.ia);
iav->push_back(addr);
subStart = list.find_first_not_of(" \t\r\n\v", subEnd);
}
if(subStart!=String::npos&&list.length()>0) {
osiSockAddr addr;
aToIPAddr(list.substr(subStart).c_str(), defaultPort, &addr.ia);
iav->push_back(addr);
}
if(appendList!=NULL) {
for(size_t i = 0; i<appendList->size(); i++)
iav->push_back(appendList->at(i));
}
return iav;
}
const String inetAddressToString(const osiSockAddr &addr,
bool displayPort, bool displayHex) {
stringstream saddr;
int ipa = ntohl(addr.ia.sin_addr.s_addr);
saddr<<((int)(ipa>>24)&0xFF)<<'.';
saddr<<((int)(ipa>>16)&0xFF)<<'.';
saddr<<((int)(ipa>>8)&0xFF)<<'.';
saddr<<((int)ipa&0xFF);
if(displayPort) saddr<<":"<<ntohs(addr.ia.sin_port);
if(displayHex) saddr<<" ("<<hex<<ntohl(addr.ia.sin_addr.s_addr)
<<")";
return saddr.str();
}
}
}

View File

@@ -1,122 +1,107 @@
/*
* inetAddressUtil.h
*
* Created on: Nov 12, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef INETADDRESSUTIL_H_
#define INETADDRESSUTIL_H_
// review this header, is it needed, use pure libCom calls?
/* uporabim lahko:
* EPICSv3 osiSock.h kjer je definiran osiSockDiscoverBroadcastAddresses
*
* Kako se ga uporablja je v
* epics/base/src/ca/iocinf.cpp funkcija configureChannelAccessAddressList
*
* razisci kako se to priredi za IPv6
*
*/
#include <pv/pvType.h>
#include <pv/byteBuffer.h>
#include <osiSock.h>
#include <vector>
namespace epics {
namespace pvAccess {
namespace pvAccess {
typedef std::vector<osiSockAddr> InetAddrVector;
typedef std::vector<osiSockAddr> InetAddrVector;
/**
* returns a vector containing all the IPv4 broadcast addresses
* on this machine. IPv6 doesn't have a local broadcast address.
* Conversion of the defaultPort to network byte order performed by
* the function.
*/
InetAddrVector* getBroadcastAddresses(SOCKET sock,
unsigned short defaultPort);
/**
* Returns a vector containing all the IPv4 broadcast addresses on this machine.
* IPv6 doesn't have a local broadcast address.
* Conversion of the defaultPort to network byte order performed by
* the function.
*/
InetAddrVector* getBroadcastAddresses(SOCKET sock, unsigned short defaultPort);
/**
* Encode IPv4 address as IPv6 address.
* @param buffer byte-buffer where to put encoded data.
* @param address address to encode.
*/
void
encodeAsIPv6Address(epics::pvData::ByteBuffer* buffer, const osiSockAddr* address);
/**
* Encode IPv4 address as IPv6 address.
* @param buffer byte-buffer where to put encoded data.
* @param address address to encode.
*/
void encodeAsIPv6Address(epics::pvData::ByteBuffer* buffer, const osiSockAddr* address);
/**
* Convert an integer into an IPv4 INET address.
* @param addr integer representation of a given address.
* @return IPv4 INET address.
*/
osiSockAddr* intToIPv4Address(epics::pvData::int32 addr);
/**
* Convert an integer into an IPv4 INET address.
* @param addr integer representation of a given address.
* @return IPv4 INET address.
*/
osiSockAddr* intToIPv4Address(epics::pvData::int32 addr);
/**
* Convert an IPv4 INET address to an integer.
* @param addr IPv4 INET address.
* @return integer representation of a given address.
*/
epics::pvData::int32 ipv4AddressToInt(const osiSockAddr& addr);
/**
* Convert an IPv4 INET address to an integer.
* @param addr IPv4 INET address.
* @return integer representation of a given address.
*/
epics::pvData::int32 ipv4AddressToInt(const osiSockAddr& addr);
/**
* Parse space delimited addresss[:port] string and return array of <code>InetSocketAddress</code>.
* @param list space delimited addresss[:port] string.
* @param defaultPort port take if not specified.
* @param appendList list to be appended.
* @return array of <code>InetSocketAddress</code>.
*/
InetAddrVector* getSocketAddressList(epics::pvData::String list, int defaultPort,
const InetAddrVector* appendList = NULL);
/**
* Parse space delimited addresss[:port] string and return array of <code>InetSocketAddress</code>.
* @param list space delimited addresss[:port] string.
* @param defaultPort port take if not specified.
* @param appendList list to be appended.
* @return array of <code>InetSocketAddress</code>.
*/
InetAddrVector* getSocketAddressList(epics::pvData::String list, int defaultPort,
const InetAddrVector* appendList = NULL);
const epics::pvData::String inetAddressToString(const osiSockAddr &addr,
bool displayPort = true, bool displayHex = false);
const epics::pvData::String inetAddressToString(const osiSockAddr &addr,
bool displayPort = true, bool displayHex = false);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* comparators for osiSockAddr
*/
struct comp_osiSockAddrPtr {
bool operator()(osiSockAddr const *a, osiSockAddr const *b) {
if(a->sa.sa_family<b->sa.sa_family) return true;
if((a->sa.sa_family==b->sa.sa_family)&&(a->ia.sin_addr.s_addr
<b->ia.sin_addr.s_addr)) return true;
if((a->sa.sa_family==b->sa.sa_family)&&(a->ia.sin_addr.s_addr
==b->ia.sin_addr.s_addr)&&(a->ia.sin_port
<b->ia.sin_port)) return true;
return false;
}
};
// comparators for osiSockAddr
struct comp_osiSock_lt {
bool operator()(const osiSockAddr& a, const osiSockAddr& b) {
if(a.sa.sa_family<b.sa.sa_family) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
<b.ia.sin_addr.s_addr)) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
==b.ia.sin_addr.s_addr)&&(a.ia.sin_port
<b.ia.sin_port)) return true;
return false;
}
};
struct comp_osiSockAddrPtr {
bool operator()(osiSockAddr const *a, osiSockAddr const *b) {
if(a->sa.sa_family<b->sa.sa_family) return true;
if((a->sa.sa_family==b->sa.sa_family)&&(a->ia.sin_addr.s_addr
<b->ia.sin_addr.s_addr)) return true;
if((a->sa.sa_family==b->sa.sa_family)&&(a->ia.sin_addr.s_addr
==b->ia.sin_addr.s_addr)&&(a->ia.sin_port
<b->ia.sin_port)) return true;
return false;
}
};
//TODO if unordered map is used instead of map we can use sockAddrAreIdentical routine from osiSock.h
struct comp_osiSockAddr {
bool operator()(osiSockAddr const a, osiSockAddr const b) {
if(a.sa.sa_family<b.sa.sa_family) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
<b.ia.sin_addr.s_addr)) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
==b.ia.sin_addr.s_addr)&&(a.ia.sin_port
<b.ia.sin_port)) return true;
return false;
}
};
struct comp_osiSock_lt {
bool operator()(const osiSockAddr& a, const osiSockAddr& b) {
if(a.sa.sa_family<b.sa.sa_family) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
<b.ia.sin_addr.s_addr)) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
==b.ia.sin_addr.s_addr)&&(a.ia.sin_port
<b.ia.sin_port)) return true;
return false;
}
};
}
//TODO if unordered map is used instead of map we can use sockAddrAreIdentical routine from osiSock.h
struct comp_osiSockAddr {
bool operator()(osiSockAddr const a, osiSockAddr const b) {
if(a.sa.sa_family<b.sa.sa_family) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
<b.ia.sin_addr.s_addr)) return true;
if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
==b.ia.sin_addr.s_addr)&&(a.ia.sin_port
<b.ia.sin_port)) return true;
return false;
}
};
}
}
#endif /* INETADDRESSUTIL_H_ */

View File

@@ -1,5 +1,7 @@
/*
* introspectionRegistry.cpp
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/introspectionRegistry.h>
@@ -9,7 +11,8 @@ using namespace epics::pvData;
using namespace std;
using std::tr1::static_pointer_cast;
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
const int8 IntrospectionRegistry::NULL_TYPE_CODE = (int8)-1;
const int8 IntrospectionRegistry::ONLY_ID_TYPE_CODE = (int8)-2;
@@ -176,7 +179,7 @@ void IntrospectionRegistry::serialize(FieldConstPtr field, StructureConstPtr par
{
case epics::pvData::scalar:
{
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(field);
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(field);
control->ensureBuffer(1);
buffer->putByte((int8)(epics::pvData::scalar << 4 | scalar->getScalarType()));
SerializeHelper::serializeString(field->getFieldName(), buffer, control);
@@ -184,7 +187,7 @@ void IntrospectionRegistry::serialize(FieldConstPtr field, StructureConstPtr par
}
case epics::pvData::scalarArray:
{
ScalarArrayConstPtr array = static_pointer_cast<const ScalarArray>(field);
ScalarArrayConstPtr array = static_pointer_cast<const ScalarArray>(field);
control->ensureBuffer(1);
buffer->putByte((int8)(epics::pvData::scalarArray << 4 | array->getElementType()));
SerializeHelper::serializeString(field->getFieldName(), buffer, control);
@@ -192,7 +195,7 @@ void IntrospectionRegistry::serialize(FieldConstPtr field, StructureConstPtr par
}
case epics::pvData::structure:
{
StructureConstPtr structure = static_pointer_cast<const Structure>(field);
StructureConstPtr structure = static_pointer_cast<const Structure>(field);
control->ensureBuffer(1);
buffer->putByte((int8)(epics::pvData::structure << 4));
serializeStructureField(buffer, control, registry, structure);
@@ -200,12 +203,12 @@ void IntrospectionRegistry::serialize(FieldConstPtr field, StructureConstPtr par
}
case epics::pvData::structureArray:
{
StructureArrayConstPtr structureArray = static_pointer_cast<const StructureArray>(field);
StructureArrayConstPtr structureArray = static_pointer_cast<const StructureArray>(field);
control->ensureBuffer(1);
buffer->putByte((int8)(epics::pvData::structureArray << 4));
SerializeHelper::serializeString(field->getFieldName(), buffer, control);
// we also need to serialize structure field...
StructureConstPtr structureElement = structureArray->getStructure();
StructureConstPtr structureElement = structureArray->getStructure();
serializeStructureField(buffer, control, registry, structureElement);
break;
}
@@ -281,7 +284,7 @@ FieldConstPtr IntrospectionRegistry::deserialize(ByteBuffer* buffer, Deserializa
default:
{
// TODO log
return FieldConstPtr();
return FieldConstPtr();
}
}
}

View File

@@ -1,5 +1,7 @@
/*
* introspectionRegistry.h
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef INTROSPECTIONREGISTRY_H
@@ -14,8 +16,6 @@
#include <pv/status.h>
#include <pv/standardField.h>
#include <epicsMutex.h>
#include <map>
#include <iostream>
@@ -30,7 +30,8 @@ using epics::pvData::PVStructurePtr;
using std::string;
using epics::pvData::int8;
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
typedef std::map<const short,FieldConstPtr> registryMap_t;

View File

@@ -1,8 +1,7 @@
/*
* logger.cpp
*
* Created on: Dec 10, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/logger.h>
@@ -33,7 +32,7 @@ namespace epics {
#define TIMETEXTLEN 32
static pvAccessLogLevel g_pvAccessLogLevel = logLevelDebug; //logLevelInfo;
static pvAccessLogLevel g_pvAccessLogLevel = logLevelInfo;
void pvAccessLog(pvAccessLogLevel level, const char* format, ...)
{

View File

@@ -1,8 +1,7 @@
/*
* logger.h
*
* Created on: Dec 10, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef LOGGER_H_
@@ -13,55 +12,55 @@
#include <errlog.h>
namespace epics {
namespace pvAccess {
namespace pvAccess {
typedef enum { logLevelAll = 0, logLevelTrace, logLevelDebug, logLevelInfo,
logLevelWarn, logLevelError, logLevelFatal, logLevelOff } pvAccessLogLevel;
/*
ALL
The ALL has the lowest possible rank and is intended to turn on all logging.
TRACE
The TRACE Level designates finer-grained informational events than the DEBUG
DEBUG
The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
INFO
The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
WARN
The WARN level designates potentially harmful situations.
ERROR
The ERROR level designates error events that might still allow the application to continue running.
FATAL
The FATAL level designates very severe error events that will presumably lead the application to abort.
OFF
The OFF has the highest possible rank and is intended to turn off logging.
typedef enum { logLevelAll = 0, logLevelTrace, logLevelDebug, logLevelInfo,
logLevelWarn, logLevelError, logLevelFatal, logLevelOff } pvAccessLogLevel;
/*
ALL
The ALL has the lowest possible rank and is intended to turn on all logging.
TRACE
The TRACE Level designates finer-grained informational events than the DEBUG
DEBUG
The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
INFO
The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
WARN
The WARN level designates potentially harmful situations.
ERROR
The ERROR level designates error events that might still allow the application to continue running.
FATAL
The FATAL level designates very severe error events that will presumably lead the application to abort.
OFF
The OFF has the highest possible rank and is intended to turn off logging.
*/
void pvAccessLog(pvAccessLogLevel level, const char* format, ...);
void pvAccessSetLogLevel(pvAccessLogLevel level);
#define LOG(level, format, ...) pvAccessLog(level, format, ##__VA_ARGS__)
#define SET_LOG_LEVEL(level) pvAccessSetLogLevel(level)
// EPICS errlog
//#define LOG errlogSevPrintf
//#define SET_LOG_LEVEL(level) errlogSetSevToLog(level)
// none
//#define LOG(level, fmt, ...)
//#define SET_LOG_LEVEL(level)
/**
* Create a logger that will write to file indicated by the <tt>fname</tt>.
* After creation you are free to use standard EPICSv3 functions from
* <tt>errlog.h</tt>.
*
* @param[in] fname The file to write to. If the file exists, it
* is opened for append.
*/
void createFileLogger( epics::pvData::String fname );
void pvAccessLog(pvAccessLogLevel level, const char* format, ...);
void pvAccessSetLogLevel(pvAccessLogLevel level);
#define LOG(level, format, ...) pvAccessLog(level, format, ##__VA_ARGS__)
#define SET_LOG_LEVEL(level) pvAccessSetLogLevel(level)
// EPICS errlog
//#define LOG errlogSevPrintf
//#define SET_LOG_LEVEL(level) errlogSetSevToLog(level)
// none
//#define LOG(level, fmt, ...)
//#define SET_LOG_LEVEL(level)
/**
* Create a logger that will write to file indicated by the <tt>fname</tt>.
* After creation you are free to use standard EPICSv3 functions from
* <tt>errlog.h</tt>.
*
* @param[in] fname The file to write to. If the file exists, it
* is opened for append.
*/
void createFileLogger( epics::pvData::String fname );
}
}
}
#endif /* LOGGER_H_ */

View File

@@ -1,5 +1,7 @@
/*
* namedLockPattern.h
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef NAMEDLOCKPATTERN_H

View File

@@ -1,10 +1,13 @@
/*
* namedLockPattern.cpp
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/referenceCountingLock.h>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
using namespace epics::pvData;
@@ -77,6 +80,7 @@ void ReferenceCountingLock::release()
}*/
}
// TODO use atomic primitive impl.
int ReferenceCountingLock::increment()
{
Lock guard(_countMutex);

View File

@@ -1,14 +1,17 @@
/*
* referenceCountingLock.h
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef REFERENCECOUNTINGLOCK_H
#define REFERENCECOUNTINGLOCK_H
#include <pv/lock.h>
#include <pv/pvType.h>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
/**
* Reference counting mutex implementation w/ deadlock detection.

View File

@@ -1,5 +1,7 @@
/*
* transportRegistry.cpp
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/transportRegistry.h>
@@ -7,7 +9,8 @@
using namespace epics::pvData;
using namespace std;
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
TransportRegistry::TransportRegistry(): _transports(), _transportCount(0), _mutex()
{

View File

@@ -1,7 +1,9 @@
/*
* transportRegistry.h
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef TRANSPORTREGISTRY_H
#define TRANSPORTREGISTRY_H
@@ -18,7 +20,8 @@
#include <pv/inetAddressUtil.h>
#include <pv/sharedPtr.h>
namespace epics { namespace pvAccess {
namespace epics {
namespace pvAccess {
class TransportRegistry {
public:

View File

@@ -1,10 +1,9 @@
/*
* wildcharMatcher.cpp
*
* Created on: Nov 4, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/wildcharMatcher.h>
#include <iostream>
@@ -13,7 +12,7 @@ using std::cout;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {
namespace pvAccess {
/** Wildchar matcher debug */
const bool WCM_DEBUG = false;
@@ -269,5 +268,5 @@ namespace epics {
return parse(pattern, 0, str, 0);
}
}
}
}

View File

@@ -1,8 +1,7 @@
/*
* wildcharMatcher.h
*
* Created on: Nov 4, 2010
* Author: Miha Vitorovic
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef WILDCHARMATCHER_H_
@@ -11,7 +10,7 @@
#include <pv/pvType.h>
namespace epics {
namespace pvAccess {
namespace pvAccess {
/**
* DFA for parsing set strings. DFA was obtained from JFlex using the rule
@@ -56,7 +55,7 @@ namespace epics {
*/
bool match(const epics::pvData::String pattern, const epics::pvData::String str);
}
}
}
#endif /* WILDCHARMATCHER_H_ */