mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Command line arguments : Add null pointer guards
This commit is contained in:
parent
70a96c21de
commit
9468c673fe
79
GrpcInterface/.clang-format
Normal file
79
GrpcInterface/.clang-format
Normal file
@ -0,0 +1,79 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '$'
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: true
|
||||
JavaScriptQuotes: Leave
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: Inner
|
||||
PenaltyBreakAssignment: 13
|
||||
PenaltyBreakBeforeFirstCallParameter: 10000
|
||||
PenaltyBreakComment: 20
|
||||
PenaltyBreakFirstLessLess: 12
|
||||
PenaltyBreakString: 100
|
||||
PenaltyExcessCharacter: 5
|
||||
PenaltyReturnTypeOnItsOwnLine: 30
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
@ -15,8 +15,8 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiaGrpcApplicationInterface.h"
|
||||
|
||||
#include "RiaGrpcApplicationInterface.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
@ -54,10 +54,9 @@ bool RiaGrpcApplicationInterface::initializeGrpcServer( const cvf::ProgramOption
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcApplicationInterface::launchGrpcServer()
|
||||
{
|
||||
m_grpcServer->runInThread();
|
||||
if ( m_grpcServer ) m_grpcServer->runInThread();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -73,23 +72,26 @@ QProcessEnvironment RiaGrpcApplicationInterface::grpcProcessEnvironment() const
|
||||
{
|
||||
QProcessEnvironment penv = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
penv.insert( "RESINSIGHT_GRPC_PORT", QString( "%1" ).arg( m_grpcServer->portNumber() ) );
|
||||
penv.insert( "RESINSIGHT_EXECUTABLE", QCoreApplication::applicationFilePath() );
|
||||
if ( m_grpcServer )
|
||||
{
|
||||
penv.insert( "RESINSIGHT_GRPC_PORT", QString( "%1" ).arg( m_grpcServer->portNumber() ) );
|
||||
penv.insert( "RESINSIGHT_EXECUTABLE", QCoreApplication::applicationFilePath() );
|
||||
|
||||
QStringList ripsLocations;
|
||||
QString separator;
|
||||
QStringList ripsLocations;
|
||||
QString separator;
|
||||
#ifdef WIN32
|
||||
ripsLocations << QCoreApplication::applicationDirPath() + "\\Python"
|
||||
<< QCoreApplication::applicationDirPath() + "\\..\\..\\Python";
|
||||
separator = ";";
|
||||
ripsLocations << QCoreApplication::applicationDirPath() + "\\Python"
|
||||
<< QCoreApplication::applicationDirPath() + "\\..\\..\\Python";
|
||||
separator = ";";
|
||||
|
||||
#else
|
||||
ripsLocations << QCoreApplication::applicationDirPath() + "/Python"
|
||||
<< QCoreApplication::applicationDirPath() + "/../../Python";
|
||||
separator = ":";
|
||||
ripsLocations << QCoreApplication::applicationDirPath() + "/Python"
|
||||
<< QCoreApplication::applicationDirPath() + "/../../Python";
|
||||
separator = ":";
|
||||
#endif
|
||||
penv.insert( "PYTHONPATH",
|
||||
QString( "%1%2%3" ).arg( penv.value( "PYTHONPATH" ) ).arg( separator ).arg( ripsLocations.join( separator ) ) );
|
||||
penv.insert( "PYTHONPATH",
|
||||
QString( "%1%2%3" ).arg( penv.value( "PYTHONPATH" ) ).arg( separator ).arg( ripsLocations.join( separator ) ) );
|
||||
}
|
||||
|
||||
return penv;
|
||||
}
|
||||
@ -97,14 +99,19 @@ QProcessEnvironment RiaGrpcApplicationInterface::grpcProcessEnvironment() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaGrpcApplicationInterface::processRequests()
|
||||
int RiaGrpcApplicationInterface::processRequests()
|
||||
{
|
||||
if ( RiaGrpcServer::receivedExitRequest() )
|
||||
{
|
||||
m_grpcServer->quit();
|
||||
if ( m_grpcServer ) m_grpcServer->quit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t requestsProcessed = m_grpcServer->processAllQueuedRequests();
|
||||
return static_cast<int>(requestsProcessed);
|
||||
if ( m_grpcServer )
|
||||
{
|
||||
size_t requestsProcessed = m_grpcServer->processAllQueuedRequests();
|
||||
return static_cast<int>( requestsProcessed );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
RiaGrpcServer* grpcServer() const;
|
||||
|
||||
QProcessEnvironment grpcProcessEnvironment() const;
|
||||
int processRequests();
|
||||
int processRequests();
|
||||
|
||||
protected:
|
||||
std::unique_ptr<RiaGrpcServer> m_grpcServer;
|
||||
|
@ -315,6 +315,8 @@ bool RiaGrpcServer::isRunning() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcServer::run()
|
||||
{
|
||||
CVF_ASSERT( m_serverImpl );
|
||||
|
||||
m_serverImpl->run();
|
||||
}
|
||||
|
||||
@ -323,6 +325,8 @@ void RiaGrpcServer::run()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcServer::runInThread()
|
||||
{
|
||||
CVF_ASSERT( m_serverImpl );
|
||||
|
||||
m_serverImpl->runInThread();
|
||||
}
|
||||
|
||||
@ -336,6 +340,8 @@ bool RiaGrpcServer::s_receivedExitRequest = false;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcServer::initialize()
|
||||
{
|
||||
CVF_ASSERT( m_serverImpl );
|
||||
|
||||
m_serverImpl->initialize();
|
||||
}
|
||||
|
||||
@ -344,6 +350,8 @@ void RiaGrpcServer::initialize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RiaGrpcServer::processAllQueuedRequests()
|
||||
{
|
||||
CVF_ASSERT( m_serverImpl );
|
||||
|
||||
return m_serverImpl->processAllQueuedRequests();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user