changed loacal host name cache object to an epics singleton

This commit is contained in:
Jeff Hill
2002-07-08 16:35:24 +00:00
parent f6f73b8e7d
commit 3aa95fdd91
4 changed files with 16 additions and 5 deletions

View File

@@ -62,14 +62,14 @@ bool cacChannel::connected () const
void cacChannel::hostName ( char *pBuf, unsigned bufLength ) const
{
if ( bufLength ) {
localHostNameAtLoadTime.copy ( pBuf, bufLength );
pLocalHostNameAtLoadTime->copy ( pBuf, bufLength );
}
}
// deprecated - please do not use
const char * cacChannel::pHostName () const
{
return localHostNameAtLoadTime.pointer ();
return pLocalHostNameAtLoadTime->pointer ();
}

View File

@@ -16,7 +16,7 @@
#include "localHostName.h"
localHostName localHostNameAtLoadTime;
epicsSingleton < localHostName > pLocalHostNameAtLoadTime;
localHostName::localHostName ()
{

View File

@@ -15,6 +15,17 @@
#include <string.h>
#ifdef epicsExportSharedSymbols
# define localHostNameh_restore_epicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
#include "epicsSingleton.h"
#ifdef localHostNameh_restore_epicsExportSharedSymbols
# define epicsExportSharedSymbols
#endif
class localHostName {
public:
localHostName ();
@@ -28,7 +39,7 @@ private:
char cache [128];
};
extern localHostName localHostNameAtLoadTime;
extern epicsSingleton < localHostName > pLocalHostNameAtLoadTime;
inline unsigned localHostName::stringLength () const
{

View File

@@ -827,7 +827,7 @@ void tcpiiu::hostNameSetRequest ( epicsGuard < cacMutex > & )
return;
}
const char *pName = localHostNameAtLoadTime.pointer ();
const char * pName = pLocalHostNameAtLoadTime->pointer ();
unsigned size = strlen ( pName ) + 1u;
unsigned postSize = CA_MESSAGE_ALIGN ( size );
assert ( postSize < 0xffff );