CAProvider: only CAClientFactory is public
This commit is contained in:
@@ -5,7 +5,6 @@ LIBRARY += pvAccessCA
|
||||
pvAccessCA_LIBS += ca pvAccess pvData Com
|
||||
|
||||
INC += pv/caProvider.h
|
||||
INC += pv/caStatus.h
|
||||
|
||||
pvAccessCA_SRCS += caProvider.cpp
|
||||
pvAccessCA_SRCS += caChannel.cpp
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
#include <pv/logger.h>
|
||||
#include <pv/pvAccess.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/caChannel.h>
|
||||
#include <pv/caStatus.h>
|
||||
#include "caChannel.h"
|
||||
#include "caStatus.h"
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/* for CA */
|
||||
#include <cadef.h>
|
||||
|
||||
#include <pv/caProvider.h>
|
||||
#include "caProviderPvt.h"
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
@@ -14,13 +14,15 @@
|
||||
#include <pv/configuration.h>
|
||||
#include <pv/pvAccess.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/caProvider.h>
|
||||
#include <pv/caChannel.h>
|
||||
#include "caProviderPvt.h"
|
||||
#include "caChannel.h"
|
||||
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
namespace ca {
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvAccess::ca;
|
||||
|
||||
#define EXCEPTION_GUARD(code) try { code; } \
|
||||
catch (std::exception &e) { LOG(logLevelError, "Unhandled exception caught from client code at %s:%d: %s", __FILE__, __LINE__, e.what()); } \
|
||||
@@ -211,3 +213,8 @@ void registerClientProvider_ca()
|
||||
}
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
89
src/ca/caProviderPvt.h
Normal file
89
src/ca/caProviderPvt.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 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 CAPROVIDERPVT_H
|
||||
#define CAPROVIDERPVT_H
|
||||
|
||||
#include <cadef.h>
|
||||
|
||||
#include <pv/caProvider.h>
|
||||
#include <pv/pvAccess.h>
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
class Configuration;
|
||||
namespace ca {
|
||||
|
||||
class CAChannelProvider :
|
||||
public ChannelProvider,
|
||||
public std::tr1::enable_shared_from_this<CAChannelProvider>
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(CAChannelProvider);
|
||||
|
||||
CAChannelProvider();
|
||||
CAChannelProvider(const std::tr1::shared_ptr<Configuration>&);
|
||||
virtual ~CAChannelProvider();
|
||||
|
||||
/* --------------- epics::pvAccess::ChannelProvider --------------- */
|
||||
|
||||
virtual std::string getProviderName();
|
||||
|
||||
virtual ChannelFind::shared_pointer channelFind(
|
||||
std::string const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester);
|
||||
|
||||
virtual ChannelFind::shared_pointer channelList(
|
||||
ChannelListRequester::shared_pointer const & channelListRequester);
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
std::string const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority);
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
std::string const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority,
|
||||
std::string const & address);
|
||||
|
||||
virtual void configure(epics::pvData::PVStructure::shared_pointer configuration);
|
||||
virtual void flush();
|
||||
virtual void poll();
|
||||
|
||||
virtual void destroy();
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
void threadAttach();
|
||||
|
||||
void registerChannel(Channel::shared_pointer const & channel);
|
||||
void unregisterChannel(Channel::shared_pointer const & channel);
|
||||
void unregisterChannel(Channel* pchannel);
|
||||
|
||||
private:
|
||||
|
||||
void initialize();
|
||||
|
||||
ca_client_context* current_context;
|
||||
|
||||
epics::pvData::Mutex channelsMutex;
|
||||
// TODO std::unordered_map
|
||||
// void* is not the nicest thing, but there is no fast weak_ptr::operator==
|
||||
typedef std::map<void*, Channel::weak_pointer> ChannelList;
|
||||
ChannelList channels;
|
||||
|
||||
// synced on channelsMutex
|
||||
bool destroyed;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CAPROVIDERPVT_H */
|
||||
@@ -4,9 +4,7 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
|
||||
#include <pv/caStatus.h>
|
||||
#include "caStatus.h"
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
namespace ca {
|
||||
@@ -20,8 +18,8 @@ enum AlarmStatus {
|
||||
dbStatus,confStatus,undefinedStatus,clientStatus
|
||||
};
|
||||
|
||||
epicsShareExtern std::string dbrStatus2alarmMessage[];
|
||||
epicsShareExtern int dbrStatus2alarmStatus[];
|
||||
extern std::string dbrStatus2alarmMessage[];
|
||||
extern int dbrStatus2alarmStatus[];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,82 +7,14 @@
|
||||
#ifndef CAPROVIDER_H
|
||||
#define CAPROVIDER_H
|
||||
|
||||
#include <cadef.h>
|
||||
|
||||
#include <pv/pvAccess.h>
|
||||
#include <map>
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <pv/pvAccess.h>
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
class Configuration;
|
||||
namespace ca {
|
||||
|
||||
class epicsShareClass CAChannelProvider :
|
||||
public ChannelProvider,
|
||||
public std::tr1::enable_shared_from_this<CAChannelProvider>
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(CAChannelProvider);
|
||||
|
||||
CAChannelProvider();
|
||||
CAChannelProvider(const std::tr1::shared_ptr<Configuration>&);
|
||||
virtual ~CAChannelProvider();
|
||||
|
||||
/* --------------- epics::pvAccess::ChannelProvider --------------- */
|
||||
|
||||
virtual std::string getProviderName();
|
||||
|
||||
virtual ChannelFind::shared_pointer channelFind(
|
||||
std::string const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester);
|
||||
|
||||
virtual ChannelFind::shared_pointer channelList(
|
||||
ChannelListRequester::shared_pointer const & channelListRequester);
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
std::string const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority);
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
std::string const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority,
|
||||
std::string const & address);
|
||||
|
||||
virtual void configure(epics::pvData::PVStructure::shared_pointer configuration);
|
||||
virtual void flush();
|
||||
virtual void poll();
|
||||
|
||||
virtual void destroy();
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
void threadAttach();
|
||||
|
||||
void registerChannel(Channel::shared_pointer const & channel);
|
||||
void unregisterChannel(Channel::shared_pointer const & channel);
|
||||
void unregisterChannel(Channel* pchannel);
|
||||
|
||||
private:
|
||||
|
||||
void initialize();
|
||||
|
||||
ca_client_context* current_context;
|
||||
|
||||
epics::pvData::Mutex channelsMutex;
|
||||
// TODO std::unordered_map
|
||||
// void* is not the nicest thing, but there is no fast weak_ptr::operator==
|
||||
typedef std::map<void*, Channel::weak_pointer> ChannelList;
|
||||
ChannelList channels;
|
||||
|
||||
// synced on channelsMutex
|
||||
bool destroyed;
|
||||
};
|
||||
|
||||
|
||||
class epicsShareClass CAClientFactory
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user