general indent beautification

This commit is contained in:
Matej Sekoranja
2016-03-10 23:36:16 +01:00
parent d139c42d17
commit 5279d247ca
110 changed files with 21778 additions and 21525 deletions

View File

@@ -31,121 +31,121 @@ namespace epics
namespace pvAccess
{
/**
* RPCClient is an interface class that is used by a service client.
*
*/
class epicsShareClass RPCClient
{
public:
POINTER_DEFINITIONS(RPCClient);
/**
* RPCClient is an interface class that is used by a service client.
* Create a RPCClient.
*
* @param serviceName the service name
* @return the RPCClient interface
*/
class epicsShareClass RPCClient
{
public:
POINTER_DEFINITIONS(RPCClient);
static shared_pointer create(const std::string & serviceName);
/**
* Create a RPCClient.
*
* @param serviceName the service name
* @return the RPCClient interface
*/
static shared_pointer create(const std::string & serviceName);
/**
* Create a RPCClient.
*
* @param serviceName the service name
* @param pvRequest the pvRequest for the ChannelRPC
* @return the RPCClient interface
*/
static shared_pointer create(const std::string & serviceName,
epics::pvData::PVStructure::shared_pointer const & pvRequest);
/**
* Create a RPCClient.
*
* @param serviceName the service name
* @param pvRequest the pvRequest for the ChannelRPC
* @return the RPCClient interface
*/
static shared_pointer create(const std::string & serviceName,
epics::pvData::PVStructure::shared_pointer const & pvRequest);
/**
* Performs complete blocking RPC call, opening a channel and connecting to the
* service and sending the request.
*
* @param serviceName the name of the service to connect to
* @param request the request sent to the service
* @param timeout the timeout (in seconds), 0 means forever.
* @return the result of the RPC call.
* @throws RPCRequestException exception thrown on error on timeout.
*/
static epics::pvData::PVStructure::shared_pointer sendRequest(const std::string & serviceName,
/**
* Performs complete blocking RPC call, opening a channel and connecting to the
* service and sending the request.
*
* @param serviceName the name of the service to connect to
* @param request the request sent to the service
* @param timeout the timeout (in seconds), 0 means forever.
* @return the result of the RPC call.
* @throws RPCRequestException exception thrown on error on timeout.
*/
static epics::pvData::PVStructure::shared_pointer sendRequest(const std::string & serviceName,
epics::pvData::PVStructure::shared_pointer const &request, double timeOut = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Destroy this instance (i.e. release resources).
*/
void destroy();
/**
* Destroy this instance (i.e. release resources).
*/
void destroy();
/**
* Connect to the server.
* The method blocks until the connection is made or a timeout occurs.
* It is the same as calling issueConnect and then waitConnect.
* @param timeout Timeout in seconds to wait, 0 means forever.
* @returns (false,true) If (not connected, is connected).
* If false then connect must be reissued.
*/
bool connect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Connect to the server.
* The method blocks until the connection is made or a timeout occurs.
* It is the same as calling issueConnect and then waitConnect.
* @param timeout Timeout in seconds to wait, 0 means forever.
* @returns (false,true) If (not connected, is connected).
* If false then connect must be reissued.
*/
bool connect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Issue a connect request and return immediately.
* waitConnect must be called to complete the request.
*/
void issueConnect();
/**
* Issue a connect request and return immediately.
* waitConnect must be called to complete the request.
*/
void issueConnect();
/**
* Wait for the connect request to complete.
* @param timeout timeout in seconds to wait, 0 means forever.
* @returns (false,true) If (not connected, is connected).
* If false then connect must be reissued.
*/
bool waitConnect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Wait for the connect request to complete.
* @param timeout timeout in seconds to wait, 0 means forever.
* @returns (false,true) If (not connected, is connected).
* If false then connect must be reissued.
*/
bool waitConnect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Sends a request and wait for the response or until timeout occurs.
* This method will also wait for client to connect, if necessary.
*
* @param pvArgument the argument for the rpc
* @param timeout the time in seconds to wait for the response, 0 means forever.
* @param lastRequest If true an automatic destroy is made.
* @return request response.
* @throws RPCRequestException exception thrown on error or timeout.
*/
epics::pvData::PVStructure::shared_pointer request(
epics::pvData::PVStructure::shared_pointer const & pvArgument,
double timeout = RPCCLIENT_DEFAULT_TIMEOUT,
bool lastRequest = false);
/**
* Sends a request and wait for the response or until timeout occurs.
* This method will also wait for client to connect, if necessary.
*
* @param pvArgument the argument for the rpc
* @param timeout the time in seconds to wait for the response, 0 means forever.
* @param lastRequest If true an automatic destroy is made.
* @return request response.
* @throws RPCRequestException exception thrown on error or timeout.
*/
epics::pvData::PVStructure::shared_pointer request(
epics::pvData::PVStructure::shared_pointer const & pvArgument,
double timeout = RPCCLIENT_DEFAULT_TIMEOUT,
bool lastRequest = false);
/**
* Issue a channelRPC request and return immediately.
* waitRequest must be called to complete the request.
* @param pvAgument The argument to pass to the server.
* @param lastRequest If true an automatic destroy is made.
* @throws std::runtime_error excption thrown on any runtime error condition (e.g. no connection made).
*/
void issueRequest(
epics::pvData::PVStructure::shared_pointer const & pvArgument,
bool lastRequest = false);
/**
* Issue a channelRPC request and return immediately.
* waitRequest must be called to complete the request.
* @param pvAgument The argument to pass to the server.
* @param lastRequest If true an automatic destroy is made.
* @throws std::runtime_error excption thrown on any runtime error condition (e.g. no connection made).
*/
void issueRequest(
epics::pvData::PVStructure::shared_pointer const & pvArgument,
bool lastRequest = false);
/**
* Wait for the request to complete.
* @param timeout the time in seconds to wait for the reponse.
* @return request response.
* @throws RPCRequestException exception thrown on error or timeout.
*/
epics::pvData::PVStructure::shared_pointer waitResponse(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
/**
* Wait for the request to complete.
* @param timeout the time in seconds to wait for the reponse.
* @return request response.
* @throws RPCRequestException exception thrown on error or timeout.
*/
epics::pvData::PVStructure::shared_pointer waitResponse(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
virtual ~RPCClient() {}
virtual ~RPCClient() {}
protected:
RPCClient(const std::string & serviceName,
epics::pvData::PVStructure::shared_pointer const & pvRequest);
protected:
RPCClient(const std::string & serviceName,
epics::pvData::PVStructure::shared_pointer const & pvRequest);
std::string m_serviceName;
Channel::shared_pointer m_channel;
epics::pvData::PVStructure::shared_pointer m_pvRequest;
};
std::string m_serviceName;
Channel::shared_pointer m_channel;
epics::pvData::PVStructure::shared_pointer m_pvRequest;
};
}

View File

@@ -32,11 +32,11 @@ namespace pvAccess
class ChannelAndRPCRequesterImpl :
public enable_shared_from_this<ChannelAndRPCRequesterImpl>,
public virtual epics::pvAccess::ChannelRequester,
public virtual epics::pvAccess::ChannelRPCRequester
public enable_shared_from_this<ChannelAndRPCRequesterImpl>,
public virtual epics::pvAccess::ChannelRequester,
public virtual epics::pvAccess::ChannelRPCRequester
{
private:
private:
Mutex m_mutex;
Event m_event;
Event m_connectionEvent;
@@ -46,13 +46,13 @@ class ChannelAndRPCRequesterImpl :
ChannelRPC::shared_pointer m_channelRPC;
PVStructure::shared_pointer m_pvRequest;
public:
public:
ChannelAndRPCRequesterImpl(PVStructure::shared_pointer const & pvRequest)
: m_pvRequest(pvRequest)
: m_pvRequest(pvRequest)
{
}
virtual string getRequesterName()
{
return "ChannelAndRPCRequesterImpl";
@@ -64,8 +64,8 @@ class ChannelAndRPCRequesterImpl :
}
void channelCreated(
const epics::pvData::Status& status,
Channel::shared_pointer const & channel)
const epics::pvData::Status& status,
Channel::shared_pointer const & channel)
{
if (status.isSuccess())
{
@@ -88,8 +88,8 @@ class ChannelAndRPCRequesterImpl :
}
void channelStateChange(
Channel::shared_pointer const & channel,
Channel::ConnectionState connectionState)
Channel::shared_pointer const & channel,
Channel::ConnectionState connectionState)
{
if (connectionState == Channel::CONNECTED)
{
@@ -113,8 +113,8 @@ class ChannelAndRPCRequesterImpl :
}
virtual void channelRPCConnect(
const epics::pvData::Status & status,
ChannelRPC::shared_pointer const & channelRPC)
const epics::pvData::Status & status,
ChannelRPC::shared_pointer const & channelRPC)
{
if (status.isSuccess())
{
@@ -136,9 +136,9 @@ class ChannelAndRPCRequesterImpl :
}
virtual void requestDone(
const epics::pvData::Status & status,
ChannelRPC::shared_pointer const & channelRPC,
epics::pvData::PVStructure::shared_pointer const & pvResponse)
const epics::pvData::Status & status,
ChannelRPC::shared_pointer const & channelRPC,
epics::pvData::PVStructure::shared_pointer const & pvResponse)
{
if (status.isSuccess())
{
@@ -149,7 +149,7 @@ class ChannelAndRPCRequesterImpl :
{
std::cerr << "[" << channelRPC->getChannel()->getChannelName() << "] failed to RPC: " << status << std::endl;
}
{
Lock lock(m_mutex);
m_status = status;
@@ -158,7 +158,7 @@ class ChannelAndRPCRequesterImpl :
m_event.signal();
}
bool waitForResponse(double timeOut)
{
return m_event.wait(timeOut);
@@ -220,7 +220,7 @@ class ChannelAndRPCRequesterImpl :
RPCClient::RPCClient(const std::string & serviceName,
PVStructure::shared_pointer const & pvRequest)
PVStructure::shared_pointer const & pvRequest)
: m_serviceName(serviceName), m_pvRequest(pvRequest)
{
}
@@ -237,7 +237,7 @@ void RPCClient::destroy()
bool RPCClient::connect(double timeout)
{
if (m_channel &&
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester())->isRPCConnected())
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester())->isRPCConnected())
return true;
issueConnect();
@@ -259,7 +259,7 @@ bool RPCClient::waitConnect(double timeout)
throw std::runtime_error("issueConnect() must be called before waitConnect()");
shared_ptr<ChannelAndRPCRequesterImpl> channelRequesterImpl =
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
return channelRequesterImpl->waitUntilRPCConnected(timeout) &&
channelRequesterImpl->isRPCConnected();
@@ -289,7 +289,7 @@ void RPCClient::issueRequest(
throw std::runtime_error("channel not connected");
shared_ptr<ChannelAndRPCRequesterImpl> channelRequesterImpl =
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
channelRequesterImpl->request(pvArgument, lastRequest);
}
@@ -297,7 +297,7 @@ void RPCClient::issueRequest(
PVStructure::shared_pointer RPCClient::waitResponse(double timeout)
{
shared_ptr<ChannelAndRPCRequesterImpl> channelRequesterImpl =
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
dynamic_pointer_cast<ChannelAndRPCRequesterImpl>(m_channel->getChannelRequester());
if (channelRequesterImpl->waitForResponse(timeout))
{
@@ -325,15 +325,15 @@ RPCClient::shared_pointer RPCClient::create(const std::string & serviceName)
}
RPCClient::shared_pointer RPCClient::create(const std::string & serviceName,
PVStructure::shared_pointer const & pvRequest)
PVStructure::shared_pointer const & pvRequest)
{
ClientFactory::start();
ClientFactory::start();
return RPCClient::shared_pointer(new RPCClient(serviceName, pvRequest));
}
PVStructure::shared_pointer RPCClient::sendRequest(const std::string & serviceName,
PVStructure::shared_pointer const & queryRequest,
double timeOut)
PVStructure::shared_pointer const & queryRequest,
double timeOut)
{
RPCClient::shared_pointer client = RPCClient::create(serviceName);
return client->request(queryRequest, timeOut);