clang-format : Added extension .inl

Applied clang-format on all files in ApplicationCode including new extension .inl. Also includes some missing clang-format on other files.
This commit is contained in:
Magne Sjaastad 2019-11-19 11:08:59 +01:00
parent ae9575feb2
commit 651c28dc49
8 changed files with 602 additions and 563 deletions

View File

@ -21,20 +21,20 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<class T>
template <class T>
RiaWeightedMeanCalculator<T>::RiaWeightedMeanCalculator()
: m_aggregatedValue(T{})
, m_aggregatedWeight(0.0)
: m_aggregatedValue( T{} )
, m_aggregatedWeight( 0.0 )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<class T>
void RiaWeightedMeanCalculator<T>::addValueAndWeight(T value, double weight)
template <class T>
void RiaWeightedMeanCalculator<T>::addValueAndWeight( T value, double weight )
{
CVF_ASSERT(weight >= 0.0);
CVF_ASSERT( weight >= 0.0 );
m_aggregatedValue = m_aggregatedValue + value * weight;
m_aggregatedWeight += weight;
@ -43,14 +43,14 @@ void RiaWeightedMeanCalculator<T>::addValueAndWeight(T value, double weight)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<class T>
template <class T>
T RiaWeightedMeanCalculator<T>::weightedMean() const
{
bool validWeights = validAggregatedWeight();
CVF_TIGHT_ASSERT(validWeights);
if (validWeights)
CVF_TIGHT_ASSERT( validWeights );
if ( validWeights )
{
return m_aggregatedValue * (1.0 / m_aggregatedWeight);
return m_aggregatedValue * ( 1.0 / m_aggregatedWeight );
}
return T{};
}
@ -58,17 +58,16 @@ T RiaWeightedMeanCalculator<T>::weightedMean() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<class T>
template <class T>
double RiaWeightedMeanCalculator<T>::aggregatedWeight() const
{
return m_aggregatedWeight;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<class T>
template <class T>
bool RiaWeightedMeanCalculator<T>::validAggregatedWeight() const
{
return m_aggregatedWeight > 1.0e-12;

View File

@ -49,7 +49,7 @@ void RiaPolyArcLineSampler::sampledPointsAndMDs( double sample
CVF_ASSERT( sampleInterval > 0.0 );
m_maxSamplingsInterval = sampleInterval;
m_isResamplingLines = isResamplingLines;
m_isResamplingLines = isResamplingLines;
double startMD = 0.0;
points->clear();
@ -160,7 +160,7 @@ void RiaPolyArcLineSampler::sampleArc( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Vec3d
double angleInc = m_maxSamplingsInterval / radius;
angleInc = angleInc < m_maxSamplingArcAngle ? angleInc: m_maxSamplingArcAngle; // Angle from 6 deg dogleg on 10 m
angleInc = angleInc < m_maxSamplingArcAngle ? angleInc : m_maxSamplingArcAngle; // Angle from 6 deg dogleg on 10 m
cvf::Vec3d C = CS_rad.center();
cvf::Vec3d N = CS_rad.normal();

View File

@ -42,10 +42,10 @@ private:
std::vector<cvf::Vec3d>* m_points; // Internal temporary pointers to collections beeing filled.
std::vector<double>* m_meshDs;
double m_maxSamplingsInterval;
const double m_maxSamplingArcAngle = 0.07310818;// Angle from 6 deg dogleg on 10 m
bool m_isResamplingLines;
double m_totalMD;
double m_maxSamplingsInterval;
const double m_maxSamplingArcAngle = 0.07310818; // Angle from 6 deg dogleg on 10 m
bool m_isResamplingLines;
double m_totalMD;
cvf::Vec3d m_startTangent;
std::vector<cvf::Vec3d> m_lineArcEndPoints;

View File

@ -70,7 +70,7 @@ RicRangeFilterNewExec* RicRangeFilterFeatureImpl::createRangeFilterExecCommand()
RimCellRangeFilterCollection* RicRangeFilterFeatureImpl::findRangeFilterCollection()
{
RimCellRangeFilterCollection* rangeFilterCollection = nullptr;
rangeFilterCollection = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimCellRangeFilterCollection>();
if ( !rangeFilterCollection )

View File

@ -81,16 +81,16 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
return; // We already have a target at sealevel.
}
cvf::Vec3d targetTangent = afterBeforePair.second->tangent();
double radius = afterBeforePair.second->radius1();
cvf::Vec3d targetTangent = afterBeforePair.second->tangent();
double radius = afterBeforePair.second->radius1();
cvf::Vec3d tangentInHorizontalPlane = targetTangent;
tangentInHorizontalPlane[2] = 0.0;
tangentInHorizontalPlane.normalize();
RiaOffshoreSphericalCoords sphTangent( targetTangent );
double inc = sphTangent.inc();
double horizontalLengthFromTarget = radius - radius * cvf::Math::cos( inc );
double inc = sphTangent.inc();
double horizontalLengthFromTarget = radius - radius * cvf::Math::cos( inc );
newPos = afterBeforePair.second->targetPointXYZ() - horizontalLengthFromTarget * tangentInHorizontalPlane;
newPos.z() = -wellGeomDef->referencePointXyz().z();

View File

@ -17,8 +17,8 @@
//////////////////////////////////////////////////////////////////////////////////
inline RiaGrpcCallbackInterface::RiaGrpcCallbackInterface()
: m_state(CREATE_HANDLER)
, m_status(Status::OK)
: m_state( CREATE_HANDLER )
, m_status( Status::OK )
{
}
@ -41,7 +41,7 @@ const Status& RiaGrpcCallbackInterface::status() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
inline void RiaGrpcCallbackInterface::setNextCallState(CallState state)
inline void RiaGrpcCallbackInterface::setNextCallState( CallState state )
{
m_state = state;
}
@ -49,30 +49,30 @@ inline void RiaGrpcCallbackInterface::setNextCallState(CallState state)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::RiaGrpcServiceCallback(ServiceT* service)
: m_service(service)
template <typename ServiceT, typename RequestT, typename ReplyT>
RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::RiaGrpcServiceCallback( ServiceT* service )
: m_service( service )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
QString RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::name() const
{
QString fullName = QString("%1:%2(%3, %4)")
.arg(typeid(ServiceT).name())
.arg(methodType())
.arg(typeid(RequestT).name())
.arg(typeid(ReplyT).name());
QString fullName = QString( "%1:%2(%3, %4)" )
.arg( typeid( ServiceT ).name() )
.arg( methodType() )
.arg( typeid( RequestT ).name() )
.arg( typeid( ReplyT ).name() );
return fullName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
const RequestT& RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::request() const
{
return m_request;
@ -81,7 +81,7 @@ const RequestT& RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::request() co
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
ReplyT& RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::reply()
{
return m_reply;
@ -90,57 +90,59 @@ ReplyT& RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::reply()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::RiaGrpcUnaryCallback(ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest)
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>(service)
, m_responder(&m_context)
, m_methodImpl(methodImpl)
, m_methodRequest(methodRequest)
template <typename ServiceT, typename RequestT, typename ReplyT>
RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::RiaGrpcUnaryCallback( ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest )
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>( service )
, m_responder( &m_context )
, m_methodImpl( methodImpl )
, m_methodRequest( methodRequest )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
RiaGrpcCallbackInterface* RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::createNewFromThis() const
{
return new RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>(this->m_service, this->m_methodImpl, this->m_methodRequest);
return new RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>( this->m_service,
this->m_methodImpl,
this->m_methodRequest );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
void RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::createRequestHandler(ServerCompletionQueue* completionQueue)
template <typename ServiceT, typename RequestT, typename ReplyT>
void RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::createRequestHandler( ServerCompletionQueue* completionQueue )
{
// The Request-method is where the service gets registered to respond to a given request.
m_methodRequest(*this->m_service, &m_context, &this->m_request, &m_responder, completionQueue, completionQueue, this);
m_methodRequest( *this->m_service, &m_context, &this->m_request, &m_responder, completionQueue, completionQueue, this );
// Simple unary requests don't need initialisation, so proceed to process as soon as a request turns up.
this->setNextCallState(RiaGrpcCallbackInterface::PROCESS_REQUEST);
this->setNextCallState( RiaGrpcCallbackInterface::PROCESS_REQUEST );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
void RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::onProcessRequest()
{
// Call request handler method
this->m_status = m_methodImpl(*this->m_service, &m_context, &this->m_request, &this->m_reply);
this->m_status = m_methodImpl( *this->m_service, &m_context, &this->m_request, &this->m_reply );
// Simply unary requests are finished as soon as you've done any processing.
// So next time we receive a new tag on the command queue we should proceed to finish.
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
// Finish will push this callback back on the command queue (now with Finish as the call state).
m_responder.Finish(this->m_reply, this->m_status, this);
m_responder.Finish( this->m_reply, this->m_status, this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT>
template <typename ServiceT, typename RequestT, typename ReplyT>
QString RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::methodType() const
{
return "RegularMethod";
@ -149,215 +151,222 @@ QString RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::methodType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcServerToClientStreamCallback(ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest,
StateHandlerT* stateHandler)
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>(service)
, m_responder(&m_context)
, m_methodImpl(methodImpl)
, m_methodRequest(methodRequest)
, m_stateHandler(stateHandler)
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcServerToClientStreamCallback(
ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest,
StateHandlerT* stateHandler )
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>( service )
, m_responder( &m_context )
, m_methodImpl( methodImpl )
, m_methodRequest( methodRequest )
, m_stateHandler( stateHandler )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcCallbackInterface* RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcCallbackInterface*
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
{
return new RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>(
this->m_service, m_methodImpl, m_methodRequest, new StateHandlerT);
return new RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>( this->m_service,
m_methodImpl,
m_methodRequest,
new StateHandlerT );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createRequestHandler(
ServerCompletionQueue* completionQueue)
ServerCompletionQueue* completionQueue )
{
// The Request-method is where the service gets registered to respond to a given request.
m_methodRequest(*this->m_service, &m_context, &this->m_request, &m_responder, completionQueue, completionQueue, this);
m_methodRequest( *this->m_service, &m_context, &this->m_request, &m_responder, completionQueue, completionQueue, this );
// Server->Client Streaming requests require initialisation. However, we receive the complete request immediately.
// So can proceed directly to completion of the init request.
this->setNextCallState(RiaGrpcCallbackInterface::INIT_REQUEST_COMPLETED);
this->setNextCallState( RiaGrpcCallbackInterface::INIT_REQUEST_COMPLETED );
}
//--------------------------------------------------------------------------------------------------
/// Perform initialisation tasks at the time of receiving a complete request
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onInitRequestCompleted()
{
// Initialise streaming state handler
this->m_status = m_stateHandler->init(&this->m_request);
this->m_status = m_stateHandler->init( &this->m_request );
if (!this->m_status.ok())
if ( !this->m_status.ok() )
{
// We have an error. Proceed to finish and report the status
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
m_responder.Finish(this->m_status, this);
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
m_responder.Finish( this->m_status, this );
return;
}
// Move on to processing and perform the first processing immediately since the client will
// not request anything more.
this->setNextCallState(RiaGrpcCallbackInterface::PROCESS_REQUEST);
this->setNextCallState( RiaGrpcCallbackInterface::PROCESS_REQUEST );
this->onProcessRequest();
}
//--------------------------------------------------------------------------------------------------
/// Process a streaming request and send one package
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onProcessRequest()
{
this->m_reply = ReplyT(); // Make sure it is reset
// Call request handler method
this->m_status = m_methodImpl(*this->m_service, &m_context, &this->m_request, &this->m_reply, m_stateHandler.get());
if (this->m_status.ok())
// Call request handler method
this->m_status = m_methodImpl( *this->m_service, &m_context, &this->m_request, &this->m_reply, m_stateHandler.get() );
if ( this->m_status.ok() )
{
// The write call will send data to client AND put this callback back on the command queue
// so that this method gets called again to send the next stream package.
m_responder.Write(this->m_reply, this);
m_responder.Write( this->m_reply, this );
}
else
{
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
// Out of range means we're finished but it isn't an error
if (this->m_status.error_code() == grpc::OUT_OF_RANGE)
if ( this->m_status.error_code() == grpc::OUT_OF_RANGE )
{
this->m_status = Status::OK;
}
// Finish will put this callback back on the command queue, now with a finish state.
m_responder.Finish(this->m_status, this);
m_responder.Finish( this->m_status, this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
QString RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::methodType() const
{
return "StreamingMethod";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcClientToServerStreamCallback(ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest,
StateHandlerT* stateHandler)
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>(service)
, m_reader(&m_context)
, m_methodImpl(methodImpl)
, m_methodRequest(methodRequest)
, m_stateHandler(stateHandler)
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcClientToServerStreamCallback(
ServiceT* service,
MethodImplT methodImpl,
MethodRequestT methodRequest,
StateHandlerT* stateHandler )
: RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>( service )
, m_reader( &m_context )
, m_methodImpl( methodImpl )
, m_methodRequest( methodRequest )
, m_stateHandler( stateHandler )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcCallbackInterface* RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
RiaGrpcCallbackInterface*
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
{
return new RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>(
this->m_service, m_methodImpl, m_methodRequest, new StateHandlerT(true));
return new RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>( this->m_service,
m_methodImpl,
m_methodRequest,
new StateHandlerT( true ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createRequestHandler(
ServerCompletionQueue* completionQueue)
ServerCompletionQueue* completionQueue )
{
// The Request-method is where the service gets registered to respond to a given request.
m_methodRequest(*this->m_service, &m_context, &this->m_reader, completionQueue, completionQueue, this);
m_methodRequest( *this->m_service, &m_context, &this->m_reader, completionQueue, completionQueue, this );
// The client->server streaming requires initialisation and each request package is streamed asynchronously
// So we need to start and complete the init request.
this->setNextCallState(RiaGrpcCallbackInterface::INIT_REQUEST_STARTED);
this->setNextCallState( RiaGrpcCallbackInterface::INIT_REQUEST_STARTED );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onInitRequestStarted()
{
this->setNextCallState(RiaGrpcCallbackInterface::INIT_REQUEST_COMPLETED);
this->setNextCallState( RiaGrpcCallbackInterface::INIT_REQUEST_COMPLETED );
// The read call will start reading the request data and push this callback back onto the command queue
// when the read call is completed.
m_reader.Read(&this->m_request, this);
m_reader.Read( &this->m_request, this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onInitRequestCompleted()
{
this->setNextCallState(RiaGrpcCallbackInterface::PROCESS_REQUEST);
this->setNextCallState( RiaGrpcCallbackInterface::PROCESS_REQUEST );
// Fully received the stream package so can now init
this->m_status = m_stateHandler->init(&this->m_request);
this->m_status = m_stateHandler->init( &this->m_request );
if (!this->m_status.ok())
if ( !this->m_status.ok() )
{
// We have an error. Proceed to finish and report the status
m_reader.FinishWithError(this->m_status, this);
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
m_reader.FinishWithError( this->m_status, this );
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
return;
}
// Start reading and push this back onto the command queue.
m_reader.Read(&this->m_request, this);
m_reader.Read( &this->m_request, this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onProcessRequest()
{
this->m_reply = ReplyT(); // Make sure it is reset
// Call request handler method
this->m_status = m_methodImpl(*this->m_service, &m_context, &this->m_request, &this->m_reply, m_stateHandler.get());
if (!this->m_status.ok())
// Call request handler method
this->m_status = m_methodImpl( *this->m_service, &m_context, &this->m_request, &this->m_reply, m_stateHandler.get() );
if ( !this->m_status.ok() )
{
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
m_reader.FinishWithError(this->m_status, this);
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
m_reader.FinishWithError( this->m_status, this );
}
else
{
CAF_ASSERT(m_stateHandler->streamedValueCount() <= m_stateHandler->cellCount());
if (m_stateHandler->streamedValueCount() == m_stateHandler->cellCount())
CAF_ASSERT( m_stateHandler->streamedValueCount() <= m_stateHandler->cellCount() );
if ( m_stateHandler->streamedValueCount() == m_stateHandler->cellCount() )
{
this->setNextCallState(RiaGrpcCallbackInterface::FINISH_REQUEST);
m_reader.Finish(this->m_reply, grpc::Status::OK, this);
this->setNextCallState( RiaGrpcCallbackInterface::FINISH_REQUEST );
m_reader.Finish( this->m_reply, grpc::Status::OK, this );
}
else
{
m_reader.Read(&this->m_request, this);
m_reader.Read( &this->m_request, this );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::onFinishRequest()
{
m_stateHandler->finish();
@ -366,7 +375,7 @@ void RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandle
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
QString RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::methodType() const
{
return "ClientStreamingMethod";

File diff suppressed because it is too large Load Diff

View File

@ -15,11 +15,10 @@ TEST( RiaPolyArcLineSampler, Basic )
sampler.sampledPointsAndMDs( 2, true, &sampledPoints, &mds );
#if 1
for (size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx)
for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx )
{
std::cout << sampledPoints[pIdx].x() << " "
<< sampledPoints[pIdx].y() << " "
<< sampledPoints[pIdx].z() << " md: " << mds[pIdx] << std::endl;
std::cout << sampledPoints[pIdx].x() << " " << sampledPoints[pIdx].y() << " " << sampledPoints[pIdx].z()
<< " md: " << mds[pIdx] << std::endl;
}
#endif
EXPECT_EQ( 55, (int)sampledPoints.size() );