diff --git a/VistaCoreLibs/CMakeLists.txt b/VistaCoreLibs/CMakeLists.txt index b794b719306e1735c5e97743d3eb68f2947d4483..f42763962b1d6eb35345c658f3b755e95adb71d9 100644 --- a/VistaCoreLibs/CMakeLists.txt +++ b/VistaCoreLibs/CMakeLists.txt @@ -87,14 +87,7 @@ if( NOT VISTACORELIBS_SUPPORT_NATIVE_64BIT_ATOMICS ) endif( NOT VISTACORELIBS_SUPPORT_NATIVE_64BIT_ATOMICS ) # Enable C++11 for all sub-modules on *NIX systems -if( UNIX ) - # check if there is already a c++ flag present - if( NOT "${CMAKE_CXX_FLAGS}" MATCHES ".*-std=.+" ) - message( "c++11 features required - adding compiler flag -std=c++11 to CMAKE_CXX_FLAGS" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "Flags used by the compiler during all build types." FORCE ) - endif() -endif() - +unix_require_c11() # Standard package config vista_configure_cpack( VistaCoreLibs ) diff --git a/VistaCoreLibs/VistaBase/Half/VistaHalf.cpp b/VistaCoreLibs/VistaBase/Half/VistaHalf.cpp index 9811df923a7a348586d572c258ed6ee6bd392c78..496342574ea7a34fd3b5ca6df14084baeea8fc1c 100644 --- a/VistaCoreLibs/VistaBase/Half/VistaHalf.cpp +++ b/VistaCoreLibs/VistaBase/Half/VistaHalf.cpp @@ -120,9 +120,9 @@ VistaHalf::convert (int i) // of float and half (127 versus 15). // - register int s = (i >> 16) & 0x00008000; - register int e = ((i >> 23) & 0x000000ff) - (127 - 15); - register int m = i & 0x007fffff; + int s = (i >> 16) & 0x00008000; + int e = ((i >> 23) & 0x000000ff) - (127 - 15); + int m = i & 0x007fffff; // // Now reassemble s, e and m into a half: diff --git a/VistaCoreLibs/VistaBase/Half/VistaHalf.h b/VistaCoreLibs/VistaBase/Half/VistaHalf.h index 580ae22eedc6c038d459b7620dda51e723bcd3b7..1377a141d5adfa5deb0b141f05d93eefeb88b35f 100644 --- a/VistaCoreLibs/VistaBase/Half/VistaHalf.h +++ b/VistaCoreLibs/VistaBase/Half/VistaHalf.h @@ -476,7 +476,7 @@ inline VistaHalf::VistaHalf (float f) x.f = f; - register int e = (x.i >> 23) & 0x000001ff; + int e = (x.i >> 23) & 0x000001ff; e = _eLut[e]; diff --git a/VistaCoreLibs/VistaBase/VistaBaseTypes.h b/VistaCoreLibs/VistaBase/VistaBaseTypes.h index 910a46e2c938873e59cbae8cd1b1c9f8e568c4f8..701152c81adb2ef55ab2b246f3f48606472d3fdb 100644 --- a/VistaCoreLibs/VistaBase/VistaBaseTypes.h +++ b/VistaCoreLibs/VistaBase/VistaBaseTypes.h @@ -79,13 +79,13 @@ namespace VistaType union VISTABASEAPI val32 { /// constructor for automatic conversion of float values - val32( const float32 nInit ) : asFloat( nInit ) {}; + val32( const float32 nInit ) : asFloat( nInit ) {} /// constructor for automatic conversion of long values - val32( const sint32 nInit ) : asSignedInt( nInit ) {}; + val32( const sint32 nInit ) : asSignedInt( nInit ) {} /// explicit conversion constructor (only for internal use) - val32( const uint32 nInit ) : asUnsignedInt( nInit ) {}; + val32( const uint32 nInit ) : asUnsignedInt( nInit ) {} float32 asFloat; sint32 asSignedInt; @@ -103,13 +103,13 @@ namespace VistaType union VISTABASEAPI val64 { /// constructor for automatic conversion of double values - val64( const float64 nInit ) : asFloat( nInit ) {}; + val64( const float64 nInit ) : asFloat( nInit ) {} /// constructor for automatic conversion of long long values - val64( const sint64 nInit ) : asSignedInt( nInit ) {}; + val64( const sint64 nInit ) : asSignedInt( nInit ) {} /// explicit conversion constructor (only for internal use) - explicit val64( const uint64 nInit ) : asUnsignedInt( nInit ) {}; + explicit val64( const uint64 nInit ) : asUnsignedInt( nInit ) {} float64 asFloat; diff --git a/VistaCoreLibs/VistaBase/VistaColor.cpp b/VistaCoreLibs/VistaBase/VistaColor.cpp index 93efbfccdc852fff5790fab869f72fb2dcb56401..d4bede48cfa8cfe47f8bca73c3a770cbeac740aa 100644 --- a/VistaCoreLibs/VistaBase/VistaColor.cpp +++ b/VistaCoreLibs/VistaBase/VistaColor.cpp @@ -491,9 +491,9 @@ void VistaColor::GetValues( { float a3fValues[3]; GetValues(a3fValues, eFormat); - adValues [0] = a3fValues[0]; - adValues [1] = a3fValues[1]; - adValues [2] = a3fValues[2]; + adValues [0] = (double)a3fValues[0]; + adValues [1] = (double)a3fValues[1]; + adValues [2] = (double)a3fValues[2]; } break; case RGBA: @@ -503,10 +503,10 @@ void VistaColor::GetValues( { float a4fValues[4]; GetValues(a4fValues, eFormat); - adValues [0] = a4fValues[0]; - adValues [1] = a4fValues[1]; - adValues [2] = a4fValues[2]; - adValues [3] = a4fValues[3]; + adValues [0] = (double)a4fValues[0]; + adValues [1] = (double)a4fValues[1]; + adValues [2] = (double)a4fValues[2]; + adValues [3] = (double)a4fValues[3]; } break; default: diff --git a/VistaCoreLibs/VistaBase/VistaMathBasics.h b/VistaCoreLibs/VistaBase/VistaMathBasics.h index e41a9100b5c4ce9fe45019d4fcf88c468f1ffa72..24f02faa7cd34d497cb258020707595754812122 100644 --- a/VistaCoreLibs/VistaBase/VistaMathBasics.h +++ b/VistaCoreLibs/VistaBase/VistaMathBasics.h @@ -29,6 +29,7 @@ /* INCLUDES */ /*============================================================================*/ +#include <cassert> #include <cmath> #include <limits> @@ -68,9 +69,14 @@ namespace Vista template< typename TFloat > bool IsValidNumber( const TFloat fValue ); + // clamps val to the range [minVal, maxVal] template< typename TFloat > TFloat Clamp( const TFloat val, const TFloat minVal, const TFloat maxVal ); + // mixes valA and valB using a param in [0, 1] + template< typename TFloat, typename TParam > + TFloat Mix( const TParam param, const TFloat valA, const TFloat valB ); + // true iff val >= minVal && val <= maxVal template< typename TFloat > bool GetIsInRangeInclusive(const TFloat val, const TFloat minVal, const TFloat maxVal); @@ -82,7 +88,7 @@ namespace Vista template< typename TFloat > TFloat Sign( const TFloat val ); -} +} // namespace Vista /** * Convert angles given in radians to degrees and vice versa. @@ -122,6 +128,13 @@ TFloat Vista::Clamp( const TFloat val, const TFloat minVal, const TFloat maxVal return val < minVal ? minVal : ( val > maxVal ? maxVal : val ); } +template< typename TFloat, typename TParam > +TFloat Vista::Mix( const TParam param, const TFloat valA, const TFloat valB ) +{ + assert( param >= TParam( 0.0 ) && param <= TParam( 1.0 ) && "Invalid mix param." ); + return ( TParam( 1.0 ) - param ) * valA + param * valB; +} + template< typename TFloat > bool Vista::GetIsInRangeInclusive(const TFloat val, const TFloat minVal, const TFloat maxVal) { diff --git a/VistaCoreLibs/VistaBase/VistaSerializingToolset.cpp b/VistaCoreLibs/VistaBase/VistaSerializingToolset.cpp index 28db21df9708dcc41d97b18a3dcb90e45e360e92..13ba3a2f1e3e86b708caa6f9574ae958d06cbaad 100644 --- a/VistaCoreLibs/VistaBase/VistaSerializingToolset.cpp +++ b/VistaCoreLibs/VistaBase/VistaSerializingToolset.cpp @@ -48,8 +48,8 @@ VistaSerializingToolset::~VistaSerializingToolset() /*============================================================================*/ void VistaSerializingToolset::Swap4( void* pBuffer ) { - register VistaType::byte cTmp; - register VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); + VistaType::byte cTmp; + VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); cTmp = pCharBuffer[0]; pCharBuffer[0] = pCharBuffer[3]; @@ -63,8 +63,8 @@ void VistaSerializingToolset::Swap4( void* pBuffer ) void VistaSerializingToolset::Swap2( void* pBuffer ) { - register VistaType::byte cTmp; - register VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); + VistaType::byte cTmp; + VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); cTmp = pCharBuffer[0]; pCharBuffer[0] = pCharBuffer[1]; @@ -74,8 +74,8 @@ void VistaSerializingToolset::Swap2( void* pBuffer ) void VistaSerializingToolset::Swap8( void* pBuffer ) { - register VistaType::byte cTmp; - register VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); + VistaType::byte cTmp; + VistaType::byte* pCharBuffer = reinterpret_cast<VistaType::byte*>( pBuffer ); cTmp =pCharBuffer[0]; pCharBuffer[0] = pCharBuffer[7]; diff --git a/VistaCoreLibs/VistaBase/VistaTransformMatrix.cpp b/VistaCoreLibs/VistaBase/VistaTransformMatrix.cpp index 1ac0f4ef1f54f0e7e85156035bd0b8ad3484a0e7..21d5dd46958e4998f9f86b5d08ab1e4c6006d3d7 100644 --- a/VistaCoreLibs/VistaBase/VistaTransformMatrix.cpp +++ b/VistaCoreLibs/VistaBase/VistaTransformMatrix.cpp @@ -164,7 +164,7 @@ namespace * Otherwise, the largest diagonal entry corresponds to the largest of |x|, * |y|, or |z|, one of which must be larger than |w|, and at least 1/2. */ Quat qu; - register double tr, s; + double tr, s; tr = mat[Vista::X][Vista::X] + mat[Vista::Y][Vista::Y]+ mat[Vista::Z][Vista::Z]; if (tr >= 0.0) { diff --git a/VistaCoreLibs/VistaBase/VistaTransformMatrix.h b/VistaCoreLibs/VistaBase/VistaTransformMatrix.h index d9769b680bba2c50a4e829e2e2ed685637be49ee..fd6020e3ea5648f30e5c76481739684f97c9e6c7 100644 --- a/VistaCoreLibs/VistaBase/VistaTransformMatrix.h +++ b/VistaCoreLibs/VistaBase/VistaTransformMatrix.h @@ -998,14 +998,14 @@ inline bool VistaTransformMatrix::GetInverted( VistaTransformMatrix& matTarget ) memcpy( matTarget.m_a16fData, m_a16fData, 16*sizeof(float) ); - for( register int i = 0; i < 4; ++i ) + for( int i = 0; i < 4; ++i ) { float fBig = 0.0f; - for( register int j = 0; j < 4; ++j ) + for( int j = 0; j < 4; ++j ) { if( a4fPivot[j] != 1 ) { - for( register int k = 0 ; k < 4 ; ++k ) + for( int k = 0 ; k < 4 ; ++k ) { if( a4fPivot[k] == 0 ) { @@ -1027,7 +1027,7 @@ inline bool VistaTransformMatrix::GetInverted( VistaTransformMatrix& matTarget ) if( iRow != iCol ) { - for ( register int l = 0 ; l<4 ; l++) + for ( int l = 0 ; l<4 ; l++) { float fTmp = matTarget[l][iCol]; matTarget[l][iCol] = matTarget[l][iRow]; @@ -1044,27 +1044,27 @@ inline bool VistaTransformMatrix::GetInverted( VistaTransformMatrix& matTarget ) float fInvPivot = 1.0f / matTarget[iCol][iCol]; matTarget[iCol][iCol] = 1.0f ; - for ( register int l = 0; l < 4; ++l ) + for ( int l = 0; l < 4; ++l ) { matTarget[l][iCol] = matTarget[l][iCol] * fInvPivot ; } - for( register int ll = 0; ll < 4; ++ll ) + for( int ll = 0; ll < 4; ++ll ) { if( ll != iCol ) { float fDum = matTarget[iCol][ll]; matTarget[iCol][ll] = 0.0; - for( register int l = 0 ; l<4 ; l++) + for( int l = 0 ; l<4 ; l++) matTarget[l][ll] = matTarget[l][ll] - matTarget[l][iCol] * fDum ; } } } - for( register int l = 4; l--; ) + for( int l = 4; l--; ) { if( a4fIndexR[l] != a4fIndexC[l] ) - for( register int k = 0; k < 4; ++k ) + for( int k = 0; k < 4; ++k ) { float fTmp = matTarget[a4fIndexR[l]][k]; matTarget[a4fIndexR[l]][k] = matTarget[a4fIndexC[l]][k]; diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnComposeTransformMatrixNode.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnComposeTransformMatrixNode.cpp index 9bf31f0a5ef36eb5402b4e903939c1c7cb7ae94b..c0cf9e9e91c762d1536dd2a6aa2edc1691a7f997 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnComposeTransformMatrixNode.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnComposeTransformMatrixNode.cpp @@ -61,7 +61,7 @@ bool VdfnComposeTransformMatrixNode::GetIsValid() const { for( int j = 0; j < 4; ++j ) { - if( m_a4x4pInPorts == NULL ) + if( m_a4x4pInPorts[i][j] == NULL ) return false; } } @@ -73,6 +73,7 @@ bool VdfnComposeTransformMatrixNode::PrepareEvaluationRun() for( int i = 0; i < 4; ++i ) { for( int j = 0; j < 4; ++j ) + { m_a4x4pInPorts[i][j] = dynamic_cast< TVdfnPort< float >* >( GetInPort( VistaConversion::ToString( i ) + "_" + VistaConversion::ToString( j ) ) ); diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnCompositeNode.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnCompositeNode.cpp index 670b77ad369357119fb165c160ddab121ed5582c..825faf8eb3c8555d061742ee26dbeaf3584d3e2b 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnCompositeNode.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnCompositeNode.cpp @@ -101,6 +101,8 @@ bool VdfnCompositeNode::SetInPort(const std::string &sName, IVdfnPort *pPort) } std::string sMappedName = (*cit).second.m_strPortName; + // if we found cit in the inport map, m_pTargetNode is not NULL!, + // see CreatePorts(), so no need to test against NULL here. if((*cit).second.m_pTargetNode->SetInPort( sMappedName, pPort )) { // register as mine... diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.cpp index 94135d7cb589a06292fe74645a69c5eb8bbcc811..f17e4d95498ecf9c8d4d7706d7959e69edf90da6 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.cpp @@ -49,7 +49,6 @@ VdfnDriverSensorNode::VdfnDriverSensorNode( VistaDeviceSensor *pSensor, VistaSen m_pHistoryPort( new HistoryPort ), m_nOldMeasureCount(0), m_nLastUpdateIdx(0), - m_nOldScore(0), m_nLastUpdateTsFromReadState(0) { RegisterOutPort( "history", m_pHistoryPort ); diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.h b/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.h index c0a17621e8931b5583a47c06de0356d276249d3a..8502e89664ce0d4868ccacd138d13efb904257dc 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.h +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnDriverSensorNode.h @@ -106,8 +106,7 @@ private: VistaDeviceSensor *m_pSensor; HistoryPort *m_pHistoryPort; - mutable VistaType::uint32 m_nLastUpdateIdx, - m_nOldScore; // is updated in CalcUpdateNeededScore() + mutable VistaType::uint32 m_nLastUpdateIdx; unsigned int m_nOldMeasureCount; mutable VistaType::microtime m_nLastUpdateTsFromReadState; }; diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.cpp index e23309add93f4fdeb3d268e0f53e9bf17d7b5516..e52b0a3dd7a20d77a1e751fcb65368280db41a41 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.cpp @@ -124,7 +124,7 @@ bool VdfnGraph::EvaluateGraph(double nTimeStamp) if( EvaluateSubGraph( m_vecTraversal, nTimeStamp ) == false ) return false; - //check if any node needs a reevaluation + // check if any node needs a reevaluation std::map<IVdfnReEvalNode*, NodeVec>::reverse_iterator ritReEvalNode; std::map<IVdfnReEvalNode*, NodeVec>::reverse_iterator rbegin = m_mpReEvalSubgraphs.rbegin(); std::map<IVdfnReEvalNode*, NodeVec>::reverse_iterator rend = m_mpReEvalSubgraphs.rend(); @@ -133,7 +133,7 @@ bool VdfnGraph::EvaluateGraph(double nTimeStamp) // Determines if another evaluation run is required for the nodes // NeedsEval will usually true in the first, normal evaluation run, // but also indicated if a ReEvalNode needs another run afterwards - // The tests and reevaluations are performed back-to-front in order + // The tests and re-evaluations are performed back-to-front in order // to ensure that a further-down ReEvalNode is fully evaluated before // a ReEvalNode further-up can trigger and change the input if( (*ritReEvalNode).first->NeedsEval() ) @@ -247,6 +247,7 @@ IVdfnNode *VdfnGraph::GetNodeByName(const std::string &strName) const } return NULL; } + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // EDGE MANAGEMENT // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -273,14 +274,13 @@ bool VdfnGraph::GetIsConnectedFromTo( IVdfnNode *pFrom, IVdfnNode *pTo) const return false; } -bool VdfnGraph::UpdatePorts() +void VdfnGraph::PrepareAllPorts() { for(Nodes::iterator uit = m_liNodes.begin(); uit != m_liNodes.end(); ++uit ) { if((*uit)->PreparePorts() == false) (*uit)->SetIsEnabled(false); } - return true; } @@ -332,8 +332,11 @@ bool VdfnGraph::ReloadActionObjects() { // ok, we found a parent node // add an edge to the edge-list - Connect &edges = GetAdjacencyList( (*pit).second, pit->first ); - edges.second.push_back( std::pair<IVdfnNode*, IVdfnPort*>(*cit, pPort) ); // add edge from (in_p) -> (sink_p) + Connect &edges = GetOrCreateAdjacencyListForNode( + (*pit).second, pit->first ); + // add edge from (in_p) -> (sink_p) + edges.second.push_back( std::pair<IVdfnNode*, + ConPortInfo>(*cit, ConPortInfo( *sit, pPort) ) ); } } @@ -346,8 +349,8 @@ bool VdfnGraph::ReloadActionObjects() bool VdfnGraph::UpdateTraversalVector() { - UpdatePorts(); - UpdatePortLookupMap(); + PrepareAllPorts(); + UpdateOutportLookupMap(); UpdateEdgeMap(); m_vecTraversal.clear(); @@ -360,9 +363,6 @@ bool VdfnGraph::UpdateTraversalVector() t != liPrts.end(); ++t ) { const ConInfo &liChildren = (*t).second; - - // ConInfo &liChildren = (*cit).second.second; - // add node with children to topology graph for( ConInfo::const_iterator nit = liChildren.begin(); nit != liChildren.end(); ++nit) @@ -375,11 +375,12 @@ bool VdfnGraph::UpdateTraversalVector() std::list<VistaTopologyGraph<IVdfnNode*>::Node*> liNodes = topology.CalcTopology(); - for(std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator tcit = liNodes.begin(); + for(std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator + tcit = liNodes.begin(); tcit != liNodes.end(); ++tcit) { m_vecTraversal.push_back( (*tcit)->m_oElement ); - //check if node is a reevalnode. if so, create its subgraph + //check if node is a re-evalnode. if so, create its subgraph IVdfnReEvalNode* pReEvalNode = dynamic_cast<IVdfnReEvalNode*>( (*tcit)->m_oElement ); // If a node is a ReEvalNode, it may become necessary to evaluate it multiple times per // frame. While the full graph is evaluated on the first run, a reevaluation should @@ -396,9 +397,11 @@ bool VdfnGraph::UpdateTraversalVector() std::vector<IVdfnNode*>& vecSubgraph = m_mpReEvalSubgraphs[pReEvalNode]; vecSubgraph.resize( liSubgraph.size() ); - std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator citOrigNode = liSubgraph.begin(); + std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator + citOrigNode = liSubgraph.begin(); std::vector<IVdfnNode*>::iterator itCopyNode = vecSubgraph.begin(); - std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator end = liSubgraph.end(); + std::list<VistaTopologyGraph<IVdfnNode*>::Node*>::const_iterator + end = liSubgraph.end(); for( ; citOrigNode != end; ++citOrigNode, ++itCopyNode ) (*itCopyNode) = (*citOrigNode)->m_oElement; @@ -411,7 +414,8 @@ bool VdfnGraph::UpdateTraversalVector() vstr::warnp() << "[VdfnGraph--" << strUserTag << "]: PrepareEvaluationRun() on node [" - << (*tcit)->m_oElement->GetNameForNameable() << "] failed to initialize." << std::endl; + << (*tcit)->m_oElement->GetNameForNameable() + << "] failed to initialize." << std::endl; } } @@ -424,16 +428,19 @@ bool VdfnGraph::UpdateTraversalVector() for(Nodes::const_iterator ucit = begin; ucit != end; ++ucit ) { - if( !topology.GetNodeByValue( *ucit ) ) // not in topology graph, so it is not in the edge list + // not in topology graph, so it is not in the edge list + if( !topology.GetNodeByValue( *ucit ) ) { // while we are at it: call initialize on these nodes :) if( (*ucit)->PrepareEvaluationRun() == true ) - m_vecTraversal.push_back( *ucit ); // order is not important, could be anywhere in the list + // order is not important, could be anywhere in the list + m_vecTraversal.push_back( *ucit ); else { // omit broken nodes vstr::warnp() << "[VdfnGraph]: PrepareEvaluationRun() on node [" - << (*ucit)->GetNameForNameable() << "] failed to initialize." << std::endl; + << (*ucit)->GetNameForNameable() + << "] failed to initialize." << std::endl; } } @@ -441,7 +448,7 @@ bool VdfnGraph::UpdateTraversalVector() return true; } -bool VdfnGraph::UpdatePortLookupMap() +bool VdfnGraph::UpdateOutportLookupMap() { // clear old values m_mpPortLookup.clear(); @@ -487,15 +494,19 @@ bool VdfnGraph::UpdateEdgeMap() { // ok, we found a parent node // add an edge to the edge-list - Connect &edges = GetAdjacencyList( (*pit).second, pit->first ); - edges.second.push_back( std::pair<IVdfnNode*, IVdfnPort*>(*cit, pPort) ); // add edge from (in_p) -> (sink_p) + Connect &edges = GetOrCreateAdjacencyListForNode( + (*pit).second, pit->first ); + // add edge and note the name as well + edges.second.push_back( + std::pair<IVdfnNode*, ConPortInfo>(*cit, + ConPortInfo( *sit, pPort) ) ); } } } } - return false; + return true; } IVdfnNode *VdfnGraph::GetNodeForPort( IVdfnPort *pPort ) const @@ -507,7 +518,8 @@ IVdfnNode *VdfnGraph::GetNodeForPort( IVdfnPort *pPort ) const } -VdfnGraph::Connect &VdfnGraph::GetAdjacencyList( IVdfnNode *pNode, IVdfnPort *pPort ) +VdfnGraph::Connect & +VdfnGraph::GetOrCreateAdjacencyListForNode( IVdfnNode *pNode, IVdfnPort *pPort ) { // lookup node in edge map Edges::iterator it = m_mpEdges.find( pNode ); @@ -515,7 +527,8 @@ VdfnGraph::Connect &VdfnGraph::GetAdjacencyList( IVdfnNode *pNode, IVdfnPort *pP { // add a new entry - it = m_mpEdges.insert( Edges::value_type( pNode, std::list<Connect>()) ).first; + it = m_mpEdges.insert( + Edges::value_type( pNode, std::list<Connect>()) ).first; (*it).second.push_back(Connect( pPort, ConInfo() )); } else @@ -524,6 +537,9 @@ VdfnGraph::Connect &VdfnGraph::GetAdjacencyList( IVdfnNode *pNode, IVdfnPort *pP for(std::list<Connect>::iterator cit = (*it).second.begin(); cit != (*it).second.end(); ++cit ) { + // FIXME this is problematic, if a port is shared multiple times + // (as it only searches for the first match, it may skip at least + // one edge). if( (*cit).first == pPort ) { return (*cit); @@ -549,7 +565,8 @@ void VdfnGraph::GetExports( ExportList &liExports ) const void VdfnGraph::SetExports(const ExportList &liExports) { - for(ExportList::const_iterator cit = liExports.begin(); cit != liExports.end(); ++cit) + for(ExportList::const_iterator cit = liExports.begin(); + cit != liExports.end(); ++cit) { const VdfnGraph::ExportData &exp = *cit; IVdfnNode *pNode = GetNodeByName( exp.m_strNodeName ); @@ -579,7 +596,7 @@ void VdfnGraph::SetExports(const ExportList &liExports) } } } - else + else if( exp.m_nDirection == VdfnGraph::ExportData::OUTPORT ) { if( pNode->GetOutPort( exp.m_strPortName ) == NULL ) { @@ -588,6 +605,12 @@ void VdfnGraph::SetExports(const ExportList &liExports) << exp.m_strNodeName << std::endl; } } + else + { + vstr::errp() << "VdfnGraph::SetExports() -- port direction not" + << " set (UNDEFINED), skipping this node declaration."; + continue; // for-loop + } m_liExports.push_back( exp ); } } diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.h b/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.h index a37a90c4124c44784f68c471ed47d88cb687a6a6..24257b12fe5c3c780a18b0e91eb87d4164e50f65 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.h +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnGraph.h @@ -52,26 +52,49 @@ class IVdfnPort; /*============================================================================*/ /** - * The graph class. Contains nodes and edges. - * It is really not meant to traverse this graph's structure by hand as a programmer. - * There is code to do that. But you can do so, if you wish. - * Consequently, the use of typedefs like Nodes, Edges, ConInfo and Connect - * are used for expert access only. + * @brief Graph container and traversal interface. + * + * The VdfnGraph implements the following responsibilities. + * - management of nodes and detection of edges + * - definition of a traversal structure and evaluation algorithm + * - access structures for composite nodes (using Exports) + * - retrieval of "input nodes", i.e., nodes with 0 inports + * + * A graph can be active, i.e., the node traversal actually evaluates node + * values, or inactive, i.e., traversal does not change node values. + * + * @note It is really not meant to traverse this graph's structure by hand + * as a programmer. Meaning: this is not a general purpose graph data + * structure. */ class VISTADFNAPI VdfnGraph : public IVistaSerializable { public: + /** + * @brief helper structure to access graph 'exports'. + * Usually required in conjunction with Composite Nodes, i.e., nodes + * that contain graphs themselves. + * Exports define virtual in- and output ports of a graph that are + * reflected on a Composite Node. + * + * @see SetExports() + * @see GetExports() + */ class ExportData { public: enum eDir { - UNDEFINED=-1, - INPORT=0, - OUTPORT + UNDEFINED=-1, /**< error tag, initial value */ + INPORT=0, /**< export direction marks an inport */ + OUTPORT /**< export direction marks an outport */ }; + /** + * @brief default c'tor. + * Initializes export direction to UNDEFINED and target node as NULL + */ ExportData() : m_nDirection(UNDEFINED), m_pTargetNode(NULL) @@ -79,26 +102,34 @@ public: } + + /** + * @brief connection defining c'tor. + * @param strNodeName export defining node name + * @param strPortName port name from node <strNodeName> to export + * @param strMapName name to use when exporting the port + * @param direction choice between inport or outport. using + * undefined is, well, undefined. + */ ExportData( const std::string &strNodeName, - const std::string &strPortName, - const std::string &strMapName, - eDir direction, - IVdfnNode *pTargetNode = NULL) + const std::string &strPortName, + const std::string &strMapName, + eDir direction) : m_strNodeName(strNodeName), m_strPortName(strPortName), m_strMapName(strMapName), m_nDirection(direction), - m_pTargetNode(pTargetNode) + m_pTargetNode(NULL) { } - std::string m_strNodeName; - std::string m_strPortName; - std::string m_strMapName; + std::string m_strNodeName; /**< name of the node to export */ + std::string m_strPortName; /**< name of the port to export */ + std::string m_strMapName; /**< export name, can be used to rename ports */ - eDir m_nDirection; - IVdfnNode *m_pTargetNode; + eDir m_nDirection; /**< port direction, INPORT or OUTPORT */ + IVdfnNode *m_pTargetNode; /**< cache pointer in case of INPORT port */ }; /** @@ -106,17 +137,23 @@ public: */ typedef std::list<IVdfnNode*> Nodes; + /** + * used to note to which port the connection was done and under + * what name. + */ + typedef std::pair<std::string, IVdfnPort*> ConPortInfo; + /** * is meant to reflect a target node and a corresponding port * where the edge in coming in. */ - typedef std::list<std::pair<IVdfnNode*, IVdfnPort*> > ConInfo; + typedef std::list< std::pair<IVdfnNode*, ConPortInfo> > ConInfo; /** * maps all the nodes that are connected by Connect.first to * the list of Connect.second. */ - typedef std::pair<IVdfnPort*, ConInfo > Connect; + typedef std::pair<IVdfnPort*, ConInfo> Connect; /** * Edges define a mapping from a node which is connected over @@ -125,7 +162,7 @@ public: * provides a link between the target node of the Connect.Port * and the TargetNode.Port */ - typedef std::map <IVdfnNode*, std::list<Connect> > Edges; + typedef std::map < IVdfnNode*, std::list<Connect> > Edges; /** * A list of exported ports. @@ -140,7 +177,7 @@ public: // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /** - * @param nTimeStamp provide a timestamp that is passed as update time + * @param nTimeStamp provide a time stamp that is passed as update time stamp to all nodes that are evaluated. Pass 0 here for the initial build which will build up the edges and will call the PrepareEvaluationRun() @@ -159,7 +196,7 @@ public: * If a graph is deactivated, it runs over <b>all</b> nodes in the graph * and calls IVdfnNode::OnDeactivate() on them, passing dTimeStamp. * @param bIsActive true if this graph is marked active, false else - * @param dTimeStamp a timestamp, 0 for "force-state-propagation-to-nodes" + * @param dTimeStamp a time stamp, 0 for "force-state-propagation-to-nodes" */ void SetIsActive( bool bIsActive, double dTimeStamp ); @@ -189,10 +226,10 @@ public: // NODE MANAGEMENT // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /** - * Adds a node to this graph. This has no direct conseqeuence. + * Adds a node to this graph. This has no direct consequence. * It is not checked, whether the node is already part of this graph. - * The graph is markes dirty when a node is added. On the next request - * to evaluate the graph, the internal traversal stuctures will be rebuild. + * The graph is marked dirty when a node is added. On the next request + * to evaluate the graph, the internal traversal structures will be rebuild. * @return always true * @param pNode the node to be added for evaluation */ @@ -212,7 +249,7 @@ public: * Searches a node in this graph by name. Note that is is assumes that any * node in this graph has a unique name. * The node is searched by a case-sensitive comparison to the node name. - * @return NULL iff a node with nam strName was not found in this graph. + * @return NULL iff a node with name strName was not found in this graph. * @param strName the case sensitive name to be searched for. */ IVdfnNode *GetNodeByName(const std::string &strName) const; @@ -297,7 +334,7 @@ public: /** * control API, it tells the serializer of this graph to respect the * IVdfnNode::GetIsMasterSim() flag or not. If this method returns - * fallse, the master sim flag can be ignored during serialization, which + * false, the master sim flag can be ignored during serialization, which * will then dump <b>all</b> nodes of this graph, * not only the ones sitting on the master. * @see SetCheckMasterSim() @@ -327,27 +364,62 @@ private: typedef std::vector<IVdfnNode*> NodeVec; protected: + /** + * @brief evaluates nodes in the given vector, passing nTimeStamp as argument. + */ bool EvaluateSubGraph( const NodeVec& vecSubGraph, const double nTimeStamp ); + /** + * @brief helper method to build the graph traversal vector out of the + * set of given nodes and their connection based on port links. + */ bool UpdateTraversalVector(); - bool UpdatePortLookupMap(); + + /** + * @brief helper method to build an outport-cache when building the traversal + * structure. This map allows to lookup outports based on pointers + * quicker than a node/port lookup. This is needed for establishing + * a backlink structure for edge creation. + */ + bool UpdateOutportLookupMap(); + + /** + * @brief create connect information based on port links, i.e., edges between + * ports. + */ bool UpdateEdgeMap(); - bool UpdatePorts(); + + /** + * @brief calls PreparePorts() for all nodes in the traversal map. + * If a node reports that it can not be prepared, it is disabled. + */ + void PrepareAllPorts(); private: - Connect &GetAdjacencyList( IVdfnNode *, IVdfnPort * ); + /** + * @brief retrieves or generates the outward connect information + * for the given node and port. + */ + Connect &GetOrCreateAdjacencyListForNode( IVdfnNode *, IVdfnPort * ); + // all nodes contained in this graph Nodes m_liNodes; + // ordered list of nodes to be traversed NodeVec m_vecTraversal; + // edge / connection lookup table Edges m_mpEdges; + // cache to speed up lookup of outports during edge creation PortLookup m_mpPortLookup; + + // cache to process re-evaluation nodes as subgraphs std::map<IVdfnReEvalNode*, NodeVec> m_mpReEvalSubgraphs; + // exports defined for this graph ExportList m_liExports; - bool m_bUpToDate, - m_bIsActive, - m_bCheckMasterSim; + bool m_bUpToDate, // flag to show dirty (false) / clean state (true) + m_bIsActive, // global activation flag + m_bCheckMasterSim; // toggle to care for master sim evaluation }; /*============================================================================*/ diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnLoggerNode.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnLoggerNode.cpp index 8eaede7ede3c2d0d6b1d02a011fb3e7060a83f93..18d857ac570bec8567efb221ea26691f2b7be5e0 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnLoggerNode.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnLoggerNode.cpp @@ -161,24 +161,25 @@ bool VdfnLoggerNode::PrepareEvaluationRun() std::list<std::string> liPortNames; std::map<IVdfnPort*, std::string> lostNames; - std::set<IVdfnPort*> Ports, SetPorts, DiffPorts; + std::set< std::pair<std::string, IVdfnPort*> > Ports, SetPorts, DiffPorts; for(PortMap::const_iterator it = m_mpInPorts.begin(); it != m_mpInPorts.end(); ++it ) { if( (*it).second == m_pFileName ) continue; // skip diz... - Ports.insert( (*it).second ); + Ports.insert( std::pair<std::string, IVdfnPort*>( (*it).first, (*it).second) ); } for(std::list<std::string>::const_iterator cit = m_liInPorts.begin(); cit != m_liInPorts.end(); ++cit) { - TVdfnPort<std::string> *pPort = VdfnUtil::GetInPortTyped<TVdfnPort<std::string>*>( *cit, this ); + TVdfnPort<std::string> *pPort + = VdfnUtil::GetInPortTyped<TVdfnPort<std::string>*>( *cit, this ); if(pPort) { m_vecPorts.push_back( pPort ); - SetPorts.insert( pPort ); + SetPorts.insert( std::pair<std::string,IVdfnPort*> ( *cit, pPort ) ); } else { @@ -196,20 +197,19 @@ bool VdfnLoggerNode::PrepareEvaluationRun() SetPorts.begin(), SetPorts.end(), std::inserter( DiffPorts, DiffPorts.end() ) ); - for( std::set<IVdfnPort*>::const_iterator dit = DiffPorts.begin(); - dit != DiffPorts.end(); ++dit ) + for( std::set< std::pair<std::string, IVdfnPort*> >::const_iterator dit + = DiffPorts.begin(); + dit != DiffPorts.end(); ++dit ) { - TVdfnPort<std::string> *pPort = dynamic_cast<TVdfnPort<std::string>*>( *dit ); + TVdfnPort<std::string> *pPort + = dynamic_cast<TVdfnPort<std::string>*>( (*dit).second ); if(pPort) - { m_vecPorts.push_back( pPort ); - } else m_vecPorts.push_back( m_pNotSet ); - std::string strName; - if(GetNameForInPort( pPort, strName )) - liPortNames.push_back(strName); + if( GetHasInPort( (*dit).first ) ) + liPortNames.push_back( (*dit).first ); else { std::map<IVdfnPort*, std::string>::const_iterator lnit = lostNames.find( pPort ); diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnNode.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnNode.cpp index 55775f44be2b52d54459cd5a1286e05e7dc52925..984a56df43d47cfe5806ecdf884755b37445c9cf 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnNode.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnNode.cpp @@ -259,20 +259,6 @@ IVdfnPort *IVdfnNode::GetOutPort(const std::string &sName) const return (*cit).second; } -bool IVdfnNode::GetNameForInPort( IVdfnPort *pPort, std::string &strName ) const -{ - // reverse lookup in m_mpInPortMap - for(PortMap::const_iterator cit = m_mpInPorts.begin(); - cit != m_mpInPorts.end(); ++cit) - { - if( (*cit).second == pPort ) - { - strName = (*cit).first; - return true; - } - } - return false; -} bool IVdfnNode::GetNameForOutPort( IVdfnPort *pPort, std::string &strName ) const { diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnNode.h b/VistaCoreLibs/VistaDataFlowNet/VdfnNode.h index 028acc6bb4778ed4eb2dda8c1fdba8b521b89dda..436e0785cc9e02deecd1959ea5d71665bc04349a 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnNode.h +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnNode.h @@ -200,16 +200,6 @@ public: */ virtual bool RemInPort(const std::string &sName); - /** - * Retrieve a name for an inport. - * @param pPort the port to lookup in the inport map - * @param strName the container to store the name to - * @return true iff the port exists as inport, false if this pPort could not - be retrieved from the set of inports. - * @see GetNameForOutPort() - */ - bool GetNameForInPort( IVdfnPort *pPort, std::string &strName ) const; - /** * Retrieve a name for an outport. * @param pPort the port to lookup in the outport map diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnPersistence.cpp b/VistaCoreLibs/VistaDataFlowNet/VdfnPersistence.cpp index 7ec5698a20dbb89bc9f4a51a9b6295ac30c3cd8b..b31bbb9e78a0d40b3c61c323e434728fb1f78ec2 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnPersistence.cpp +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnPersistence.cpp @@ -1150,11 +1150,8 @@ bool VdfnPersistence::SaveAsDot( VdfnGraph *pGraph, (*cit)->GetNameForOutPort( (*t).first, strFromPortName ); - std::string strToPortName; - if((*nit).first->GetNameForInPort( (*nit).second, strToPortName ) == false) - { - vstr::warnp() << "VdfnPersistence::SaveAsDot() - No port given" << std::endl; - } + std::string strToPortName = (*nit).second.first; + if( bWritePorts || bWriteValues ) { std::string strNodeName = CleanNodeName((*cit)->GetNameForNameable()); diff --git a/VistaCoreLibs/VistaDataFlowNet/VdfnSetTransformNode.h b/VistaCoreLibs/VistaDataFlowNet/VdfnSetTransformNode.h index 46e88e37cfd23c963eae954abbaaccc0184a0a5f..6ad517e71fc54410bd25f387ce9df25112692680 100644 --- a/VistaCoreLibs/VistaDataFlowNet/VdfnSetTransformNode.h +++ b/VistaCoreLibs/VistaDataFlowNet/VdfnSetTransformNode.h @@ -23,7 +23,7 @@ #ifndef _VDFNSETTRANSFORMNODE_H -#define _VDFSETTRANSFORMNODE_H +#define _VDFNSETTRANSFORMNODE_H /*============================================================================*/ diff --git a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionCommonShare.h b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionCommonShare.h index 5701514c6302985bea0130c49bb2b04bf8516f1f..b7f944a29e47ee30e7eaec6982603c96f238c1bc 100644 --- a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionCommonShare.h +++ b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionCommonShare.h @@ -176,12 +176,9 @@ namespace VistaLeapMotionMeasures m_ray_scale_x, m_ray_scale_y; + // @TODO: serialization VistaAutoBuffer m_data; }; - - struct ControllerStats - { - }; } diff --git a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.cpp b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.cpp index 21d9f7c02527d7b27f94c51220e6135792719dd3..aa6a6ae7c4e2dcbe71d2f5cf325fd1fe25ae6d0a 100644 --- a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.cpp +++ b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.cpp @@ -343,9 +343,9 @@ VistaLeapMotionCreationMethod::VistaLeapMotionCreationMethod( IVistaTranscoderFa { RegisterSensorType( "HAND", sizeof( VistaLeapMotionMeasures::HandMeasure ), 120, pMetaFac->CreateFactoryForType( "HAND" ) ); - RegisterSensorType( "FINGERS", sizeof( VistaLeapMotionMeasures::HandMeasure ), + RegisterSensorType( "FINGERS", sizeof( VistaLeapMotionMeasures::FingersMeasure ), 120, pMetaFac->CreateFactoryForType( "FINGERS" ) ); - RegisterSensorType( "TOOLS", sizeof( VistaLeapMotionMeasures::HandMeasure ), + RegisterSensorType( "TOOLS", sizeof( VistaLeapMotionMeasures::ToolsMeasure ), 120, pMetaFac->CreateFactoryForType( "TOOLS" ) ); RegisterSensorType( "KEYTAP", sizeof( VistaLeapMotionMeasures::GestureMeasure ), 120, pMetaFac->CreateFactoryForType( "GESTURE" ) ); @@ -357,6 +357,8 @@ VistaLeapMotionCreationMethod::VistaLeapMotionCreationMethod( IVistaTranscoderFa 120, pMetaFac->CreateFactoryForType( "GESTURE" ) ); RegisterSensorType( "GESTURE", sizeof( VistaLeapMotionMeasures::GestureMeasure ), 120, pMetaFac->CreateFactoryForType( "GESTURE" ) ); + RegisterSensorType( "IMAGE", sizeof( VistaLeapMotionMeasures::ImageMeasure ), + 120, pMetaFac->CreateFactoryForType( "IMAGE" ) ); } IVistaDeviceDriver *VistaLeapMotionCreationMethod::CreateDriver() @@ -528,6 +530,7 @@ VistaLeapMotionDriver::VistaLeapMotionDriver( IVistaDriverCreationMethod* pCreat , m_pListener( NULL ) , m_pLeapController( NULL ) , m_bListenerIsRegistered( false ) +, m_nLastFrameId( ~0u ) { SetUpdateType( IVistaDeviceDriver::UPDATE_CUSTOM_THREADED ); @@ -536,6 +539,7 @@ VistaLeapMotionDriver::VistaLeapMotionDriver( IVistaDriverCreationMethod* pCreat m_pConfigAspect = new VistaDriverGenericParameterAspect( new TParameterCreate< VistaLeapMotionDriver, VistaLeapMotionDriver::Parameters >(this) ); RegisterAspect( m_pConfigAspect ); + m_pParameters = Vista::assert_cast< Parameters* >( m_pConfigAspect->GetParameterContainer() ); // register sensor type STICK measuring 18 values m_nHandsSensorId = m_pSensors->GetTypeId( "HAND" ); @@ -553,13 +557,10 @@ VistaLeapMotionDriver::VistaLeapMotionDriver( IVistaDriverCreationMethod* pCreat m_nSwipeGestureSensorId = m_pSensors->GetTypeId( "SWIPE" ); assert( m_nSwipeGestureSensorId != ~0u ); m_nCircleGestureSensorId = m_pSensors->GetTypeId( "CIRCLE" ); - assert( m_nCircleGestureSensorId != ~0u ); - + assert( m_nCircleGestureSensorId != ~0u ); m_nImageSensorId = m_pSensors->GetTypeId( "IMAGE" ); assert( m_nImageSensorId != ~0u ); - m_nFrameSensorId = m_pSensors->GetTypeId( "FRAMESTATE" ); - assert( m_nFrameSensorId != ~0u ); RegisterAspect( m_pSensors ); @@ -586,7 +587,7 @@ VistaLeapMotionDriver::~VistaLeapMotionDriver() delete m_pLeapController; delete m_pListener; - delete m_parameters; + delete m_pParameters; } bool VistaLeapMotionDriver::DoSensorUpdate( VistaType::microtime dTs ) @@ -597,154 +598,156 @@ bool VistaLeapMotionDriver::DoSensorUpdate( VistaType::microtime dTs ) if( m_pThreadAspect->GetDriverUpdatePrepare() ) m_pThreadAspect->GetDriverUpdatePrepare()->PrePoll(); - bool valid_frame=true; - int history_index=0; - - while( valid_frame == true ) + const Leap::Frame oLatestFrame = m_pLeapController->frame(); + VistaType::uint64 nLatestFrameId = oLatestFrame.id(); + + if( nLatestFrameId > m_nLastFrameId + 1 ) { - const Leap::Frame oFrame = m_pLeapController->frame(history_index++); - valid_frame = oFrame.isValid(); - - if( valid_frame == true ) + VistaType::uint64 nFramesToProcess = nLatestFrameId - m_nLastFrameId - 1; + for( int nPast = nFramesToProcess; nPast > 0; --nPast ) { - // Fill hand sensor - unsigned int nNumHands = m_pSensors->GetNumRegisteredSensorsForType( m_nHandsSensorId ); - Leap::HandList oHands = oFrame.hands(); - for( unsigned int nHand = 0; nHand < nNumHands; ++nHand ) - { - int nSensorId = m_pSensors->GetSensorId( m_nHandsSensorId, nHand ); - VistaSensorMeasure* pMeasure = MeasureStart( nSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); + const Leap::Frame oPastFrame = m_pLeapController->frame( nPast ); + if( oPastFrame.isValid() && oPastFrame.id() > m_nLastFrameId ) + ProcessFrame( oLatestFrame, dTs ); + } + } + ProcessFrame( oLatestFrame, dTs ); + m_nLastFrameId = nLatestFrameId; + + if( m_pThreadAspect->GetDriverUpdatePrepare() ) + m_pThreadAspect->GetDriverUpdatePrepare()->PostPoll(); + return true; +} + +void VistaLeapMotionDriver::ProcessFrame( const Leap::Frame& oFrame, VistaType::microtime dTs ) +{ + // Fill hand sensor + unsigned int nNumHands = m_pSensors->GetNumRegisteredSensorsForType( m_nHandsSensorId ); + Leap::HandList oHands = oFrame.hands(); + for( unsigned int nHand = 0; nHand < nNumHands; ++nHand ) + { + int nSensorId = m_pSensors->GetSensorId( m_nHandsSensorId, nHand ); + VistaSensorMeasure* pMeasure = MeasureStart( nSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); - VistaLeapMotionMeasures::HandMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::HandMeasure >(); - FillHand( *pData, oHands[nHand], oFrame.timestamp() ); - MeasureStop( nSensorId ); - } + VistaLeapMotionMeasures::HandMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::HandMeasure >(); + FillHand( *pData, oHands[nHand], oFrame.timestamp() ); + MeasureStop( nSensorId ); + } - unsigned int nFingersSensorId = m_pSensors->GetSensorId( m_nFingerSensorId, 0 ); - if( nFingersSensorId != ~0u ) - { - VistaSensorMeasure* pMeasure = MeasureStart( nFingersSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); - VistaLeapMotionMeasures::FingersMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::FingersMeasure >(); - Leap::FingerList liFingers = oFrame.fingers(); - int nCount = std::max<int>( liFingers.count(), LEAPMEASURES_MAX_FINGERS ); - int nIndex = 0; - for( ; nIndex < nCount; ++nIndex ) - FillFinger( pData->m_aFingers[ nIndex ], liFingers[nIndex], oFrame.timestamp() ); + unsigned int nFingersSensorId = m_pSensors->GetSensorId( m_nFingerSensorId, 0 ); + if( nFingersSensorId != ~0u ) + { + VistaSensorMeasure* pMeasure = MeasureStart( nFingersSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); + VistaLeapMotionMeasures::FingersMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::FingersMeasure >(); + Leap::FingerList liFingers = oFrame.fingers(); + int nCount = std::max<int>( liFingers.count(), LEAPMEASURES_MAX_FINGERS ); + int nIndex = 0; + for( ; nIndex < nCount; ++nIndex ) + FillFinger( pData->m_aFingers[ nIndex ], liFingers[nIndex], oFrame.timestamp() ); - for( ; nIndex < LEAPMEASURES_MAX_FINGERS; ++nIndex ) - pData->m_aFingers[ nIndex ] = VistaLeapMotionMeasures::Finger(); + for( ; nIndex < LEAPMEASURES_MAX_FINGERS; ++nIndex ) + pData->m_aFingers[ nIndex ] = VistaLeapMotionMeasures::Finger(); - MeasureStop( nFingersSensorId ); - } + MeasureStop( nFingersSensorId ); + } - unsigned int nToolsSensorId = m_pSensors->GetSensorId( m_nToolsSensorId, 0 ); - if( nToolsSensorId != ~0u ) - { - VistaSensorMeasure* pMeasure = MeasureStart( nToolsSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); + unsigned int nToolsSensorId = m_pSensors->GetSensorId( m_nToolsSensorId, 0 ); + if( nToolsSensorId != ~0u ) + { + VistaSensorMeasure* pMeasure = MeasureStart( nToolsSensorId, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); - VistaLeapMotionMeasures::ToolsMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::ToolsMeasure >(); - Leap::ToolList liTools = oFrame.tools(); - int nCount = std::max<int>( liTools.count(), LEAPMEASURES_MAX_TOOLS ); - int nIndex = 0; - for( ; nIndex < nCount; ++nIndex ) - FillPointable( pData->m_aTools[ nIndex ], liTools[nIndex], oFrame.timestamp() ); + VistaLeapMotionMeasures::ToolsMeasure* pData = pMeasure->getWrite< VistaLeapMotionMeasures::ToolsMeasure >(); + Leap::ToolList liTools = oFrame.tools(); + int nCount = std::max<int>( liTools.count(), LEAPMEASURES_MAX_TOOLS ); + int nIndex = 0; + for( ; nIndex < nCount; ++nIndex ) + FillPointable( pData->m_aTools[ nIndex ], liTools[nIndex], oFrame.timestamp() ); - for( ; nIndex < LEAPMEASURES_MAX_TOOLS; ++nIndex ) - pData->m_aTools[ nIndex ] = VistaLeapMotionMeasures::Tool(); + for( ; nIndex < LEAPMEASURES_MAX_TOOLS; ++nIndex ) + pData->m_aTools[ nIndex ] = VistaLeapMotionMeasures::Tool(); - MeasureStop( nToolsSensorId ); - } + MeasureStop( nToolsSensorId ); + } - Leap::GestureList oList = oFrame.gestures(); - int count = oList.count(); + Leap::GestureList oList = oFrame.gestures(); + int count = oList.count(); - for( int i = 0; i < count; ++i ) - { - Leap::Gesture oGesture = oList[i]; - ProcessGesture( m_nGestureSensorId, oGesture, dTs, oFrame.timestamp() ); - switch( oGesture.type() ) - { - case Leap::Gesture::TYPE_SWIPE: - ProcessGesture( m_nSwipeGestureSensorId, oGesture, dTs, oFrame.timestamp() ); - break; - case Leap::Gesture::TYPE_CIRCLE: - ProcessGesture( m_nCircleGestureSensorId, oGesture, dTs, oFrame.timestamp() ); - break; - case Leap::Gesture::TYPE_KEY_TAP: - ProcessGesture( m_nKeyTapGestureSensorId, oGesture, dTs, oFrame.timestamp() ); - break; - case Leap::Gesture::TYPE_SCREEN_TAP: - ProcessGesture( m_nScreenTapGestureSensorId, oGesture, dTs, oFrame.timestamp() ); - break; - case Leap::Gesture::TYPE_INVALID: - default: - break; - } - } - - - // two conditions to receive images: - // 1) policy was set - // 2) image sensor was specified - if( GetParameters()->GetPolicyFlags() & VistaLeapMotionDriver::Parameters::POLICY_IMAGES ) - { - unsigned int image_sensors[2]; - image_sensors[0] = m_pSensors->GetSensorId( m_nImageSensorId, 0 ); - image_sensors[1] = m_pSensors->GetSensorId( m_nImageSensorId, 1 ); - - Leap::ImageList images = oFrame.images(); - Leap::ImageList::const_iterator begin = images.begin(); - Leap::ImageList::const_iterator end = images.end(); - - for( Leap::ImageList::const_iterator cit = begin; cit != end; ++cit ) - { - unsigned int sensor_id = image_sensors[ (*cit).id() ]; - if( sensor_id != VistaDriverSensorMappingAspect::INVALID_ID ) - { - VistaSensorMeasure *m = MeasureStart( sensor_id, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); - VistaLeapMotionMeasures::ImageMeasure *image = m->getWrite< VistaLeapMotionMeasures::ImageMeasure >(); - - image->m_driver_timestamp = oFrame.timestamp(); - image->m_nId = (*cit).id(); - image->m_nTimeVisible = 1.0f / 120.0f; - image->m_bVisible = true; - - image->m_format = VistaType::uint32( (*cit).format() ); - image->m_height = (*cit).width(); - image->m_width = (*cit).height(); - image->m_bytes_per_pixel = (*cit).bytesPerPixel(); - image->m_ray_offset_x = (*cit).rayOffsetX(); - image->m_ray_offset_y = (*cit).rayOffsetY(); - image->m_ray_scale_x = (*cit).rayScaleX(); - image->m_ray_scale_y = (*cit).rayScaleY(); - - - // copy data fields - VistaType::uint32 data_size = image->m_width * image->m_height * image->m_bytes_per_pixel; - VistaAutoWriteBuffer ib( data_size ); - memcpy( ib.data(), (*cit).data(), data_size ); - - image->m_data = ib; - - MeasureStop( sensor_id ); - } // sensor available - } // for each image - } // POLICY IMAGES enables - - unsigned int nFrameStatsId = m_pSensors->GetSensorId( m_nFrameSensorId, 0 ); - if( nFrameStatsId != VistaDriverSensorMappingAspect::INVALID_ID ) - { - // record frame stats - } + for( int i = 0; i < count; ++i ) + { + Leap::Gesture oGesture = oList[i]; + ProcessGesture( m_nGestureSensorId, oGesture, dTs, oFrame.timestamp() ); + switch( oGesture.type() ) + { + case Leap::Gesture::TYPE_SWIPE: + ProcessGesture( m_nSwipeGestureSensorId, oGesture, dTs, oFrame.timestamp() ); + break; + case Leap::Gesture::TYPE_CIRCLE: + ProcessGesture( m_nCircleGestureSensorId, oGesture, dTs, oFrame.timestamp() ); + break; + case Leap::Gesture::TYPE_KEY_TAP: + ProcessGesture( m_nKeyTapGestureSensorId, oGesture, dTs, oFrame.timestamp() ); + break; + case Leap::Gesture::TYPE_SCREEN_TAP: + ProcessGesture( m_nScreenTapGestureSensorId, oGesture, dTs, oFrame.timestamp() ); + break; + case Leap::Gesture::TYPE_INVALID: + default: + break; + } + } - } // valid frame - } // while valid_frame - if( m_pThreadAspect->GetDriverUpdatePrepare() ) - m_pThreadAspect->GetDriverUpdatePrepare()->PostPoll(); - return true; + // two conditions to receive images: + // 1) policy was set + // 2) image sensor was specified + if( GetParameters()->GetPolicyFlags() & VistaLeapMotionDriver::Parameters::POLICY_IMAGES ) + { + unsigned int image_sensors[2]; + image_sensors[0] = m_pSensors->GetSensorId( m_nImageSensorId, 0 ); + image_sensors[1] = m_pSensors->GetSensorId( m_nImageSensorId, 1 ); + + Leap::ImageList images = oFrame.images(); + Leap::ImageList::const_iterator begin = images.begin(); + Leap::ImageList::const_iterator end = images.end(); + + for( Leap::ImageList::const_iterator cit = begin; cit != end; ++cit ) + { + unsigned int sensor_id = image_sensors[ (*cit).id() ]; + if( sensor_id != VistaDriverSensorMappingAspect::INVALID_ID ) + { + VistaSensorMeasure *m = MeasureStart( sensor_id, dTs, IVistaDeviceDriver::RETURN_CURRENT_SLOT ); + VistaLeapMotionMeasures::ImageMeasure *image = m->getWrite< VistaLeapMotionMeasures::ImageMeasure >(); + + image->m_driver_timestamp = oFrame.timestamp(); + image->m_nId = (*cit).id(); + image->m_nTimeVisible = 1.0f / 120.0f; + image->m_bVisible = true; + + image->m_format = VistaType::uint32( (*cit).format() ); + image->m_height = (*cit).width(); + image->m_width = (*cit).height(); + image->m_bytes_per_pixel = (*cit).bytesPerPixel(); + image->m_ray_offset_x = (*cit).rayOffsetX(); + image->m_ray_offset_y = (*cit).rayOffsetY(); + image->m_ray_scale_x = (*cit).rayScaleX(); + image->m_ray_scale_y = (*cit).rayScaleY(); + + + // copy data fields + VistaType::uint32 data_size = image->m_width * image->m_height * image->m_bytes_per_pixel; + VistaAutoWriteBuffer ib( data_size ); + memcpy( ib.data(), (*cit).data(), data_size ); + + image->m_data = ib; + + MeasureStop( sensor_id ); + } // sensor available + } // for each image + } // POLICY IMAGES enables } + + void VistaLeapMotionDriver::ProcessGesture( const int nSensorTypeId, const Leap::Gesture& oGesture, const VistaType::microtime nTime, VistaType::uint64 driver_time_stamp ) { unsigned int nSensorId = m_pSensors->GetSensorId( nSensorTypeId, 0 ); @@ -764,7 +767,7 @@ bool VistaLeapMotionDriver::PhysicalEnable( bool bEnable ) if( m_pLeapController == 0 ) return ( bEnable == false ); - VistaMutexLock g( m_connection_guard_mutex ); + VistaMutexLock g( m_oConnectionGuardMutex ); bool bRes = false; if( bEnable ) @@ -796,6 +799,7 @@ bool VistaLeapMotionDriver::PhysicalEnable( bool bEnable ) } } } + m_nLastFrameId = ~0u; return bRes; } @@ -844,6 +848,8 @@ bool VistaLeapMotionDriver::DoConnect() GetParameters()->ApplyGestureConfiguration(); GetParameters()->ApplyPolicyFlags(); + m_nLastFrameId = ~0u; + return true; } @@ -853,13 +859,14 @@ bool VistaLeapMotionDriver::DoDisconnect() { delete m_pLeapController; m_pLeapController = 0; + m_nLastFrameId = ~0u; } return true; } VistaLeapMotionDriver::Parameters *VistaLeapMotionDriver::GetParameters() const { - return m_parameters; + return m_pParameters; } Leap::Controller *VistaLeapMotionDriver::GetLeapController() const diff --git a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.h b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.h index 41d333abe3273ea1f65b9f6490f3eb86ff60ec34..a8d13720fa2bd89f8b778382d244f855efc6d338 100644 --- a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.h +++ b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionDriver.h @@ -66,6 +66,7 @@ namespace Leap { class Controller; class Gesture; + class Frame; } /*============================================================================*/ /* CLASS DEFINITIONS */ @@ -174,6 +175,7 @@ protected: virtual bool DoConnect(); virtual bool DoDisconnect(); + void ProcessFrame( const Leap::Frame& oFrame, VistaType::microtime dTs ); void ProcessGesture( const int nSensorTypeId, const Leap::Gesture& oGesture, const VistaType::microtime nTime, VistaType::uint64 driver_time_stamp ); private: @@ -195,16 +197,14 @@ private: unsigned int m_nCircleGestureSensorId; unsigned int m_nScreenTapGestureSensorId; unsigned int m_nKeyTapGestureSensorId; - unsigned int m_nSwipeGestureSensorId; - + unsigned int m_nSwipeGestureSensorId; unsigned int m_nImageSensorId; - unsigned int m_nFrameSensorId; + VistaType::uint64 m_nLastFrameId; + Parameters* m_pParameters; - Parameters *m_parameters; - - VistaMutex m_connection_guard_mutex; + VistaMutex m_oConnectionGuardMutex; }; diff --git a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionTranscoder.cpp b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionTranscoder.cpp index 78b53c039d9538af6dadcdb76563ecf6ea432e04..a646d645cb1991de4a14aa45be39e761bb9b0845 100644 --- a/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionTranscoder.cpp +++ b/VistaCoreLibs/VistaDeviceDrivers/VistaLeapMotionDriver/VistaLeapMotionTranscoder.cpp @@ -82,6 +82,17 @@ namespace static std::string GetTypeString() { return "LeapMotionGestureTranscoder"; } }; + class LeapMotionImageTranscoder : public IVistaMeasureTranscode + { + REFL_INLINEIMP( LeapMotionImageTranscoder, IVistaMeasureTranscode ) + public: + LeapMotionImageTranscoder() + { + } + + //@TODO implement getters, how to acces image data? + static std::string GetTypeString() { return "LeapMotionImageTranscoder"; } + }; class LeapMotionHandOrientationGet : public IVistaMeasureTranscode::TTranscodeValueGet< VistaQuaternion > { @@ -675,6 +686,7 @@ namespace m_mapCreators[ "FINGERS" ] = new TCreateTranscoder< LeapMotionFingersTranscoder >(); m_mapCreators[ "TOOLS" ] = new TCreateTranscoder< LeapMotionToolsTranscoder >(); m_mapCreators[ "GESTURE" ] = new TCreateTranscoder< LeapMotionGestureTranscoder >(); + m_mapCreators[ "IMAGE" ] = new TCreateTranscoder< LeapMotionImageTranscoder >(); } static void CleanupCreators( CreatorsMap& m_mapCreators ) diff --git a/VistaCoreLibs/VistaDeviceDrivers/VistaSpaceMouseDriver/VistaSpaceMouseDriver.cpp b/VistaCoreLibs/VistaDeviceDrivers/VistaSpaceMouseDriver/VistaSpaceMouseDriver.cpp index 8134e15eb03eb2a52e042a017a09a3c084ae6361..6774057c8c489e9704cfaba7aabe310200f766d3 100644 --- a/VistaCoreLibs/VistaDeviceDrivers/VistaSpaceMouseDriver/VistaSpaceMouseDriver.cpp +++ b/VistaCoreLibs/VistaDeviceDrivers/VistaSpaceMouseDriver/VistaSpaceMouseDriver.cpp @@ -210,7 +210,7 @@ bool VistaSpaceMouseDriver::DoSensorUpdate(VistaType::microtime dTs) iButtons+=DecodeValue(ucRead[2])*16; // Buttons 5-8 iButtons+=DecodeValue(ucRead[3])*256; // Button * - for(register unsigned int n=0; n < 9; ++n) + for(unsigned int n=0; n < 9; ++n) { m_nVecButtonStates[n] = (iButtons & (1 << n) ? 1.0 : 0.0); } @@ -341,7 +341,7 @@ unsigned char VistaSpaceMouseDriver::EncodeValue(unsigned int nValue) unsigned int VistaSpaceMouseDriver::DecodeValue(unsigned char cKey) { - for(register unsigned int i=0;i<16;++i) + for(unsigned int i=0;i<16;++i) { if(SCodeTable[i]==cKey) return i; diff --git a/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.cpp b/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.cpp index 83d7be45104788d04ed5508bc5e8911deeb12a8e..9d0bef75c31733bd26c8175167eb4476eeca26b1 100644 --- a/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.cpp +++ b/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.cpp @@ -113,7 +113,6 @@ namespace VistaDriverManager::VistaDriverManager( VistaDriverMap &dmap ) : m_pConnUpdater(new VistaConnectionUpdater) -, m_AsyncDispatchRunning(false) , m_Drivers(dmap) { VddUtil::InitVdd(); diff --git a/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.h b/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.h index b432a9a9d621d97659d446c8477dc2df90f9848b..63c701a25cf51eec99bc7179bf48818ddf9bcf5f 100644 --- a/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.h +++ b/VistaCoreLibs/VistaDeviceDriversBase/VistaDriverManager.h @@ -134,8 +134,6 @@ private: VistaDriverMap& m_Drivers; VistaConnectionUpdater *m_pConnUpdater; - - bool m_AsyncDispatchRunning; }; diff --git a/VistaCoreLibs/VistaInterProcComm/Concurrency/Imp/VistaPosixThreadEventImp.cpp b/VistaCoreLibs/VistaInterProcComm/Concurrency/Imp/VistaPosixThreadEventImp.cpp index e1221b3410f242b734128e53085325b7350313be..328177a194ef9d136a174bf2d0c4eacdcafb7691 100644 --- a/VistaCoreLibs/VistaInterProcComm/Concurrency/Imp/VistaPosixThreadEventImp.cpp +++ b/VistaCoreLibs/VistaInterProcComm/Concurrency/Imp/VistaPosixThreadEventImp.cpp @@ -32,6 +32,7 @@ #if defined (LINUX) || defined (DARWIN) #include <sys/ioctl.h> + #include <sys/time.h> #elif defined(SUNOS) || defined(IRIX) #include <sys/types.h> #include <sys/filio.h> @@ -84,7 +85,7 @@ void VistaPosixThreadEventImp::SignalEvent() VistaPosixThreadEventImp* pThis = this; int n = 0; - if(0 <= ioctl(m_fd[PIPE_W],FIONREAD,(char*)&n) && n==0) + if(0 <= ioctl(m_fd[PIPE_W],FIONREAD, reinterpret_cast<char*>(&n)) && n==0) TEMP_FAILURE_RETRY( write(m_fd[PIPE_W], &pThis, sizeof(this)) ); } diff --git a/VistaCoreLibs/VistaInterProcComm/Concurrency/VistaTicker.cpp b/VistaCoreLibs/VistaInterProcComm/Concurrency/VistaTicker.cpp index d2fd2594b09430a5da922d89c54773c615946c02..9a83725f6494d8ebce3a824cd7ad1ea9898932b3 100644 --- a/VistaCoreLibs/VistaInterProcComm/Concurrency/VistaTicker.cpp +++ b/VistaCoreLibs/VistaInterProcComm/Concurrency/VistaTicker.cpp @@ -245,7 +245,7 @@ void VistaTicker::UpdateTriggerContexts() return; TriggerContext **p = m_pFirst; - for(register TRIGVEC::size_type n = 0; n < m_nSizeCache; ++n, ++p) + for(TRIGVEC::size_type n = 0; n < m_nSizeCache; ++n, ++p) { //p = m_vecTriggers[n]; if(!(*p)->m_bActive) diff --git a/VistaCoreLibs/VistaInterProcComm/Connections/VistaByteBufferSerializer.cpp b/VistaCoreLibs/VistaInterProcComm/Connections/VistaByteBufferSerializer.cpp index 1a52110dac1d6b114ed7b5aa306aff75a43d2d74..6675f120b631973455cbc9a3916dd80828d4374c 100644 --- a/VistaCoreLibs/VistaInterProcComm/Connections/VistaByteBufferSerializer.cpp +++ b/VistaCoreLibs/VistaInterProcComm/Connections/VistaByteBufferSerializer.cpp @@ -64,7 +64,7 @@ VistaByteBufferSerializer::~VistaByteBufferSerializer() /*============================================================================*/ int VistaByteBufferSerializer::WriteValue( const VistaType::byte* pValue, int iLength ) { - register VistaType::byte* pTarget; + VistaType::byte* pTarget; if( m_iOverwritePosition < 0 ) // no overwrite requested { int iSum = m_iWriteHead + iLength; diff --git a/VistaCoreLibs/VistaInterProcComm/IPNet/VistaSocket.cpp b/VistaCoreLibs/VistaInterProcComm/IPNet/VistaSocket.cpp index d05e64300dc97a3c19600dccf1180a6a9b671f3b..b85395a1d58f5d4a385e13c908e696063a342082 100644 --- a/VistaCoreLibs/VistaInterProcComm/IPNet/VistaSocket.cpp +++ b/VistaCoreLibs/VistaInterProcComm/IPNet/VistaSocket.cpp @@ -51,7 +51,6 @@ #include <time.h> #endif #include <iostream> -using namespace std; #include <cerrno> // errno #include <cstring> @@ -62,7 +61,7 @@ using namespace std; /* MACROS AND DEFINES */ /*============================================================================*/ -bool IVistaSocket::PrintErrorMessage(const string &sMethodName) +bool IVistaSocket::PrintErrorMessage(const std::string &sMethodName) { std::string sErrorMessage; #ifdef WIN32 @@ -671,7 +670,7 @@ int IVistaSocket::ReceiveRaw(void *pvBuffer, const int iLength, int iTimeout, i if(PrintErrorMessage("ReceiveRaw") == false) { // it's a real error and _not_ WOULDBLOCK - if(GetSocketTypeString() != string("UDP")) + if(GetSocketTypeString() != std::string("UDP")) { // we have a real error on a tcp socket SetErrorState(true); diff --git a/VistaCoreLibs/VistaKernel/Cluster/VistaClusterMaster.cpp b/VistaCoreLibs/VistaKernel/Cluster/VistaClusterMaster.cpp index 615d833091ab79d5aef0271c87777983c58420c1..f0a1f0b83fda01821a69ed35a3b521a5ad8d007e 100644 --- a/VistaCoreLibs/VistaKernel/Cluster/VistaClusterMaster.cpp +++ b/VistaCoreLibs/VistaKernel/Cluster/VistaClusterMaster.cpp @@ -88,7 +88,7 @@ public: : m_sIP( pCon->GetPeerName()), m_nPort(pCon->GetPeerPort() ) , m_pCon( pCon ) , m_sName( sSlaveName ) - , m_bSwap( m_pCon->GetByteorderSwapFlag() == VistaSerializingToolset::SWAPS_MULTIBYTE_VALUES ? true : false ) + , m_bSwap( pCon->GetByteorderSwapFlag() == VistaSerializingToolset::SWAPS_MULTIBYTE_VALUES ? true : false ) , m_bSwapSyncs( bDoSync ) , m_pAckCon( pAckCon ) , m_nIndex( nIndex ) diff --git a/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.cpp b/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.cpp index d344372dba04ebfe63627872629861eaadc7e43d..e94bfa0314e0a9dd1e5a1f9a0dc33556b5756541 100644 --- a/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.cpp +++ b/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.cpp @@ -42,8 +42,7 @@ VistaTimeoutHandler::VistaTimeoutHandler(VistaEventManager *pEvMgr, VistaClusterMode *pClusterMode) : VistaEventHandler(), m_pEventManager(pEvMgr), - m_pClusterAux(pClusterMode), - m_nEvId(-1) + m_pClusterAux(pClusterMode) { } diff --git a/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.h b/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.h index 699a31058b5caa79b6b0a938939af00a971e962e..a517d0bcc362dd2d55c9074235ace63fe81b0eb6 100644 --- a/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.h +++ b/VistaCoreLibs/VistaKernel/EventManager/VistaTimeoutHandler.h @@ -166,7 +166,6 @@ public: private: VistaTickTimer *ConvertFromHandle(HD_TIMER tim) const; - int m_nEvId; protected: VistaEventManager *m_pEventManager; /**< handy pointer to the EvMgr */ diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaGeometryFactory.cpp b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaGeometryFactory.cpp index 0f6dbad38c7ae815252bc06cbd0f5b2baacf2e3e..15446b82c5fc21c411914bc23999af429cd295eb 100644 --- a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaGeometryFactory.cpp +++ b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaGeometryFactory.cpp @@ -1011,7 +1011,7 @@ bool VistaGeometryFactory::CreateDiskData( float stepR = radius/resD; if(step == 0.0f) - return NULL; + return false; for(int j = 1; j <= resD; j++) { @@ -1183,7 +1183,7 @@ bool VistaGeometryFactory::CreateConeData( float r = botRad; if(step == 0.0f) - return NULL; + return false; // Coords Bottom circle if(bBottom) diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.cpp b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.cpp index f6b518b426ee549f191f771fec6fdab90838dfd5..ac35242d50cf076041eda421cf2e36a80e956518 100644 --- a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.cpp +++ b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.cpp @@ -112,9 +112,9 @@ bool VistaTransformNode::Scale( const VistaVector3D& v3Scale ) VistaTransformMatrix matTransform; if( m_pBridge->GetTransform( matTransform, m_pData ) == false ) return false; - for( register int i = 0; i < 3; ++i ) + for( int i = 0; i < 3; ++i ) { - for( register int j = 0; j < 4; ++j ) + for( int j = 0; j < 4; ++j ) { matTransform[i][j] *= v3Scale[i]; } @@ -240,15 +240,38 @@ bool VistaTransformNode::GetTranslation( VistaVector3D& v3Translation ) const { return m_pBridge->GetTranslation( v3Translation, m_pData ); } -bool VistaTransformNode::GetRotation( VistaQuaternion& qRotation ) const + +VistaVector3D VistaTransformNode::GetTranslation() const +{ + VistaVector3D v3Translation; + this->GetTranslation(v3Translation); + return v3Translation; +} + +bool VistaTransformNode::GetRotation(VistaQuaternion& qRotation) const { return m_pBridge->GetRotation( qRotation, m_pData ); } -bool VistaTransformNode::GetTransform( VistaTransformMatrix& matTransform ) const + +VistaQuaternion VistaTransformNode::GetRotation() const +{ + VistaQuaternion qRotation; + this->GetRotation(qRotation); + return qRotation; +} + +bool VistaTransformNode::GetTransform(VistaTransformMatrix& matTransform) const { return m_pBridge->GetTransform( matTransform, m_pData ); } +VistaTransformMatrix VistaTransformNode::GetTransform() const +{ + VistaTransformMatrix matTransform; + this->GetTransform(matTransform); + return matTransform; +} + /*============================================================================*/ /* LOCAL VARS AND FUNCS */ /*============================================================================*/ diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.h b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.h index 6de1e571464f206e65e5111f3209bf50417942cb..55e9f4a6d20c949810c1f2acde79ef4382a336bf 100644 --- a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.h +++ b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaTransformNode.h @@ -103,6 +103,11 @@ public: using VistaNode::GetTranslation; using VistaNode::GetRotation; using VistaNode::GetTransform; + + // convenience interface + VistaVector3D GetTranslation() const; + VistaQuaternion GetRotation() const; + VistaTransformMatrix GetTransform() const; protected: diff --git a/VistaCoreLibs/VistaKernel/Stuff/VistaFrameSeriesCapture.cpp b/VistaCoreLibs/VistaKernel/Stuff/VistaFrameSeriesCapture.cpp index d60c6aaaf45ed7ad482912f5556d1bce5bb83c0d..27790817918d5506b3b8dee6120355245545b7d8 100644 --- a/VistaCoreLibs/VistaKernel/Stuff/VistaFrameSeriesCapture.cpp +++ b/VistaCoreLibs/VistaKernel/Stuff/VistaFrameSeriesCapture.cpp @@ -91,7 +91,7 @@ VistaFrameSeriesCapture::~VistaFrameSeriesCapture() bool VistaFrameSeriesCapture::InitCaptureEveryFrame( const std::string& sLocation, const std::string& sFilenamePattern ) { - if( m_pWindow == false ) + if( m_pWindow == NULL ) return false; VistaType::microtime nTime = m_pSystem->GetFrameClock(); @@ -126,7 +126,7 @@ bool VistaFrameSeriesCapture::InitCaptureEveryFrame( const std::string& sLocatio bool VistaFrameSeriesCapture::InitCaptureEveryNthFrame( const std::string& sLocation, const std::string& sFilenamePattern, const int nFrame ) { - if( m_pWindow == false ) + if( m_pWindow == NULL ) return false; VistaType::microtime nTime = m_pSystem->GetFrameClock(); @@ -162,7 +162,7 @@ bool VistaFrameSeriesCapture::InitCaptureEveryNthFrame( const std::string& sLoca bool VistaFrameSeriesCapture::InitCapturePeriodically( const std::string& sLocation, const std::string& sFilenamePattern, const VistaType::microtime nPeriod ) { - if( m_pWindow == false ) + if( m_pWindow == NULL ) return false; VistaType::microtime nTime = m_pSystem->GetFrameClock(); @@ -198,7 +198,7 @@ bool VistaFrameSeriesCapture::InitCapturePeriodically( const std::string& sLocat bool VistaFrameSeriesCapture::InitCaptureWithFramerate( const std::string& sLocation, const std::string& sFilenamePattern, const float nFramerate ) { - if( m_pWindow == false ) + if( m_pWindow == NULL ) return false; VistaType::microtime nTime = m_pSystem->GetFrameClock(); diff --git a/VistaCoreLibs/VistaKernel/VistaSystem.cpp b/VistaCoreLibs/VistaKernel/VistaSystem.cpp index ef7685e02dc7c94d1293c43824c4b9e52929eed6..b0f80035b30dc81ee0a14f5f7e99bc8002d92e80 100644 --- a/VistaCoreLibs/VistaKernel/VistaSystem.cpp +++ b/VistaCoreLibs/VistaKernel/VistaSystem.cpp @@ -2540,7 +2540,7 @@ void VistaSystem::CreateDeviceDrivers() if(pSensorMapping) { // create a proper mapping - pSensorMapping->SetSensorId(0, nSensorId, nDriverSensorId); + pSensorMapping->SetSensorId(nType, nSensorId, nDriverSensorId); } diff --git a/VistaCoreLibs/VistaKernel/VistaSystemConfigurators.cpp b/VistaCoreLibs/VistaKernel/VistaSystemConfigurators.cpp index 2500e1f9e8b44a1960b4b3793a45a9d8047ad918..8ae1dc1904ce6a9c261994f1cc0194c34cc7fb90 100644 --- a/VistaCoreLibs/VistaKernel/VistaSystemConfigurators.cpp +++ b/VistaCoreLibs/VistaKernel/VistaSystemConfigurators.cpp @@ -857,7 +857,7 @@ bool VistaDriverReferenceFrameConfigurator::Configure( IVistaDeviceDriver* pDriv iHemisphere = IVistaDriverReferenceFrameAspect::HS_FRONT; else if( sHemisphere == "AFT" || sHemisphere == "BACK" ) iHemisphere = IVistaDriverReferenceFrameAspect::HS_AFT; - if( iHemisphere != -1 ) + if( iHemisphere != IVistaDriverReferenceFrameAspect::eHemisphereCode(-1) ) { if( pAspect->SetHemisphere( iHemisphere ) == false ) { diff --git a/VistaCoreLibs/VistaMath/VistaGeometries.cpp b/VistaCoreLibs/VistaMath/VistaGeometries.cpp index 660500b0975f4c2c63c2b7de26be5d37f256f29f..9b3eb6ac03499168aa503b58c5fa47e9bc4d1400 100644 --- a/VistaCoreLibs/VistaMath/VistaGeometries.cpp +++ b/VistaCoreLibs/VistaMath/VistaGeometries.cpp @@ -507,6 +507,8 @@ bool VistaTriangle::IntersectionPoint(const VistaVector3D& pnt, } // if p,q } // if |r| < epsilon + barycentric_ab = q; + barycentric_ac = p; return false; } diff --git a/VistaCoreLibs/VistaMath/VistaVector.h b/VistaCoreLibs/VistaMath/VistaVector.h index 085184a30df35a51cf53614b12b15de1fb3eac65..581152379439fb69db3f4c5a6a3b7b86666656b2 100644 --- a/VistaCoreLibs/VistaMath/VistaVector.h +++ b/VistaCoreLibs/VistaMath/VistaVector.h @@ -201,7 +201,7 @@ VistaVector<Type,dim>::VistaVector(const Type * pVals) :m_bTransposed(false),m_nDimension(dim) { //SetNull(); is overwriten form next line //av006ss - for (register int idx=0; idx < dim; ++idx) + for (int idx=0; idx < dim; ++idx) m_pVec[idx] = pVals[idx]; } @@ -216,7 +216,7 @@ VistaVector<Type,dim>::VistaVector (const Type first ...) va_list ap; va_start (ap, first); m_pVec[0] = first; - for (register int idx=1; idx < dim; ++idx) + for (int idx=1; idx < dim; ++idx) { m_pVec[idx] = va_arg (ap, Type); } @@ -234,7 +234,7 @@ VistaVector<Type,dim>::VistaVector(const VistaVector<Type,dim> & orgVec) //SetNull(); // gets overwriten => obsolete? m_bTransposed = orgVec.IsTransposed(); - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] = orgVec.GetVal (idx); } #endif @@ -273,7 +273,7 @@ template <class Type, int dim> inline bool VistaVector<Type,dim>::SetNull() { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) { m_pVec[idx] = 0; } @@ -287,7 +287,7 @@ template <class Type, int dim> inline bool VistaVector<Type,dim>::IsNull () const { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) if (m_pVec[idx] != 0) return false; return true; @@ -322,7 +322,7 @@ inline VistaVector<Type,dim> & VistaVector<Type,dim>::operator= (const VistaVector<Type,dim>& vec2) { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] = vec2.GetVal (idx); m_bTransposed = vec2.IsTransposed(); return *this; @@ -339,7 +339,7 @@ VistaVector<Type,dim>::operator+ (const Type& num) const { VistaVector<Type,dim> tempVec; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) tempVec[idx] = num + m_pVec[idx]; return tempVec; @@ -352,7 +352,7 @@ inline VistaVector<Type,dim> VistaVector<Type,dim>::operator- ( ) const { VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = -m_pVec[idx]; return res; } @@ -364,7 +364,7 @@ inline VistaVector<Type,dim> VistaVector<Type,dim>::operator* ( const Type scaleVal ) const { VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = m_pVec[idx] * scaleVal; return res; } @@ -377,7 +377,7 @@ VistaVector<Type,dim> VistaVector<Type,dim>::operator/ ( const Type scaleVal ) { const Type scaleValInv = 1.0f/scaleVal; VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = m_pVec[idx] * scaleValInv; return res; } @@ -389,7 +389,7 @@ inline VistaVector<Type,dim> VistaVector<Type,dim>::operator+ ( const VistaVector<Type,dim> & other ) const { VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = m_pVec[idx] + other[idx]; return res; } @@ -401,7 +401,7 @@ inline VistaVector<Type,dim> VistaVector<Type,dim>::operator- ( const VistaVector<Type,dim> & other ) const { VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = m_pVec[idx] - other[idx]; return res; } @@ -413,7 +413,7 @@ inline Type VistaVector<Type,dim>::operator* ( const VistaVector<Type,dim> & other ) const { Type res = 0; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res += m_pVec[idx]*other[idx]; return res; } @@ -424,7 +424,7 @@ template <class Type, int dim> inline const VistaVector<Type,dim> & VistaVector<Type,dim>::operator*= ( const Type scaleVal ) { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] *= scaleVal; return *this; } @@ -436,7 +436,7 @@ inline const VistaVector<Type,dim> & VistaVector<Type,dim>::operator/= ( const Type scaleVal ) { const Type scaleValInv = 1.0f/scaleVal; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] *= scaleValInv; return *this; } @@ -447,7 +447,7 @@ template <class Type, int dim> inline const VistaVector<Type,dim> & VistaVector<Type,dim>::operator+= ( const VistaVector<Type,dim> & other ) { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] += other[idx]; return *this; } @@ -458,7 +458,7 @@ template <class Type, int dim> inline const VistaVector<Type,dim> & VistaVector<Type,dim>::operator-= ( const VistaVector<Type,dim> & other ) { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] -= other[idx]; return *this; @@ -470,7 +470,7 @@ template <class Type, int dim> inline bool VistaVector<Type,dim>::operator== ( const VistaVector<Type,dim> & other ) const { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) if (std::abs( m_pVec[idx] - other[idx] ) > Vista::Epsilon) return false; return true; @@ -487,7 +487,7 @@ template <class Type, int dim> inline void VistaVector<Type,dim>::operator= ( const Type *pOther ) { - for(register int n=0; n < dim; ++n) + for(int n=0; n < dim; ++n) m_pVec[n] = pOther[n]; } @@ -498,7 +498,7 @@ inline VistaVector<Type,dim> VistaVector<Type,dim>::Absolute ( ) const { VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = (m_pVec[idx]>=0) ? m_pVec[idx] : -m_pVec[idx]; return res; } @@ -528,7 +528,7 @@ inline Type VistaVector<Type,dim>::GetLengthSquared () const { Type res = 0; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res += m_pVec[idx] * m_pVec[idx]; return res; @@ -572,7 +572,7 @@ VistaVector<Type,dim> VistaVector<Type,dim>::Interpolate ( return in; VistaVector<Type,dim> res; - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) res[idx] = (1.0-t) * m_pVec[idx] + t * in[idx]; return res; } @@ -583,7 +583,7 @@ template <class Type, int dim> inline void VistaVector<Type,dim>::GetValues ( Type out[dim] ) const { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) out[idx] = m_pVec[idx]; } @@ -593,7 +593,7 @@ template <class Type, int dim> inline void VistaVector<Type,dim>::SetValues ( const Type in[dim] ) { - for (register int idx = 0; idx < dim; ++idx) + for (int idx = 0; idx < dim; ++idx) m_pVec[idx] = in[idx]; } diff --git a/VistaCoreLibs/VistaOGLExt/Rendering/ABuffer/VistaABufferOIT.cpp b/VistaCoreLibs/VistaOGLExt/Rendering/ABuffer/VistaABufferOIT.cpp index c972924e82ee04919278facfb1a67f4ffaf012f2..ca8da0928693eb39867f08da9e71bfe066b55dc9 100644 --- a/VistaCoreLibs/VistaOGLExt/Rendering/ABuffer/VistaABufferOIT.cpp +++ b/VistaCoreLibs/VistaOGLExt/Rendering/ABuffer/VistaABufferOIT.cpp @@ -141,7 +141,7 @@ bool VistaABufferOIT::Init( break; default: vstr::errp() << "[VistaABufferOIT] unknown A-Buffer-Implementation" << std::endl; - return NULL; + return false; } diff --git a/VistaCoreLibs/VistaTools/VistaStreams.cpp b/VistaCoreLibs/VistaTools/VistaStreams.cpp index cc91eaccbbfef032713f62ae2ec63041205fedba..02242c44032065b0b501bf29420055c9a3db9d3b 100644 --- a/VistaCoreLibs/VistaTools/VistaStreams.cpp +++ b/VistaCoreLibs/VistaTools/VistaStreams.cpp @@ -510,7 +510,7 @@ VistaColorOutstream::CONSOLE_COLOR VistaColorOutstream::GetConsoleColorFromStrin if( sCleanedName == S_aColorNames[nColorIndex] ) return CONSOLE_COLOR( nColorIndex ); } - return CONSOLE_COLOR( -1 ); + return CONSOLE_COLOR( ~0 ); } @@ -1247,7 +1247,7 @@ std::ostream* CreateStreamFromDescription( const std::string& sDefinition, if( vecArguments.size() > 0 ) { oTextColor = VistaColorOutstream::GetConsoleColorFromString( vecArguments[0] ); - if( oTextColor == -1 ) + if( oTextColor == VistaColorOutstream::CONSOLE_COLOR( ~0 ) ) { vstr::warnp() << "VistaStreams::CreateStreamsFromProplist -- " << "unknown color \"" << vecArguments[0] << "\" to stream \"COLOR\"" << std::endl; @@ -1264,7 +1264,7 @@ std::ostream* CreateStreamFromDescription( const std::string& sDefinition, else { oBackgroundColor = VistaColorOutstream::GetConsoleColorFromString( vecArguments[1] ); - if( oBackgroundColor == -1 ) + if( oBackgroundColor == VistaColorOutstream::CONSOLE_COLOR( ~0 ) ) { vstr::warnp() << "VistaStreams::CreateStreamsFromProplist -- " << "unknown color \"" << vecArguments[1] << "\" to stream \"COLOR\"" << std::endl; diff --git a/VistaDemo/21ClusterModeDemo/start_clustered.bat b/VistaDemo/21ClusterModeDemo/start_clustered.bat index 174904d4ac8b72230279f9ee9f696737c8c3ae0a..b79e645f3940d0e3a3425cba5920537ca3823dc9 100644 --- a/VistaDemo/21ClusterModeDemo/start_clustered.bat +++ b/VistaDemo/21ClusterModeDemo/start_clustered.bat @@ -1,21 +1,21 @@ -@ECHO OFF -REM In this file, we will first start the slaves, and then the master - -SET CURRENT_PATH=%PATH% - -CALL set_path_for_21ClusterModeDemo.bat - -ECHO starting slave 1 -START 21ClusterModeDemo.exe -newclusterslave DesktopSlave1 -ECHO starting slave 2 -START 21ClusterModeDemo.exe -newclusterslave DesktopSlave2 - -REM We want to sleep two seconds to allow the slaves to start properly, before we -REM start the master. Since batch files don't have a sleep, we use dirty hacks -ECHO sleeping for 3 seconds -ping 127.0.0.1 -n 4 -w 1000 > nul - -ECHO starting the master -START 21ClusterModeDemo.exe -newclustermaster DesktopMaster - +@ECHO OFF +REM In this file, we will first start the slaves, and then the master + +SET CURRENT_PATH=%PATH% + +CALL set_path_for_21ClusterModeDemo.bat + +ECHO starting slave 1 +START 21ClusterModeDemo.exe -newclusterslave DesktopSlave1 +ECHO starting slave 2 +START 21ClusterModeDemo.exe -newclusterslave DesktopSlave2 + +REM We want to sleep two seconds to allow the slaves to start properly, before we +REM start the master. Since batch files don't have a sleep, we use dirty hacks +ECHO sleeping for 3 seconds +ping 127.0.0.1 -n 4 -w 1000 > nul + +ECHO starting the master +START 21ClusterModeDemo.exe -newclustermaster DesktopMaster + set PATH=%CURRENT_PATH% \ No newline at end of file diff --git a/VistaDemo/22RecordReplayDemo/capture_replay.bat b/VistaDemo/22RecordReplayDemo/capture_replay.bat index 09a0f40c4b8f76a72b83a19169efe3decb8aee5f..4096a7535698d86d670b2657acbd68bfc55dfb58 100755 --- a/VistaDemo/22RecordReplayDemo/capture_replay.bat +++ b/VistaDemo/22RecordReplayDemo/capture_replay.bat @@ -1,11 +1,11 @@ -@ECHO OFF -REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session and renders to an offscreen buffer window. -REM The offscreen buffer allows rendering with a higher resolution than the screen. The rendered images are captured at a fixed framerate of 30Hz. - -SET CURRENT_PATH=%PATH% - -CALL set_path_for_22RecordReplayDemo.bat - -CALL 22RecordReplayDemo.exe -displayini display_desktop_offscreen.ini -replay testrecord -capture_frames_with_framerate 30 -capture_frames_filename testrecord_capture/screenshot_$S$.jpg - +@ECHO OFF +REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session and renders to an offscreen buffer window. +REM The offscreen buffer allows rendering with a higher resolution than the screen. The rendered images are captured at a fixed framerate of 30Hz. + +SET CURRENT_PATH=%PATH% + +CALL set_path_for_22RecordReplayDemo.bat + +CALL 22RecordReplayDemo.exe -displayini display_desktop_offscreen.ini -replay testrecord -capture_frames_with_framerate 30 -capture_frames_filename testrecord_capture/screenshot_$S$.jpg + set PATH=%CURRENT_PATH% \ No newline at end of file diff --git a/VistaDemo/22RecordReplayDemo/capture_replay_sidebyside.bat b/VistaDemo/22RecordReplayDemo/capture_replay_sidebyside.bat index b7fe0ab98b3c346af81e984c1e78a17f095d725c..641f591f8c3eb0976dfb7923770f3d276b8fd3d1 100755 --- a/VistaDemo/22RecordReplayDemo/capture_replay_sidebyside.bat +++ b/VistaDemo/22RecordReplayDemo/capture_replay_sidebyside.bat @@ -1,13 +1,13 @@ -@ECHO OFF -REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session and renders to an offscreen buffer window. -REM The offscreen buffer allows rendering with a higher resolution than the screen. The rendered images are captured at a fixed framerate of 30Hz. -REM This variant uses a window with two viewports, allowing to render a side-by-side vide -REM NOTE: please read the comments in the README.txt concerning synchronicity - -SET CURRENT_PATH=%PATH% - -CALL set_path_for_22RecordReplayDemo.bat - -CALL 22RecordReplayDemo.exe -displayini display_desktop_offscreen_sidebyside.ini -replay testrecord -capture_frames_with_framerate 30 -capture_frames_filename testrecord_sbs/screenshot_$S$.jpg - +@ECHO OFF +REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session and renders to an offscreen buffer window. +REM The offscreen buffer allows rendering with a higher resolution than the screen. The rendered images are captured at a fixed framerate of 30Hz. +REM This variant uses a window with two viewports, allowing to render a side-by-side vide +REM NOTE: please read the comments in the README.txt concerning synchronicity + +SET CURRENT_PATH=%PATH% + +CALL set_path_for_22RecordReplayDemo.bat + +CALL 22RecordReplayDemo.exe -displayini display_desktop_offscreen_sidebyside.ini -replay testrecord -capture_frames_with_framerate 30 -capture_frames_filename testrecord_sbs/screenshot_$S$.jpg + set PATH=%CURRENT_PATH% \ No newline at end of file diff --git a/VistaDemo/22RecordReplayDemo/start_record.bat b/VistaDemo/22RecordReplayDemo/start_record.bat index 61f002e6c2e6afc6cf0ad61d52ba5a92b4b204b4..2463f961fc79b61766545c9957d985a32024d685 100755 --- a/VistaDemo/22RecordReplayDemo/start_record.bat +++ b/VistaDemo/22RecordReplayDemo/start_record.bat @@ -1,10 +1,10 @@ -@ECHO OFF -REM In this file, we start a the demo to record data to a folder "testrecord" - -SET CURRENT_PATH=%PATH% - -CALL set_path_for_22RecordReplayDemo.bat - -CALL 22RecordReplayDemo.exe -record testrecord - +@ECHO OFF +REM In this file, we start a the demo to record data to a folder "testrecord" + +SET CURRENT_PATH=%PATH% + +CALL set_path_for_22RecordReplayDemo.bat + +CALL 22RecordReplayDemo.exe -record testrecord + set PATH=%CURRENT_PATH% \ No newline at end of file diff --git a/VistaDemo/22RecordReplayDemo/start_replay.bat b/VistaDemo/22RecordReplayDemo/start_replay.bat index 201c03b66a59ba9e7609aa93b860019069c649fb..f37b1f51a48c611c9b25516a3ec1a6104a74f1e7 100755 --- a/VistaDemo/22RecordReplayDemo/start_replay.bat +++ b/VistaDemo/22RecordReplayDemo/start_replay.bat @@ -1,10 +1,10 @@ -@ECHO OFF -REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session - -SET CURRENT_PATH=%PATH% - -CALL set_path_for_22RecordReplayDemo.bat - -CALL 22RecordReplayDemo.exe -replay testrecord - +@ECHO OFF +REM In this file, we run the demo RecordReplayDemo with -replay, which replays a prevously recorded session + +SET CURRENT_PATH=%PATH% + +CALL set_path_for_22RecordReplayDemo.bat + +CALL 22RecordReplayDemo.exe -replay testrecord + set PATH=%CURRENT_PATH% \ No newline at end of file