update requester.h

move to pvAccess namespace.
This commit is contained in:
Michael Davidsaver
2017-07-12 14:26:28 +02:00
parent 042b3e7b0f
commit 0222463123
4 changed files with 24 additions and 51 deletions

View File

@@ -18,13 +18,13 @@
#include <pv/pvData.h>
#include <pv/sharedPtr.h>
#include <pv/bitSet.h>
#include <pv/requester.h>
#ifdef monitorEpicsExportSharedSymbols
# define epicsExportSharedSymbols
# undef monitorEpicsExportSharedSymbols
#endif
#include <pv/requester.h>
#include <pv/destroyable.h>
#include <shareLib.h>

View File

@@ -7,17 +7,7 @@
#ifndef BASECHANNELREQUESTER_H_
#define BASECHANNELREQUESTER_H_
#ifdef epicsExportSharedSymbols
# define baseChannelRequesterEpicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
#include <pv/requester.h>
#ifdef baseChannelRequesterEpicsExportSharedSymbols
# define epicsExportSharedSymbols
# undef baseChannelRequesterEpicsExportSharedSymbols
#endif
#include <pv/destroyable.h>
#include <pv/serverContextImpl.h>
#include <pv/serverChannelImpl.h>

View File

@@ -15,7 +15,7 @@
#include <shareLib.h>
namespace epics { namespace pvData {
namespace epics { namespace pvAccess {
class Requester;
typedef std::tr1::shared_ptr<Requester> RequesterPtr;
@@ -27,45 +27,31 @@ enum MessageType {
epicsShareExtern std::string getMessageTypeName(MessageType messageType);
/**
* @brief Callback class for passing messages to a requester.
*
* This is used by many other classes and also extended by other classes.
* The request is passed a message and a messageType.
* A message is just a string and a messageType is:
@code
enum MessageType {
infoMessage,warningMessage,errorMessage,fatalErrorMessage
};
@endcode
*
/** @brief Callback class for passing messages to a requester.
*/
class epicsShareClass Requester {
public:
POINTER_DEFINITIONS(Requester);
/**
* Destructor
*/
virtual ~Requester(){}
/**
* The requester must have a name.
* @return The requester's name.
*/
virtual std::string getRequesterName() = 0;
/**
*
* A message for the requester.
* @param message The message.
* @param messageType The type of message:
@code
enum MessageType {
infoMessage,warningMessage,errorMessage,fatalErrorMessage
};
@endcode
/** Push notification
*/
virtual void message(std::string const & message,MessageType messageType);
virtual void message(std::string const & message,MessageType messageType = errorMessage);
};
}}
namespace epics { namespace pvData {
using ::epics::pvAccess::Requester;
using ::epics::pvAccess::RequesterPtr;
using ::epics::pvAccess::MessageType;
using ::epics::pvAccess::getMessageTypeName;
using ::epics::pvAccess::infoMessage;
using ::epics::pvAccess::warningMessage;
using ::epics::pvAccess::errorMessage;
using ::epics::pvAccess::fatalErrorMessage;
}}
#endif /* REQUESTER_H */

View File

@@ -12,28 +12,25 @@
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#define epicsExportSharedSymbols
#include <pv/requester.h>
using std::string;
namespace epics { namespace pvData {
namespace epics { namespace pvAccess {
static StringArray messageTypeName(MESSAGE_TYPE_COUNT);
string getMessageTypeName(MessageType messageType)
{
// TODO not thread-safe
static Mutex mutex;
Lock xx(mutex);
if(messageTypeName[0].size()==0) {
messageTypeName[0] = "info";
messageTypeName[1] = "warning";
messageTypeName[2] = "error";
messageTypeName[3] = "fatalError";
switch(messageType) {
case infoMessage: return "info";
case warningMessage: return "warning";
case errorMessage: return "error";
case fatalErrorMessage: return "fatalError";
default: return "unknown";
}
return messageTypeName[messageType];
}
void Requester::message(std::string const & message,MessageType messageType)