max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
578
package com.ocnyang.contourviewdemo; import android.content.Intent; import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.RadialGradient; import android.graphics.Shader; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import com.ocnyang.contourview.ContourView; public class ContourActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contour); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); initBeachContourView(); initCustomContourView(); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri uri = Uri.parse("https://github.com/OCNYang/ContourView"); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); } /** * Customize the coordinates of the anchor to control the area to be drawn。 */ private void initCustomContourView() { ContourView contourViewCustom = (ContourView) findViewById(R.id.contourview_custom); int width = getWidth(); int hight = 700; int[] ints = {width / 2, 50, ((int) (width * 0.75)), hight / 2, ((int) (width * 0.35)), 350}; int[] intArr = new int[]{width / 5, hight / 3, width / 4 * 3, hight / 2, width / 2, ((int) (hight * 0.9)), width / 5, ((int) (hight * 0.8))}; contourViewCustom.setPoints(ints, intArr); contourViewCustom.setShaderStartColor(getResources().getColor(R.color.startcolor)); contourViewCustom.setShaderEndColor(getResources().getColor(R.color.endcolor)); contourViewCustom.setShaderMode(ContourView.SHADER_MODE_RADIAL); // contourViewCustom.invalidate(); } /** * Controls the color of the drawing. */ private void initBeachContourView() { ContourView contourViewBeach = ((ContourView) findViewById(R.id.contourview_beach)); RadialGradient radialGradient = new RadialGradient( 0, 0, 4000, getResources().getColor(R.color.startcolor), getResources().getColor(R.color.endcolor), Shader.TileMode.CLAMP); LinearGradient linearGradient = new LinearGradient(0, 0, getWidth(), 400, Color.argb(30, 255, 255, 255), Color.argb(90, 255, 255, 255), Shader.TileMode.REPEAT); contourViewBeach.setShader(radialGradient, linearGradient); } public int getWidth() { int width = getWindowManager().getDefaultDisplay().getWidth(); return width; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } }
1,388
815
<reponame>xj361685640/ParaView /*------------------------------------------------------------------------------*/ /** * \file GW_MatrixNxP.h * \brief Definition of class \c GW_MatrixNxP * \author <NAME> * \date 5-31-2003 */ /*------------------------------------------------------------------------------*/ #error matrixnp #ifndef _GW_MATRIXNXP_H_ #define _GW_MATRIXNXP_H_ #include "GW_MathsConfig.h" #include "GW_VectorND.h" #include "GW_MatrixStatic.h" #include "tnt/tnt.h" #include "tnt/jama_eig.h" #include "tnt/jama_qr.h" #include "tnt/jama_cholesky.h" #include "tnt/jama_svd.h" #include "tnt/jama_lu.h" namespace GW { typedef TNT::Array2D<GW_Float> GW_TNTArray2D; /*------------------------------------------------------------------------------*/ /** * \class GW_MatrixNxP * \brief A matrix of arbitrary size. * \author <NAME> * \date 5-31-2003 * * Use \b TNT library. */ /*------------------------------------------------------------------------------*/ class GW_MatrixNxP: public GW_TNTArray2D { public: GW_MatrixNxP() :GW_TNTArray2D(){} GW_MatrixNxP(GW_U32 m, GW_U32 n) :GW_TNTArray2D((int) m,(int) n){} GW_MatrixNxP(GW_U32 m, GW_U32 n, GW_Float *a) :GW_TNTArray2D((int) m,(int) n,a){} GW_MatrixNxP(GW_U32 m, GW_U32 n, const GW_Float &a) :GW_TNTArray2D((int) m,(int) n,a){} GW_MatrixNxP(const GW_MatrixNxP &A) :GW_TNTArray2D(A){} void Reset( GW_U32 i, GW_U32 j ) { ((GW_TNTArray2D&) (*this)) = GW_TNTArray2D((int) i, (int) j); } GW_U32 GetNbrRows() const { return this->dim1(); } GW_U32 GetNbrCols() const { return this->dim2(); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::GetData * * \param i row number * \param j col number * \return value of the (i,j) data. * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_Float GW_MatrixNxP::GetData(GW_U32 i, GW_U32 j) const { GW_ASSERT( i<this->GetNbrRows() && j<this->GetNbrCols() ); return (*this)[i][j]; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::SetData * * \param i row number * \param j col number * \param rVal value * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::SetData(GW_U32 i, GW_U32 j, GW_Float rVal) { GW_ASSERT( i<this->GetNbrRows() && j<this->GetNbrCols() ); (*this)[i][j] = rVal; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::operator * * * \param m right hand side * \return multiplication this*m * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator*(const GW_MatrixNxP& m) { GW_ASSERT( this->GetNbrCols() == m.GetNbrRows() ); GW_MatrixNxP Res( this->GetNbrRows(), m.GetNbrCols() ); GW_MatrixNxP::Multiply( *this, m, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Multiply * * \param a right side * \param b left side * \param r result * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ static void GW_MatrixNxP::Multiply(const GW_MatrixNxP& a, const GW_MatrixNxP& b, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols() == b.GetNbrRows() ); GW_ASSERT( r.GetNbrRows() == a.GetNbrRows() ); GW_ASSERT( r.GetNbrCols() == b.GetNbrCols() ); GW_Float rVal; for( GW_U32 i=0; i<r.GetNbrRows(); ++i ) for( GW_U32 j=0; j<r.GetNbrCols(); ++j ) { rVal = 0; for( GW_U32 k=0; k<a.GetNbrCols(); ++k ) rVal += a.GetData(i,k) * b.GetData(k,j); r.SetData( i,j, rVal ); } } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::*= * * \param m right side * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::operator*=(const GW_MatrixNxP & m) { GW_MatrixNxP Tmp( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Multiply( *this, m, Tmp ); (*this) = Tmp; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::GW_MatrixNxP operator* /** * \param s [GW_Float] scalar. * \author <NAME> * \date 6-1-2003 * * Matrix times scalar operator. */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator*(GW_Float s) { GW_MatrixNxP m( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Multiply(*this, s, m); return m; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::Multiply /** * \param a [GW_MatrixNxP&] The matrix. * \param s [GW_Float] The scalar. * \param r [GW_MatrixNxP&] The result. * \author <NAME> * \date 6-1-2003 * * Matrix times scalar. */ /*------------------------------------------------------------------------------*/ static void GW_MatrixNxP::Multiply(const GW_MatrixNxP& a, const GW_Float s, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols()==r.GetNbrCols() && r.GetNbrRows()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) r.SetData(i,j, a.GetData(i,j)*s ); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP:: /** * \param s [GW_Float] scalar. * \return [void operator *] DESCRIPTION * \author <NAME> * \date 6-1-2003 * * Auto multiply. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::operator *= (GW_Float s) { GW_MatrixNxP::Multiply(*this, s, *this); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::GW_MatrixNxP operator/ /** * \param s [GW_Float] scalar. * \author <NAME> * \date 6-1-2003 * * Matrix divided by scalar operator. */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator/(GW_Float s) { GW_MatrixNxP m( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Divide(*this, s, m); return m; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::Divide /** * \param a [GW_MatrixNxP&] The matrix. * \param s [GW_Float] The scalar. * \param r [GW_MatrixNxP&] The result. * \author <NAME> * \date 6-1-2003 * * Matrix divided by scalar. */ /*------------------------------------------------------------------------------*/ static void GW_MatrixNxP::Divide(const GW_MatrixNxP& a, const GW_Float s, GW_MatrixNxP& r) { if( s==0 ) return; GW_ASSERT( a.GetNbrCols()==r.GetNbrCols() && r.GetNbrRows()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) r.SetData(i,j, a.GetData(i,j)/s ); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::/= /** * \param s [GW_Float] scalar. * \return [void operator *] DESCRIPTION * \author <NAME> * \date 6-1-2003 * * Auto divide. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::operator /= (GW_Float s) { GW_MatrixNxP::Divide(*this, s, *this); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::operator * * \param v right hand statement. * \return the vector multiplied by the matrix. * \author <NAME> 2001-09-30 */ /*------------------------------------------------------------------------------*/ GW_VectorND GW_MatrixNxP::operator*(const GW_VectorND& v) { GW_VectorND Res( this->GetNbrRows() ); GW_MatrixNxP::Multiply( *this, v, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Multiply * * \param a left hand statement. * \param v Right hand statement. * \param r Result. * \author <NAME> 2001-09-30 * * Multiply the vector by the matrix. */ /*------------------------------------------------------------------------------*/ static void GW_MatrixNxP::Multiply(const GW_MatrixNxP& a, const GW_VectorND& v, GW_VectorND& r) { GW_ASSERT( a.GetNbrRows() == r.GetDim() ); GW_ASSERT( a.GetNbrCols() == v.GetDim() ); GW_Float rVal; for( GW_U32 i=0; i<r.GetDim(); ++i ) { rVal = 0; for( GW_U32 j=0; j<v.GetDim(); ++j ) rVal += a.GetData(i,j) * v.GetData(j); r.SetData( i, rVal ); } } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Transpose * * \return Transposed matrix. * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::Transpose() { GW_MatrixNxP Res( this->GetNbrCols(), this->GetNbrRows() ); GW_MatrixNxP::Transpose( *this, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Transpose * * \param a Right side * \param r Result * \return Transposed matrix. * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::Transpose(const GW_MatrixNxP& a, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols()==r.GetNbrRows() && r.GetNbrCols()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) { r.SetData(i,j, a.GetData(j,i) ); } } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::operator + * * \param m Right side * \return this+a * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator+(const GW_MatrixNxP & m) { GW_MatrixNxP Res( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Add( *this, m, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Add * * \param a left hand side * \param b right hand side * \param r result = a+b * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::Add(const GW_MatrixNxP& a, const GW_MatrixNxP& b, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols()==b.GetNbrCols() && a.GetNbrRows()==b.GetNbrRows() ); GW_ASSERT( a.GetNbrCols()==r.GetNbrCols() && a.GetNbrRows()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) r.SetData(i,j, a.GetData(i,j)+b.GetData(i,j) ); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::operator - * * \param m Right side * \return this-a * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator-(const GW_MatrixNxP & m) { GW_MatrixNxP Res( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Minus( *this, m, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Minus * * \param a left hand side * \param b right hand side * \param r result = a-b * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::Minus(const GW_MatrixNxP& a, const GW_MatrixNxP& b, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols()==b.GetNbrCols() && a.GetNbrRows()==b.GetNbrRows() ); GW_ASSERT( a.GetNbrCols()==r.GetNbrCols() && a.GetNbrRows()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) r.SetData(i,j, a.GetData(i,j)-b.GetData(i,j) ); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::operator - * * \return -this * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ GW_MatrixNxP GW_MatrixNxP::operator-() { GW_MatrixNxP Res( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::UMinus( *this, Res ); return Res; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::UMinus * * \param a right side * \param r result * \author <NAME> 2001-09-19 * * unary minus. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::UMinus(const GW_MatrixNxP& a, GW_MatrixNxP& r) { GW_ASSERT( a.GetNbrCols()==r.GetNbrCols() && a.GetNbrRows()==r.GetNbrRows() ); for( GW_U32 i=0; i<a.GetNbrRows(); ++i ) for( GW_U32 j=0; j<a.GetNbrCols(); ++j ) r.SetData(i,j, -a.GetData(i,j) ); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::+= * * \param m right side * \author <NAME> 2001-09-19 * * unary minus. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::operator+=(const GW_MatrixNxP & m) { GW_MatrixNxP Tmp( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Add( *this, m, Tmp ); (*this) = Tmp; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::-=(const * * \param m right side * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::operator-=(const GW_MatrixNxP & m) { GW_MatrixNxP Tmp( this->GetNbrRows(), this->GetNbrCols() ); GW_MatrixNxP::Minus( *this, m, Tmp ); (*this) = Tmp; } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::SetZero * * \return set all component of the matrix to zero. * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::SetZero() { this->SetValue(0); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::SetValue * * \param rVal value to set. * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::SetValue(GW_Float rVal) { GW_ASSERT( this->GetNbrCols()>0 && this-GetNbrRows()>0 ); for( GW_U32 i=0; i<this->GetNbrRows(); ++i ) for( GW_U32 j=0; j<this->GetNbrCols(); ++j ) this->SetData( i, j, rVal ); } /*------------------------------------------------------------------------------*/ /** * Name : GW_MatrixNxP::Randomize * * \param rMin minimum value * \param rMax maximum value * \author <NAME> 2001-09-19 */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::Randomize(GW_Float rMin = 0, GW_Float rMax = 1) { GW_ASSERT( this->GetNbrRows()>0 && this->GetNbrCols()>0 ); for( GW_U32 i=0; i<this->GetNbrRows(); ++i ) for( GW_U32 j=0; j<this->GetNbrCols(); ++j ) this->SetData( i, j, rMin + GW_RAND*(rMax-rMin) ); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::LU /** * \param L [GW_MatrixNxP&] The \c L matrix. * \param U [GW_MatrixNxP&] The \c U matrix. * \param P [GW_VectorND&] Permutations of the columns. * \return [GW_Float] Determinant. * \author <NAME> * \date 5-31-2003 * * Perform an LU decomposition of the matrix. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::LU( GW_MatrixNxP& L, GW_MatrixNxP& U, GW_VectorND& P ) { JAMA::LU<GW_Float> lu( *this ); U = (GW_MatrixNxP&) lu.getU(); L = (GW_MatrixNxP&) lu.getL(); P = (GW_VectorND&) lu.getPivot(); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::LUSolve /** * \param x [GW_VectorND&] Solution. * \param b [GW_VectorND&] RHS * \return [GW_Bool] Is the system inversible ? * \author <NAME> * \date 5-31-2003 * * Solve a linear system Ax=b with LU decomposition. */ /*------------------------------------------------------------------------------*/ GW_Bool GW_MatrixNxP::LUSolve( GW_VectorND& x, const GW_VectorND& b ) { JAMA::LU<GW_Float> lu( *this ); if( lu.isNonsingular() ) { x = (GW_VectorND&) lu.solve(b); return x.dim()!=0; } else return GW_False; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::Cholesky /** * \param L [GW_MatrixNxP&] The result, lower triangular matrix. * \return [GW_Bool] \c true if the decomposition was a success, \c false if the matrix is not * symmetric definite positive. * \author <NAME> * \date 5-31-2003 * * Perform the Cholesky decomposition of the matrix M =AA^* */ /*------------------------------------------------------------------------------*/ GW_Bool GW_MatrixNxP::Cholesky( GW_MatrixNxP& L ) { JAMA::Cholesky<GW_Float> chol( *this ); L = (GW_MatrixNxP&) chol.getL(); return chol.is_spd()==1; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::CholeskySolve /** * \param x [GW_VectorND&] Solution. * \param b [GW_VectorND&] RHS. * \return [GW_Bool] Was the inversion a success ? * \author <NAME> * \date 5-31-2003 * * Solve using Cholesky. */ /*------------------------------------------------------------------------------*/ GW_Bool GW_MatrixNxP::CholeskySolve( GW_VectorND& x, const GW_VectorND& b ) { JAMA::Cholesky<GW_Float> chol( *this ); if( chol.is_spd() ) { x = (GW_VectorND&) chol.solve( b ); return x.dim()!=0; } else return GW_False; } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::QR /** * \param Q [GW_MatrixNxP&] The Q matrix. * \param R [GW_MatrixNxP&] The R matrix. * \author <NAME> * \date 5-31-2003 * * Perform QR decomposition. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::QR( GW_MatrixNxP& Q, GW_MatrixNxP& R ) { JAMA::QR<GW_Float> qr( *this ); Q = (GW_MatrixNxP&) qr.getQ(); R = (GW_MatrixNxP&) qr.getR(); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::QRSolve /** * \param x [GW_VectorND&] solution. * \param b [GW_VectorND&] RHS. * \return [GW_Bool] Was the process successful ? * \author <NAME> * \date 5-31-2003 * * Solve a linear system using QR decomposition. */ /*------------------------------------------------------------------------------*/ GW_Bool GW_MatrixNxP::QRSolve( GW_VectorND& x, const GW_VectorND& b ) { JAMA::QR<GW_Float> qr( *this ); if( !qr.isFullRank() ) return GW_False; else { x = (GW_VectorND&) qr.solve(b); return x.dim()!=0; } } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::Eigenvalue /** * \param V [GW_MatrixNxP&] The change of basis matrix. * \param pD [GW_MatrixNxP*] A block diagonal matrix (diagonal if eigenvalues are real). * \param pRealEig [GW_VectorND*] The real part of the eigenvalues. * \param pImagEig [GW_VectorND*] The imaginary part of the eigenvalues. * \author <NAME> * \date 5-31-2003 * * Perform eigen-decomposition A = V D V^*. */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::Eigenvalue( GW_MatrixNxP& V, GW_MatrixNxP* pD, GW_VectorND* pRealEig, GW_VectorND* pImagEig ) { JAMA::Eigenvalue<GW_Float> eig( *this ); eig.getV(V); if( pD!=NULL ) eig.getD(*pD); if( pRealEig!=NULL ) eig.getRealEigenvalues(*pRealEig); if( pImagEig!=NULL ) eig.getImagEigenvalues(*pImagEig); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::SVD /** * \param U [GW_MatrixNxP&] U orthogonal matrix * \param V [GW_MatrixNxP&] the right singular vectors. * \param pSingV [GW_VectorND*] The singular values. * \param pS [GW_MatrixNxP*] Diagonal matrix of singular values. * \author <NAME> * \date 5-31-2003 * * Compute SVD decomposition, ie A */ /*------------------------------------------------------------------------------*/ void GW_MatrixNxP::SVD( GW_MatrixNxP& U, GW_MatrixNxP& V, GW_VectorND* pSingV, GW_MatrixNxP* pS ) { JAMA::SVD<GW_Float> svd( *this ); svd.getU( U ); svd.getV( V ); if( pSingV!=NULL ) svd.getSingularValues( *pSingV ); if( pS!=NULL ) svd.getS( *pS ); } /*------------------------------------------------------------------------------*/ // Name : GW_MatrixNxP::TestClass /** * \author <NAME> * \date 6-1-2003 * * Test the class. */ /*------------------------------------------------------------------------------*/ static void GW_MatrixNxP::TestClass(std::ostream &s = cout) { TestClassHeader("GW_MatrixNxP", s); const GW_U32 n = 50; GW_MatrixNxP m(n,n); m.Randomize(); GW_VectorND v(n), x(n), b(n); v.Randomize(); b.Randomize(); m.LUSolve( x, b ); GW_Float err = ( m*x-b ).Norm2(); GW_ASSERT( err<GW_EPSILON ); /* turn m into a symmetric matrix */ m = m*m.Transpose(); GW_MatrixNxP Vmat(n,n), Dmat(n,n); GW_VectorND RealEig, ImagEig; m.Eigenvalue( Vmat,&Dmat, &RealEig, &ImagEig ); GW_Float dotp = GW_VectorND(n,Vmat[0])*GW_VectorND(n,Vmat[1]); GW_ASSERT( GW_ABS(dotp)<GW_EPSILON ); dotp = GW_VectorND(n,Vmat[0])*GW_VectorND(n,Vmat[1]); GW_ASSERT( GW_ABS(dotp)<GW_EPSILON ); dotp = GW_VectorND(n,Vmat[1])*GW_VectorND(n,Vmat[2]); GW_ASSERT( GW_ABS(dotp)<GW_EPSILON ); dotp = GW_VectorND(n,Vmat[2])*GW_VectorND(n,Vmat[3]); GW_ASSERT( GW_ABS(dotp)<GW_EPSILON ); TestClassFooter("GW_MatrixNxP", s); } private: }; inline std::ostream& operator<<(std::ostream &s, GW_MatrixNxP& m) { s << "GW_MatrixNxP : " << endl; for( GW_U32 i=0; i<m.GetNbrRows(); ++i ) { cout << "|"; for( GW_U32 j=0; j<m.GetNbrCols(); ++j ) { s << m.GetData(i,j); if( j!=m.GetNbrCols()-1 ) s << " "; } s << "|"; if( i!=m.GetNbrRows()-1 ) s << endl; } return s; } } // End namespace GW #endif // _GW_MATRIXNXP_H_ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) <NAME> /////////////////////////////////////////////////////////////////////////////// // END OF FILE // ///////////////////////////////////////////////////////////////////////////////
11,017
372
import numpy as np import cv2 def horizontalFlip(image, planes, segmentation, depth, metadata): image = image[:, ::-1] depth = depth[:, ::-1] segmentation = segmentation[:, ::-1] metadata[2] = image.shape[1] - metadata[2] if len(planes) > 0: planes[:, 0] *= -1 pass return image, planes, segmentation, depth, metadata def cropPatch(box, imageSizes, image, planes, segmentation, depth, metadata): mins, ranges = box image = cv2.resize(image[mins[1]:mins[1] + ranges[1], mins[0]:mins[0] + ranges[0]], (imageSizes[0], imageSizes[1])) depth = cv2.resize(depth[mins[1]:mins[1] + ranges[1], mins[0]:mins[0] + ranges[0]], (imageSizes[0], imageSizes[1])) segmentation = cv2.resize(segmentation[mins[1]:mins[1] + ranges[1], mins[0]:mins[0] + ranges[0]], (imageSizes[0], imageSizes[1]), interpolation=cv2.INTER_NEAREST) metadata[0] *= float(imageSizes[0]) / ranges[0] metadata[1] *= float(imageSizes[1]) / ranges[1] metadata[2] = (metadata[2] - mins[0]) * float(imageSizes[0]) / ranges[0] metadata[3] = (metadata[3] - mins[1]) * float(imageSizes[1]) / ranges[1] metadata[4] = imageSizes[0] metadata[5] = imageSizes[1] return image, planes, segmentation, depth, metadata
518
487
// Copyright 2017-2020 The Verible Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Implementation of matcher.h #include "common/analysis/matcher/matcher.h" #include <optional> #include <vector> #include "common/analysis/matcher/bound_symbol_manager.h" #include "common/text/symbol.h" namespace verible { namespace matcher { bool Matcher::Matches(const Symbol& symbol, BoundSymbolManager* manager) const { if (predicate_(symbol)) { // If this matcher matches (as in, predicate succeeds), test inner matchers // to see if they also match. // Get set of symbols to try inner matchers on. auto next_targets = transformer_(symbol); // If we failed to fnd any next targets, we can't proceed. if (next_targets.empty()) return false; // If any target matches, this is set to true. bool any_target_matches = false; // TODO(jeremycs): add branching match groups here // Try to match inner matches to every target symbol. for (const auto& target_symbol : next_targets) { if (!target_symbol) continue; bool inner_match_result = inner_match_handler_(*target_symbol, inner_matchers_, manager); if (inner_match_result && manager && bind_id_) manager->BindSymbol(bind_id_.value(), target_symbol); any_target_matches |= inner_match_result; } return any_target_matches; } return false; } } // namespace matcher } // namespace verible
625
778
<filename>applications/DEMApplication/custom_utilities/mesh_to_clu_converter.cpp // Translated to C++ from the original work in FORTRAN by <NAME>, 2016 #include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <cmath> void Diagonalize(const double (&A)[3][3], double (&Q)[3][3], double (&D)[3][3]); int main() { // Import the mesh (.msh) and spheres (.sph) files containing the cluster information std::ifstream infile("file_name.msh"); std::ifstream infilesph("file_name.sph"); std::string line, linesph; infile.ignore(80,'\n'); infile.ignore(80,'\n'); // Check the number of nodes (NUM_OF_NODES) and the number of elements (NUM_OF_ELEMENTS) int node_counter = 0; while (std::getline(infile, line)) { std::istringstream iss(line); int a; double b, c, d, e; if (iss >> a >> b >> c >> d) { node_counter++; } else break; } std::cout << "\nNumber of nodes: " << node_counter << '\n'; infile.ignore(80,'\n'); infile.ignore(80,'\n'); int element_counter = 0; while (std::getline(infile, line)) { std::istringstream iss(line); int a; double b, c, d, e; if (iss >> a >> b >> c >> d >> e) { element_counter++; } else break; } std::cout << "Number of elements: " << element_counter << '\n'; int spheres_counter = 0; while (std::getline(infilesph, linesph)) { std::istringstream iss(linesph); double Xcoord, Ycoord, Zcoord, Rad; if (iss >> Xcoord >> Ycoord >> Zcoord >> Rad) { spheres_counter++; } else break; } std::cout << "Number of spheres: " << spheres_counter << '\n'; infile.seekg(0, std::ios::beg); infile.ignore(80,'\n'); infile.ignore(80,'\n'); const int NUM_OF_NODES = node_counter; const int NUM_OF_ELEMENTS = element_counter; const double density = 1; double* tcoord = new double[3*NUM_OF_NODES]; int* Nconec = new int[4*NUM_OF_ELEMENTS]; double* Vnerc = new double[9*NUM_OF_ELEMENTS]; double* Volum = new double[NUM_OF_ELEMENTS]; double* Vmass = new double[NUM_OF_ELEMENTS]; double* BARIC = new double[3*NUM_OF_ELEMENTS]; double* Local = new double[3*NUM_OF_ELEMENTS]; double VNERT[9]; double I[3][3]; double Q[3][3]; double D[3][3]; node_counter = 0; while (std::getline(infile, line)) { std::istringstream iss(line); int a; double b, c, d, e; if (iss >> a >> b >> c >> d) { tcoord[node_counter * 3 + 0] = b; tcoord[node_counter * 3 + 1] = c; tcoord[node_counter * 3 + 2] = d; node_counter++; } else break; } infile.ignore(80,'\n'); infile.ignore(80,'\n'); element_counter = 0; while (std::getline(infile, line)) { std::istringstream iss(line); int a; double b, c, d, e; if (iss >> a >> b >> c >> d >> e) { Nconec[element_counter * 4 + 0] = b; Nconec[element_counter * 4 + 1] = c; Nconec[element_counter * 4 + 2] = d; Nconec[element_counter * 4 + 3] = e; element_counter++; } else break; } infilesph.clear(); infilesph.seekg(0, std::ios::beg); const int NUM_OF_SPHERES = spheres_counter; double* sphcoord = new double[3*NUM_OF_SPHERES]; double sphrad[NUM_OF_SPHERES]; spheres_counter = 0; while (std::getline(infilesph, linesph)) { std::istringstream iss(linesph); double Xcoord, Ycoord, Zcoord, Rad; if (iss >> Xcoord >> Ycoord >> Zcoord >> Rad) { sphcoord[spheres_counter * 3 + 0] = Xcoord; sphcoord[spheres_counter * 3 + 1] = Ycoord; sphcoord[spheres_counter * 3 + 2] = Zcoord; sphrad[spheres_counter] = Rad; spheres_counter++; } else break; } double total_volume = 0.0; for (int element_counter = 0; element_counter < NUM_OF_ELEMENTS; element_counter++) { int NodeA=Nconec[element_counter * 4 + 0]; int NodeB=Nconec[element_counter * 4 + 1]; int NodeC=Nconec[element_counter * 4 + 2]; int NodeD=Nconec[element_counter * 4 + 3]; double ValU1=tcoord[(NodeB-1) * 3 + 0] - tcoord[(NodeA-1) * 3 + 0]; double ValU2=tcoord[(NodeB-1) * 3 + 1] - tcoord[(NodeA-1) * 3 + 1]; double ValU3=tcoord[(NodeB-1) * 3 + 2] - tcoord[(NodeA-1) * 3 + 2]; double ValV1=tcoord[(NodeC-1) * 3 + 0] - tcoord[(NodeA-1) * 3 + 0]; double ValV2=tcoord[(NodeC-1) * 3 + 1] - tcoord[(NodeA-1) * 3 + 1]; double ValV3=tcoord[(NodeC-1) * 3 + 2] - tcoord[(NodeA-1) * 3 + 2]; double ValW1=tcoord[(NodeD-1) * 3 + 0] - tcoord[(NodeA-1) * 3 + 0]; double ValW2=tcoord[(NodeD-1) * 3 + 1] - tcoord[(NodeA-1) * 3 + 1]; double ValW3=tcoord[(NodeD-1) * 3 + 2] - tcoord[(NodeA-1) * 3 + 2]; double Volu0= ValU1*ValV2*ValW3+ValU2*ValV3*ValW1+ValU3*ValW2*ValV1-ValU3*ValV2*ValW1-ValU2*ValV1*ValW3-ValU1*ValW2*ValV3; Volum[element_counter]=Volu0/6; total_volume += Volum[element_counter]; Vmass[element_counter] = Volum[element_counter]*density; // Calculate the barycentre of each tetrahedron BARIC[element_counter * 3 + 0]= (tcoord[(NodeA-1) * 3 + 0]+tcoord[(NodeB-1) * 3 + 0]+tcoord[(NodeC-1) * 3 + 0]+tcoord[(NodeD-1) * 3 + 0])/4; BARIC[element_counter * 3 + 1]= (tcoord[(NodeA-1) * 3 + 1]+tcoord[(NodeB-1) * 3 + 1]+tcoord[(NodeC-1) * 3 + 1]+tcoord[(NodeD-1) * 3 + 1])/4; BARIC[element_counter * 3 + 2]= (tcoord[(NodeA-1) * 3 + 2]+tcoord[(NodeB-1) * 3 + 2]+tcoord[(NodeC-1) * 3 + 2]+tcoord[(NodeD-1) * 3 + 2])/4; } std::cout << "\nTotal volume: " << total_volume << '\n'; // Calculate the total mass of the cluster double Vmaspiedra=0.0; for (int element_counter = 0; element_counter < NUM_OF_ELEMENTS; element_counter++) { Vmaspiedra+=Vmass[element_counter]; } std::cout << "Total mass: " << Vmaspiedra << '\n'; // Calculate the cluster's centre of gravity double Valor1=0.0; double Valor2=0.0; double Valor3=0.0; for (int element_counter = 0; element_counter < NUM_OF_ELEMENTS; element_counter++) { Valor1+=Vmass[element_counter]*BARIC[element_counter * 3 + 0]; Valor2+=Vmass[element_counter]*BARIC[element_counter * 3 + 1]; Valor3+=Vmass[element_counter]*BARIC[element_counter * 3 + 2]; } double Xcdgrav=Valor1/Vmaspiedra; double Ycdgrav=Valor2/Vmaspiedra; double Zcdgrav=Valor3/Vmaspiedra; std::cout << "Centroid: " << Xcdgrav << " " << Ycdgrav << " " << Zcdgrav << "\n\n"; // Move the object so that its centre of gravity coincides with the origin for (int node_counter = 0; node_counter < NUM_OF_NODES; node_counter++) { tcoord[node_counter * 3 + 0] -= Xcdgrav; tcoord[node_counter * 3 + 1] -= Ycdgrav; tcoord[node_counter * 3 + 2] -= Zcdgrav; } // Move the spheres accordingly for (int spheres_counter = 0; spheres_counter < NUM_OF_SPHERES; spheres_counter++) { sphcoord[spheres_counter * 3 + 0] -= Xcdgrav; sphcoord[spheres_counter * 3 + 1] -= Ycdgrav; sphcoord[spheres_counter * 3 + 2] -= Zcdgrav; } // Calculate the inertia tensor of each tetrahedron with resct to the centre of gravity of the cluster for (int element_counter = 0; element_counter < NUM_OF_ELEMENTS; element_counter++) { Local[element_counter * 3 + 0]= BARIC[element_counter * 3 + 0]-Xcdgrav; Local[element_counter * 3 + 1]= BARIC[element_counter * 3 + 1]-Ycdgrav; Local[element_counter * 3 + 2]= BARIC[element_counter * 3 + 2]-Zcdgrav; Vnerc[element_counter * 9 + 0]= Vmass[element_counter]*(Local[element_counter * 3 + 1]*Local[element_counter * 3 + 1]+Local[element_counter * 3 + 2]*Local[element_counter * 3 + 2]); Vnerc[element_counter * 9 + 1]= -Vmass[element_counter]*Local[element_counter * 3 + 0]*Local[element_counter * 3 + 1]; Vnerc[element_counter * 9 + 2]= -Vmass[element_counter]*Local[element_counter * 3 + 0]*Local[element_counter * 3 + 2]; Vnerc[element_counter * 9 + 3]= -Vmass[element_counter]*Local[element_counter * 3 + 1]*Local[element_counter * 3 + 0]; Vnerc[element_counter * 9 + 4]= Vmass[element_counter]*(Local[element_counter * 3 + 0]*Local[element_counter * 3 + 0]+Local[element_counter * 3 + 2]*Local[element_counter * 3 + 2]); Vnerc[element_counter * 9 + 5]= -Vmass[element_counter]*Local[element_counter * 3 + 1]*Local[element_counter * 3 + 2]; Vnerc[element_counter * 9 + 6]= -Vmass[element_counter]*Local[element_counter * 3 + 2]*Local[element_counter * 3 + 0]; Vnerc[element_counter * 9 + 7]= -Vmass[element_counter]*Local[element_counter * 3 + 2]*Local[element_counter * 3 + 1]; Vnerc[element_counter * 9 + 8]= Vmass[element_counter]*(Local[element_counter * 3 + 0]*Local[element_counter * 3 + 0]+Local[element_counter * 3 + 1]*Local[element_counter * 3 + 1]); } for (int i = 0; i < 9; i++) VNERT[i]=0.0; // Calculate the whole inertia tensor for (int element_counter = 0; element_counter < NUM_OF_ELEMENTS; element_counter++) { VNERT[0]+=Vnerc[element_counter * 9 + 0]; VNERT[1]+=Vnerc[element_counter * 9 + 1]; VNERT[2]+=Vnerc[element_counter * 9 + 2]; VNERT[3]+=Vnerc[element_counter * 9 + 3]; VNERT[4]+=Vnerc[element_counter * 9 + 4]; VNERT[5]+=Vnerc[element_counter * 9 + 5]; VNERT[6]+=Vnerc[element_counter * 9 + 6]; VNERT[7]+=Vnerc[element_counter * 9 + 7]; VNERT[8]+=Vnerc[element_counter * 9 + 8]; } // Calculate the inertias per unit of mass Queremos las inercias por unidad de masa, así que dividimos las inercias por la masa total=total_volume*density (density = 1, no la ponemos en la fórmula) std::cout << "Inertias: " << VNERT[0]/total_volume << " " << VNERT[1]/total_volume << " " << VNERT[2]/total_volume << '\n'; std::cout << "Inertias: " << VNERT[3]/total_volume << " " << VNERT[4]/total_volume << " " << VNERT[5]/total_volume << '\n'; std::cout << "Inertias: " << VNERT[6]/total_volume << " " << VNERT[7]/total_volume << " " << VNERT[8]/total_volume << "\n\n"; I[0][0] = VNERT[0]/total_volume; I[0][1] = VNERT[1]/total_volume; I[0][2] = VNERT[2]/total_volume; I[1][0] = VNERT[3]/total_volume; I[1][1] = VNERT[4]/total_volume; I[1][2] = VNERT[5]/total_volume; I[2][0] = VNERT[6]/total_volume; I[2][1] = VNERT[7]/total_volume; I[2][2] = VNERT[8]/total_volume; Diagonalize(I, Q, D); std::cout << "Eigenvectors: " << Q[0][0] << " " << Q[0][1] << " " << Q[0][2] << '\n'; std::cout << "Eigenvectors: " << Q[1][0] << " " << Q[1][1] << " " << Q[1][2] << '\n'; std::cout << "Eigenvectors: " << Q[2][0] << " " << Q[2][1] << " " << Q[2][2] << "\n\n"; std::cout << "Eigenvalues: " << D[0][0] << " " << D[0][1] << " " << D[0][2] << '\n'; std::cout << "Eigenvalues: " << D[1][0] << " " << D[1][1] << " " << D[1][2] << '\n'; std::cout << "Eigenvalues: " << D[2][0] << " " << D[2][1] << " " << D[2][2] << "\n\n"; // Rotate the object and place it parallel to its principal axis of inertia for (int node_counter = 0; node_counter < NUM_OF_NODES; node_counter++) { double temporal_array[3][1]; temporal_array[0][0] = Q[0][0] * tcoord[node_counter * 3 + 0] + Q[1][0] * tcoord[node_counter * 3 + 0] + Q[2][0] * tcoord[node_counter * 3 + 0]; temporal_array[1][0] = Q[0][1] * tcoord[node_counter * 3 + 1] + Q[1][1] * tcoord[node_counter * 3 + 1] + Q[2][1] * tcoord[node_counter * 3 + 1]; temporal_array[2][0] = Q[0][2] * tcoord[node_counter * 3 + 2] + Q[1][2] * tcoord[node_counter * 3 + 2] + Q[2][2] * tcoord[node_counter * 3 + 2]; tcoord[node_counter * 3 + 0] = temporal_array[0][0]; tcoord[node_counter * 3 + 1] = temporal_array[1][0]; tcoord[node_counter * 3 + 2] = temporal_array[2][0]; } // Rotate the spheres accordingly for (int spheres_counter = 0; spheres_counter < NUM_OF_SPHERES; spheres_counter++) { double temporal_array_sph[3][1]; temporal_array_sph[0][0] = Q[0][0] * sphcoord[spheres_counter * 3 + 0] + Q[1][0] * sphcoord[spheres_counter * 3 + 1] + Q[2][0] * sphcoord[spheres_counter * 3 + 2]; temporal_array_sph[1][0] = Q[0][1] * sphcoord[spheres_counter * 3 + 0] + Q[1][1] * sphcoord[spheres_counter * 3 + 1] + Q[2][1] * sphcoord[spheres_counter * 3 + 2]; temporal_array_sph[2][0] = Q[0][2] * sphcoord[spheres_counter * 3 + 0] + Q[1][2] * sphcoord[spheres_counter * 3 + 1] + Q[2][2] * sphcoord[spheres_counter * 3 + 2]; sphcoord[spheres_counter * 3 + 0] = temporal_array_sph[0][0]; sphcoord[spheres_counter * 3 + 1] = temporal_array_sph[1][0]; sphcoord[spheres_counter * 3 + 2] = temporal_array_sph[2][0]; } // Calculate the smallest sphere that circumscribe the cluster (necessary for the cluster mesher) double Distance, CenterX, CenterY, CenterZ, Radius = 0.0; int extreme_sphere_1, extreme_sphere_2; std::vector<int> extreme_sphere; for (int spheres_counter_1 = 0; spheres_counter_1 < NUM_OF_SPHERES; spheres_counter_1++) { for (int spheres_counter_2 = 0; spheres_counter_2 < NUM_OF_SPHERES; spheres_counter_2++) { if (spheres_counter_2 < spheres_counter_1) { Distance = sqrt((sphcoord[spheres_counter_2 * 3 + 0] - sphcoord[spheres_counter_1 * 3 + 0]) * (sphcoord[spheres_counter_2 * 3 + 0] - sphcoord[spheres_counter_1 * 3 + 0]) + (sphcoord[spheres_counter_2 * 3 + 1] - sphcoord[spheres_counter_1 * 3 + 1]) * (sphcoord[spheres_counter_2 * 3 + 1] - sphcoord[spheres_counter_1 * 3 + 1]) + (sphcoord[spheres_counter_2 * 3 + 2] - sphcoord[spheres_counter_1 * 3 + 2]) * (sphcoord[spheres_counter_2 * 3 + 2] - sphcoord[spheres_counter_1 * 3 + 2])) + sphrad[spheres_counter_2] + sphrad[spheres_counter_1]; if (Distance > 2 * Radius) { Radius = 0.5 * Distance; extreme_sphere_1 = spheres_counter_1; extreme_sphere_2 = spheres_counter_2; } } } } extreme_sphere.push_back(extreme_sphere_1); extreme_sphere.push_back(extreme_sphere_2); double SphDistance[3]; SphDistance[0] = sphcoord[extreme_sphere[1] * 3 + 0] - sphcoord[extreme_sphere[0] * 3 + 0]; SphDistance[1] = sphcoord[extreme_sphere[1] * 3 + 1] - sphcoord[extreme_sphere[0] * 3 + 1]; SphDistance[2] = sphcoord[extreme_sphere[1] * 3 + 2] - sphcoord[extreme_sphere[0] * 3 + 2]; double SphDistanceNorm = sqrt(SphDistance[0] * SphDistance[0] + SphDistance[1] * SphDistance[1] + SphDistance[2] * SphDistance[2]); double SphDistanceUnitVect[3]; SphDistanceUnitVect[0] = SphDistance[0] / SphDistanceNorm; SphDistanceUnitVect[1] = SphDistance[1] / SphDistanceNorm; SphDistanceUnitVect[2] = SphDistance[2] / SphDistanceNorm; CenterX = 0.5 * (sphcoord[extreme_sphere[0] * 3 + 0] - sphrad[extreme_sphere[0]] * SphDistanceUnitVect[0] + sphcoord[extreme_sphere[1] * 3 + 0] + sphrad[extreme_sphere[1]] * SphDistanceUnitVect[0]); CenterY = 0.5 * (sphcoord[extreme_sphere[0] * 3 + 1] - sphrad[extreme_sphere[0]] * SphDistanceUnitVect[1] + sphcoord[extreme_sphere[1] * 3 + 1] + sphrad[extreme_sphere[1]] * SphDistanceUnitVect[1]); CenterZ = 0.5 * (sphcoord[extreme_sphere[0] * 3 + 2] - sphrad[extreme_sphere[0]] * SphDistanceUnitVect[2] + sphcoord[extreme_sphere[1] * 3 + 2] + sphrad[extreme_sphere[1]] * SphDistanceUnitVect[2]); double CheckX, CheckY, CheckZ, TempRad; std::vector<double> extreme_radius; int sphere_counter_check = 0; double CheckDistance[3]; double CheckDistanceNorm; double CheckDistanceUnitVect[3]; double CheckRadius[3]; double CheckRadiusNorm; double CheckRadiusUnitVect[3]; while (sphere_counter_check < (NUM_OF_SPHERES)) { //CHECK that all nodes are inside the big sphere CheckDistance[0] = sphcoord[sphere_counter_check * 3 + 0] - CenterX; CheckDistance[1] = sphcoord[sphere_counter_check * 3 + 1] - CenterY; CheckDistance[2] = sphcoord[sphere_counter_check * 3 + 2] - CenterZ; CheckDistanceNorm = sqrt(CheckDistance[0] * CheckDistance[0] + CheckDistance[1] * CheckDistance[1] + CheckDistance[2] * CheckDistance[2]); CheckDistanceUnitVect[0] = CheckDistance[0] / CheckDistanceNorm; CheckDistanceUnitVect[1] = CheckDistance[1] / CheckDistanceNorm; CheckDistanceUnitVect[2] = CheckDistance[2] / CheckDistanceNorm; CheckX = sphcoord[sphere_counter_check * 3 + 0] + sphrad[sphere_counter_check] * CheckDistanceUnitVect[0] - CenterX; CheckY = sphcoord[sphere_counter_check * 3 + 1] + sphrad[sphere_counter_check] * CheckDistanceUnitVect[1] - CenterY; CheckZ = sphcoord[sphere_counter_check * 3 + 2] + sphrad[sphere_counter_check] * CheckDistanceUnitVect[2] - CenterZ; TempRad = sqrt(CheckX * CheckX + CheckY * CheckY + CheckZ * CheckZ); if (TempRad - Radius > 1.0e-15) { extreme_sphere.push_back(sphere_counter_check); CenterX = CenterX + CheckX - (Radius * (CheckX/TempRad)); CenterY = CenterY + CheckY - (Radius * (CheckY/TempRad)); CenterZ = CenterZ + CheckZ - (Radius * (CheckZ/TempRad)); extreme_radius.clear(); for(int i = 0; i < extreme_sphere.size(); i++) { CheckRadius[0] = sphcoord[sphere_counter_check * 3 + 0] - CenterX; CheckRadius[1] = sphcoord[sphere_counter_check * 3 + 1] - CenterY; CheckRadius[2] = sphcoord[sphere_counter_check * 3 + 2] - CenterZ; CheckRadiusNorm = sqrt(CheckRadius[0] * CheckRadius[0] + CheckRadius[1] * CheckRadius[1] + CheckRadius[2] * CheckRadius[2]); CheckRadiusUnitVect[0] = CheckRadius[0] / CheckRadiusNorm; CheckRadiusUnitVect[1] = CheckRadius[1] / CheckRadiusNorm; CheckRadiusUnitVect[2] = CheckRadius[2] / CheckRadiusNorm; extreme_radius.push_back(sqrt((sphcoord[extreme_sphere[i] * 3 + 0] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[0] - CenterX) * (sphcoord[extreme_sphere[i] * 3 + 0] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[0] - CenterX) + (sphcoord[extreme_sphere[i] * 3 + 1] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[1] - CenterX) * (sphcoord[extreme_sphere[i] * 3 + 1] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[1] - CenterX) + (sphcoord[extreme_sphere[i] * 3 + 2] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[2] - CenterX) * (sphcoord[extreme_sphere[i] * 3 + 2] + sphrad[extreme_sphere[i]] * CheckRadiusUnitVect[2] - CenterX))); } for(int i = 0; i < extreme_radius.size(); i++) { if (extreme_radius[i] > Radius) { Radius = extreme_radius[i]; } } sphere_counter_check = 0; } else { sphere_counter_check++; } } double diameter = 2 * Radius; double characteristic_size = 2 * std::pow(3 * total_volume / (4 * M_PI), 1/3.); std::cout << "\nThe diameter is: " << diameter << "\n\n"; std::cout << "\nThe characteristic size is: " << characteristic_size << "\n\n"; std::cout << "\nThe size ratio is: " << diameter/characteristic_size << "\n\n"; // Create the cluster (.clu) file std::ofstream outputfile("file_name.clu", std::ios_base::out); outputfile << "//\n// Cluster Name: \"Cluster name\"\n"; outputfile << "// Author: Author Name\n"; outputfile << "// Date: YYYY-MM-DD\n//\n\n"; outputfile << "Name\nCluster name\n\nBegin centers_and_radii\n"; for (int spheres_counter = 0; spheres_counter < NUM_OF_SPHERES; spheres_counter++) { outputfile << sphcoord[spheres_counter * 3 + 0] << " " << sphcoord[spheres_counter * 3 + 1] << " " << sphcoord[spheres_counter * 3 + 2] << " " << sphrad[spheres_counter] << '\n'; } outputfile << "End centers_and_radii\n\n"; outputfile << "Particle_center_and_diameter\n" << CenterX << " " << CenterY << " " << CenterZ << " " << diameter << "\n\n"; outputfile << "Size\n" << diameter << "\n\n" << "Volume\n" << total_volume << "\n\n"; outputfile << "Inertia per unit mass\n" << D[0][0] << '\n' << D[1][1] << '\n' << D[2][2] << '\n'; outputfile.close(); delete[] tcoord; delete[] Nconec; delete[] Vnerc; delete[] Volum; delete[] Vmass; delete[] BARIC; delete[] Local; delete[] sphcoord; } // Slightly modified version of Stan Melax's code for 3x3 matrix diagonalization // source: http://www.melax.com/diag.html?attredirects=0 void Diagonalize(const double (&A)[3][3], double (&Q)[3][3], double (&D)[3][3]) { // 'A' must be a symmetric matrix. // Returns Q and D such that diagonal matrix D = QT * A * Q; and A = Q*D*QT const int maxsteps=24; // certainly won't need that many. int k0, k1, k2; double o[3], m[3]; double q [4] = {0.0,0.0,0.0,1.0}; double jr[4]; double sqw, sqx, sqy, sqz; double tmp1, tmp2, mq; double AQ[3][3]; double thet, sgn, t, c; for (int i = 0; i < maxsteps; ++i) { // quat to matrix sqx = q[0]*q[0]; sqy = q[1]*q[1]; sqz = q[2]*q[2]; sqw = q[3]*q[3]; Q[0][0] = ( sqx - sqy - sqz + sqw); Q[1][1] = (-sqx + sqy - sqz + sqw); Q[2][2] = (-sqx - sqy + sqz + sqw); tmp1 = q[0]*q[1]; tmp2 = q[2]*q[3]; Q[1][0] = 2.0 * (tmp1 + tmp2); Q[0][1] = 2.0 * (tmp1 - tmp2); tmp1 = q[0]*q[2]; tmp2 = q[1]*q[3]; Q[2][0] = 2.0 * (tmp1 - tmp2); Q[0][2] = 2.0 * (tmp1 + tmp2); tmp1 = q[1]*q[2]; tmp2 = q[0]*q[3]; Q[2][1] = 2.0 * (tmp1 + tmp2); Q[1][2] = 2.0 * (tmp1 - tmp2); // AQ = A * Q AQ[0][0] = Q[0][0]*A[0][0]+Q[1][0]*A[0][1]+Q[2][0]*A[0][2]; AQ[0][1] = Q[0][1]*A[0][0]+Q[1][1]*A[0][1]+Q[2][1]*A[0][2]; AQ[0][2] = Q[0][2]*A[0][0]+Q[1][2]*A[0][1]+Q[2][2]*A[0][2]; AQ[1][0] = Q[0][0]*A[0][1]+Q[1][0]*A[1][1]+Q[2][0]*A[1][2]; AQ[1][1] = Q[0][1]*A[0][1]+Q[1][1]*A[1][1]+Q[2][1]*A[1][2]; AQ[1][2] = Q[0][2]*A[0][1]+Q[1][2]*A[1][1]+Q[2][2]*A[1][2]; AQ[2][0] = Q[0][0]*A[0][2]+Q[1][0]*A[1][2]+Q[2][0]*A[2][2]; AQ[2][1] = Q[0][1]*A[0][2]+Q[1][1]*A[1][2]+Q[2][1]*A[2][2]; AQ[2][2] = Q[0][2]*A[0][2]+Q[1][2]*A[1][2]+Q[2][2]*A[2][2]; // D = Qt * AQ D[0][0] = AQ[0][0]*Q[0][0]+AQ[1][0]*Q[1][0]+AQ[2][0]*Q[2][0]; D[0][1] = AQ[0][0]*Q[0][1]+AQ[1][0]*Q[1][1]+AQ[2][0]*Q[2][1]; D[0][2] = AQ[0][0]*Q[0][2]+AQ[1][0]*Q[1][2]+AQ[2][0]*Q[2][2]; D[1][0] = AQ[0][1]*Q[0][0]+AQ[1][1]*Q[1][0]+AQ[2][1]*Q[2][0]; D[1][1] = AQ[0][1]*Q[0][1]+AQ[1][1]*Q[1][1]+AQ[2][1]*Q[2][1]; D[1][2] = AQ[0][1]*Q[0][2]+AQ[1][1]*Q[1][2]+AQ[2][1]*Q[2][2]; D[2][0] = AQ[0][2]*Q[0][0]+AQ[1][2]*Q[1][0]+AQ[2][2]*Q[2][0]; D[2][1] = AQ[0][2]*Q[0][1]+AQ[1][2]*Q[1][1]+AQ[2][2]*Q[2][1]; D[2][2] = AQ[0][2]*Q[0][2]+AQ[1][2]*Q[1][2]+AQ[2][2]*Q[2][2]; o[0] = D[1][2]; o[1] = D[0][2]; o[2] = D[0][1]; m[0] = fabs(o[0]); m[1] = fabs(o[1]); m[2] = fabs(o[2]); k0 = (m[0] > m[1] && m[0] > m[2])?0: (m[1] > m[2])? 1 : 2; // index of largest element of offdiag k1 = (k0+1)%3; k2 = (k0+2)%3; if (o[k0] == 0.0) break; // Diagonal already thet = (D[k2][k2]-D[k1][k1])/(2.0*o[k0]); sgn = (thet > 0.0)?1.0:-1.0; thet *= sgn; // make it positive t = sgn /(thet +((thet < 1.E6)?sqrt(thet*thet+1.0):thet)) ; // sign(T)/(|T|+sqrt(T^2+1)) c = 1.0/sqrt(t*t+1.0); // c= 1/(t^2+1) , t=s/c if (c == 1.0) break; // No room for improvement, reached machine precision. jr[0 ] = jr[1] = jr[2] = jr[3] = 0.0; jr[k0] = sgn * sqrt((1.0-c)/2.0); // using 1/2 angle identity sin(a/2) = sqrt((1-cos(a))/2) jr[k0] *= -1.0; // since our quat-to-matrix convention was for v*M instead of M*v jr[3 ] = sqrt(1.0f - jr[k0] * jr[k0]); if (jr[3] == 1.0) break; // Reached limits of floating point precision q[0] = (q[3]*jr[0] + q[0]*jr[3] + q[1]*jr[2] - q[2]*jr[1]); q[1] = (q[3]*jr[1] - q[0]*jr[2] + q[1]*jr[3] + q[2]*jr[0]); q[2] = (q[3]*jr[2] + q[0]*jr[1] - q[1]*jr[0] + q[2]*jr[3]); q[3] = (q[3]*jr[3] - q[0]*jr[0] - q[1]*jr[1] - q[2]*jr[2]); mq = sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]); q[0] /= mq; q[1] /= mq; q[2] /= mq; q[3] /= mq; } }
12,681
723
#import <Foundation/Foundation.h> @class LRPackage; @class LRPackageType; @class LRPackageReference; // a set of specific package versions (only one version of a package can be included) @interface LRPackageSet : NSObject - (instancetype)initWithPackages:(NSArray *)packages; @property(nonatomic, readonly, copy) NSArray *packages; @property(nonatomic, readonly) LRPackage *primaryPackage; - (LRPackage *)packageNamed:(NSString *)name type:(LRPackageType *)type; - (LRPackage *)packageMatchingReference:(LRPackageReference *)reference; - (BOOL)matchesAllPackageReferencesInArray:(NSArray *)packageReferences; @end
183
1,755
/*========================================================================= Program: ParaView Module: vtkSelection.cxx Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkSelection.h" #include "vtkAbstractArray.h" #include "vtkFieldData.h" #include "vtkInformation.h" #include "vtkInformationIntegerKey.h" #include "vtkInformationIterator.h" #include "vtkInformationObjectBaseKey.h" #include "vtkInformationStringKey.h" #include "vtkInformationVector.h" #include "vtkNew.h" #include "vtkObjectFactory.h" #include "vtkSMPTools.h" #include "vtkSelectionNode.h" #include "vtkSignedCharArray.h" #include "vtkTable.h" #include <vtksys/RegularExpression.hxx> #include <vtksys/SystemTools.hxx> #include <atomic> #include <cassert> #include <cctype> #include <iterator> #include <map> #include <memory> #include <sstream> #include <string> #include <vector> namespace { // since certain compilers don't support std::to_string yet template <typename T> std::string convert_to_string(const T& val) { std::ostringstream str; str << val; return str.str(); } } //============================================================================ namespace parser { class Node { public: Node() = default; virtual ~Node() = default; virtual bool Evaluate(vtkIdType offset) const = 0; virtual void Print(ostream& os) const = 0; }; class NodeVariable : public Node { vtkSignedCharArray* Data; std::string Name; public: NodeVariable(vtkSignedCharArray* data, const std::string& name) : Data(data) , Name(name) { } bool Evaluate(vtkIdType offset) const override { assert(this->Data == nullptr || this->Data->GetNumberOfValues() > offset); return this->Data ? (this->Data->GetValue(offset) != 0) : false; } void Print(ostream& os) const override { os << this->Name; } }; class NodeNot : public Node { std::shared_ptr<Node> Child; public: NodeNot(const std::shared_ptr<Node>& node) : Child(node) { } bool Evaluate(vtkIdType offset) const override { assert(this->Child); return !this->Child->Evaluate(offset); } void Print(ostream& os) const override { os << "!"; this->Child->Print(os); } }; class NodeAnd : public Node { std::shared_ptr<Node> ChildA; std::shared_ptr<Node> ChildB; public: NodeAnd(const std::shared_ptr<Node>& nodeA, const std::shared_ptr<Node>& nodeB) : ChildA(nodeA) , ChildB(nodeB) { } bool Evaluate(vtkIdType offset) const override { assert(this->ChildA && this->ChildB); return this->ChildA->Evaluate(offset) && this->ChildB->Evaluate(offset); } void Print(ostream& os) const override { os << "("; this->ChildA->Print(os); os << " & "; this->ChildB->Print(os); os << ")"; } }; class NodeOr : public Node { std::shared_ptr<Node> ChildA; std::shared_ptr<Node> ChildB; public: NodeOr(const std::shared_ptr<Node>& nodeA, const std::shared_ptr<Node>& nodeB) : ChildA(nodeA) , ChildB(nodeB) { } bool Evaluate(vtkIdType offset) const override { assert(this->ChildA && this->ChildB); return this->ChildA->Evaluate(offset) || this->ChildB->Evaluate(offset); } void Print(ostream& os) const override { os << "("; this->ChildA->Print(os); os << " | "; this->ChildB->Print(os); os << ")"; } }; } // namespace parser //============================================================================ class vtkSelection::vtkInternals { // applies the operator on the "top" (aka back) of the op_stack to the // variables on the var_stack and pushes the result on the var_stack. bool ApplyBack( std::vector<char>& op_stack, std::vector<std::shared_ptr<parser::Node>>& var_stack) const { assert(!op_stack.empty()); if (op_stack.back() == '!') { if (var_stack.empty()) { // failed return false; } const auto a = var_stack.back(); var_stack.pop_back(); var_stack.push_back(std::make_shared<parser::NodeNot>(a)); // pop the applied operator. op_stack.pop_back(); return true; } else if (op_stack.back() == '|' || op_stack.back() == '&') { if (var_stack.size() < 2) { // failed! return false; } const auto b = var_stack.back(); var_stack.pop_back(); const auto a = var_stack.back(); var_stack.pop_back(); if (op_stack.back() == '|') { var_stack.push_back(std::make_shared<parser::NodeOr>(a, b)); } else { var_stack.push_back(std::make_shared<parser::NodeAnd>(a, b)); } // pop the applied operator. op_stack.pop_back(); return true; } return false; } // higher the value, higher the precedence. inline int precedence(char op) const { switch (op) { case '|': return -15; case '&': return -14; case '!': return -3; case '(': case ')': return -1; default: return -100; } } public: std::map<std::string, vtkSmartPointer<vtkSelectionNode>> Items; vtksys::RegularExpression RegExID; vtkInternals() : RegExID("^[a-zA-Z0-9]+$") { } std::shared_ptr<parser::Node> BuildExpressionTree( const std::string& expression, const std::map<std::string, vtkSignedCharArray*>& values_map) { // We don't use PEGTL since it does not support all supported compilers viz. // VS2013. std::string accumated_text; accumated_text.reserve(expression.size() + 64); std::vector<std::string> parts; for (auto ch : expression) { switch (ch) { case '(': case ')': case '|': case '&': case '!': if (!accumated_text.empty()) { parts.push_back(accumated_text); accumated_text.clear(); } parts.emplace_back(1, ch); break; default: if (std::isalnum(ch)) { accumated_text.push_back(ch); } break; } } if (!accumated_text.empty()) { parts.push_back(accumated_text); } std::vector<std::shared_ptr<parser::Node>> var_stack; std::vector<char> op_stack; for (const auto& term : parts) { if (term[0] == '(') { op_stack.push_back(term[0]); } else if (term[0] == ')') { // apply operators till we encounter the opening paren. while (!op_stack.empty() && op_stack.back() != '(' && this->ApplyBack(op_stack, var_stack)) { } if (op_stack.empty()) { // missing opening paren??? return nullptr; } assert(op_stack.back() == '('); // pop the opening paren. op_stack.pop_back(); } else if (term[0] == '&' || term[0] == '|' || term[0] == '!') { while (!op_stack.empty() && (precedence(term[0]) < precedence(op_stack.back())) && this->ApplyBack(op_stack, var_stack)) { } // push the boolean operator on stack to eval later. op_stack.push_back(term[0]); } else { auto iter = values_map.find(term); auto dataptr = iter != values_map.end() ? iter->second : nullptr; var_stack.push_back(std::make_shared<parser::NodeVariable>(dataptr, term)); } } while (!op_stack.empty() && this->ApplyBack(op_stack, var_stack)) { } return (op_stack.empty() && var_stack.size() == 1) ? var_stack.front() : nullptr; } }; //------------------------------------------------------------------------------ vtkStandardNewMacro(vtkSelection); //------------------------------------------------------------------------------ vtkSelection::vtkSelection() : Internals(new vtkSelection::vtkInternals()) { this->Information->Set(vtkDataObject::DATA_EXTENT_TYPE(), VTK_PIECES_EXTENT); this->Information->Set(vtkDataObject::DATA_PIECE_NUMBER(), -1); this->Information->Set(vtkDataObject::DATA_NUMBER_OF_PIECES(), 1); this->Information->Set(vtkDataObject::DATA_NUMBER_OF_GHOST_LEVELS(), 0); } //------------------------------------------------------------------------------ vtkSelection::~vtkSelection() { delete this->Internals; } //------------------------------------------------------------------------------ void vtkSelection::Initialize() { this->Superclass::Initialize(); this->RemoveAllNodes(); this->Expression.clear(); } //------------------------------------------------------------------------------ unsigned int vtkSelection::GetNumberOfNodes() const { return static_cast<unsigned int>(this->Internals->Items.size()); } //------------------------------------------------------------------------------ vtkSelectionNode* vtkSelection::GetNode(unsigned int idx) const { const vtkInternals& internals = (*this->Internals); if (static_cast<unsigned int>(internals.Items.size()) > idx) { auto iter = std::next(internals.Items.begin(), static_cast<int>(idx)); assert(iter != internals.Items.end()); return iter->second; } return nullptr; } //------------------------------------------------------------------------------ vtkSelectionNode* vtkSelection::GetNode(const std::string& name) const { const vtkInternals& internals = (*this->Internals); auto iter = internals.Items.find(name); if (iter != internals.Items.end()) { return iter->second; } return nullptr; } //------------------------------------------------------------------------------ std::string vtkSelection::AddNode(vtkSelectionNode* node) { if (!node) { return std::string(); } const vtkInternals& internals = (*this->Internals); // Make sure that node is not already added for (const auto& pair : internals.Items) { if (pair.second == node) { return pair.first; } } static std::atomic<uint64_t> counter(0U); std::string name = std::string("node") + convert_to_string(++counter); while (internals.Items.find(name) != internals.Items.end()) { name = std::string("node") + convert_to_string(++counter); } this->SetNode(name, node); return name; } //------------------------------------------------------------------------------ void vtkSelection::SetNode(const std::string& name, vtkSelectionNode* node) { vtkInternals& internals = (*this->Internals); if (!node) { vtkErrorMacro("`node` cannot be null."); } else if (!internals.RegExID.find(name)) { vtkErrorMacro("`" << name << "` is not in the expected form."); } else if (internals.Items[name] != node) { internals.Items[name] = node; this->Modified(); } } //------------------------------------------------------------------------------ std::string vtkSelection::GetNodeNameAtIndex(unsigned int idx) const { const vtkInternals& internals = (*this->Internals); if (static_cast<unsigned int>(internals.Items.size()) > idx) { auto iter = std::next(internals.Items.begin(), static_cast<int>(idx)); assert(iter != internals.Items.end()); return iter->first; } return std::string(); } //------------------------------------------------------------------------------ void vtkSelection::RemoveNode(unsigned int idx) { vtkInternals& internals = (*this->Internals); if (static_cast<unsigned int>(internals.Items.size()) > idx) { auto iter = std::next(internals.Items.begin(), static_cast<int>(idx)); assert(iter != internals.Items.end()); internals.Items.erase(iter); this->Modified(); } } //------------------------------------------------------------------------------ void vtkSelection::RemoveNode(const std::string& name) { vtkInternals& internals = (*this->Internals); if (internals.Items.erase(name) == 1) { this->Modified(); } } //------------------------------------------------------------------------------ void vtkSelection::RemoveNode(vtkSelectionNode* node) { vtkInternals& internals = (*this->Internals); for (auto iter = internals.Items.begin(); iter != internals.Items.end(); ++iter) { if (iter->second == node) { internals.Items.erase(iter); this->Modified(); break; } } } //------------------------------------------------------------------------------ void vtkSelection::RemoveAllNodes() { vtkInternals& internals = (*this->Internals); if (!internals.Items.empty()) { internals.Items.clear(); this->Modified(); } } //------------------------------------------------------------------------------ void vtkSelection::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); unsigned int numNodes = this->GetNumberOfNodes(); os << indent << "Number of nodes: " << numNodes << endl; os << indent << "Nodes: " << endl; for (unsigned int i = 0; i < numNodes; i++) { os << indent << "Node #" << i << endl; this->GetNode(i)->PrintSelf(os, indent.GetNextIndent()); } } //------------------------------------------------------------------------------ void vtkSelection::ShallowCopy(vtkDataObject* src) { if (auto* ssrc = vtkSelection::SafeDownCast(src)) { this->Expression = ssrc->Expression; this->Internals->Items = ssrc->Internals->Items; this->Superclass::ShallowCopy(src); this->Modified(); } } //------------------------------------------------------------------------------ void vtkSelection::DeepCopy(vtkDataObject* src) { if (auto* ssrc = vtkSelection::SafeDownCast(src)) { this->Expression = ssrc->Expression; const auto& srcMap = ssrc->Internals->Items; auto& destMap = this->Internals->Items; destMap = srcMap; for (auto& apair : destMap) { vtkNew<vtkSelectionNode> clone; clone->DeepCopy(apair.second); apair.second = clone; } this->Superclass::DeepCopy(src); this->Modified(); } } //------------------------------------------------------------------------------ void vtkSelection::Union(vtkSelection* s) { for (unsigned int n = 0; n < s->GetNumberOfNodes(); ++n) { this->Union(s->GetNode(n)); } } //------------------------------------------------------------------------------ void vtkSelection::Union(vtkSelectionNode* node) { bool merged = false; for (unsigned int tn = 0; tn < this->GetNumberOfNodes(); ++tn) { vtkSelectionNode* tnode = this->GetNode(tn); if (tnode->EqualProperties(node)) { tnode->UnionSelectionList(node); merged = true; break; } } if (!merged) { vtkSmartPointer<vtkSelectionNode> clone = vtkSmartPointer<vtkSelectionNode>::New(); clone->DeepCopy(node); this->AddNode(clone); } } //------------------------------------------------------------------------------ void vtkSelection::Subtract(vtkSelection* s) { for (unsigned int n = 0; n < s->GetNumberOfNodes(); ++n) { this->Subtract(s->GetNode(n)); } } //------------------------------------------------------------------------------ void vtkSelection::Subtract(vtkSelectionNode* node) { bool subtracted = false; for (unsigned int tn = 0; tn < this->GetNumberOfNodes(); ++tn) { vtkSelectionNode* tnode = this->GetNode(tn); if (tnode->EqualProperties(node)) { tnode->SubtractSelectionList(node); subtracted = true; } } if (!subtracted) { vtkErrorMacro("Could not subtract selections"); } } //------------------------------------------------------------------------------ vtkMTimeType vtkSelection::GetMTime() { vtkMTimeType mtime = this->Superclass::GetMTime(); const vtkInternals& internals = (*this->Internals); for (const auto& apair : internals.Items) { mtime = std::max(mtime, apair.second->GetMTime()); } return mtime; } //------------------------------------------------------------------------------ vtkSelection* vtkSelection::GetData(vtkInformation* info) { return info ? vtkSelection::SafeDownCast(info->Get(DATA_OBJECT())) : nullptr; } //------------------------------------------------------------------------------ vtkSelection* vtkSelection::GetData(vtkInformationVector* v, int i) { return vtkSelection::GetData(v->GetInformationObject(i)); } //------------------------------------------------------------------------------ vtkSmartPointer<vtkSignedCharArray> vtkSelection::Evaluate( vtkSignedCharArray* const* values, unsigned int num_values) const { std::map<std::string, vtkSignedCharArray*> values_map; vtkIdType numVals = -1; unsigned int cc = 0; const vtkInternals& internals = (*this->Internals); for (const auto& apair : internals.Items) { vtkSignedCharArray* array = cc < num_values ? values[cc] : nullptr; if (array == nullptr) { // lets assume null means false. } else { if (array->GetNumberOfComponents() != 1) { vtkGenericWarningMacro("Only single-component arrays are supported!"); return nullptr; } if (numVals != -1 && array->GetNumberOfTuples() != numVals) { vtkGenericWarningMacro("Mismatched number of tuples."); return nullptr; } numVals = array->GetNumberOfTuples(); } values_map[apair.first] = array; cc++; } std::string expr = this->Expression; if (expr.empty()) { bool add_separator = false; std::ostringstream stream; for (const auto& apair : internals.Items) { stream << (add_separator ? "|" : "") << apair.first; add_separator = true; } expr = stream.str(); } auto tree = this->Internals->BuildExpressionTree(expr, values_map); if (tree && (!values_map.empty())) { auto result = vtkSmartPointer<vtkSignedCharArray>::New(); result->SetNumberOfComponents(1); result->SetNumberOfTuples(numVals); vtkSMPTools::For(0, numVals, [&](vtkIdType start, vtkIdType end) { for (vtkIdType idx = start; idx < end; ++idx) { result->SetTypedComponent(idx, 0, tree->Evaluate(idx)); } }); return result; } else if (!tree) { vtkGenericWarningMacro("Failed to parse expression: " << this->Expression); } return nullptr; } //------------------------------------------------------------------------------ void vtkSelection::Dump() { this->Dump(cout); } //------------------------------------------------------------------------------ void vtkSelection::Dump(ostream& os) { vtkSmartPointer<vtkTable> tmpTable = vtkSmartPointer<vtkTable>::New(); cerr << "==Selection==" << endl; for (unsigned int i = 0; i < this->GetNumberOfNodes(); ++i) { os << "===Node " << i << "===" << endl; vtkSelectionNode* node = this->GetNode(i); os << "ContentType: "; switch (node->GetContentType()) { case vtkSelectionNode::GLOBALIDS: os << "GLOBALIDS"; break; case vtkSelectionNode::PEDIGREEIDS: os << "PEDIGREEIDS"; break; case vtkSelectionNode::VALUES: os << "VALUES"; break; case vtkSelectionNode::INDICES: os << "INDICES"; break; case vtkSelectionNode::FRUSTUM: os << "FRUSTUM"; break; case vtkSelectionNode::LOCATIONS: os << "LOCATIONS"; break; case vtkSelectionNode::THRESHOLDS: os << "THRESHOLDS"; break; case vtkSelectionNode::BLOCKS: os << "BLOCKS"; break; case vtkSelectionNode::USER: os << "USER"; break; default: os << "UNKNOWN"; break; } os << endl; os << "FieldType: "; switch (node->GetFieldType()) { case vtkSelectionNode::CELL: os << "CELL"; break; case vtkSelectionNode::POINT: os << "POINT"; break; case vtkSelectionNode::FIELD: os << "FIELD"; break; case vtkSelectionNode::VERTEX: os << "VERTEX"; break; case vtkSelectionNode::EDGE: os << "EDGE"; break; case vtkSelectionNode::ROW: os << "ROW"; break; default: os << "UNKNOWN"; break; } os << endl; if (node->GetSelectionData()) { tmpTable->SetRowData(node->GetSelectionData()); tmpTable->Dump(10); } } }
7,757
468
<reponame>PiraToRo/hexbin { "name": "coldwar", "author": "<NAME>", "license": "CC0", "vector": "http://hexb.in/vector/coldwar.svg", "description": "ColdWar.io Simulation Platform. Artwork by @cj_barnaby", "order_online_url": "https://www.stickermule.com/marketplace/9199-coldwar-dot-io", "raster": "http://hexb.in/hexagons/coldwar.png", "filename": "meta/coldwar.json" }
156
23,901
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for ...tf3d.semantic_segmentation.metric.""" import tensorflow as tf from tf3d import standard_fields from tf3d.semantic_segmentation import metric class MetricTest(tf.test.TestCase): def test_semantic_segmentation_metric(self): label_map = {1: 'car', 2: 'bus', 3: 'sign', 9: 'pedestrian', 12: 'cyclist'} num_classes = 20 num_frames = 5 num_points = 100 inputs = [] outputs = [] for _ in range(num_frames): inputs_i = { standard_fields.InputDataFields.object_class_points: tf.random.uniform([num_points, 1], minval=0, maxval=num_classes, dtype=tf.int32), standard_fields.InputDataFields.point_loss_weights: tf.random.uniform([num_points, 1], minval=0.0, maxval=1.0, dtype=tf.float32), standard_fields.InputDataFields.num_valid_points: tf.random.uniform([], minval=1, maxval=num_points, dtype=tf.int32), } inputs.append(inputs_i) outputs_i = { standard_fields.DetectionResultFields.object_semantic_points: tf.random.uniform([num_points, num_classes], minval=-2.0, maxval=2.0, dtype=tf.float32) } outputs.append(outputs_i) m = metric.SemanticSegmentationMetric( multi_label=False, num_classes=num_classes, label_map=label_map, eval_prefix='eval') for i in range(num_frames): m.update_state(inputs[i], outputs[i]) metrics_dict = m.get_metric_dictionary() for object_name in ['car', 'bus', 'sign', 'pedestrian', 'cyclist']: self.assertIn('eval_recall/{}'.format(object_name), metrics_dict) self.assertIn('eval_precision/{}'.format(object_name), metrics_dict) self.assertIn('eval_iou/{}'.format(object_name), metrics_dict) self.assertIn('eval_avg/mean_pixel_accuracy', metrics_dict) self.assertIn('eval_avg/mean_iou', metrics_dict) if __name__ == '__main__': tf.test.main()
1,321
1,300
<filename>optuna/samplers/nsgaii/_crossovers/_spx.py<gh_stars>1000+ from typing import Optional import numpy as np from optuna._experimental import experimental from optuna.samplers.nsgaii._crossovers._base import BaseCrossover from optuna.study import Study @experimental("3.0.0") class SPXCrossover(BaseCrossover): """Simplex Crossover operation used by :class:`~optuna.samplers.NSGAIISampler`. Uniformly samples child individuals from within a single simplex that is similar to the simplex produced by the parent individual. For further information about SPX crossover, please refer to the following paper: - `<NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> Progress Toward Linkage Learning in Real-Coded GAs with Simplex Crossover. IlliGAL Report. 2000. <https://www.researchgate.net/publication/2388486_Progress_Toward_Linkage_Learning_in_Real-Coded_GAs_with_Simplex_Crossover>`_ Args: epsilon: Expansion rate. If not specified, defaults to ``sqrt(len(search_space) + 2)``. """ n_parents = 3 def __init__(self, epsilon: Optional[float] = None) -> None: self._epsilon = epsilon def crossover( self, parents_params: np.ndarray, rng: np.random.RandomState, study: Study, search_space_bounds: np.ndarray, ) -> np.ndarray: # https://www.researchgate.net/publication/2388486_Progress_Toward_Linkage_Learning_in_Real-Coded_GAs_with_Simplex_Crossover # Section 2 A Brief Review of SPX n = self.n_parents - 1 G = np.mean(parents_params, axis=0) # Equation (1). rs = np.power(rng.rand(n), 1 / (np.arange(n) + 1)) # Equation (2). epsilon = np.sqrt(len(search_space_bounds) + 2) if self._epsilon is None else self._epsilon xks = [G + epsilon * (pk - G) for pk in parents_params] # Equation (3). ck = 0 # Equation (4). for k in range(1, self.n_parents): ck = rs[k - 1] * (xks[k - 1] - xks[k] + ck) child_params = xks[-1] + ck # Equation (5). return child_params
878
32,544
<filename>hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Person.java package com.baeldung.hibernate.pojo.inheritance; import javax.persistence.Id; import javax.persistence.MappedSuperclass; @MappedSuperclass public class Person { @Id private long personId; private String name; public Person() { } public Person(long personId, String name) { this.personId = personId; this.name = name; } public long getPersonId() { return personId; } public void setPersonId(long personId) { this.personId = personId; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
308
736
<reponame>tuomijal/pmdarima # -*- coding: utf-8 -*- import numpy as np import pandas as pd from ..compat import DTYPE __all__ = [ 'load_heartrate' ] def load_heartrate(as_series=False, dtype=DTYPE): """Uniform heart-rate data. A sample of heartrate data borrowed from an `MIT database <http://ecg.mit.edu/time-series/>`_. The sample consists of 150 evenly spaced (0.5 seconds) heartrate measurements. Parameters ---------- as_series : bool, optional (default=False) Whether to return a Pandas series. If False, will return a 1d numpy array. dtype : type, optional (default=np.float64) The type to return for the array. Default is np.float64, which is used throughout the package as the default type. Returns ------- rslt : array-like, shape=(n_samples,) The heartrate vector. Examples -------- >>> from pmdarima.datasets import load_heartrate >>> load_heartrate() array([84.2697, 84.2697, 84.0619, 85.6542, 87.2093, 87.1246, 86.8726, 86.7052, 87.5899, 89.1475, 89.8204, 89.8204, 90.4375, 91.7605, 93.1081, 94.3291, 95.8003, 97.5119, 98.7457, 98.904 , 98.3437, 98.3075, 98.8313, 99.0789, 98.8157, 98.2998, 97.7311, 97.6471, 97.7922, 97.2974, 96.2042, 95.2318, 94.9367, 95.0867, 95.389 , 95.5414, 95.2439, 94.9415, 95.3557, 96.3423, 97.1563, 97.4026, 96.7028, 96.5516, 97.9837, 98.9879, 97.6312, 95.4064, 93.8603, 93.0552, 94.6012, 95.8476, 95.7692, 95.9236, 95.7692, 95.9211, 95.8501, 94.6703, 93.0993, 91.972 , 91.7821, 91.7911, 90.807 , 89.3196, 88.1511, 88.7762, 90.2265, 90.8066, 91.2284, 92.4238, 93.243 , 92.8472, 92.5926, 91.7778, 91.2974, 91.6364, 91.2952, 91.771 , 93.2285, 93.3199, 91.8799, 91.2239, 92.4055, 93.8716, 94.5825, 94.5594, 94.9453, 96.2412, 96.6879, 95.8295, 94.7819, 93.4731, 92.7997, 92.963 , 92.6996, 91.9648, 91.2417, 91.9312, 93.9548, 95.3044, 95.2511, 94.5358, 93.8093, 93.2287, 92.2065, 92.1588, 93.6376, 94.899 , 95.1592, 95.2415, 95.5414, 95.0971, 94.528 , 95.5887, 96.4715, 96.6158, 97.0769, 96.8531, 96.3947, 97.4291, 98.1767, 97.0148, 96.044 , 95.9581, 96.4814, 96.5211, 95.3629, 93.5741, 92.077 , 90.4094, 90.1751, 91.3312, 91.2883, 89.0592, 87.052 , 86.6226, 85.7889, 85.6348, 85.3911, 83.8064, 82.8729, 82.6266, 82.645 , 82.645 , 82.645 , 82.645 , 82.645 , 82.645 , 82.645 , 82.645 ]) >>> load_heartrate(True).head() 0 84.2697 1 84.2697 2 84.0619 3 85.6542 4 87.2093 dtype: float64 References ---------- .. [1] <NAME>, <NAME>. Nonlinear dynamics at the bedside. In: <NAME>, <NAME>, <NAME>, eds. Theory of Heart: Biomechanics, Biophysics, and Nonlinear Dynamics of Cardiac Function. New York: Springer-Verlag, 1991, pp. 583-605. """ rslt = np.array([ 84.2697, 84.2697, 84.0619, 85.6542, 87.2093, 87.1246, 86.8726, 86.7052, 87.5899, 89.1475, 89.8204, 89.8204, 90.4375, 91.7605, 93.1081, 94.3291, 95.8003, 97.5119, 98.7457, 98.904, 98.3437, 98.3075, 98.8313, 99.0789, 98.8157, 98.2998, 97.7311, 97.6471, 97.7922, 97.2974, 96.2042, 95.2318, 94.9367, 95.0867, 95.389, 95.5414, 95.2439, 94.9415, 95.3557, 96.3423, 97.1563, 97.4026, 96.7028, 96.5516, 97.9837, 98.9879, 97.6312, 95.4064, 93.8603, 93.0552, 94.6012, 95.8476, 95.7692, 95.9236, 95.7692, 95.9211, 95.8501, 94.6703, 93.0993, 91.972, 91.7821, 91.7911, 90.807, 89.3196, 88.1511, 88.7762, 90.2265, 90.8066, 91.2284, 92.4238, 93.243, 92.8472, 92.5926, 91.7778, 91.2974, 91.6364, 91.2952, 91.771, 93.2285, 93.3199, 91.8799, 91.2239, 92.4055, 93.8716, 94.5825, 94.5594, 94.9453, 96.2412, 96.6879, 95.8295, 94.7819, 93.4731, 92.7997, 92.963, 92.6996, 91.9648, 91.2417, 91.9312, 93.9548, 95.3044, 95.2511, 94.5358, 93.8093, 93.2287, 92.2065, 92.1588, 93.6376, 94.899, 95.1592, 95.2415, 95.5414, 95.0971, 94.528, 95.5887, 96.4715, 96.6158, 97.0769, 96.8531, 96.3947, 97.4291, 98.1767, 97.0148, 96.044, 95.9581, 96.4814, 96.5211, 95.3629, 93.5741, 92.077, 90.4094, 90.1751, 91.3312, 91.2883, 89.0592, 87.052, 86.6226, 85.7889, 85.6348, 85.3911, 83.8064, 82.8729, 82.6266, 82.645, 82.645, 82.645, 82.645, 82.645, 82.645, 82.645, 82.645]).astype(dtype) if as_series: return pd.Series(rslt) return rslt
2,534
32,544
package com.baeldung.guava.mathutils; import static org.junit.Assert.*; import java.math.RoundingMode; import com.google.common.math.LongMath; import org.junit.Test; public class GuavaLongMathUnitTest { @Test public void whenPerformBinomialOnTwoLongValues_shouldReturnResultIfUnderLong() { long result = LongMath.binomial(6, 3); assertEquals(20L, result); } @Test public void whenProformCeilPowOfTwoLongValues_shouldReturnResult() { long result = LongMath.ceilingPowerOfTwo(20L); assertEquals(32L, result); } @Test public void whenCheckedAddTwoLongValues_shouldAddThemAndReturnTheSumIfNotOverflow() { long result = LongMath.checkedAdd(1L, 2L); assertEquals(3L, result); } @Test(expected = ArithmeticException.class) public void whenCheckedAddTwoLongValues_shouldThrowArithmeticExceptionIfOverflow() { LongMath.checkedAdd(Long.MAX_VALUE, 100L); } @Test public void whenCheckedMultiplyTwoLongValues_shouldMultiplyThemAndReturnTheResultIfNotOverflow() { long result = LongMath.checkedMultiply(3L, 2L); assertEquals(6L, result); } @Test(expected = ArithmeticException.class) public void whenCheckedMultiplyTwoLongValues_shouldThrowArithmeticExceptionIfOverflow() { LongMath.checkedMultiply(Long.MAX_VALUE, 100L); } @Test public void whenCheckedPowTwoLongValues_shouldPowThemAndReturnTheResultIfNotOverflow() { long result = LongMath.checkedPow(2L, 3); assertEquals(8L, result); } @Test(expected = ArithmeticException.class) public void gwhenCheckedPowTwoLongValues_shouldThrowArithmeticExceptionIfOverflow() { LongMath.checkedPow(Long.MAX_VALUE, 100); } @Test public void whenCheckedSubstractTwoLongValues_shouldSubstractThemAndReturnTheResultIfNotOverflow() { long result = LongMath.checkedSubtract(4L, 1L); assertEquals(3L, result); } @Test(expected = ArithmeticException.class) public void gwhenCheckedSubstractTwoLongValues_shouldThrowArithmeticExceptionIfOverflow() { LongMath.checkedSubtract(Long.MAX_VALUE, -100); } @Test public void whenDivideTwoLongValues_shouldDivideThemAndReturnTheResultForCeilingRounding() { long result = LongMath.divide(10L, 3L, RoundingMode.CEILING); assertEquals(4L, result); } @Test public void whenDivideTwoLongValues_shouldDivideThemAndReturnTheResultForFloorRounding() { long result = LongMath.divide(10L, 3L, RoundingMode.FLOOR); assertEquals(3L, result); } @Test(expected = ArithmeticException.class) public void whenDivideTwoLongValues_shouldThrowArithmeticExceptionIfRoundingNotDefinedButNecessary() { LongMath.divide(10L, 3L, RoundingMode.UNNECESSARY); } @Test public void whenFactorailLong_shouldFactorialThemAndReturnTheResultIfInIntRange() { long result = LongMath.factorial(5); assertEquals(120L, result); } @Test public void whenFactorailLong_shouldFactorialThemAndReturnIntMaxIfNotInIntRange() { long result = LongMath.factorial(Integer.MAX_VALUE); assertEquals(Long.MAX_VALUE, result); } @Test public void whenFloorPowerOfLong_shouldReturnValue() { long result = LongMath.floorPowerOfTwo(30L); assertEquals(16L, result); } @Test public void whenGcdOfTwoLongs_shouldReturnValue() { long result = LongMath.gcd(30L, 40L); assertEquals(10L, result); } @Test public void whenIsPowOfLong_shouldReturnTrueIfPowerOfTwo() { boolean result = LongMath.isPowerOfTwo(16L); assertTrue(result); } @Test public void whenIsPowOfLong_shouldReturnFalseeIfNotPowerOfTwo() { boolean result = LongMath.isPowerOfTwo(20L); assertFalse(result); } @Test public void whenIsPrineOfLong_shouldReturnFalseeIfNotPrime() { boolean result = LongMath.isPrime(20L); assertFalse(result); } @Test public void whenLog10LongValues_shouldLog10ThemAndReturnTheResultForCeilingRounding() { int result = LongMath.log10(30L, RoundingMode.CEILING); assertEquals(2, result); } @Test public void whenLog10LongValues_shouldog10ThemAndReturnTheResultForFloorRounding() { int result = LongMath.log10(30L, RoundingMode.FLOOR); assertEquals(1, result); } @Test(expected = ArithmeticException.class) public void whenLog10LongValues_shouldThrowArithmeticExceptionIfRoundingNotDefinedButNecessary() { LongMath.log10(30L, RoundingMode.UNNECESSARY); } @Test public void whenLog2LongValues_shouldLog2ThemAndReturnTheResultForCeilingRounding() { int result = LongMath.log2(30L, RoundingMode.CEILING); assertEquals(5, result); } @Test public void whenLog2LongValues_shouldog2ThemAndReturnTheResultForFloorRounding() { int result = LongMath.log2(30L, RoundingMode.FLOOR); assertEquals(4, result); } @Test(expected = ArithmeticException.class) public void whenLog2LongValues_shouldThrowArithmeticExceptionIfRoundingNotDefinedButNecessary() { LongMath.log2(30L, RoundingMode.UNNECESSARY); } @Test public void whenMeanTwoLongValues_shouldMeanThemAndReturnTheResult() { long result = LongMath.mean(30L, 20L); assertEquals(25L, result); } @Test public void whenModLongAndIntegerValues_shouldModThemAndReturnTheResult() { int result = LongMath.mod(30L, 4); assertEquals(2, result); } @Test public void whenModTwoLongValues_shouldModThemAndReturnTheResult() { long result = LongMath.mod(30L, 4L); assertEquals(2L, result); } @Test public void whenPowTwoLongValues_shouldPowThemAndReturnTheResult() { long result = LongMath.pow(6L, 4); assertEquals(1296L, result); } @Test public void whenSaturatedAddTwoLongValues_shouldAddThemAndReturnTheResult() { long result = LongMath.saturatedAdd(6L, 4L); assertEquals(10L, result); } @Test public void whenSaturatedAddTwoLongValues_shouldAddThemAndReturnIntMaxIfOverflow() { long result = LongMath.saturatedAdd(Long.MAX_VALUE, 1000L); assertEquals(Long.MAX_VALUE, result); } @Test public void whenSaturatedAddTwoLongValues_shouldAddThemAndReturnIntMinIfUnderflow() { long result = LongMath.saturatedAdd(Long.MIN_VALUE, -1000); assertEquals(Long.MIN_VALUE, result); } @Test public void whenSaturatedMultiplyTwoLongValues_shouldMultiplyThemAndReturnTheResult() { long result = LongMath.saturatedMultiply(6L, 4L); assertEquals(24L, result); } @Test public void whenSaturatedMultiplyTwoLongValues_shouldMultiplyThemAndReturnIntMaxIfOverflow() { long result = LongMath.saturatedMultiply(Long.MAX_VALUE, 1000L); assertEquals(Long.MAX_VALUE, result); } @Test public void whenSaturatedPowTwoLongValues_shouldPowThemAndReturnTheResult() { long result = LongMath.saturatedPow(6L, 2); assertEquals(36L, result); } @Test public void whenSaturatedPowTwoLongValues_shouldPowThemAndReturnIntMaxIfOverflow() { long result = LongMath.saturatedPow(Long.MAX_VALUE, 2); assertEquals(Long.MAX_VALUE, result); } @Test public void whenSaturatedPowTwoLongValues_shouldPowThemAndReturnIntMinIfUnderflow() { long result = LongMath.saturatedPow(Long.MIN_VALUE, 3); assertEquals(Long.MIN_VALUE, result); } @Test public void whenSaturatedSubstractTwoLongValues_shouldSubstractThemAndReturnTheResult() { long result = LongMath.saturatedSubtract(6L, 2L); assertEquals(4L, result); } @Test public void whenSaturatedSubstractTwoLongValues_shouldSubstractwThemAndReturnIntMaxIfOverflow() { long result = LongMath.saturatedSubtract(Long.MAX_VALUE, -2L); assertEquals(Long.MAX_VALUE, result); } @Test public void whenSaturatedSubstractTwoLongValues_shouldSubstractThemAndReturnIntMinIfUnderflow() { long result = LongMath.saturatedSubtract(Long.MIN_VALUE, 3L); assertEquals(Long.MIN_VALUE, result); } @Test public void whenSqrtLongValues_shouldSqrtThemAndReturnTheResultForCeilingRounding() { long result = LongMath.sqrt(30L, RoundingMode.CEILING); assertEquals(6L, result); } @Test public void whenSqrtLongValues_shouldSqrtThemAndReturnTheResultForFloorRounding() { long result = LongMath.sqrt(30L, RoundingMode.FLOOR); assertEquals(5L, result); } @Test(expected = ArithmeticException.class) public void whenSqrtLongValues_shouldThrowArithmeticExceptionIfRoundingNotDefinedButNecessary() { LongMath.sqrt(30L, RoundingMode.UNNECESSARY); } }
3,547
957
#ifdef __EFFEKSEER_RENDERER_INTERNAL_LOADER__ #ifndef __EFFEKSEERRENDERER_TEXTURELOADER_H__ #define __EFFEKSEERRENDERER_TEXTURELOADER_H__ #include <Effekseer.h> #include "../EffekseerRendererCommon/EffekseerRenderer.DDSTextureLoader.h" #include "../EffekseerRendererCommon/EffekseerRenderer.PngTextureLoader.h" #include "../EffekseerRendererCommon/EffekseerRenderer.TGATextureLoader.h" namespace EffekseerRenderer { class TextureLoader : public ::Effekseer::TextureLoader { private: ::Effekseer::FileInterface* m_fileInterface; ::Effekseer::DefaultFileInterface m_defaultFileInterface; ::Effekseer::ColorSpaceType colorSpaceType_; ::Effekseer::Backend::GraphicsDevice* graphicsDevice_ = nullptr; #ifdef __EFFEKSEER_RENDERER_INTERNAL_LOADER__ ::EffekseerRenderer::PngTextureLoader pngTextureLoader_; ::EffekseerRenderer::DDSTextureLoader ddsTextureLoader_; ::EffekseerRenderer::TGATextureLoader tgaTextureLoader_; #endif public: TextureLoader(::Effekseer::Backend::GraphicsDevice* graphicsDevice, ::Effekseer::FileInterface* fileInterface = nullptr, ::Effekseer::ColorSpaceType colorSpaceType = ::Effekseer::ColorSpaceType::Gamma); virtual ~TextureLoader(); public: Effekseer::TextureRef Load(const char16_t* path, ::Effekseer::TextureType textureType) override; Effekseer::TextureRef Load(const void* data, int32_t size, Effekseer::TextureType textureType, bool isMipMapEnabled) override; void Unload(Effekseer::TextureRef data) override; }; } // namespace EffekseerRenderer #endif // __EFFEKSEERRENDERER_TEXTURELOADER_H__ #endif // __EFFEKSEER_RENDERER_INTERNAL_LOADER__
625
501
<filename>sshd-common/src/main/java/org/apache/sshd/common/keyprovider/KeyTypeIndicator.java /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.sshd.common.keyprovider; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.NavigableMap; import java.util.TreeMap; import java.util.stream.Collectors; import org.apache.sshd.common.util.GenericUtils; /** * @author <a href="mailto:<EMAIL>">Apache MINA SSHD Project</a> */ @FunctionalInterface public interface KeyTypeIndicator { /** * @return The <U>SSH</U> key type name - e.g., &quot;ssh-rsa&quot;, &quot;sshd-dss&quot; etc. */ String getKeyType(); /** * @param <I> The {@link KeyTypeIndicator} * @param indicators The indicators to group * @return A {@link NavigableMap} where key=the case <U>insensitive</U> {@link #getKeyType() key type}, * value = the {@link List} of all indicators having the same key type */ static <I extends KeyTypeIndicator> NavigableMap<String, List<I>> groupByKeyType(Collection<? extends I> indicators) { return GenericUtils.isEmpty(indicators) ? Collections.emptyNavigableMap() : indicators.stream() .collect(Collectors.groupingBy( KeyTypeIndicator::getKeyType, () -> new TreeMap<>(String.CASE_INSENSITIVE_ORDER), Collectors.toList())); } }
821
892
{ "schema_version": "1.2.0", "id": "GHSA-fjj6-r3pr-3rrj", "modified": "2022-05-13T01:38:38Z", "published": "2022-05-13T01:38:38Z", "aliases": [ "CVE-2016-8634" ], "details": "A vulnerability was found in foreman 1.14.0. When creating an organization or location in Foreman, if the name contains HTML then the second step of the wizard (/organizations/id/step2) will render the HTML. This occurs in the alertbox on the page. The result is a stored XSS attack if an organization/location with HTML in the name is created, then a user is linked directly to this URL.", "severity": [ { "type": "CVSS_V3", "score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N" } ], "affected": [ ], "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2016-8634" }, { "type": "WEB", "url": "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-8634" }, { "type": "WEB", "url": "https://projects.theforeman.org/issues/17195" }, { "type": "WEB", "url": "http://www.securityfocus.com/bid/94206" } ], "database_specific": { "cwe_ids": [ "CWE-79" ], "severity": "MODERATE", "github_reviewed": false } }
573
14,668
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ash/crostini/crostini_remover.h" #include <string> #include <utility> #include "base/bind.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/crostini_util.h" #include "chrome/browser/ash/guest_os/guest_os_mime_types_service.h" #include "chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/component_updater/cros_component_installer_chromeos.h" #include "chrome/browser/profiles/profile.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" namespace crostini { CrostiniRemover::CrostiniRemover( Profile* profile, std::string vm_name, CrostiniManager::RemoveCrostiniCallback callback) : profile_(profile), vm_name_(std::move(vm_name)), callback_(std::move(callback)) {} CrostiniRemover::~CrostiniRemover() = default; void CrostiniRemover::RemoveCrostini() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); CrostiniManager::GetForProfile(profile_)->StopVm( vm_name_, base::BindOnce(&CrostiniRemover::StopVmFinished, this)); } void CrostiniRemover::StopVmFinished(CrostiniResult result) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (result != CrostiniResult::SUCCESS) { LOG(ERROR) << "Failed to stop VM"; std::move(callback_).Run(result); return; } VLOG(1) << "Clearing application list"; guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile_) ->ClearApplicationList(guest_os::GuestOsRegistryService::VmType:: ApplicationList_VmType_TERMINA, vm_name_, ""); guest_os::GuestOsMimeTypesServiceFactory::GetForProfile(profile_) ->ClearMimeTypes(vm_name_, ""); VLOG(1) << "Destroying disk image"; CrostiniManager::GetForProfile(profile_)->DestroyDiskImage( vm_name_, base::BindOnce(&CrostiniRemover::DestroyDiskImageFinished, this)); } void CrostiniRemover::DestroyDiskImageFinished(bool success) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!success) { LOG(ERROR) << "Failed to destroy disk image"; std::move(callback_).Run(CrostiniResult::DESTROY_DISK_IMAGE_FAILED); return; } VLOG(1) << "Uninstalling Termina"; CrostiniManager::GetForProfile(profile_)->UninstallTermina( base::BindOnce(&CrostiniRemover::UninstallTerminaFinished, this)); } void CrostiniRemover::UninstallTerminaFinished(bool success) { if (!success) { LOG(ERROR) << "Failed to uninstall Termina"; std::move(callback_).Run(CrostiniResult::UNKNOWN_ERROR); return; } profile_->GetPrefs()->SetBoolean(prefs::kCrostiniEnabled, false); profile_->GetPrefs()->ClearPref(prefs::kCrostiniLastDiskSize); profile_->GetPrefs()->Set(prefs::kCrostiniContainers, base::Value(base::Value::Type::LIST)); profile_->GetPrefs()->ClearPref(prefs::kCrostiniDefaultContainerConfigured); std::move(callback_).Run(CrostiniResult::SUCCESS); } } // namespace crostini
1,300
677
#ifndef LYNX_GL_CANVAS_LYNX_PATH_H_ #define LYNX_GL_CANVAS_LYNX_PATH_H_ #include <vector> #include "gl/canvas/lynx_point.h" #include "base/scoped_ptr.h" #include "base/scoped_vector.h" namespace canvas { class LxPath { public: struct SubPath { std::vector<LxPoint> points_; bool closed_; SubPath() : points_(), closed_(false) {} }; typedef base::ScopedVector<SubPath> SubPathStack; LxPath(); ~LxPath(); void MoveTo(float x, float y); void LineTo(float x, float y); void Arc(float cx, float cy, float radius, float start_angle, float end_angle, bool anti_clockwise); void ArcTo(float x1, float y1, float x2, float y2, float radius); void Clear(); void Stroke(); const SubPathStack& path_stack() const { return path_stack_; } private: void PushPoint(float x, float y); SubPathStack path_stack_; base::ScopedPtr<SubPath> current_sub_path_; LxPoint begin_position_; LxPoint current_position_; }; } // namespace canvas #endif
433
453
<reponame>The0x539/wasp #include <math.h> #include "headers/scalbn.h" double scalbn(double x, int exp) { return _scalbn(x, exp); }
64
388
<gh_stars>100-1000 import errno import os import tempfile import time import pytest from celery_once.backends.file import key_to_lock_name, File from celery_once.tasks import AlreadyQueued def test_key_to_lock_name(): assert key_to_lock_name('qo_test') == \ 'qo_test_999f583e69db6a0c04b86beeebb2b631' assert key_to_lock_name('qo_looooooong_task_name') == \ 'qo_looooooong_tas_6626e5965e549303044d5a7f4fdc3c6b' def test_file_init(mocker): makedirs_mock = mocker.patch('celery_once.backends.file.os.makedirs') location = '/home/test' backend = File({'location': location}) assert backend.location == location assert makedirs_mock.called is True assert makedirs_mock.call_args[0] == (location,) def test_file_init_default(mocker): makedirs_mock = mocker.patch('celery_once.backends.file.os.makedirs') backend = File({}) assert backend.location == os.path.join(tempfile.gettempdir(), 'celery_once') assert makedirs_mock.called is True def test_file_init_location_exists(mocker): makedirs_mock = mocker.patch('celery_once.backends.file.os.makedirs', side_effect=OSError(errno.EEXIST, 'error')) location = '/home/test' backend = File({'location': location}) assert backend.location == location assert makedirs_mock.called is True TEST_LOCATION = '/tmp/celery' @pytest.fixture() def backend(mocker): mocker.patch('celery_once.backends.file.os.makedirs') backend = File({'location': TEST_LOCATION}) return backend def test_file_create_lock(backend, mocker): key = 'test.task.key' timeout = 3600 open_mock = mocker.patch('celery_once.backends.file.os.open') mtime_mock = mocker.patch('celery_once.backends.file.os.path.getmtime') utime_mock = mocker.patch('celery_once.backends.file.os.utime') close_mock = mocker.patch('celery_once.backends.file.os.close') expected_lock_path = os.path.join(TEST_LOCATION, key_to_lock_name(key)) ret = backend.raise_or_lock(key, timeout) assert open_mock.call_count == 1 assert open_mock.call_args[0] == ( expected_lock_path, os.O_CREAT | os.O_EXCL, ) assert utime_mock.called is False assert close_mock.called is True assert ret is None def test_file_lock_exists(backend, mocker): key = 'test.task.key' timeout = 3600 open_mock = mocker.patch( 'celery_once.backends.file.os.open', side_effect=OSError(errno.EEXIST, 'error')) mtime_mock = mocker.patch( 'celery_once.backends.file.os.path.getmtime', return_value=1550155000.0) time_mock = mocker.patch( 'celery_once.backends.file.time.time', return_value=1550156000.0) utime_mock = mocker.patch('celery_once.backends.file.os.utime') close_mock = mocker.patch('celery_once.backends.file.os.close') with pytest.raises(AlreadyQueued) as exc_info: backend.raise_or_lock(key, timeout) assert open_mock.call_count == 1 assert utime_mock.called is False assert close_mock.called is False assert exc_info.value.countdown == timeout - 1000 def test_file_lock_timeout(backend, mocker): key = 'test.task.key' timeout = 3600 open_mock = mocker.patch( 'celery_once.backends.file.os.open', side_effect=OSError(errno.EEXIST, 'error')) mtime_mock = mocker.patch( 'celery_once.backends.file.os.path.getmtime', return_value=1550150000.0) time_mock = mocker.patch( 'celery_once.backends.file.time.time', return_value=1550156000.0) utime_mock = mocker.patch('celery_once.backends.file.os.utime') close_mock = mocker.patch('celery_once.backends.file.os.close') expected_lock_path = os.path.join(TEST_LOCATION, key_to_lock_name(key)) ret = backend.raise_or_lock(key, timeout) assert open_mock.call_count == 1 assert utime_mock.call_count == 1 assert utime_mock.call_args[0] == (expected_lock_path, None) assert close_mock.called is False assert ret is None def test_file_clear_lock(backend, mocker): key = 'test.task.key' remove_mock = mocker.patch('celery_once.backends.file.os.remove') expected_lock_path = os.path.join(TEST_LOCATION, key_to_lock_name(key)) ret = backend.clear_lock(key) assert remove_mock.call_count == 1 assert remove_mock.call_args[0] == (expected_lock_path,) assert ret is None
2,045
1,001
<reponame>yndu13/aliyun-openapi-python-sdk<gh_stars>1000+ ######################## BEGIN LICENSE BLOCK ######################## # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### __version__ = "3.0.4" from .compat import PY2, PY3 from .universaldetector import UniversalDetector from .version import __version__, VERSION def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expected object of type bytes or bytearray, got: ' '{0}'.format(type(byte_str))) else: byte_str = bytearray(byte_str) detector = UniversalDetector() detector.feed(byte_str) return detector.close()
540
348
<gh_stars>100-1000 {"nom":"Beuvry","circ":"10ème circonscription","dpt":"Pas-de-Calais","inscrits":7011,"abs":3930,"votants":3081,"blancs":55,"nuls":26,"exp":3000,"res":[{"nuance":"FN","nom":"<NAME>","voix":1025},{"nuance":"REM","nom":"Mme <NAME>","voix":720},{"nuance":"FI","nom":"<NAME>","voix":449},{"nuance":"SOC","nom":"<NAME>","voix":244},{"nuance":"LR","nom":"<NAME>","voix":178},{"nuance":"ECO","nom":"Mme <NAME>","voix":107},{"nuance":"COM","nom":"<NAME>","voix":106},{"nuance":"DVD","nom":"<NAME>","voix":68},{"nuance":"EXG","nom":"Mme <NAME>","voix":48},{"nuance":"DVG","nom":"<NAME>","voix":40},{"nuance":"DIV","nom":"Mme <NAME>","voix":13},{"nuance":"DVG","nom":"<NAME>","voix":2}]}
280
4,640
<filename>tests/python/contrib/test_hexagon/test_run_unit_tests.py<gh_stars>1000+ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import pytest import numpy as np import tvm from tvm.contrib.hexagon.session import Session # use pytest -sv to observe gtest output # use --gtest_args to pass arguments to gtest # for example to run all "foo" tests twice and observe gtest output run # pytest -sv <this file> --gtests_args="--gtest_filter=*foo* --gtest_repeat=2" @tvm.testing.requires_hexagon def test_run_unit_tests(hexagon_session: Session, gtest_args): try: func = hexagon_session._rpc.get_function("hexagon.run_unit_tests") except: print( "This test requires TVM Runtime to be built with a Hexagon gtest version using Hexagon API cmake flag -DUSE_HEXAGON_GTEST=/path/to/hexagon/sdk/utils/googletest/gtest" ) raise gtest_error_code_and_output = func(gtest_args) gtest_error_code = int(gtest_error_code_and_output.splitlines()[0]) gtest_output = gtest_error_code_and_output.split("\n", 1)[-1] print(gtest_output) np.testing.assert_equal(gtest_error_code, 0)
621
900
from wasmer import Store, Module, Instance import os __dir__ = os.path.dirname(os.path.realpath(__file__)) # Instantiates the module. module = Module(Store(), open(__dir__ + '/greet.wasm', 'rb').read()) instance = Instance(module) # Set the subject to greet. subject = bytes('Wasmer 🐍', 'utf-8') length_of_subject = len(subject) + 1 # Allocate memory for the subject, and get a pointer to it. input_pointer = instance.exports.allocate(length_of_subject) # Write the subject into the memory. memory = instance.exports.memory.uint8_view(input_pointer) memory[0:length_of_subject] = subject memory[length_of_subject] = 0 # C-string terminates by NULL. # Run the `greet` function. Give the pointer to the subject. output_pointer = instance.exports.greet(input_pointer) # Read the result of the `greet` function. memory = instance.exports.memory.uint8_view(output_pointer) memory_length = len(memory) output = [] nth = 0 while nth < memory_length: byte = memory[nth] if byte == 0: break output.append(byte) nth += 1 length_of_output = nth print(bytes(output).decode()) # Deallocate the subject, and the output. instance.exports.deallocate(input_pointer, length_of_subject) instance.exports.deallocate(output_pointer, length_of_output)
434
335
{ "word": "Quinqueliteral", "definitions": [ "(Of a root) containing five consonants." ], "parts-of-speech": "Adjective" }
65
609
<reponame>0xflotus/token-core-android package org.consenlabs.tokencore.foundation.crypto; import com.google.common.base.Strings; import org.consenlabs.tokencore.wallet.model.Messages; import org.consenlabs.tokencore.wallet.model.TokenException; /** * Created by xyz on 2018/2/2. */ public class SCryptParams implements KDFParams { static final int COST_FACTOR = 8192; static final int BLOCK_SIZE_FACTOR = 8; static final int PARALLELIZATION_FACTOR = 1; private int dklen = 0; private int n = 0; private int p = 0; private int r = 0; private String salt; public SCryptParams() { } public static SCryptParams createSCryptParams() { SCryptParams params = new SCryptParams(); params.dklen = DK_LEN; params.n = COST_FACTOR; params.p = PARALLELIZATION_FACTOR; params.r = BLOCK_SIZE_FACTOR; return params; } public int getDklen() { return dklen; } public void setDklen(int dklen) { this.dklen = dklen; } public int getN() { return n; } public void setN(int n) { this.n = n; } public int getP() { return p; } public void setP(int p) { this.p = p; } public int getR() { return r; } public void setR(int r) { this.r = r; } public String getSalt() { return salt; } @Override public void validate() { if (n == 0 || dklen == 0 || p == 0 || r == 0 || Strings.isNullOrEmpty(salt)) { throw new TokenException(Messages.KDF_PARAMS_INVALID); } } public void setSalt(String salt) { this.salt = salt; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof SCryptParams)) { return false; } SCryptParams that = (SCryptParams) o; if (dklen != that.dklen) { return false; } if (n != that.n) { return false; } if (p != that.p) { return false; } if (r != that.r) { return false; } return getSalt() != null ? getSalt().equals(that.getSalt()) : that.getSalt() == null; } @Override public int hashCode() { int result = dklen; result = 31 * result + n; result = 31 * result + p; result = 31 * result + r; result = 31 * result + (getSalt() != null ? getSalt().hashCode() : 0); return result; } }
963
7,073
from functools import wraps def decorator(f): @wraps(f) def wrapper(*args, **kws): return f(*args, **kws) return wrapper class WrappedMethods: @decorator def wrapped_method(self): pass @decorator def wrapped_method_with_arguments(self, a, b=2): pass
135
1,331
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif /* __RPCNDR_H_VERSION__ */ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __searchapi_h__ #define __searchapi_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IUrlAccessor_FWD_DEFINED__ #define __IUrlAccessor_FWD_DEFINED__ typedef interface IUrlAccessor IUrlAccessor; #endif /* __IUrlAccessor_FWD_DEFINED__ */ #ifndef __IUrlAccessor2_FWD_DEFINED__ #define __IUrlAccessor2_FWD_DEFINED__ typedef interface IUrlAccessor2 IUrlAccessor2; #endif /* __IUrlAccessor2_FWD_DEFINED__ */ #ifndef __IUrlAccessor3_FWD_DEFINED__ #define __IUrlAccessor3_FWD_DEFINED__ typedef interface IUrlAccessor3 IUrlAccessor3; #endif /* __IUrlAccessor3_FWD_DEFINED__ */ #ifndef __IUrlAccessor4_FWD_DEFINED__ #define __IUrlAccessor4_FWD_DEFINED__ typedef interface IUrlAccessor4 IUrlAccessor4; #endif /* __IUrlAccessor4_FWD_DEFINED__ */ #ifndef __IOpLockStatus_FWD_DEFINED__ #define __IOpLockStatus_FWD_DEFINED__ typedef interface IOpLockStatus IOpLockStatus; #endif /* __IOpLockStatus_FWD_DEFINED__ */ #ifndef __ISearchProtocolThreadContext_FWD_DEFINED__ #define __ISearchProtocolThreadContext_FWD_DEFINED__ typedef interface ISearchProtocolThreadContext ISearchProtocolThreadContext; #endif /* __ISearchProtocolThreadContext_FWD_DEFINED__ */ #ifndef __ISearchProtocol_FWD_DEFINED__ #define __ISearchProtocol_FWD_DEFINED__ typedef interface ISearchProtocol ISearchProtocol; #endif /* __ISearchProtocol_FWD_DEFINED__ */ #ifndef __ISearchProtocol2_FWD_DEFINED__ #define __ISearchProtocol2_FWD_DEFINED__ typedef interface ISearchProtocol2 ISearchProtocol2; #endif /* __ISearchProtocol2_FWD_DEFINED__ */ #ifndef __IProtocolHandlerSite_FWD_DEFINED__ #define __IProtocolHandlerSite_FWD_DEFINED__ typedef interface IProtocolHandlerSite IProtocolHandlerSite; #endif /* __IProtocolHandlerSite_FWD_DEFINED__ */ #ifndef __ISearchRoot_FWD_DEFINED__ #define __ISearchRoot_FWD_DEFINED__ typedef interface ISearchRoot ISearchRoot; #endif /* __ISearchRoot_FWD_DEFINED__ */ #ifndef __IEnumSearchRoots_FWD_DEFINED__ #define __IEnumSearchRoots_FWD_DEFINED__ typedef interface IEnumSearchRoots IEnumSearchRoots; #endif /* __IEnumSearchRoots_FWD_DEFINED__ */ #ifndef __ISearchScopeRule_FWD_DEFINED__ #define __ISearchScopeRule_FWD_DEFINED__ typedef interface ISearchScopeRule ISearchScopeRule; #endif /* __ISearchScopeRule_FWD_DEFINED__ */ #ifndef __IEnumSearchScopeRules_FWD_DEFINED__ #define __IEnumSearchScopeRules_FWD_DEFINED__ typedef interface IEnumSearchScopeRules IEnumSearchScopeRules; #endif /* __IEnumSearchScopeRules_FWD_DEFINED__ */ #ifndef __ISearchCrawlScopeManager_FWD_DEFINED__ #define __ISearchCrawlScopeManager_FWD_DEFINED__ typedef interface ISearchCrawlScopeManager ISearchCrawlScopeManager; #endif /* __ISearchCrawlScopeManager_FWD_DEFINED__ */ #ifndef __ISearchCrawlScopeManager2_FWD_DEFINED__ #define __ISearchCrawlScopeManager2_FWD_DEFINED__ typedef interface ISearchCrawlScopeManager2 ISearchCrawlScopeManager2; #endif /* __ISearchCrawlScopeManager2_FWD_DEFINED__ */ #ifndef __ISearchItemsChangedSink_FWD_DEFINED__ #define __ISearchItemsChangedSink_FWD_DEFINED__ typedef interface ISearchItemsChangedSink ISearchItemsChangedSink; #endif /* __ISearchItemsChangedSink_FWD_DEFINED__ */ #ifndef __ISearchPersistentItemsChangedSink_FWD_DEFINED__ #define __ISearchPersistentItemsChangedSink_FWD_DEFINED__ typedef interface ISearchPersistentItemsChangedSink ISearchPersistentItemsChangedSink; #endif /* __ISearchPersistentItemsChangedSink_FWD_DEFINED__ */ #ifndef __ISearchViewChangedSink_FWD_DEFINED__ #define __ISearchViewChangedSink_FWD_DEFINED__ typedef interface ISearchViewChangedSink ISearchViewChangedSink; #endif /* __ISearchViewChangedSink_FWD_DEFINED__ */ #ifndef __ISearchNotifyInlineSite_FWD_DEFINED__ #define __ISearchNotifyInlineSite_FWD_DEFINED__ typedef interface ISearchNotifyInlineSite ISearchNotifyInlineSite; #endif /* __ISearchNotifyInlineSite_FWD_DEFINED__ */ #ifndef __ISearchCatalogManager_FWD_DEFINED__ #define __ISearchCatalogManager_FWD_DEFINED__ typedef interface ISearchCatalogManager ISearchCatalogManager; #endif /* __ISearchCatalogManager_FWD_DEFINED__ */ #ifndef __ISearchCatalogManager2_FWD_DEFINED__ #define __ISearchCatalogManager2_FWD_DEFINED__ typedef interface ISearchCatalogManager2 ISearchCatalogManager2; #endif /* __ISearchCatalogManager2_FWD_DEFINED__ */ #ifndef __ISearchQueryHelper_FWD_DEFINED__ #define __ISearchQueryHelper_FWD_DEFINED__ typedef interface ISearchQueryHelper ISearchQueryHelper; #endif /* __ISearchQueryHelper_FWD_DEFINED__ */ #ifndef __IRowsetPrioritization_FWD_DEFINED__ #define __IRowsetPrioritization_FWD_DEFINED__ typedef interface IRowsetPrioritization IRowsetPrioritization; #endif /* __IRowsetPrioritization_FWD_DEFINED__ */ #ifndef __IRowsetEvents_FWD_DEFINED__ #define __IRowsetEvents_FWD_DEFINED__ typedef interface IRowsetEvents IRowsetEvents; #endif /* __IRowsetEvents_FWD_DEFINED__ */ #ifndef __ISearchManager_FWD_DEFINED__ #define __ISearchManager_FWD_DEFINED__ typedef interface ISearchManager ISearchManager; #endif /* __ISearchManager_FWD_DEFINED__ */ #ifndef __ISearchManager2_FWD_DEFINED__ #define __ISearchManager2_FWD_DEFINED__ typedef interface ISearchManager2 ISearchManager2; #endif /* __ISearchManager2_FWD_DEFINED__ */ #ifndef __ISearchLanguageSupport_FWD_DEFINED__ #define __ISearchLanguageSupport_FWD_DEFINED__ typedef interface ISearchLanguageSupport ISearchLanguageSupport; #endif /* __ISearchLanguageSupport_FWD_DEFINED__ */ #ifndef __ISearchCatalogManager_FWD_DEFINED__ #define __ISearchCatalogManager_FWD_DEFINED__ typedef interface ISearchCatalogManager ISearchCatalogManager; #endif /* __ISearchCatalogManager_FWD_DEFINED__ */ #ifndef __ISearchCatalogManager2_FWD_DEFINED__ #define __ISearchCatalogManager2_FWD_DEFINED__ typedef interface ISearchCatalogManager2 ISearchCatalogManager2; #endif /* __ISearchCatalogManager2_FWD_DEFINED__ */ #ifndef __ISearchQueryHelper_FWD_DEFINED__ #define __ISearchQueryHelper_FWD_DEFINED__ typedef interface ISearchQueryHelper ISearchQueryHelper; #endif /* __ISearchQueryHelper_FWD_DEFINED__ */ #ifndef __ISearchItemsChangedSink_FWD_DEFINED__ #define __ISearchItemsChangedSink_FWD_DEFINED__ typedef interface ISearchItemsChangedSink ISearchItemsChangedSink; #endif /* __ISearchItemsChangedSink_FWD_DEFINED__ */ #ifndef __ISearchCrawlScopeManager_FWD_DEFINED__ #define __ISearchCrawlScopeManager_FWD_DEFINED__ typedef interface ISearchCrawlScopeManager ISearchCrawlScopeManager; #endif /* __ISearchCrawlScopeManager_FWD_DEFINED__ */ #ifndef __IEnumSearchScopeRules_FWD_DEFINED__ #define __IEnumSearchScopeRules_FWD_DEFINED__ typedef interface IEnumSearchScopeRules IEnumSearchScopeRules; #endif /* __IEnumSearchScopeRules_FWD_DEFINED__ */ #ifndef __ISearchManager_FWD_DEFINED__ #define __ISearchManager_FWD_DEFINED__ typedef interface ISearchManager ISearchManager; #endif /* __ISearchManager_FWD_DEFINED__ */ #ifndef __ISearchManager2_FWD_DEFINED__ #define __ISearchManager2_FWD_DEFINED__ typedef interface ISearchManager2 ISearchManager2; #endif /* __ISearchManager2_FWD_DEFINED__ */ #ifndef __CSearchManager_FWD_DEFINED__ #define __CSearchManager_FWD_DEFINED__ #ifdef __cplusplus typedef class CSearchManager CSearchManager; #else typedef struct CSearchManager CSearchManager; #endif /* __cplusplus */ #endif /* __CSearchManager_FWD_DEFINED__ */ #ifndef __CSearchRoot_FWD_DEFINED__ #define __CSearchRoot_FWD_DEFINED__ #ifdef __cplusplus typedef class CSearchRoot CSearchRoot; #else typedef struct CSearchRoot CSearchRoot; #endif /* __cplusplus */ #endif /* __CSearchRoot_FWD_DEFINED__ */ #ifndef __CSearchScopeRule_FWD_DEFINED__ #define __CSearchScopeRule_FWD_DEFINED__ #ifdef __cplusplus typedef class CSearchScopeRule CSearchScopeRule; #else typedef struct CSearchScopeRule CSearchScopeRule; #endif /* __cplusplus */ #endif /* __CSearchScopeRule_FWD_DEFINED__ */ #ifndef __FilterRegistration_FWD_DEFINED__ #define __FilterRegistration_FWD_DEFINED__ #ifdef __cplusplus typedef class FilterRegistration FilterRegistration; #else typedef struct FilterRegistration FilterRegistration; #endif /* __cplusplus */ #endif /* __FilterRegistration_FWD_DEFINED__ */ /* header files for imported files */ #include "unknwn.h" #include "objidl.h" #include "ocidl.h" #include "propidl.h" #include "filter.h" #include "filtereg.h" #include "propsys.h" #include "oledb.h" #include "structuredquery.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_searchapi_0000_0000 */ /* [local] */ //+---------------------------------------------------------------------------- // // Copyright (c) 2005 Microsoft Corporation. // Search API Interface // //----------------------------------------------------------------------------- #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef LONG ITEMID; #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0000_v0_0_s_ifspec; #ifndef __IUrlAccessor_INTERFACE_DEFINED__ #define __IUrlAccessor_INTERFACE_DEFINED__ /* interface IUrlAccessor */ /* [unique][public][helpstring][uuid][object] */ EXTERN_C const IID IID_IUrlAccessor; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0b63e318-9ccc-11d0-bcdb-00805fccce04") IUrlAccessor : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE AddRequestParameter( /* [in] */ __RPC__in PROPSPEC *pSpec, /* [in] */ __RPC__in PROPVARIANT *pVar) = 0; virtual HRESULT STDMETHODCALLTYPE GetDocFormat( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocFormat[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE GetCLSID( /* [out] */ __RPC__out CLSID *pClsid) = 0; virtual HRESULT STDMETHODCALLTYPE GetHost( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszHost[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE IsDirectory( void) = 0; virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ __RPC__out ULONGLONG *pllSize) = 0; virtual HRESULT STDMETHODCALLTYPE GetLastModified( /* [out] */ __RPC__out FILETIME *pftLastModified) = 0; virtual HRESULT STDMETHODCALLTYPE GetFileName( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszFileName[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE GetSecurityDescriptor( /* [size_is][out] */ __RPC__out_ecount_full(dwSize) BYTE *pSD, /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE GetRedirectedURL( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszRedirectedURL[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE GetSecurityProvider( /* [out] */ __RPC__out CLSID *pSPClsid) = 0; virtual HRESULT STDMETHODCALLTYPE BindToStream( /* [out] */ __RPC__deref_out_opt IStream **ppStream) = 0; virtual HRESULT STDMETHODCALLTYPE BindToFilter( /* [out] */ __RPC__deref_out_opt IFilter **ppFilter) = 0; }; #else /* C style interface */ typedef struct IUrlAccessorVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IUrlAccessor * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IUrlAccessor * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IUrlAccessor * This); HRESULT ( STDMETHODCALLTYPE *AddRequestParameter )( __RPC__in IUrlAccessor * This, /* [in] */ __RPC__in PROPSPEC *pSpec, /* [in] */ __RPC__in PROPVARIANT *pVar); HRESULT ( STDMETHODCALLTYPE *GetDocFormat )( __RPC__in IUrlAccessor * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocFormat[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetCLSID )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__out CLSID *pClsid); HRESULT ( STDMETHODCALLTYPE *GetHost )( __RPC__in IUrlAccessor * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszHost[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDirectory )( __RPC__in IUrlAccessor * This); HRESULT ( STDMETHODCALLTYPE *GetSize )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__out ULONGLONG *pllSize); HRESULT ( STDMETHODCALLTYPE *GetLastModified )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__out FILETIME *pftLastModified); HRESULT ( STDMETHODCALLTYPE *GetFileName )( __RPC__in IUrlAccessor * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszFileName[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityDescriptor )( __RPC__in IUrlAccessor * This, /* [size_is][out] */ __RPC__out_ecount_full(dwSize) BYTE *pSD, /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetRedirectedURL )( __RPC__in IUrlAccessor * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszRedirectedURL[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityProvider )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__out CLSID *pSPClsid); HRESULT ( STDMETHODCALLTYPE *BindToStream )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__deref_out_opt IStream **ppStream); HRESULT ( STDMETHODCALLTYPE *BindToFilter )( __RPC__in IUrlAccessor * This, /* [out] */ __RPC__deref_out_opt IFilter **ppFilter); END_INTERFACE } IUrlAccessorVtbl; interface IUrlAccessor { CONST_VTBL struct IUrlAccessorVtbl *lpVtbl; }; #ifdef COBJMACROS #define IUrlAccessor_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IUrlAccessor_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IUrlAccessor_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IUrlAccessor_AddRequestParameter(This,pSpec,pVar) \ ( (This)->lpVtbl -> AddRequestParameter(This,pSpec,pVar) ) #define IUrlAccessor_GetDocFormat(This,wszDocFormat,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDocFormat(This,wszDocFormat,dwSize,pdwLength) ) #define IUrlAccessor_GetCLSID(This,pClsid) \ ( (This)->lpVtbl -> GetCLSID(This,pClsid) ) #define IUrlAccessor_GetHost(This,wszHost,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetHost(This,wszHost,dwSize,pdwLength) ) #define IUrlAccessor_IsDirectory(This) \ ( (This)->lpVtbl -> IsDirectory(This) ) #define IUrlAccessor_GetSize(This,pllSize) \ ( (This)->lpVtbl -> GetSize(This,pllSize) ) #define IUrlAccessor_GetLastModified(This,pftLastModified) \ ( (This)->lpVtbl -> GetLastModified(This,pftLastModified) ) #define IUrlAccessor_GetFileName(This,wszFileName,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetFileName(This,wszFileName,dwSize,pdwLength) ) #define IUrlAccessor_GetSecurityDescriptor(This,pSD,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetSecurityDescriptor(This,pSD,dwSize,pdwLength) ) #define IUrlAccessor_GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) ) #define IUrlAccessor_GetSecurityProvider(This,pSPClsid) \ ( (This)->lpVtbl -> GetSecurityProvider(This,pSPClsid) ) #define IUrlAccessor_BindToStream(This,ppStream) \ ( (This)->lpVtbl -> BindToStream(This,ppStream) ) #define IUrlAccessor_BindToFilter(This,ppFilter) \ ( (This)->lpVtbl -> BindToFilter(This,ppFilter) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IUrlAccessor_INTERFACE_DEFINED__ */ #ifndef __IUrlAccessor2_INTERFACE_DEFINED__ #define __IUrlAccessor2_INTERFACE_DEFINED__ /* interface IUrlAccessor2 */ /* [unique][public][helpstring][uuid][object] */ EXTERN_C const IID IID_IUrlAccessor2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("c7310734-ac80-11d1-8df3-00c04fb6ef4f") IUrlAccessor2 : public IUrlAccessor { public: virtual HRESULT STDMETHODCALLTYPE GetDisplayUrl( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocUrl[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; virtual HRESULT STDMETHODCALLTYPE IsDocument( void) = 0; virtual HRESULT STDMETHODCALLTYPE GetCodePage( /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszCodePage[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength) = 0; }; #else /* C style interface */ typedef struct IUrlAccessor2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IUrlAccessor2 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IUrlAccessor2 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IUrlAccessor2 * This); HRESULT ( STDMETHODCALLTYPE *AddRequestParameter )( __RPC__in IUrlAccessor2 * This, /* [in] */ __RPC__in PROPSPEC *pSpec, /* [in] */ __RPC__in PROPVARIANT *pVar); HRESULT ( STDMETHODCALLTYPE *GetDocFormat )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocFormat[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetCLSID )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__out CLSID *pClsid); HRESULT ( STDMETHODCALLTYPE *GetHost )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszHost[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDirectory )( __RPC__in IUrlAccessor2 * This); HRESULT ( STDMETHODCALLTYPE *GetSize )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__out ULONGLONG *pllSize); HRESULT ( STDMETHODCALLTYPE *GetLastModified )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__out FILETIME *pftLastModified); HRESULT ( STDMETHODCALLTYPE *GetFileName )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszFileName[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityDescriptor )( __RPC__in IUrlAccessor2 * This, /* [size_is][out] */ __RPC__out_ecount_full(dwSize) BYTE *pSD, /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetRedirectedURL )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszRedirectedURL[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityProvider )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__out CLSID *pSPClsid); HRESULT ( STDMETHODCALLTYPE *BindToStream )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__deref_out_opt IStream **ppStream); HRESULT ( STDMETHODCALLTYPE *BindToFilter )( __RPC__in IUrlAccessor2 * This, /* [out] */ __RPC__deref_out_opt IFilter **ppFilter); HRESULT ( STDMETHODCALLTYPE *GetDisplayUrl )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocUrl[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDocument )( __RPC__in IUrlAccessor2 * This); HRESULT ( STDMETHODCALLTYPE *GetCodePage )( __RPC__in IUrlAccessor2 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszCodePage[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); END_INTERFACE } IUrlAccessor2Vtbl; interface IUrlAccessor2 { CONST_VTBL struct IUrlAccessor2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IUrlAccessor2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IUrlAccessor2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IUrlAccessor2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IUrlAccessor2_AddRequestParameter(This,pSpec,pVar) \ ( (This)->lpVtbl -> AddRequestParameter(This,pSpec,pVar) ) #define IUrlAccessor2_GetDocFormat(This,wszDocFormat,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDocFormat(This,wszDocFormat,dwSize,pdwLength) ) #define IUrlAccessor2_GetCLSID(This,pClsid) \ ( (This)->lpVtbl -> GetCLSID(This,pClsid) ) #define IUrlAccessor2_GetHost(This,wszHost,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetHost(This,wszHost,dwSize,pdwLength) ) #define IUrlAccessor2_IsDirectory(This) \ ( (This)->lpVtbl -> IsDirectory(This) ) #define IUrlAccessor2_GetSize(This,pllSize) \ ( (This)->lpVtbl -> GetSize(This,pllSize) ) #define IUrlAccessor2_GetLastModified(This,pftLastModified) \ ( (This)->lpVtbl -> GetLastModified(This,pftLastModified) ) #define IUrlAccessor2_GetFileName(This,wszFileName,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetFileName(This,wszFileName,dwSize,pdwLength) ) #define IUrlAccessor2_GetSecurityDescriptor(This,pSD,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetSecurityDescriptor(This,pSD,dwSize,pdwLength) ) #define IUrlAccessor2_GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) ) #define IUrlAccessor2_GetSecurityProvider(This,pSPClsid) \ ( (This)->lpVtbl -> GetSecurityProvider(This,pSPClsid) ) #define IUrlAccessor2_BindToStream(This,ppStream) \ ( (This)->lpVtbl -> BindToStream(This,ppStream) ) #define IUrlAccessor2_BindToFilter(This,ppFilter) \ ( (This)->lpVtbl -> BindToFilter(This,ppFilter) ) #define IUrlAccessor2_GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) ) #define IUrlAccessor2_IsDocument(This) \ ( (This)->lpVtbl -> IsDocument(This) ) #define IUrlAccessor2_GetCodePage(This,wszCodePage,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetCodePage(This,wszCodePage,dwSize,pdwLength) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IUrlAccessor2_INTERFACE_DEFINED__ */ #ifndef __IUrlAccessor3_INTERFACE_DEFINED__ #define __IUrlAccessor3_INTERFACE_DEFINED__ /* interface IUrlAccessor3 */ /* [unique][public][helpstring][uuid][object] */ EXTERN_C const IID IID_IUrlAccessor3; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("6FBC7005-0455-4874-B8FF-7439450241A3") IUrlAccessor3 : public IUrlAccessor2 { public: virtual HRESULT STDMETHODCALLTYPE GetImpersonationSidBlobs( /* [in] */ __RPC__in LPCWSTR pcwszURL, /* [out] */ __RPC__out DWORD *pcSidCount, /* [out] */ __RPC__deref_out_opt BLOB **ppSidBlobs) = 0; }; #else /* C style interface */ typedef struct IUrlAccessor3Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IUrlAccessor3 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IUrlAccessor3 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IUrlAccessor3 * This); HRESULT ( STDMETHODCALLTYPE *AddRequestParameter )( __RPC__in IUrlAccessor3 * This, /* [in] */ __RPC__in PROPSPEC *pSpec, /* [in] */ __RPC__in PROPVARIANT *pVar); HRESULT ( STDMETHODCALLTYPE *GetDocFormat )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocFormat[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetCLSID )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__out CLSID *pClsid); HRESULT ( STDMETHODCALLTYPE *GetHost )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszHost[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDirectory )( __RPC__in IUrlAccessor3 * This); HRESULT ( STDMETHODCALLTYPE *GetSize )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__out ULONGLONG *pllSize); HRESULT ( STDMETHODCALLTYPE *GetLastModified )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__out FILETIME *pftLastModified); HRESULT ( STDMETHODCALLTYPE *GetFileName )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszFileName[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityDescriptor )( __RPC__in IUrlAccessor3 * This, /* [size_is][out] */ __RPC__out_ecount_full(dwSize) BYTE *pSD, /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetRedirectedURL )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszRedirectedURL[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityProvider )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__out CLSID *pSPClsid); HRESULT ( STDMETHODCALLTYPE *BindToStream )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__deref_out_opt IStream **ppStream); HRESULT ( STDMETHODCALLTYPE *BindToFilter )( __RPC__in IUrlAccessor3 * This, /* [out] */ __RPC__deref_out_opt IFilter **ppFilter); HRESULT ( STDMETHODCALLTYPE *GetDisplayUrl )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocUrl[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDocument )( __RPC__in IUrlAccessor3 * This); HRESULT ( STDMETHODCALLTYPE *GetCodePage )( __RPC__in IUrlAccessor3 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszCodePage[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetImpersonationSidBlobs )( __RPC__in IUrlAccessor3 * This, /* [in] */ __RPC__in LPCWSTR pcwszURL, /* [out] */ __RPC__out DWORD *pcSidCount, /* [out] */ __RPC__deref_out_opt BLOB **ppSidBlobs); END_INTERFACE } IUrlAccessor3Vtbl; interface IUrlAccessor3 { CONST_VTBL struct IUrlAccessor3Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IUrlAccessor3_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IUrlAccessor3_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IUrlAccessor3_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IUrlAccessor3_AddRequestParameter(This,pSpec,pVar) \ ( (This)->lpVtbl -> AddRequestParameter(This,pSpec,pVar) ) #define IUrlAccessor3_GetDocFormat(This,wszDocFormat,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDocFormat(This,wszDocFormat,dwSize,pdwLength) ) #define IUrlAccessor3_GetCLSID(This,pClsid) \ ( (This)->lpVtbl -> GetCLSID(This,pClsid) ) #define IUrlAccessor3_GetHost(This,wszHost,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetHost(This,wszHost,dwSize,pdwLength) ) #define IUrlAccessor3_IsDirectory(This) \ ( (This)->lpVtbl -> IsDirectory(This) ) #define IUrlAccessor3_GetSize(This,pllSize) \ ( (This)->lpVtbl -> GetSize(This,pllSize) ) #define IUrlAccessor3_GetLastModified(This,pftLastModified) \ ( (This)->lpVtbl -> GetLastModified(This,pftLastModified) ) #define IUrlAccessor3_GetFileName(This,wszFileName,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetFileName(This,wszFileName,dwSize,pdwLength) ) #define IUrlAccessor3_GetSecurityDescriptor(This,pSD,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetSecurityDescriptor(This,pSD,dwSize,pdwLength) ) #define IUrlAccessor3_GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) ) #define IUrlAccessor3_GetSecurityProvider(This,pSPClsid) \ ( (This)->lpVtbl -> GetSecurityProvider(This,pSPClsid) ) #define IUrlAccessor3_BindToStream(This,ppStream) \ ( (This)->lpVtbl -> BindToStream(This,ppStream) ) #define IUrlAccessor3_BindToFilter(This,ppFilter) \ ( (This)->lpVtbl -> BindToFilter(This,ppFilter) ) #define IUrlAccessor3_GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) ) #define IUrlAccessor3_IsDocument(This) \ ( (This)->lpVtbl -> IsDocument(This) ) #define IUrlAccessor3_GetCodePage(This,wszCodePage,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetCodePage(This,wszCodePage,dwSize,pdwLength) ) #define IUrlAccessor3_GetImpersonationSidBlobs(This,pcwszURL,pcSidCount,ppSidBlobs) \ ( (This)->lpVtbl -> GetImpersonationSidBlobs(This,pcwszURL,pcSidCount,ppSidBlobs) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IUrlAccessor3_INTERFACE_DEFINED__ */ #ifndef __IUrlAccessor4_INTERFACE_DEFINED__ #define __IUrlAccessor4_INTERFACE_DEFINED__ /* interface IUrlAccessor4 */ /* [unique][public][helpstring][uuid][object] */ EXTERN_C const IID IID_IUrlAccessor4; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("5CC51041-C8D2-41d7-BCA3-9E9E286297DC") IUrlAccessor4 : public IUrlAccessor3 { public: virtual HRESULT STDMETHODCALLTYPE ShouldIndexItemContent( /* [out] */ __RPC__out BOOL *pfIndexContent) = 0; virtual HRESULT STDMETHODCALLTYPE ShouldIndexProperty( /* [in] */ __RPC__in REFPROPERTYKEY key, /* [out] */ __RPC__out BOOL *pfIndexProperty) = 0; }; #else /* C style interface */ typedef struct IUrlAccessor4Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IUrlAccessor4 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IUrlAccessor4 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IUrlAccessor4 * This); HRESULT ( STDMETHODCALLTYPE *AddRequestParameter )( __RPC__in IUrlAccessor4 * This, /* [in] */ __RPC__in PROPSPEC *pSpec, /* [in] */ __RPC__in PROPVARIANT *pVar); HRESULT ( STDMETHODCALLTYPE *GetDocFormat )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocFormat[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetCLSID )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__out CLSID *pClsid); HRESULT ( STDMETHODCALLTYPE *GetHost )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszHost[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDirectory )( __RPC__in IUrlAccessor4 * This); HRESULT ( STDMETHODCALLTYPE *GetSize )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__out ULONGLONG *pllSize); HRESULT ( STDMETHODCALLTYPE *GetLastModified )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__out FILETIME *pftLastModified); HRESULT ( STDMETHODCALLTYPE *GetFileName )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszFileName[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityDescriptor )( __RPC__in IUrlAccessor4 * This, /* [size_is][out] */ __RPC__out_ecount_full(dwSize) BYTE *pSD, /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetRedirectedURL )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszRedirectedURL[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetSecurityProvider )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__out CLSID *pSPClsid); HRESULT ( STDMETHODCALLTYPE *BindToStream )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__deref_out_opt IStream **ppStream); HRESULT ( STDMETHODCALLTYPE *BindToFilter )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__deref_out_opt IFilter **ppFilter); HRESULT ( STDMETHODCALLTYPE *GetDisplayUrl )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszDocUrl[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *IsDocument )( __RPC__in IUrlAccessor4 * This); HRESULT ( STDMETHODCALLTYPE *GetCodePage )( __RPC__in IUrlAccessor4 * This, /* [size_is][length_is][out] */ __RPC__out_ecount_part(dwSize, *pdwLength) WCHAR wszCodePage[ ], /* [in] */ DWORD dwSize, /* [out] */ __RPC__out DWORD *pdwLength); HRESULT ( STDMETHODCALLTYPE *GetImpersonationSidBlobs )( __RPC__in IUrlAccessor4 * This, /* [in] */ __RPC__in LPCWSTR pcwszURL, /* [out] */ __RPC__out DWORD *pcSidCount, /* [out] */ __RPC__deref_out_opt BLOB **ppSidBlobs); HRESULT ( STDMETHODCALLTYPE *ShouldIndexItemContent )( __RPC__in IUrlAccessor4 * This, /* [out] */ __RPC__out BOOL *pfIndexContent); HRESULT ( STDMETHODCALLTYPE *ShouldIndexProperty )( __RPC__in IUrlAccessor4 * This, /* [in] */ __RPC__in REFPROPERTYKEY key, /* [out] */ __RPC__out BOOL *pfIndexProperty); END_INTERFACE } IUrlAccessor4Vtbl; interface IUrlAccessor4 { CONST_VTBL struct IUrlAccessor4Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IUrlAccessor4_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IUrlAccessor4_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IUrlAccessor4_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IUrlAccessor4_AddRequestParameter(This,pSpec,pVar) \ ( (This)->lpVtbl -> AddRequestParameter(This,pSpec,pVar) ) #define IUrlAccessor4_GetDocFormat(This,wszDocFormat,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDocFormat(This,wszDocFormat,dwSize,pdwLength) ) #define IUrlAccessor4_GetCLSID(This,pClsid) \ ( (This)->lpVtbl -> GetCLSID(This,pClsid) ) #define IUrlAccessor4_GetHost(This,wszHost,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetHost(This,wszHost,dwSize,pdwLength) ) #define IUrlAccessor4_IsDirectory(This) \ ( (This)->lpVtbl -> IsDirectory(This) ) #define IUrlAccessor4_GetSize(This,pllSize) \ ( (This)->lpVtbl -> GetSize(This,pllSize) ) #define IUrlAccessor4_GetLastModified(This,pftLastModified) \ ( (This)->lpVtbl -> GetLastModified(This,pftLastModified) ) #define IUrlAccessor4_GetFileName(This,wszFileName,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetFileName(This,wszFileName,dwSize,pdwLength) ) #define IUrlAccessor4_GetSecurityDescriptor(This,pSD,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetSecurityDescriptor(This,pSD,dwSize,pdwLength) ) #define IUrlAccessor4_GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetRedirectedURL(This,wszRedirectedURL,dwSize,pdwLength) ) #define IUrlAccessor4_GetSecurityProvider(This,pSPClsid) \ ( (This)->lpVtbl -> GetSecurityProvider(This,pSPClsid) ) #define IUrlAccessor4_BindToStream(This,ppStream) \ ( (This)->lpVtbl -> BindToStream(This,ppStream) ) #define IUrlAccessor4_BindToFilter(This,ppFilter) \ ( (This)->lpVtbl -> BindToFilter(This,ppFilter) ) #define IUrlAccessor4_GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetDisplayUrl(This,wszDocUrl,dwSize,pdwLength) ) #define IUrlAccessor4_IsDocument(This) \ ( (This)->lpVtbl -> IsDocument(This) ) #define IUrlAccessor4_GetCodePage(This,wszCodePage,dwSize,pdwLength) \ ( (This)->lpVtbl -> GetCodePage(This,wszCodePage,dwSize,pdwLength) ) #define IUrlAccessor4_GetImpersonationSidBlobs(This,pcwszURL,pcSidCount,ppSidBlobs) \ ( (This)->lpVtbl -> GetImpersonationSidBlobs(This,pcwszURL,pcSidCount,ppSidBlobs) ) #define IUrlAccessor4_ShouldIndexItemContent(This,pfIndexContent) \ ( (This)->lpVtbl -> ShouldIndexItemContent(This,pfIndexContent) ) #define IUrlAccessor4_ShouldIndexProperty(This,key,pfIndexProperty) \ ( (This)->lpVtbl -> ShouldIndexProperty(This,key,pfIndexProperty) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IUrlAccessor4_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0004 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0004_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0004_v0_0_s_ifspec; #ifndef __IOpLockStatus_INTERFACE_DEFINED__ #define __IOpLockStatus_INTERFACE_DEFINED__ /* interface IOpLockStatus */ /* [unique][local][helpstring][uuid][object] */ EXTERN_C const IID IID_IOpLockStatus; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("c731065d-ac80-11d1-8df3-00c04fb6ef4f") IOpLockStatus : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE IsOplockValid( /* [annotation][out] */ _Out_ BOOL *pfIsOplockValid) = 0; virtual HRESULT STDMETHODCALLTYPE IsOplockBroken( /* [annotation][out] */ _Out_ BOOL *pfIsOplockBroken) = 0; virtual HRESULT STDMETHODCALLTYPE GetOplockEventHandle( /* [annotation][out] */ _Outptr_ HANDLE *phOplockEv) = 0; }; #else /* C style interface */ typedef struct IOpLockStatusVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IOpLockStatus * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IOpLockStatus * This); ULONG ( STDMETHODCALLTYPE *Release )( IOpLockStatus * This); HRESULT ( STDMETHODCALLTYPE *IsOplockValid )( IOpLockStatus * This, /* [annotation][out] */ _Out_ BOOL *pfIsOplockValid); HRESULT ( STDMETHODCALLTYPE *IsOplockBroken )( IOpLockStatus * This, /* [annotation][out] */ _Out_ BOOL *pfIsOplockBroken); HRESULT ( STDMETHODCALLTYPE *GetOplockEventHandle )( IOpLockStatus * This, /* [annotation][out] */ _Outptr_ HANDLE *phOplockEv); END_INTERFACE } IOpLockStatusVtbl; interface IOpLockStatus { CONST_VTBL struct IOpLockStatusVtbl *lpVtbl; }; #ifdef COBJMACROS #define IOpLockStatus_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IOpLockStatus_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IOpLockStatus_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IOpLockStatus_IsOplockValid(This,pfIsOplockValid) \ ( (This)->lpVtbl -> IsOplockValid(This,pfIsOplockValid) ) #define IOpLockStatus_IsOplockBroken(This,pfIsOplockBroken) \ ( (This)->lpVtbl -> IsOplockBroken(This,pfIsOplockBroken) ) #define IOpLockStatus_GetOplockEventHandle(This,phOplockEv) \ ( (This)->lpVtbl -> GetOplockEventHandle(This,phOplockEv) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IOpLockStatus_INTERFACE_DEFINED__ */ #ifndef __ISearchProtocolThreadContext_INTERFACE_DEFINED__ #define __ISearchProtocolThreadContext_INTERFACE_DEFINED__ /* interface ISearchProtocolThreadContext */ /* [unique][local][helpstring][uuid][object] */ EXTERN_C const IID IID_ISearchProtocolThreadContext; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("c73106e1-ac80-11d1-8df3-00c04fb6ef4f") ISearchProtocolThreadContext : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE ThreadInit( void) = 0; virtual HRESULT STDMETHODCALLTYPE ThreadShutdown( void) = 0; virtual HRESULT STDMETHODCALLTYPE ThreadIdle( /* [in] */ DWORD dwTimeElaspedSinceLastCallInMS) = 0; }; #else /* C style interface */ typedef struct ISearchProtocolThreadContextVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISearchProtocolThreadContext * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( ISearchProtocolThreadContext * This); ULONG ( STDMETHODCALLTYPE *Release )( ISearchProtocolThreadContext * This); HRESULT ( STDMETHODCALLTYPE *ThreadInit )( ISearchProtocolThreadContext * This); HRESULT ( STDMETHODCALLTYPE *ThreadShutdown )( ISearchProtocolThreadContext * This); HRESULT ( STDMETHODCALLTYPE *ThreadIdle )( ISearchProtocolThreadContext * This, /* [in] */ DWORD dwTimeElaspedSinceLastCallInMS); END_INTERFACE } ISearchProtocolThreadContextVtbl; interface ISearchProtocolThreadContext { CONST_VTBL struct ISearchProtocolThreadContextVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchProtocolThreadContext_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchProtocolThreadContext_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchProtocolThreadContext_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchProtocolThreadContext_ThreadInit(This) \ ( (This)->lpVtbl -> ThreadInit(This) ) #define ISearchProtocolThreadContext_ThreadShutdown(This) \ ( (This)->lpVtbl -> ThreadShutdown(This) ) #define ISearchProtocolThreadContext_ThreadIdle(This,dwTimeElaspedSinceLastCallInMS) \ ( (This)->lpVtbl -> ThreadIdle(This,dwTimeElaspedSinceLastCallInMS) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchProtocolThreadContext_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0006 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #pragma pack(8) typedef struct _TIMEOUT_INFO { DWORD dwSize; DWORD dwConnectTimeout; DWORD dwDataTimeout; } TIMEOUT_INFO; typedef enum _PROXY_ACCESS { PROXY_ACCESS_PRECONFIG = 0, PROXY_ACCESS_DIRECT = ( PROXY_ACCESS_PRECONFIG + 1 ) , PROXY_ACCESS_PROXY = ( PROXY_ACCESS_DIRECT + 1 ) } PROXY_ACCESS; typedef struct _PROXY_INFO { DWORD dwSize; LPCWSTR pcwszUserAgent; PROXY_ACCESS paUseProxy; BOOL fLocalBypass; DWORD dwPortNumber; LPCWSTR pcwszProxyName; LPCWSTR pcwszBypassList; } PROXY_INFO; typedef enum _AUTH_TYPE { eAUTH_TYPE_ANONYMOUS = 0, eAUTH_TYPE_NTLM = ( eAUTH_TYPE_ANONYMOUS + 1 ) , eAUTH_TYPE_BASIC = ( eAUTH_TYPE_NTLM + 1 ) } AUTH_TYPE; typedef struct _AUTHENTICATION_INFO { DWORD dwSize; AUTH_TYPE atAuthenticationType; LPCWSTR pcwszUser; LPCWSTR pcwszPassword; } AUTHENTICATION_INFO; typedef struct _INCREMENTAL_ACCESS_INFO { DWORD dwSize; FILETIME ftLastModifiedTime; } INCREMENTAL_ACCESS_INFO; typedef struct _ITEM_INFO { DWORD dwSize; LPCWSTR pcwszFromEMail; LPCWSTR pcwszApplicationName; LPCWSTR pcwszCatalogName; LPCWSTR pcwszContentClass; } ITEM_INFO; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0006_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0006_v0_0_s_ifspec; #ifndef __ISearchProtocol_INTERFACE_DEFINED__ #define __ISearchProtocol_INTERFACE_DEFINED__ /* interface ISearchProtocol */ /* [unique][helpstring][uuid][local][object] */ EXTERN_C const IID IID_ISearchProtocol; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("c73106ba-ac80-11d1-8df3-00c04fb6ef4f") ISearchProtocol : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Init( /* [in] */ TIMEOUT_INFO *pTimeoutInfo, /* [in] */ IProtocolHandlerSite *pProtocolHandlerSite, /* [in] */ PROXY_INFO *pProxyInfo) = 0; virtual HRESULT STDMETHODCALLTYPE CreateAccessor( /* [in] */ LPCWSTR pcwszURL, /* [in] */ AUTHENTICATION_INFO *pAuthenticationInfo, /* [in] */ INCREMENTAL_ACCESS_INFO *pIncrementalAccessInfo, /* [in] */ ITEM_INFO *pItemInfo, /* [out] */ IUrlAccessor **ppAccessor) = 0; virtual HRESULT STDMETHODCALLTYPE CloseAccessor( /* [in] */ IUrlAccessor *pAccessor) = 0; virtual HRESULT STDMETHODCALLTYPE ShutDown( void) = 0; }; #else /* C style interface */ typedef struct ISearchProtocolVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISearchProtocol * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( ISearchProtocol * This); ULONG ( STDMETHODCALLTYPE *Release )( ISearchProtocol * This); HRESULT ( STDMETHODCALLTYPE *Init )( ISearchProtocol * This, /* [in] */ TIMEOUT_INFO *pTimeoutInfo, /* [in] */ IProtocolHandlerSite *pProtocolHandlerSite, /* [in] */ PROXY_INFO *pProxyInfo); HRESULT ( STDMETHODCALLTYPE *CreateAccessor )( ISearchProtocol * This, /* [in] */ LPCWSTR pcwszURL, /* [in] */ AUTHENTICATION_INFO *pAuthenticationInfo, /* [in] */ INCREMENTAL_ACCESS_INFO *pIncrementalAccessInfo, /* [in] */ ITEM_INFO *pItemInfo, /* [out] */ IUrlAccessor **ppAccessor); HRESULT ( STDMETHODCALLTYPE *CloseAccessor )( ISearchProtocol * This, /* [in] */ IUrlAccessor *pAccessor); HRESULT ( STDMETHODCALLTYPE *ShutDown )( ISearchProtocol * This); END_INTERFACE } ISearchProtocolVtbl; interface ISearchProtocol { CONST_VTBL struct ISearchProtocolVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchProtocol_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchProtocol_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchProtocol_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchProtocol_Init(This,pTimeoutInfo,pProtocolHandlerSite,pProxyInfo) \ ( (This)->lpVtbl -> Init(This,pTimeoutInfo,pProtocolHandlerSite,pProxyInfo) ) #define ISearchProtocol_CreateAccessor(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,ppAccessor) \ ( (This)->lpVtbl -> CreateAccessor(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,ppAccessor) ) #define ISearchProtocol_CloseAccessor(This,pAccessor) \ ( (This)->lpVtbl -> CloseAccessor(This,pAccessor) ) #define ISearchProtocol_ShutDown(This) \ ( (This)->lpVtbl -> ShutDown(This) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchProtocol_INTERFACE_DEFINED__ */ #ifndef __ISearchProtocol2_INTERFACE_DEFINED__ #define __ISearchProtocol2_INTERFACE_DEFINED__ /* interface ISearchProtocol2 */ /* [unique][helpstring][uuid][local][object] */ EXTERN_C const IID IID_ISearchProtocol2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("7789F0B2-B5B2-4722-8B65-5DBD150697A9") ISearchProtocol2 : public ISearchProtocol { public: virtual HRESULT STDMETHODCALLTYPE CreateAccessorEx( /* [in] */ LPCWSTR pcwszURL, /* [in] */ AUTHENTICATION_INFO *pAuthenticationInfo, /* [in] */ INCREMENTAL_ACCESS_INFO *pIncrementalAccessInfo, /* [in] */ ITEM_INFO *pItemInfo, /* [in] */ const BLOB *pUserData, /* [out] */ IUrlAccessor **ppAccessor) = 0; }; #else /* C style interface */ typedef struct ISearchProtocol2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ISearchProtocol2 * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( ISearchProtocol2 * This); ULONG ( STDMETHODCALLTYPE *Release )( ISearchProtocol2 * This); HRESULT ( STDMETHODCALLTYPE *Init )( ISearchProtocol2 * This, /* [in] */ TIMEOUT_INFO *pTimeoutInfo, /* [in] */ IProtocolHandlerSite *pProtocolHandlerSite, /* [in] */ PROXY_INFO *pProxyInfo); HRESULT ( STDMETHODCALLTYPE *CreateAccessor )( ISearchProtocol2 * This, /* [in] */ LPCWSTR pcwszURL, /* [in] */ AUTHENTICATION_INFO *pAuthenticationInfo, /* [in] */ INCREMENTAL_ACCESS_INFO *pIncrementalAccessInfo, /* [in] */ ITEM_INFO *pItemInfo, /* [out] */ IUrlAccessor **ppAccessor); HRESULT ( STDMETHODCALLTYPE *CloseAccessor )( ISearchProtocol2 * This, /* [in] */ IUrlAccessor *pAccessor); HRESULT ( STDMETHODCALLTYPE *ShutDown )( ISearchProtocol2 * This); HRESULT ( STDMETHODCALLTYPE *CreateAccessorEx )( ISearchProtocol2 * This, /* [in] */ LPCWSTR pcwszURL, /* [in] */ AUTHENTICATION_INFO *pAuthenticationInfo, /* [in] */ INCREMENTAL_ACCESS_INFO *pIncrementalAccessInfo, /* [in] */ ITEM_INFO *pItemInfo, /* [in] */ const BLOB *pUserData, /* [out] */ IUrlAccessor **ppAccessor); END_INTERFACE } ISearchProtocol2Vtbl; interface ISearchProtocol2 { CONST_VTBL struct ISearchProtocol2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchProtocol2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchProtocol2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchProtocol2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchProtocol2_Init(This,pTimeoutInfo,pProtocolHandlerSite,pProxyInfo) \ ( (This)->lpVtbl -> Init(This,pTimeoutInfo,pProtocolHandlerSite,pProxyInfo) ) #define ISearchProtocol2_CreateAccessor(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,ppAccessor) \ ( (This)->lpVtbl -> CreateAccessor(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,ppAccessor) ) #define ISearchProtocol2_CloseAccessor(This,pAccessor) \ ( (This)->lpVtbl -> CloseAccessor(This,pAccessor) ) #define ISearchProtocol2_ShutDown(This) \ ( (This)->lpVtbl -> ShutDown(This) ) #define ISearchProtocol2_CreateAccessorEx(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,pUserData,ppAccessor) \ ( (This)->lpVtbl -> CreateAccessorEx(This,pcwszURL,pAuthenticationInfo,pIncrementalAccessInfo,pItemInfo,pUserData,ppAccessor) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchProtocol2_INTERFACE_DEFINED__ */ #ifndef __IProtocolHandlerSite_INTERFACE_DEFINED__ #define __IProtocolHandlerSite_INTERFACE_DEFINED__ /* interface IProtocolHandlerSite */ /* [unique][helpstring][uuid][local][object] */ EXTERN_C const IID IID_IProtocolHandlerSite; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0b63e385-9ccc-11d0-bcdb-00805fccce04") IProtocolHandlerSite : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetFilter( /* [in] */ CLSID *pclsidObj, /* [in] */ LPCWSTR pcwszContentType, /* [in] */ LPCWSTR pcwszExtension, /* [out] */ IFilter **ppFilter) = 0; }; #else /* C style interface */ typedef struct IProtocolHandlerSiteVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IProtocolHandlerSite * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IProtocolHandlerSite * This); ULONG ( STDMETHODCALLTYPE *Release )( IProtocolHandlerSite * This); HRESULT ( STDMETHODCALLTYPE *GetFilter )( IProtocolHandlerSite * This, /* [in] */ CLSID *pclsidObj, /* [in] */ LPCWSTR pcwszContentType, /* [in] */ LPCWSTR pcwszExtension, /* [out] */ IFilter **ppFilter); END_INTERFACE } IProtocolHandlerSiteVtbl; interface IProtocolHandlerSite { CONST_VTBL struct IProtocolHandlerSiteVtbl *lpVtbl; }; #ifdef COBJMACROS #define IProtocolHandlerSite_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IProtocolHandlerSite_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IProtocolHandlerSite_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IProtocolHandlerSite_GetFilter(This,pclsidObj,pcwszContentType,pcwszExtension,ppFilter) \ ( (This)->lpVtbl -> GetFilter(This,pclsidObj,pcwszContentType,pcwszExtension,ppFilter) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IProtocolHandlerSite_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0009 */ /* [local] */ #pragma pack() #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0009_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0009_v0_0_s_ifspec; #ifndef __ISearchRoot_INTERFACE_DEFINED__ #define __ISearchRoot_INTERFACE_DEFINED__ /* interface ISearchRoot */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchRoot; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("04C18CCF-1F57-4CBD-88CC-3900F5195CE3") ISearchRoot : public IUnknown { public: virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Schedule( /* [string][in] */ __RPC__in_string LPCWSTR pszTaskArg) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Schedule( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszTaskArg) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RootURL( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RootURL( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszURL) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsHierarchical( /* [in] */ BOOL fIsHierarchical) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsHierarchical( /* [retval][out] */ __RPC__out BOOL *pfIsHierarchical) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ProvidesNotifications( /* [in] */ BOOL fProvidesNotifications) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProvidesNotifications( /* [retval][out] */ __RPC__out BOOL *pfProvidesNotifications) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_UseNotificationsOnly( /* [in] */ BOOL fUseNotificationsOnly) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UseNotificationsOnly( /* [retval][out] */ __RPC__out BOOL *pfUseNotificationsOnly) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_EnumerationDepth( /* [in] */ DWORD dwDepth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EnumerationDepth( /* [retval][out] */ __RPC__out DWORD *pdwDepth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_HostDepth( /* [in] */ DWORD dwDepth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostDepth( /* [retval][out] */ __RPC__out DWORD *pdwDepth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FollowDirectories( /* [in] */ BOOL fFollowDirectories) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FollowDirectories( /* [retval][out] */ __RPC__out BOOL *pfFollowDirectories) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AuthenticationType( /* [in] */ AUTH_TYPE authType) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AuthenticationType( /* [retval][out] */ __RPC__out AUTH_TYPE *pAuthType) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_User( /* [string][in] */ __RPC__in_string LPCWSTR pszUser) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_User( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszUser) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Password( /* [string][in] */ __RPC__in_string LPCWSTR pszPassword) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Password( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszPassword) = 0; }; #else /* C style interface */ typedef struct ISearchRootVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchRoot * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchRoot * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchRoot * This); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Schedule )( __RPC__in ISearchRoot * This, /* [string][in] */ __RPC__in_string LPCWSTR pszTaskArg); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Schedule )( __RPC__in ISearchRoot * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszTaskArg); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RootURL )( __RPC__in ISearchRoot * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RootURL )( __RPC__in ISearchRoot * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszURL); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsHierarchical )( __RPC__in ISearchRoot * This, /* [in] */ BOOL fIsHierarchical); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsHierarchical )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out BOOL *pfIsHierarchical); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ProvidesNotifications )( __RPC__in ISearchRoot * This, /* [in] */ BOOL fProvidesNotifications); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProvidesNotifications )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out BOOL *pfProvidesNotifications); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_UseNotificationsOnly )( __RPC__in ISearchRoot * This, /* [in] */ BOOL fUseNotificationsOnly); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UseNotificationsOnly )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out BOOL *pfUseNotificationsOnly); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_EnumerationDepth )( __RPC__in ISearchRoot * This, /* [in] */ DWORD dwDepth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EnumerationDepth )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out DWORD *pdwDepth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_HostDepth )( __RPC__in ISearchRoot * This, /* [in] */ DWORD dwDepth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HostDepth )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out DWORD *pdwDepth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FollowDirectories )( __RPC__in ISearchRoot * This, /* [in] */ BOOL fFollowDirectories); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FollowDirectories )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out BOOL *pfFollowDirectories); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AuthenticationType )( __RPC__in ISearchRoot * This, /* [in] */ AUTH_TYPE authType); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AuthenticationType )( __RPC__in ISearchRoot * This, /* [retval][out] */ __RPC__out AUTH_TYPE *pAuthType); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_User )( __RPC__in ISearchRoot * This, /* [string][in] */ __RPC__in_string LPCWSTR pszUser); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_User )( __RPC__in ISearchRoot * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszUser); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Password )( __RPC__in ISearchRoot * This, /* [string][in] */ __RPC__in_string LPCWSTR pszPassword); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Password )( __RPC__in ISearchRoot * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszPassword); END_INTERFACE } ISearchRootVtbl; interface ISearchRoot { CONST_VTBL struct ISearchRootVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchRoot_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchRoot_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchRoot_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchRoot_put_Schedule(This,pszTaskArg) \ ( (This)->lpVtbl -> put_Schedule(This,pszTaskArg) ) #define ISearchRoot_get_Schedule(This,ppszTaskArg) \ ( (This)->lpVtbl -> get_Schedule(This,ppszTaskArg) ) #define ISearchRoot_put_RootURL(This,pszURL) \ ( (This)->lpVtbl -> put_RootURL(This,pszURL) ) #define ISearchRoot_get_RootURL(This,ppszURL) \ ( (This)->lpVtbl -> get_RootURL(This,ppszURL) ) #define ISearchRoot_put_IsHierarchical(This,fIsHierarchical) \ ( (This)->lpVtbl -> put_IsHierarchical(This,fIsHierarchical) ) #define ISearchRoot_get_IsHierarchical(This,pfIsHierarchical) \ ( (This)->lpVtbl -> get_IsHierarchical(This,pfIsHierarchical) ) #define ISearchRoot_put_ProvidesNotifications(This,fProvidesNotifications) \ ( (This)->lpVtbl -> put_ProvidesNotifications(This,fProvidesNotifications) ) #define ISearchRoot_get_ProvidesNotifications(This,pfProvidesNotifications) \ ( (This)->lpVtbl -> get_ProvidesNotifications(This,pfProvidesNotifications) ) #define ISearchRoot_put_UseNotificationsOnly(This,fUseNotificationsOnly) \ ( (This)->lpVtbl -> put_UseNotificationsOnly(This,fUseNotificationsOnly) ) #define ISearchRoot_get_UseNotificationsOnly(This,pfUseNotificationsOnly) \ ( (This)->lpVtbl -> get_UseNotificationsOnly(This,pfUseNotificationsOnly) ) #define ISearchRoot_put_EnumerationDepth(This,dwDepth) \ ( (This)->lpVtbl -> put_EnumerationDepth(This,dwDepth) ) #define ISearchRoot_get_EnumerationDepth(This,pdwDepth) \ ( (This)->lpVtbl -> get_EnumerationDepth(This,pdwDepth) ) #define ISearchRoot_put_HostDepth(This,dwDepth) \ ( (This)->lpVtbl -> put_HostDepth(This,dwDepth) ) #define ISearchRoot_get_HostDepth(This,pdwDepth) \ ( (This)->lpVtbl -> get_HostDepth(This,pdwDepth) ) #define ISearchRoot_put_FollowDirectories(This,fFollowDirectories) \ ( (This)->lpVtbl -> put_FollowDirectories(This,fFollowDirectories) ) #define ISearchRoot_get_FollowDirectories(This,pfFollowDirectories) \ ( (This)->lpVtbl -> get_FollowDirectories(This,pfFollowDirectories) ) #define ISearchRoot_put_AuthenticationType(This,authType) \ ( (This)->lpVtbl -> put_AuthenticationType(This,authType) ) #define ISearchRoot_get_AuthenticationType(This,pAuthType) \ ( (This)->lpVtbl -> get_AuthenticationType(This,pAuthType) ) #define ISearchRoot_put_User(This,pszUser) \ ( (This)->lpVtbl -> put_User(This,pszUser) ) #define ISearchRoot_get_User(This,ppszUser) \ ( (This)->lpVtbl -> get_User(This,ppszUser) ) #define ISearchRoot_put_Password(This,pszPassword) \ ( (This)->lpVtbl -> put_Password(This,pszPassword) ) #define ISearchRoot_get_Password(This,ppszPassword) \ ( (This)->lpVtbl -> get_Password(This,ppszPassword) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchRoot_INTERFACE_DEFINED__ */ #ifndef __IEnumSearchRoots_INTERFACE_DEFINED__ #define __IEnumSearchRoots_INTERFACE_DEFINED__ /* interface IEnumSearchRoots */ /* [unique][uuid][object] */ EXTERN_C const IID IID_IEnumSearchRoots; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF52") IEnumSearchRoots : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [size_is][out] */ __RPC__out_ecount_full(celt) ISearchRoot **rgelt, /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched) = 0; virtual HRESULT STDMETHODCALLTYPE Skip( /* [in] */ ULONG celt) = 0; virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; virtual HRESULT STDMETHODCALLTYPE Clone( /* [retval][out] */ __RPC__deref_out_opt IEnumSearchRoots **ppenum) = 0; }; #else /* C style interface */ typedef struct IEnumSearchRootsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IEnumSearchRoots * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IEnumSearchRoots * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IEnumSearchRoots * This); HRESULT ( STDMETHODCALLTYPE *Next )( __RPC__in IEnumSearchRoots * This, /* [in] */ ULONG celt, /* [size_is][out] */ __RPC__out_ecount_full(celt) ISearchRoot **rgelt, /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); HRESULT ( STDMETHODCALLTYPE *Skip )( __RPC__in IEnumSearchRoots * This, /* [in] */ ULONG celt); HRESULT ( STDMETHODCALLTYPE *Reset )( __RPC__in IEnumSearchRoots * This); HRESULT ( STDMETHODCALLTYPE *Clone )( __RPC__in IEnumSearchRoots * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchRoots **ppenum); END_INTERFACE } IEnumSearchRootsVtbl; interface IEnumSearchRoots { CONST_VTBL struct IEnumSearchRootsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IEnumSearchRoots_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IEnumSearchRoots_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IEnumSearchRoots_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IEnumSearchRoots_Next(This,celt,rgelt,pceltFetched) \ ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) #define IEnumSearchRoots_Skip(This,celt) \ ( (This)->lpVtbl -> Skip(This,celt) ) #define IEnumSearchRoots_Reset(This) \ ( (This)->lpVtbl -> Reset(This) ) #define IEnumSearchRoots_Clone(This,ppenum) \ ( (This)->lpVtbl -> Clone(This,ppenum) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IEnumSearchRoots_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0011 */ /* [local] */ typedef /* [v1_enum] */ enum _FOLLOW_FLAGS { FF_INDEXCOMPLEXURLS = 0x1, FF_SUPPRESSINDEXING = 0x2 } FOLLOW_FLAGS; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0011_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0011_v0_0_s_ifspec; #ifndef __ISearchScopeRule_INTERFACE_DEFINED__ #define __ISearchScopeRule_INTERFACE_DEFINED__ /* interface ISearchScopeRule */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchScopeRule; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF53") ISearchScopeRule : public IUnknown { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PatternOrURL( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszPatternOrURL) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsIncluded( /* [retval][out] */ __RPC__out BOOL *pfIsIncluded) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsDefault( /* [retval][out] */ __RPC__out BOOL *pfIsDefault) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FollowFlags( /* [retval][out] */ __RPC__out DWORD *pFollowFlags) = 0; }; #else /* C style interface */ typedef struct ISearchScopeRuleVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchScopeRule * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchScopeRule * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchScopeRule * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PatternOrURL )( __RPC__in ISearchScopeRule * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszPatternOrURL); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsIncluded )( __RPC__in ISearchScopeRule * This, /* [retval][out] */ __RPC__out BOOL *pfIsIncluded); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsDefault )( __RPC__in ISearchScopeRule * This, /* [retval][out] */ __RPC__out BOOL *pfIsDefault); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FollowFlags )( __RPC__in ISearchScopeRule * This, /* [retval][out] */ __RPC__out DWORD *pFollowFlags); END_INTERFACE } ISearchScopeRuleVtbl; interface ISearchScopeRule { CONST_VTBL struct ISearchScopeRuleVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchScopeRule_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchScopeRule_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchScopeRule_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchScopeRule_get_PatternOrURL(This,ppszPatternOrURL) \ ( (This)->lpVtbl -> get_PatternOrURL(This,ppszPatternOrURL) ) #define ISearchScopeRule_get_IsIncluded(This,pfIsIncluded) \ ( (This)->lpVtbl -> get_IsIncluded(This,pfIsIncluded) ) #define ISearchScopeRule_get_IsDefault(This,pfIsDefault) \ ( (This)->lpVtbl -> get_IsDefault(This,pfIsDefault) ) #define ISearchScopeRule_get_FollowFlags(This,pFollowFlags) \ ( (This)->lpVtbl -> get_FollowFlags(This,pFollowFlags) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchScopeRule_INTERFACE_DEFINED__ */ #ifndef __IEnumSearchScopeRules_INTERFACE_DEFINED__ #define __IEnumSearchScopeRules_INTERFACE_DEFINED__ /* interface IEnumSearchScopeRules */ /* [unique][uuid][object] */ EXTERN_C const IID IID_IEnumSearchScopeRules; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF54") IEnumSearchScopeRules : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [size_is][out] */ __RPC__out_ecount_full(celt) ISearchScopeRule **pprgelt, /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched) = 0; virtual HRESULT STDMETHODCALLTYPE Skip( /* [in] */ ULONG celt) = 0; virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; virtual HRESULT STDMETHODCALLTYPE Clone( /* [retval][out] */ __RPC__deref_out_opt IEnumSearchScopeRules **ppenum) = 0; }; #else /* C style interface */ typedef struct IEnumSearchScopeRulesVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IEnumSearchScopeRules * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IEnumSearchScopeRules * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IEnumSearchScopeRules * This); HRESULT ( STDMETHODCALLTYPE *Next )( __RPC__in IEnumSearchScopeRules * This, /* [in] */ ULONG celt, /* [size_is][out] */ __RPC__out_ecount_full(celt) ISearchScopeRule **pprgelt, /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); HRESULT ( STDMETHODCALLTYPE *Skip )( __RPC__in IEnumSearchScopeRules * This, /* [in] */ ULONG celt); HRESULT ( STDMETHODCALLTYPE *Reset )( __RPC__in IEnumSearchScopeRules * This); HRESULT ( STDMETHODCALLTYPE *Clone )( __RPC__in IEnumSearchScopeRules * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchScopeRules **ppenum); END_INTERFACE } IEnumSearchScopeRulesVtbl; interface IEnumSearchScopeRules { CONST_VTBL struct IEnumSearchScopeRulesVtbl *lpVtbl; }; #ifdef COBJMACROS #define IEnumSearchScopeRules_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IEnumSearchScopeRules_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IEnumSearchScopeRules_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IEnumSearchScopeRules_Next(This,celt,pprgelt,pceltFetched) \ ( (This)->lpVtbl -> Next(This,celt,pprgelt,pceltFetched) ) #define IEnumSearchScopeRules_Skip(This,celt) \ ( (This)->lpVtbl -> Skip(This,celt) ) #define IEnumSearchScopeRules_Reset(This) \ ( (This)->lpVtbl -> Reset(This) ) #define IEnumSearchScopeRules_Clone(This,ppenum) \ ( (This)->lpVtbl -> Clone(This,ppenum) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IEnumSearchScopeRules_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0013 */ /* [local] */ typedef /* [public][public] */ enum __MIDL___MIDL_itf_searchapi_0000_0013_0001 { CLUSIONREASON_UNKNOWNSCOPE = 0, CLUSIONREASON_DEFAULT = 1, CLUSIONREASON_USER = 2, CLUSIONREASON_GROUPPOLICY = 3 } CLUSION_REASON; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0013_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0013_v0_0_s_ifspec; #ifndef __ISearchCrawlScopeManager_INTERFACE_DEFINED__ #define __ISearchCrawlScopeManager_INTERFACE_DEFINED__ /* interface ISearchCrawlScopeManager */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchCrawlScopeManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF55") ISearchCrawlScopeManager : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE AddDefaultScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ DWORD fFollowFlags) = 0; virtual HRESULT STDMETHODCALLTYPE AddRoot( /* [in] */ __RPC__in_opt ISearchRoot *pSearchRoot) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveRoot( /* [in] */ __RPC__in LPCWSTR pszURL) = 0; virtual HRESULT STDMETHODCALLTYPE EnumerateRoots( /* [retval][out] */ __RPC__deref_out_opt IEnumSearchRoots **ppSearchRoots) = 0; virtual HRESULT STDMETHODCALLTYPE AddHierarchicalScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fDefault, /* [in] */ BOOL fOverrideChildren) = 0; virtual HRESULT STDMETHODCALLTYPE AddUserScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fOverrideChildren, /* [in] */ DWORD fFollowFlags) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszRule) = 0; virtual HRESULT STDMETHODCALLTYPE EnumerateScopeRules( /* [retval][out] */ __RPC__deref_out_opt IEnumSearchScopeRules **ppSearchScopeRules) = 0; virtual HRESULT STDMETHODCALLTYPE HasParentScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasParentRule) = 0; virtual HRESULT STDMETHODCALLTYPE HasChildScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasChildRule) = 0; virtual HRESULT STDMETHODCALLTYPE IncludedInCrawlScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfIsIncluded) = 0; virtual HRESULT STDMETHODCALLTYPE IncludedInCrawlScopeEx( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [out] */ __RPC__out BOOL *pfIsIncluded, /* [out] */ __RPC__out CLUSION_REASON *pReason) = 0; virtual HRESULT STDMETHODCALLTYPE RevertToDefaultScopes( void) = 0; virtual HRESULT STDMETHODCALLTYPE SaveAll( void) = 0; virtual HRESULT STDMETHODCALLTYPE GetParentScopeVersionId( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out LONG *plScopeId) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveDefaultScopeRule( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; }; #else /* C style interface */ typedef struct ISearchCrawlScopeManagerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchCrawlScopeManager * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchCrawlScopeManager * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchCrawlScopeManager * This); HRESULT ( STDMETHODCALLTYPE *AddDefaultScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ DWORD fFollowFlags); HRESULT ( STDMETHODCALLTYPE *AddRoot )( __RPC__in ISearchCrawlScopeManager * This, /* [in] */ __RPC__in_opt ISearchRoot *pSearchRoot); HRESULT ( STDMETHODCALLTYPE *RemoveRoot )( __RPC__in ISearchCrawlScopeManager * This, /* [in] */ __RPC__in LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *EnumerateRoots )( __RPC__in ISearchCrawlScopeManager * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchRoots **ppSearchRoots); HRESULT ( STDMETHODCALLTYPE *AddHierarchicalScope )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fDefault, /* [in] */ BOOL fOverrideChildren); HRESULT ( STDMETHODCALLTYPE *AddUserScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fOverrideChildren, /* [in] */ DWORD fFollowFlags); HRESULT ( STDMETHODCALLTYPE *RemoveScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszRule); HRESULT ( STDMETHODCALLTYPE *EnumerateScopeRules )( __RPC__in ISearchCrawlScopeManager * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchScopeRules **ppSearchScopeRules); HRESULT ( STDMETHODCALLTYPE *HasParentScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasParentRule); HRESULT ( STDMETHODCALLTYPE *HasChildScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasChildRule); HRESULT ( STDMETHODCALLTYPE *IncludedInCrawlScope )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfIsIncluded); HRESULT ( STDMETHODCALLTYPE *IncludedInCrawlScopeEx )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [out] */ __RPC__out BOOL *pfIsIncluded, /* [out] */ __RPC__out CLUSION_REASON *pReason); HRESULT ( STDMETHODCALLTYPE *RevertToDefaultScopes )( __RPC__in ISearchCrawlScopeManager * This); HRESULT ( STDMETHODCALLTYPE *SaveAll )( __RPC__in ISearchCrawlScopeManager * This); HRESULT ( STDMETHODCALLTYPE *GetParentScopeVersionId )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out LONG *plScopeId); HRESULT ( STDMETHODCALLTYPE *RemoveDefaultScopeRule )( __RPC__in ISearchCrawlScopeManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); END_INTERFACE } ISearchCrawlScopeManagerVtbl; interface ISearchCrawlScopeManager { CONST_VTBL struct ISearchCrawlScopeManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchCrawlScopeManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchCrawlScopeManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchCrawlScopeManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchCrawlScopeManager_AddDefaultScopeRule(This,pszURL,fInclude,fFollowFlags) \ ( (This)->lpVtbl -> AddDefaultScopeRule(This,pszURL,fInclude,fFollowFlags) ) #define ISearchCrawlScopeManager_AddRoot(This,pSearchRoot) \ ( (This)->lpVtbl -> AddRoot(This,pSearchRoot) ) #define ISearchCrawlScopeManager_RemoveRoot(This,pszURL) \ ( (This)->lpVtbl -> RemoveRoot(This,pszURL) ) #define ISearchCrawlScopeManager_EnumerateRoots(This,ppSearchRoots) \ ( (This)->lpVtbl -> EnumerateRoots(This,ppSearchRoots) ) #define ISearchCrawlScopeManager_AddHierarchicalScope(This,pszURL,fInclude,fDefault,fOverrideChildren) \ ( (This)->lpVtbl -> AddHierarchicalScope(This,pszURL,fInclude,fDefault,fOverrideChildren) ) #define ISearchCrawlScopeManager_AddUserScopeRule(This,pszURL,fInclude,fOverrideChildren,fFollowFlags) \ ( (This)->lpVtbl -> AddUserScopeRule(This,pszURL,fInclude,fOverrideChildren,fFollowFlags) ) #define ISearchCrawlScopeManager_RemoveScopeRule(This,pszRule) \ ( (This)->lpVtbl -> RemoveScopeRule(This,pszRule) ) #define ISearchCrawlScopeManager_EnumerateScopeRules(This,ppSearchScopeRules) \ ( (This)->lpVtbl -> EnumerateScopeRules(This,ppSearchScopeRules) ) #define ISearchCrawlScopeManager_HasParentScopeRule(This,pszURL,pfHasParentRule) \ ( (This)->lpVtbl -> HasParentScopeRule(This,pszURL,pfHasParentRule) ) #define ISearchCrawlScopeManager_HasChildScopeRule(This,pszURL,pfHasChildRule) \ ( (This)->lpVtbl -> HasChildScopeRule(This,pszURL,pfHasChildRule) ) #define ISearchCrawlScopeManager_IncludedInCrawlScope(This,pszURL,pfIsIncluded) \ ( (This)->lpVtbl -> IncludedInCrawlScope(This,pszURL,pfIsIncluded) ) #define ISearchCrawlScopeManager_IncludedInCrawlScopeEx(This,pszURL,pfIsIncluded,pReason) \ ( (This)->lpVtbl -> IncludedInCrawlScopeEx(This,pszURL,pfIsIncluded,pReason) ) #define ISearchCrawlScopeManager_RevertToDefaultScopes(This) \ ( (This)->lpVtbl -> RevertToDefaultScopes(This) ) #define ISearchCrawlScopeManager_SaveAll(This) \ ( (This)->lpVtbl -> SaveAll(This) ) #define ISearchCrawlScopeManager_GetParentScopeVersionId(This,pszURL,plScopeId) \ ( (This)->lpVtbl -> GetParentScopeVersionId(This,pszURL,plScopeId) ) #define ISearchCrawlScopeManager_RemoveDefaultScopeRule(This,pszURL) \ ( (This)->lpVtbl -> RemoveDefaultScopeRule(This,pszURL) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchCrawlScopeManager_INTERFACE_DEFINED__ */ #ifndef __ISearchCrawlScopeManager2_INTERFACE_DEFINED__ #define __ISearchCrawlScopeManager2_INTERFACE_DEFINED__ /* interface ISearchCrawlScopeManager2 */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchCrawlScopeManager2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("6292F7AD-4E19-4717-A534-8FC22BCD5CCD") ISearchCrawlScopeManager2 : public ISearchCrawlScopeManager { public: virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetVersion( /* [out] */ long **plVersion, /* [out] */ HANDLE *phFileMapping) = 0; }; #else /* C style interface */ typedef struct ISearchCrawlScopeManager2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchCrawlScopeManager2 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchCrawlScopeManager2 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchCrawlScopeManager2 * This); HRESULT ( STDMETHODCALLTYPE *AddDefaultScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ DWORD fFollowFlags); HRESULT ( STDMETHODCALLTYPE *AddRoot )( __RPC__in ISearchCrawlScopeManager2 * This, /* [in] */ __RPC__in_opt ISearchRoot *pSearchRoot); HRESULT ( STDMETHODCALLTYPE *RemoveRoot )( __RPC__in ISearchCrawlScopeManager2 * This, /* [in] */ __RPC__in LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *EnumerateRoots )( __RPC__in ISearchCrawlScopeManager2 * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchRoots **ppSearchRoots); HRESULT ( STDMETHODCALLTYPE *AddHierarchicalScope )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fDefault, /* [in] */ BOOL fOverrideChildren); HRESULT ( STDMETHODCALLTYPE *AddUserScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [in] */ BOOL fInclude, /* [in] */ BOOL fOverrideChildren, /* [in] */ DWORD fFollowFlags); HRESULT ( STDMETHODCALLTYPE *RemoveScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszRule); HRESULT ( STDMETHODCALLTYPE *EnumerateScopeRules )( __RPC__in ISearchCrawlScopeManager2 * This, /* [retval][out] */ __RPC__deref_out_opt IEnumSearchScopeRules **ppSearchScopeRules); HRESULT ( STDMETHODCALLTYPE *HasParentScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasParentRule); HRESULT ( STDMETHODCALLTYPE *HasChildScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfHasChildRule); HRESULT ( STDMETHODCALLTYPE *IncludedInCrawlScope )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out BOOL *pfIsIncluded); HRESULT ( STDMETHODCALLTYPE *IncludedInCrawlScopeEx )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [out] */ __RPC__out BOOL *pfIsIncluded, /* [out] */ __RPC__out CLUSION_REASON *pReason); HRESULT ( STDMETHODCALLTYPE *RevertToDefaultScopes )( __RPC__in ISearchCrawlScopeManager2 * This); HRESULT ( STDMETHODCALLTYPE *SaveAll )( __RPC__in ISearchCrawlScopeManager2 * This); HRESULT ( STDMETHODCALLTYPE *GetParentScopeVersionId )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out LONG *plScopeId); HRESULT ( STDMETHODCALLTYPE *RemoveDefaultScopeRule )( __RPC__in ISearchCrawlScopeManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetVersion )( ISearchCrawlScopeManager2 * This, /* [out] */ long **plVersion, /* [out] */ HANDLE *phFileMapping); END_INTERFACE } ISearchCrawlScopeManager2Vtbl; interface ISearchCrawlScopeManager2 { CONST_VTBL struct ISearchCrawlScopeManager2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchCrawlScopeManager2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchCrawlScopeManager2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchCrawlScopeManager2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchCrawlScopeManager2_AddDefaultScopeRule(This,pszURL,fInclude,fFollowFlags) \ ( (This)->lpVtbl -> AddDefaultScopeRule(This,pszURL,fInclude,fFollowFlags) ) #define ISearchCrawlScopeManager2_AddRoot(This,pSearchRoot) \ ( (This)->lpVtbl -> AddRoot(This,pSearchRoot) ) #define ISearchCrawlScopeManager2_RemoveRoot(This,pszURL) \ ( (This)->lpVtbl -> RemoveRoot(This,pszURL) ) #define ISearchCrawlScopeManager2_EnumerateRoots(This,ppSearchRoots) \ ( (This)->lpVtbl -> EnumerateRoots(This,ppSearchRoots) ) #define ISearchCrawlScopeManager2_AddHierarchicalScope(This,pszURL,fInclude,fDefault,fOverrideChildren) \ ( (This)->lpVtbl -> AddHierarchicalScope(This,pszURL,fInclude,fDefault,fOverrideChildren) ) #define ISearchCrawlScopeManager2_AddUserScopeRule(This,pszURL,fInclude,fOverrideChildren,fFollowFlags) \ ( (This)->lpVtbl -> AddUserScopeRule(This,pszURL,fInclude,fOverrideChildren,fFollowFlags) ) #define ISearchCrawlScopeManager2_RemoveScopeRule(This,pszRule) \ ( (This)->lpVtbl -> RemoveScopeRule(This,pszRule) ) #define ISearchCrawlScopeManager2_EnumerateScopeRules(This,ppSearchScopeRules) \ ( (This)->lpVtbl -> EnumerateScopeRules(This,ppSearchScopeRules) ) #define ISearchCrawlScopeManager2_HasParentScopeRule(This,pszURL,pfHasParentRule) \ ( (This)->lpVtbl -> HasParentScopeRule(This,pszURL,pfHasParentRule) ) #define ISearchCrawlScopeManager2_HasChildScopeRule(This,pszURL,pfHasChildRule) \ ( (This)->lpVtbl -> HasChildScopeRule(This,pszURL,pfHasChildRule) ) #define ISearchCrawlScopeManager2_IncludedInCrawlScope(This,pszURL,pfIsIncluded) \ ( (This)->lpVtbl -> IncludedInCrawlScope(This,pszURL,pfIsIncluded) ) #define ISearchCrawlScopeManager2_IncludedInCrawlScopeEx(This,pszURL,pfIsIncluded,pReason) \ ( (This)->lpVtbl -> IncludedInCrawlScopeEx(This,pszURL,pfIsIncluded,pReason) ) #define ISearchCrawlScopeManager2_RevertToDefaultScopes(This) \ ( (This)->lpVtbl -> RevertToDefaultScopes(This) ) #define ISearchCrawlScopeManager2_SaveAll(This) \ ( (This)->lpVtbl -> SaveAll(This) ) #define ISearchCrawlScopeManager2_GetParentScopeVersionId(This,pszURL,plScopeId) \ ( (This)->lpVtbl -> GetParentScopeVersionId(This,pszURL,plScopeId) ) #define ISearchCrawlScopeManager2_RemoveDefaultScopeRule(This,pszURL) \ ( (This)->lpVtbl -> RemoveDefaultScopeRule(This,pszURL) ) #define ISearchCrawlScopeManager2_GetVersion(This,plVersion,phFileMapping) \ ( (This)->lpVtbl -> GetVersion(This,plVersion,phFileMapping) ) #endif /* COBJMACROS */ #endif /* C style interface */ /* [call_as] */ HRESULT STDMETHODCALLTYPE ISearchCrawlScopeManager2_RemoteGetVersion_Proxy( __RPC__in ISearchCrawlScopeManager2 * This, /* [out] */ __RPC__out long *plVersion); void __RPC_STUB ISearchCrawlScopeManager2_RemoteGetVersion_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __ISearchCrawlScopeManager2_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0015 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef /* [v1_enum] */ enum _SEARCH_KIND_OF_CHANGE { SEARCH_CHANGE_ADD = 0, SEARCH_CHANGE_DELETE = 1, SEARCH_CHANGE_MODIFY = 2, SEARCH_CHANGE_MOVE_RENAME = 3, SEARCH_CHANGE_SEMANTICS_DIRECTORY = 0x40000, SEARCH_CHANGE_SEMANTICS_SHALLOW = 0x80000, SEARCH_CHANGE_SEMANTICS_UPDATE_SECURITY = 0x400000 } SEARCH_KIND_OF_CHANGE; typedef enum _SEARCH_NOTIFICATION_PRIORITY { SEARCH_NORMAL_PRIORITY = 0, SEARCH_HIGH_PRIORITY = 1 } SEARCH_NOTIFICATION_PRIORITY; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0015_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0015_v0_0_s_ifspec; #ifndef __ISearchItemsChangedSink_INTERFACE_DEFINED__ #define __ISearchItemsChangedSink_INTERFACE_DEFINED__ /* interface ISearchItemsChangedSink */ /* [unique][uuid][object] */ typedef struct _SEARCH_ITEM_CHANGE { SEARCH_KIND_OF_CHANGE Change; SEARCH_NOTIFICATION_PRIORITY Priority; BLOB *pUserData; LPWSTR lpwszURL; /* [unique] */ LPWSTR lpwszOldURL; } SEARCH_ITEM_CHANGE; EXTERN_C const IID IID_ISearchItemsChangedSink; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF58") ISearchItemsChangedSink : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE StartedMonitoringScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; virtual HRESULT STDMETHODCALLTYPE StoppedMonitoringScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; virtual HRESULT STDMETHODCALLTYPE OnItemsChanged( /* [in] */ DWORD dwNumberOfChanges, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfChanges) SEARCH_ITEM_CHANGE rgDataChangeEntries[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) DWORD rgdwDocIds[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) HRESULT rghrCompletionCodes[ ]) = 0; }; #else /* C style interface */ typedef struct ISearchItemsChangedSinkVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchItemsChangedSink * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchItemsChangedSink * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchItemsChangedSink * This); HRESULT ( STDMETHODCALLTYPE *StartedMonitoringScope )( __RPC__in ISearchItemsChangedSink * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *StoppedMonitoringScope )( __RPC__in ISearchItemsChangedSink * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *OnItemsChanged )( __RPC__in ISearchItemsChangedSink * This, /* [in] */ DWORD dwNumberOfChanges, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfChanges) SEARCH_ITEM_CHANGE rgDataChangeEntries[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) DWORD rgdwDocIds[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) HRESULT rghrCompletionCodes[ ]); END_INTERFACE } ISearchItemsChangedSinkVtbl; interface ISearchItemsChangedSink { CONST_VTBL struct ISearchItemsChangedSinkVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchItemsChangedSink_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchItemsChangedSink_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchItemsChangedSink_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchItemsChangedSink_StartedMonitoringScope(This,pszURL) \ ( (This)->lpVtbl -> StartedMonitoringScope(This,pszURL) ) #define ISearchItemsChangedSink_StoppedMonitoringScope(This,pszURL) \ ( (This)->lpVtbl -> StoppedMonitoringScope(This,pszURL) ) #define ISearchItemsChangedSink_OnItemsChanged(This,dwNumberOfChanges,rgDataChangeEntries,rgdwDocIds,rghrCompletionCodes) \ ( (This)->lpVtbl -> OnItemsChanged(This,dwNumberOfChanges,rgDataChangeEntries,rgdwDocIds,rghrCompletionCodes) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchItemsChangedSink_INTERFACE_DEFINED__ */ #ifndef __ISearchPersistentItemsChangedSink_INTERFACE_DEFINED__ #define __ISearchPersistentItemsChangedSink_INTERFACE_DEFINED__ /* interface ISearchPersistentItemsChangedSink */ /* [unique][uuid][object] */ typedef struct _SEARCH_ITEM_PERSISTENT_CHANGE { SEARCH_KIND_OF_CHANGE Change; LPWSTR URL; /* [unique] */ LPWSTR OldURL; SEARCH_NOTIFICATION_PRIORITY Priority; } SEARCH_ITEM_PERSISTENT_CHANGE; EXTERN_C const IID IID_ISearchPersistentItemsChangedSink; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("A2FFDF9B-4758-4F84-B729-DF81A1A0612F") ISearchPersistentItemsChangedSink : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE StartedMonitoringScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; virtual HRESULT STDMETHODCALLTYPE StoppedMonitoringScope( /* [string][in] */ __RPC__in_string LPCWSTR pszURL) = 0; virtual HRESULT STDMETHODCALLTYPE OnItemsChanged( /* [in] */ DWORD dwNumberOfChanges, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfChanges) SEARCH_ITEM_PERSISTENT_CHANGE DataChangeEntries[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) HRESULT hrCompletionCodes[ ]) = 0; }; #else /* C style interface */ typedef struct ISearchPersistentItemsChangedSinkVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchPersistentItemsChangedSink * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchPersistentItemsChangedSink * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchPersistentItemsChangedSink * This); HRESULT ( STDMETHODCALLTYPE *StartedMonitoringScope )( __RPC__in ISearchPersistentItemsChangedSink * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *StoppedMonitoringScope )( __RPC__in ISearchPersistentItemsChangedSink * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL); HRESULT ( STDMETHODCALLTYPE *OnItemsChanged )( __RPC__in ISearchPersistentItemsChangedSink * This, /* [in] */ DWORD dwNumberOfChanges, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfChanges) SEARCH_ITEM_PERSISTENT_CHANGE DataChangeEntries[ ], /* [size_is][out] */ __RPC__out_ecount_full(dwNumberOfChanges) HRESULT hrCompletionCodes[ ]); END_INTERFACE } ISearchPersistentItemsChangedSinkVtbl; interface ISearchPersistentItemsChangedSink { CONST_VTBL struct ISearchPersistentItemsChangedSinkVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchPersistentItemsChangedSink_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchPersistentItemsChangedSink_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchPersistentItemsChangedSink_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchPersistentItemsChangedSink_StartedMonitoringScope(This,pszURL) \ ( (This)->lpVtbl -> StartedMonitoringScope(This,pszURL) ) #define ISearchPersistentItemsChangedSink_StoppedMonitoringScope(This,pszURL) \ ( (This)->lpVtbl -> StoppedMonitoringScope(This,pszURL) ) #define ISearchPersistentItemsChangedSink_OnItemsChanged(This,dwNumberOfChanges,DataChangeEntries,hrCompletionCodes) \ ( (This)->lpVtbl -> OnItemsChanged(This,dwNumberOfChanges,DataChangeEntries,hrCompletionCodes) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchPersistentItemsChangedSink_INTERFACE_DEFINED__ */ #ifndef __ISearchViewChangedSink_INTERFACE_DEFINED__ #define __ISearchViewChangedSink_INTERFACE_DEFINED__ /* interface ISearchViewChangedSink */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchViewChangedSink; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF65") ISearchViewChangedSink : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnChange( /* [in] */ __RPC__in ITEMID *pdwDocID, /* [in] */ __RPC__in SEARCH_ITEM_CHANGE *pChange, /* [in] */ __RPC__in BOOL *pfInView) = 0; }; #else /* C style interface */ typedef struct ISearchViewChangedSinkVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchViewChangedSink * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchViewChangedSink * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchViewChangedSink * This); HRESULT ( STDMETHODCALLTYPE *OnChange )( __RPC__in ISearchViewChangedSink * This, /* [in] */ __RPC__in ITEMID *pdwDocID, /* [in] */ __RPC__in SEARCH_ITEM_CHANGE *pChange, /* [in] */ __RPC__in BOOL *pfInView); END_INTERFACE } ISearchViewChangedSinkVtbl; interface ISearchViewChangedSink { CONST_VTBL struct ISearchViewChangedSinkVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchViewChangedSink_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchViewChangedSink_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchViewChangedSink_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchViewChangedSink_OnChange(This,pdwDocID,pChange,pfInView) \ ( (This)->lpVtbl -> OnChange(This,pdwDocID,pChange,pfInView) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchViewChangedSink_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0018 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0018_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0018_v0_0_s_ifspec; #ifndef __ISearchNotifyInlineSite_INTERFACE_DEFINED__ #define __ISearchNotifyInlineSite_INTERFACE_DEFINED__ /* interface ISearchNotifyInlineSite */ /* [helpstring][unique][uuid][object] */ typedef enum _SEARCH_INDEXING_PHASE { SEARCH_INDEXING_PHASE_GATHERER = 0, SEARCH_INDEXING_PHASE_QUERYABLE = 1, SEARCH_INDEXING_PHASE_PERSISTED = 2 } SEARCH_INDEXING_PHASE; typedef struct _SEARCH_ITEM_INDEXING_STATUS { DWORD dwDocID; HRESULT hrIndexingStatus; } SEARCH_ITEM_INDEXING_STATUS; EXTERN_C const IID IID_ISearchNotifyInlineSite; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("B5702E61-E75C-4B64-82A1-6CB4F832FCCF") ISearchNotifyInlineSite : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnItemIndexedStatusChange( /* [in] */ SEARCH_INDEXING_PHASE sipStatus, /* [in] */ DWORD dwNumEntries, /* [size_is][in] */ __RPC__in_ecount_full(dwNumEntries) SEARCH_ITEM_INDEXING_STATUS rgItemStatusEntries[ ]) = 0; virtual HRESULT STDMETHODCALLTYPE OnCatalogStatusChange( /* [in] */ __RPC__in REFGUID guidCatalogResetSignature, /* [in] */ __RPC__in REFGUID guidCheckPointSignature, /* [in] */ DWORD dwLastCheckPointNumber) = 0; }; #else /* C style interface */ typedef struct ISearchNotifyInlineSiteVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchNotifyInlineSite * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchNotifyInlineSite * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchNotifyInlineSite * This); HRESULT ( STDMETHODCALLTYPE *OnItemIndexedStatusChange )( __RPC__in ISearchNotifyInlineSite * This, /* [in] */ SEARCH_INDEXING_PHASE sipStatus, /* [in] */ DWORD dwNumEntries, /* [size_is][in] */ __RPC__in_ecount_full(dwNumEntries) SEARCH_ITEM_INDEXING_STATUS rgItemStatusEntries[ ]); HRESULT ( STDMETHODCALLTYPE *OnCatalogStatusChange )( __RPC__in ISearchNotifyInlineSite * This, /* [in] */ __RPC__in REFGUID guidCatalogResetSignature, /* [in] */ __RPC__in REFGUID guidCheckPointSignature, /* [in] */ DWORD dwLastCheckPointNumber); END_INTERFACE } ISearchNotifyInlineSiteVtbl; interface ISearchNotifyInlineSite { CONST_VTBL struct ISearchNotifyInlineSiteVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchNotifyInlineSite_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchNotifyInlineSite_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchNotifyInlineSite_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchNotifyInlineSite_OnItemIndexedStatusChange(This,sipStatus,dwNumEntries,rgItemStatusEntries) \ ( (This)->lpVtbl -> OnItemIndexedStatusChange(This,sipStatus,dwNumEntries,rgItemStatusEntries) ) #define ISearchNotifyInlineSite_OnCatalogStatusChange(This,guidCatalogResetSignature,guidCheckPointSignature,dwLastCheckPointNumber) \ ( (This)->lpVtbl -> OnCatalogStatusChange(This,guidCatalogResetSignature,guidCheckPointSignature,dwLastCheckPointNumber) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchNotifyInlineSite_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0019 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef enum _CatalogStatus { CATALOG_STATUS_IDLE = 0, CATALOG_STATUS_PAUSED = 1, CATALOG_STATUS_RECOVERING = 2, CATALOG_STATUS_FULL_CRAWL = 3, CATALOG_STATUS_INCREMENTAL_CRAWL = 4, CATALOG_STATUS_PROCESSING_NOTIFICATIONS = 5, CATALOG_STATUS_SHUTTING_DOWN = 6 } CatalogStatus; typedef enum _CatalogPausedReason { CATALOG_PAUSED_REASON_NONE = 0, CATALOG_PAUSED_REASON_HIGH_IO = 1, CATALOG_PAUSED_REASON_HIGH_CPU = 2, CATALOG_PAUSED_REASON_HIGH_NTF_RATE = 3, CATALOG_PAUSED_REASON_LOW_BATTERY = 4, CATALOG_PAUSED_REASON_LOW_MEMORY = 5, CATALOG_PAUSED_REASON_LOW_DISK = 6, CATALOG_PAUSED_REASON_DELAYED_RECOVERY = 7, CATALOG_PAUSED_REASON_USER_ACTIVE = 8, CATALOG_PAUSED_REASON_EXTERNAL = 9, CATALOG_PAUSED_REASON_UPGRADING = 10 } CatalogPausedReason; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0019_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0019_v0_0_s_ifspec; #ifndef __ISearchCatalogManager_INTERFACE_DEFINED__ #define __ISearchCatalogManager_INTERFACE_DEFINED__ /* interface ISearchCatalogManager */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchCatalogManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF50") ISearchCatalogManager : public IUnknown { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszName) = 0; virtual HRESULT STDMETHODCALLTYPE GetParameter( /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue) = 0; virtual HRESULT STDMETHODCALLTYPE SetParameter( /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in PROPVARIANT *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetCatalogStatus( /* [out] */ __RPC__out CatalogStatus *pStatus, /* [out] */ __RPC__out CatalogPausedReason *pPausedReason) = 0; virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; virtual HRESULT STDMETHODCALLTYPE Reindex( void) = 0; virtual HRESULT STDMETHODCALLTYPE ReindexMatchingURLs( /* [string][in] */ __RPC__in_string LPCWSTR pszPattern) = 0; virtual HRESULT STDMETHODCALLTYPE ReindexSearchRoot( /* [string][in] */ __RPC__in_string LPCWSTR pszRootURL) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ConnectTimeout( /* [in] */ DWORD dwConnectTimeout) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ConnectTimeout( /* [retval][out] */ __RPC__out DWORD *pdwConnectTimeout) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DataTimeout( /* [in] */ DWORD dwDataTimeout) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DataTimeout( /* [retval][out] */ __RPC__out DWORD *pdwDataTimeout) = 0; virtual HRESULT STDMETHODCALLTYPE NumberOfItems( /* [retval][out] */ __RPC__out LONG *plCount) = 0; virtual HRESULT STDMETHODCALLTYPE NumberOfItemsToIndex( /* [out] */ __RPC__out LONG *plIncrementalCount, /* [out] */ __RPC__out LONG *plNotificationQueue, /* [out] */ __RPC__out LONG *plHighPriorityQueue) = 0; virtual HRESULT STDMETHODCALLTYPE URLBeingIndexed( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszUrl) = 0; virtual HRESULT STDMETHODCALLTYPE GetURLIndexingState( /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out DWORD *pdwState) = 0; virtual HRESULT STDMETHODCALLTYPE GetPersistentItemsChangedSink( /* [retval][out] */ __RPC__deref_out_opt ISearchPersistentItemsChangedSink **ppISearchPersistentItemsChangedSink) = 0; virtual HRESULT STDMETHODCALLTYPE RegisterViewForNotification( /* [string][in] */ __RPC__in_string LPCWSTR pszView, /* [in] */ __RPC__in_opt ISearchViewChangedSink *pViewChangedSink, /* [out] */ __RPC__out DWORD *pdwCookie) = 0; virtual HRESULT STDMETHODCALLTYPE GetItemsChangedSink( /* [in] */ __RPC__in_opt ISearchNotifyInlineSite *pISearchNotifyInlineSite, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppv, /* [out] */ __RPC__out GUID *pGUIDCatalogResetSignature, /* [out] */ __RPC__out GUID *pGUIDCheckPointSignature, /* [out] */ __RPC__out DWORD *pdwLastCheckPointNumber) = 0; virtual HRESULT STDMETHODCALLTYPE UnregisterViewForNotification( /* [in] */ DWORD dwCookie) = 0; virtual HRESULT STDMETHODCALLTYPE SetExtensionClusion( /* [string][in] */ __RPC__in_string LPCWSTR pszExtension, /* [in] */ BOOL fExclude) = 0; virtual HRESULT STDMETHODCALLTYPE EnumerateExcludedExtensions( /* [retval][out] */ __RPC__deref_out_opt IEnumString **ppExtensions) = 0; virtual HRESULT STDMETHODCALLTYPE GetQueryHelper( /* [retval][out] */ __RPC__deref_out_opt ISearchQueryHelper **ppSearchQueryHelper) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DiacriticSensitivity( /* [in] */ BOOL fDiacriticSensitive) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DiacriticSensitivity( /* [retval][out] */ __RPC__out BOOL *pfDiacriticSensitive) = 0; virtual HRESULT STDMETHODCALLTYPE GetCrawlScopeManager( /* [retval][out] */ __RPC__deref_out_opt ISearchCrawlScopeManager **ppCrawlScopeManager) = 0; }; #else /* C style interface */ typedef struct ISearchCatalogManagerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchCatalogManager * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchCatalogManager * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchCatalogManager * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in ISearchCatalogManager * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszName); HRESULT ( STDMETHODCALLTYPE *GetParameter )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue); HRESULT ( STDMETHODCALLTYPE *SetParameter )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in PROPVARIANT *pValue); HRESULT ( STDMETHODCALLTYPE *GetCatalogStatus )( __RPC__in ISearchCatalogManager * This, /* [out] */ __RPC__out CatalogStatus *pStatus, /* [out] */ __RPC__out CatalogPausedReason *pPausedReason); HRESULT ( STDMETHODCALLTYPE *Reset )( __RPC__in ISearchCatalogManager * This); HRESULT ( STDMETHODCALLTYPE *Reindex )( __RPC__in ISearchCatalogManager * This); HRESULT ( STDMETHODCALLTYPE *ReindexMatchingURLs )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszPattern); HRESULT ( STDMETHODCALLTYPE *ReindexSearchRoot )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszRootURL); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ConnectTimeout )( __RPC__in ISearchCatalogManager * This, /* [in] */ DWORD dwConnectTimeout); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConnectTimeout )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__out DWORD *pdwConnectTimeout); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataTimeout )( __RPC__in ISearchCatalogManager * This, /* [in] */ DWORD dwDataTimeout); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataTimeout )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__out DWORD *pdwDataTimeout); HRESULT ( STDMETHODCALLTYPE *NumberOfItems )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__out LONG *plCount); HRESULT ( STDMETHODCALLTYPE *NumberOfItemsToIndex )( __RPC__in ISearchCatalogManager * This, /* [out] */ __RPC__out LONG *plIncrementalCount, /* [out] */ __RPC__out LONG *plNotificationQueue, /* [out] */ __RPC__out LONG *plHighPriorityQueue); HRESULT ( STDMETHODCALLTYPE *URLBeingIndexed )( __RPC__in ISearchCatalogManager * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszUrl); HRESULT ( STDMETHODCALLTYPE *GetURLIndexingState )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out DWORD *pdwState); HRESULT ( STDMETHODCALLTYPE *GetPersistentItemsChangedSink )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__deref_out_opt ISearchPersistentItemsChangedSink **ppISearchPersistentItemsChangedSink); HRESULT ( STDMETHODCALLTYPE *RegisterViewForNotification )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszView, /* [in] */ __RPC__in_opt ISearchViewChangedSink *pViewChangedSink, /* [out] */ __RPC__out DWORD *pdwCookie); HRESULT ( STDMETHODCALLTYPE *GetItemsChangedSink )( __RPC__in ISearchCatalogManager * This, /* [in] */ __RPC__in_opt ISearchNotifyInlineSite *pISearchNotifyInlineSite, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppv, /* [out] */ __RPC__out GUID *pGUIDCatalogResetSignature, /* [out] */ __RPC__out GUID *pGUIDCheckPointSignature, /* [out] */ __RPC__out DWORD *pdwLastCheckPointNumber); HRESULT ( STDMETHODCALLTYPE *UnregisterViewForNotification )( __RPC__in ISearchCatalogManager * This, /* [in] */ DWORD dwCookie); HRESULT ( STDMETHODCALLTYPE *SetExtensionClusion )( __RPC__in ISearchCatalogManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszExtension, /* [in] */ BOOL fExclude); HRESULT ( STDMETHODCALLTYPE *EnumerateExcludedExtensions )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__deref_out_opt IEnumString **ppExtensions); HRESULT ( STDMETHODCALLTYPE *GetQueryHelper )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__deref_out_opt ISearchQueryHelper **ppSearchQueryHelper); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DiacriticSensitivity )( __RPC__in ISearchCatalogManager * This, /* [in] */ BOOL fDiacriticSensitive); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DiacriticSensitivity )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__out BOOL *pfDiacriticSensitive); HRESULT ( STDMETHODCALLTYPE *GetCrawlScopeManager )( __RPC__in ISearchCatalogManager * This, /* [retval][out] */ __RPC__deref_out_opt ISearchCrawlScopeManager **ppCrawlScopeManager); END_INTERFACE } ISearchCatalogManagerVtbl; interface ISearchCatalogManager { CONST_VTBL struct ISearchCatalogManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchCatalogManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchCatalogManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchCatalogManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchCatalogManager_get_Name(This,pszName) \ ( (This)->lpVtbl -> get_Name(This,pszName) ) #define ISearchCatalogManager_GetParameter(This,pszName,ppValue) \ ( (This)->lpVtbl -> GetParameter(This,pszName,ppValue) ) #define ISearchCatalogManager_SetParameter(This,pszName,pValue) \ ( (This)->lpVtbl -> SetParameter(This,pszName,pValue) ) #define ISearchCatalogManager_GetCatalogStatus(This,pStatus,pPausedReason) \ ( (This)->lpVtbl -> GetCatalogStatus(This,pStatus,pPausedReason) ) #define ISearchCatalogManager_Reset(This) \ ( (This)->lpVtbl -> Reset(This) ) #define ISearchCatalogManager_Reindex(This) \ ( (This)->lpVtbl -> Reindex(This) ) #define ISearchCatalogManager_ReindexMatchingURLs(This,pszPattern) \ ( (This)->lpVtbl -> ReindexMatchingURLs(This,pszPattern) ) #define ISearchCatalogManager_ReindexSearchRoot(This,pszRootURL) \ ( (This)->lpVtbl -> ReindexSearchRoot(This,pszRootURL) ) #define ISearchCatalogManager_put_ConnectTimeout(This,dwConnectTimeout) \ ( (This)->lpVtbl -> put_ConnectTimeout(This,dwConnectTimeout) ) #define ISearchCatalogManager_get_ConnectTimeout(This,pdwConnectTimeout) \ ( (This)->lpVtbl -> get_ConnectTimeout(This,pdwConnectTimeout) ) #define ISearchCatalogManager_put_DataTimeout(This,dwDataTimeout) \ ( (This)->lpVtbl -> put_DataTimeout(This,dwDataTimeout) ) #define ISearchCatalogManager_get_DataTimeout(This,pdwDataTimeout) \ ( (This)->lpVtbl -> get_DataTimeout(This,pdwDataTimeout) ) #define ISearchCatalogManager_NumberOfItems(This,plCount) \ ( (This)->lpVtbl -> NumberOfItems(This,plCount) ) #define ISearchCatalogManager_NumberOfItemsToIndex(This,plIncrementalCount,plNotificationQueue,plHighPriorityQueue) \ ( (This)->lpVtbl -> NumberOfItemsToIndex(This,plIncrementalCount,plNotificationQueue,plHighPriorityQueue) ) #define ISearchCatalogManager_URLBeingIndexed(This,pszUrl) \ ( (This)->lpVtbl -> URLBeingIndexed(This,pszUrl) ) #define ISearchCatalogManager_GetURLIndexingState(This,pszURL,pdwState) \ ( (This)->lpVtbl -> GetURLIndexingState(This,pszURL,pdwState) ) #define ISearchCatalogManager_GetPersistentItemsChangedSink(This,ppISearchPersistentItemsChangedSink) \ ( (This)->lpVtbl -> GetPersistentItemsChangedSink(This,ppISearchPersistentItemsChangedSink) ) #define ISearchCatalogManager_RegisterViewForNotification(This,pszView,pViewChangedSink,pdwCookie) \ ( (This)->lpVtbl -> RegisterViewForNotification(This,pszView,pViewChangedSink,pdwCookie) ) #define ISearchCatalogManager_GetItemsChangedSink(This,pISearchNotifyInlineSite,riid,ppv,pGUIDCatalogResetSignature,pGUIDCheckPointSignature,pdwLastCheckPointNumber) \ ( (This)->lpVtbl -> GetItemsChangedSink(This,pISearchNotifyInlineSite,riid,ppv,pGUIDCatalogResetSignature,pGUIDCheckPointSignature,pdwLastCheckPointNumber) ) #define ISearchCatalogManager_UnregisterViewForNotification(This,dwCookie) \ ( (This)->lpVtbl -> UnregisterViewForNotification(This,dwCookie) ) #define ISearchCatalogManager_SetExtensionClusion(This,pszExtension,fExclude) \ ( (This)->lpVtbl -> SetExtensionClusion(This,pszExtension,fExclude) ) #define ISearchCatalogManager_EnumerateExcludedExtensions(This,ppExtensions) \ ( (This)->lpVtbl -> EnumerateExcludedExtensions(This,ppExtensions) ) #define ISearchCatalogManager_GetQueryHelper(This,ppSearchQueryHelper) \ ( (This)->lpVtbl -> GetQueryHelper(This,ppSearchQueryHelper) ) #define ISearchCatalogManager_put_DiacriticSensitivity(This,fDiacriticSensitive) \ ( (This)->lpVtbl -> put_DiacriticSensitivity(This,fDiacriticSensitive) ) #define ISearchCatalogManager_get_DiacriticSensitivity(This,pfDiacriticSensitive) \ ( (This)->lpVtbl -> get_DiacriticSensitivity(This,pfDiacriticSensitive) ) #define ISearchCatalogManager_GetCrawlScopeManager(This,ppCrawlScopeManager) \ ( (This)->lpVtbl -> GetCrawlScopeManager(This,ppCrawlScopeManager) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchCatalogManager_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0020 */ /* [local] */ /* [v1_enum] */ enum tagPRIORITIZE_FLAGS { PRIORITIZE_FLAG_RETRYFAILEDITEMS = 0x1, PRIORITIZE_FLAG_IGNOREFAILURECOUNT = 0x2 } ; typedef int PRIORITIZE_FLAGS; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0020_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0020_v0_0_s_ifspec; #ifndef __ISearchCatalogManager2_INTERFACE_DEFINED__ #define __ISearchCatalogManager2_INTERFACE_DEFINED__ /* interface ISearchCatalogManager2 */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchCatalogManager2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("7AC3286D-4D1D-4817-84FC-C1C85E3AF0D9") ISearchCatalogManager2 : public ISearchCatalogManager { public: virtual HRESULT STDMETHODCALLTYPE PrioritizeMatchingURLs( /* [string][in] */ __RPC__in_string LPCWSTR pszPattern, /* [in] */ PRIORITIZE_FLAGS dwPrioritizeFlags) = 0; }; #else /* C style interface */ typedef struct ISearchCatalogManager2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchCatalogManager2 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchCatalogManager2 * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( __RPC__in ISearchCatalogManager2 * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszName); HRESULT ( STDMETHODCALLTYPE *GetParameter )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue); HRESULT ( STDMETHODCALLTYPE *SetParameter )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in PROPVARIANT *pValue); HRESULT ( STDMETHODCALLTYPE *GetCatalogStatus )( __RPC__in ISearchCatalogManager2 * This, /* [out] */ __RPC__out CatalogStatus *pStatus, /* [out] */ __RPC__out CatalogPausedReason *pPausedReason); HRESULT ( STDMETHODCALLTYPE *Reset )( __RPC__in ISearchCatalogManager2 * This); HRESULT ( STDMETHODCALLTYPE *Reindex )( __RPC__in ISearchCatalogManager2 * This); HRESULT ( STDMETHODCALLTYPE *ReindexMatchingURLs )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszPattern); HRESULT ( STDMETHODCALLTYPE *ReindexSearchRoot )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszRootURL); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ConnectTimeout )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ DWORD dwConnectTimeout); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConnectTimeout )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__out DWORD *pdwConnectTimeout); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DataTimeout )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ DWORD dwDataTimeout); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataTimeout )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__out DWORD *pdwDataTimeout); HRESULT ( STDMETHODCALLTYPE *NumberOfItems )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__out LONG *plCount); HRESULT ( STDMETHODCALLTYPE *NumberOfItemsToIndex )( __RPC__in ISearchCatalogManager2 * This, /* [out] */ __RPC__out LONG *plIncrementalCount, /* [out] */ __RPC__out LONG *plNotificationQueue, /* [out] */ __RPC__out LONG *plHighPriorityQueue); HRESULT ( STDMETHODCALLTYPE *URLBeingIndexed )( __RPC__in ISearchCatalogManager2 * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszUrl); HRESULT ( STDMETHODCALLTYPE *GetURLIndexingState )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszURL, /* [retval][out] */ __RPC__out DWORD *pdwState); HRESULT ( STDMETHODCALLTYPE *GetPersistentItemsChangedSink )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__deref_out_opt ISearchPersistentItemsChangedSink **ppISearchPersistentItemsChangedSink); HRESULT ( STDMETHODCALLTYPE *RegisterViewForNotification )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszView, /* [in] */ __RPC__in_opt ISearchViewChangedSink *pViewChangedSink, /* [out] */ __RPC__out DWORD *pdwCookie); HRESULT ( STDMETHODCALLTYPE *GetItemsChangedSink )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ __RPC__in_opt ISearchNotifyInlineSite *pISearchNotifyInlineSite, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppv, /* [out] */ __RPC__out GUID *pGUIDCatalogResetSignature, /* [out] */ __RPC__out GUID *pGUIDCheckPointSignature, /* [out] */ __RPC__out DWORD *pdwLastCheckPointNumber); HRESULT ( STDMETHODCALLTYPE *UnregisterViewForNotification )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ DWORD dwCookie); HRESULT ( STDMETHODCALLTYPE *SetExtensionClusion )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszExtension, /* [in] */ BOOL fExclude); HRESULT ( STDMETHODCALLTYPE *EnumerateExcludedExtensions )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__deref_out_opt IEnumString **ppExtensions); HRESULT ( STDMETHODCALLTYPE *GetQueryHelper )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__deref_out_opt ISearchQueryHelper **ppSearchQueryHelper); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DiacriticSensitivity )( __RPC__in ISearchCatalogManager2 * This, /* [in] */ BOOL fDiacriticSensitive); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DiacriticSensitivity )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__out BOOL *pfDiacriticSensitive); HRESULT ( STDMETHODCALLTYPE *GetCrawlScopeManager )( __RPC__in ISearchCatalogManager2 * This, /* [retval][out] */ __RPC__deref_out_opt ISearchCrawlScopeManager **ppCrawlScopeManager); HRESULT ( STDMETHODCALLTYPE *PrioritizeMatchingURLs )( __RPC__in ISearchCatalogManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszPattern, /* [in] */ PRIORITIZE_FLAGS dwPrioritizeFlags); END_INTERFACE } ISearchCatalogManager2Vtbl; interface ISearchCatalogManager2 { CONST_VTBL struct ISearchCatalogManager2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchCatalogManager2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchCatalogManager2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchCatalogManager2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchCatalogManager2_get_Name(This,pszName) \ ( (This)->lpVtbl -> get_Name(This,pszName) ) #define ISearchCatalogManager2_GetParameter(This,pszName,ppValue) \ ( (This)->lpVtbl -> GetParameter(This,pszName,ppValue) ) #define ISearchCatalogManager2_SetParameter(This,pszName,pValue) \ ( (This)->lpVtbl -> SetParameter(This,pszName,pValue) ) #define ISearchCatalogManager2_GetCatalogStatus(This,pStatus,pPausedReason) \ ( (This)->lpVtbl -> GetCatalogStatus(This,pStatus,pPausedReason) ) #define ISearchCatalogManager2_Reset(This) \ ( (This)->lpVtbl -> Reset(This) ) #define ISearchCatalogManager2_Reindex(This) \ ( (This)->lpVtbl -> Reindex(This) ) #define ISearchCatalogManager2_ReindexMatchingURLs(This,pszPattern) \ ( (This)->lpVtbl -> ReindexMatchingURLs(This,pszPattern) ) #define ISearchCatalogManager2_ReindexSearchRoot(This,pszRootURL) \ ( (This)->lpVtbl -> ReindexSearchRoot(This,pszRootURL) ) #define ISearchCatalogManager2_put_ConnectTimeout(This,dwConnectTimeout) \ ( (This)->lpVtbl -> put_ConnectTimeout(This,dwConnectTimeout) ) #define ISearchCatalogManager2_get_ConnectTimeout(This,pdwConnectTimeout) \ ( (This)->lpVtbl -> get_ConnectTimeout(This,pdwConnectTimeout) ) #define ISearchCatalogManager2_put_DataTimeout(This,dwDataTimeout) \ ( (This)->lpVtbl -> put_DataTimeout(This,dwDataTimeout) ) #define ISearchCatalogManager2_get_DataTimeout(This,pdwDataTimeout) \ ( (This)->lpVtbl -> get_DataTimeout(This,pdwDataTimeout) ) #define ISearchCatalogManager2_NumberOfItems(This,plCount) \ ( (This)->lpVtbl -> NumberOfItems(This,plCount) ) #define ISearchCatalogManager2_NumberOfItemsToIndex(This,plIncrementalCount,plNotificationQueue,plHighPriorityQueue) \ ( (This)->lpVtbl -> NumberOfItemsToIndex(This,plIncrementalCount,plNotificationQueue,plHighPriorityQueue) ) #define ISearchCatalogManager2_URLBeingIndexed(This,pszUrl) \ ( (This)->lpVtbl -> URLBeingIndexed(This,pszUrl) ) #define ISearchCatalogManager2_GetURLIndexingState(This,pszURL,pdwState) \ ( (This)->lpVtbl -> GetURLIndexingState(This,pszURL,pdwState) ) #define ISearchCatalogManager2_GetPersistentItemsChangedSink(This,ppISearchPersistentItemsChangedSink) \ ( (This)->lpVtbl -> GetPersistentItemsChangedSink(This,ppISearchPersistentItemsChangedSink) ) #define ISearchCatalogManager2_RegisterViewForNotification(This,pszView,pViewChangedSink,pdwCookie) \ ( (This)->lpVtbl -> RegisterViewForNotification(This,pszView,pViewChangedSink,pdwCookie) ) #define ISearchCatalogManager2_GetItemsChangedSink(This,pISearchNotifyInlineSite,riid,ppv,pGUIDCatalogResetSignature,pGUIDCheckPointSignature,pdwLastCheckPointNumber) \ ( (This)->lpVtbl -> GetItemsChangedSink(This,pISearchNotifyInlineSite,riid,ppv,pGUIDCatalogResetSignature,pGUIDCheckPointSignature,pdwLastCheckPointNumber) ) #define ISearchCatalogManager2_UnregisterViewForNotification(This,dwCookie) \ ( (This)->lpVtbl -> UnregisterViewForNotification(This,dwCookie) ) #define ISearchCatalogManager2_SetExtensionClusion(This,pszExtension,fExclude) \ ( (This)->lpVtbl -> SetExtensionClusion(This,pszExtension,fExclude) ) #define ISearchCatalogManager2_EnumerateExcludedExtensions(This,ppExtensions) \ ( (This)->lpVtbl -> EnumerateExcludedExtensions(This,ppExtensions) ) #define ISearchCatalogManager2_GetQueryHelper(This,ppSearchQueryHelper) \ ( (This)->lpVtbl -> GetQueryHelper(This,ppSearchQueryHelper) ) #define ISearchCatalogManager2_put_DiacriticSensitivity(This,fDiacriticSensitive) \ ( (This)->lpVtbl -> put_DiacriticSensitivity(This,fDiacriticSensitive) ) #define ISearchCatalogManager2_get_DiacriticSensitivity(This,pfDiacriticSensitive) \ ( (This)->lpVtbl -> get_DiacriticSensitivity(This,pfDiacriticSensitive) ) #define ISearchCatalogManager2_GetCrawlScopeManager(This,ppCrawlScopeManager) \ ( (This)->lpVtbl -> GetCrawlScopeManager(This,ppCrawlScopeManager) ) #define ISearchCatalogManager2_PrioritizeMatchingURLs(This,pszPattern,dwPrioritizeFlags) \ ( (This)->lpVtbl -> PrioritizeMatchingURLs(This,pszPattern,dwPrioritizeFlags) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchCatalogManager2_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0021 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0021_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0021_v0_0_s_ifspec; #ifndef __ISearchQueryHelper_INTERFACE_DEFINED__ #define __ISearchQueryHelper_INTERFACE_DEFINED__ /* interface ISearchQueryHelper */ /* [unique][uuid][object] */ typedef enum _SEARCH_TERM_EXPANSION { SEARCH_TERM_NO_EXPANSION = 0, SEARCH_TERM_PREFIX_ALL = ( SEARCH_TERM_NO_EXPANSION + 1 ) , SEARCH_TERM_STEM_ALL = ( SEARCH_TERM_PREFIX_ALL + 1 ) } SEARCH_TERM_EXPANSION; typedef enum _SEARCH_QUERY_SYNTAX { SEARCH_NO_QUERY_SYNTAX = 0, SEARCH_ADVANCED_QUERY_SYNTAX = ( SEARCH_NO_QUERY_SYNTAX + 1 ) , SEARCH_NATURAL_QUERY_SYNTAX = ( SEARCH_ADVANCED_QUERY_SYNTAX + 1 ) } SEARCH_QUERY_SYNTAX; typedef struct _SEARCH_COLUMN_PROPERTIES { PROPVARIANT Value; LCID lcid; } SEARCH_COLUMN_PROPERTIES; EXTERN_C const IID IID_ISearchQueryHelper; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF63") ISearchQueryHelper : public IUnknown { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionString( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszConnectionString) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryContentLocale( /* [in] */ LCID lcid) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryContentLocale( /* [retval][out] */ __RPC__out LCID *plcid) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryKeywordLocale( /* [in] */ LCID lcid) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryKeywordLocale( /* [retval][out] */ __RPC__out LCID *plcid) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryTermExpansion( /* [in] */ SEARCH_TERM_EXPANSION expandTerms) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryTermExpansion( /* [retval][out] */ __RPC__out SEARCH_TERM_EXPANSION *pExpandTerms) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QuerySyntax( /* [in] */ SEARCH_QUERY_SYNTAX querySyntax) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QuerySyntax( /* [retval][out] */ __RPC__out SEARCH_QUERY_SYNTAX *pQuerySyntax) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryContentProperties( /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszContentProperties) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryContentProperties( /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszContentProperties) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QuerySelectColumns( /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszSelectColumns) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QuerySelectColumns( /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSelectColumns) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryWhereRestrictions( /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszRestrictions) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryWhereRestrictions( /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszRestrictions) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QuerySorting( /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszSorting) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QuerySorting( /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSorting) = 0; virtual HRESULT STDMETHODCALLTYPE GenerateSQLFromUserQuery( /* [string][in] */ __RPC__in_string LPCWSTR pszQuery, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSQL) = 0; virtual HRESULT STDMETHODCALLTYPE WriteProperties( /* [in] */ ITEMID itemID, /* [in] */ DWORD dwNumberOfColumns, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfColumns) PROPERTYKEY *pColumns, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfColumns) SEARCH_COLUMN_PROPERTIES *pValues, /* [unique][in] */ __RPC__in_opt FILETIME *pftGatherModifiedTime) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_QueryMaxResults( /* [in] */ LONG cMaxResults) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_QueryMaxResults( /* [retval][out] */ __RPC__out LONG *pcMaxResults) = 0; }; #else /* C style interface */ typedef struct ISearchQueryHelperVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchQueryHelper * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchQueryHelper * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchQueryHelper * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConnectionString )( __RPC__in ISearchQueryHelper * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *pszConnectionString); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryContentLocale )( __RPC__in ISearchQueryHelper * This, /* [in] */ LCID lcid); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryContentLocale )( __RPC__in ISearchQueryHelper * This, /* [retval][out] */ __RPC__out LCID *plcid); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryKeywordLocale )( __RPC__in ISearchQueryHelper * This, /* [in] */ LCID lcid); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryKeywordLocale )( __RPC__in ISearchQueryHelper * This, /* [retval][out] */ __RPC__out LCID *plcid); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryTermExpansion )( __RPC__in ISearchQueryHelper * This, /* [in] */ SEARCH_TERM_EXPANSION expandTerms); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryTermExpansion )( __RPC__in ISearchQueryHelper * This, /* [retval][out] */ __RPC__out SEARCH_TERM_EXPANSION *pExpandTerms); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QuerySyntax )( __RPC__in ISearchQueryHelper * This, /* [in] */ SEARCH_QUERY_SYNTAX querySyntax); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QuerySyntax )( __RPC__in ISearchQueryHelper * This, /* [retval][out] */ __RPC__out SEARCH_QUERY_SYNTAX *pQuerySyntax); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryContentProperties )( __RPC__in ISearchQueryHelper * This, /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszContentProperties); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryContentProperties )( __RPC__in ISearchQueryHelper * This, /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszContentProperties); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QuerySelectColumns )( __RPC__in ISearchQueryHelper * This, /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszSelectColumns); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QuerySelectColumns )( __RPC__in ISearchQueryHelper * This, /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSelectColumns); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryWhereRestrictions )( __RPC__in ISearchQueryHelper * This, /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszRestrictions); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryWhereRestrictions )( __RPC__in ISearchQueryHelper * This, /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszRestrictions); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QuerySorting )( __RPC__in ISearchQueryHelper * This, /* [unique][string][in] */ __RPC__in_opt_string LPCWSTR pszSorting); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QuerySorting )( __RPC__in ISearchQueryHelper * This, /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSorting); HRESULT ( STDMETHODCALLTYPE *GenerateSQLFromUserQuery )( __RPC__in ISearchQueryHelper * This, /* [string][in] */ __RPC__in_string LPCWSTR pszQuery, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszSQL); HRESULT ( STDMETHODCALLTYPE *WriteProperties )( __RPC__in ISearchQueryHelper * This, /* [in] */ ITEMID itemID, /* [in] */ DWORD dwNumberOfColumns, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfColumns) PROPERTYKEY *pColumns, /* [size_is][in] */ __RPC__in_ecount_full(dwNumberOfColumns) SEARCH_COLUMN_PROPERTIES *pValues, /* [unique][in] */ __RPC__in_opt FILETIME *pftGatherModifiedTime); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_QueryMaxResults )( __RPC__in ISearchQueryHelper * This, /* [in] */ LONG cMaxResults); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_QueryMaxResults )( __RPC__in ISearchQueryHelper * This, /* [retval][out] */ __RPC__out LONG *pcMaxResults); END_INTERFACE } ISearchQueryHelperVtbl; interface ISearchQueryHelper { CONST_VTBL struct ISearchQueryHelperVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchQueryHelper_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchQueryHelper_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchQueryHelper_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchQueryHelper_get_ConnectionString(This,pszConnectionString) \ ( (This)->lpVtbl -> get_ConnectionString(This,pszConnectionString) ) #define ISearchQueryHelper_put_QueryContentLocale(This,lcid) \ ( (This)->lpVtbl -> put_QueryContentLocale(This,lcid) ) #define ISearchQueryHelper_get_QueryContentLocale(This,plcid) \ ( (This)->lpVtbl -> get_QueryContentLocale(This,plcid) ) #define ISearchQueryHelper_put_QueryKeywordLocale(This,lcid) \ ( (This)->lpVtbl -> put_QueryKeywordLocale(This,lcid) ) #define ISearchQueryHelper_get_QueryKeywordLocale(This,plcid) \ ( (This)->lpVtbl -> get_QueryKeywordLocale(This,plcid) ) #define ISearchQueryHelper_put_QueryTermExpansion(This,expandTerms) \ ( (This)->lpVtbl -> put_QueryTermExpansion(This,expandTerms) ) #define ISearchQueryHelper_get_QueryTermExpansion(This,pExpandTerms) \ ( (This)->lpVtbl -> get_QueryTermExpansion(This,pExpandTerms) ) #define ISearchQueryHelper_put_QuerySyntax(This,querySyntax) \ ( (This)->lpVtbl -> put_QuerySyntax(This,querySyntax) ) #define ISearchQueryHelper_get_QuerySyntax(This,pQuerySyntax) \ ( (This)->lpVtbl -> get_QuerySyntax(This,pQuerySyntax) ) #define ISearchQueryHelper_put_QueryContentProperties(This,pszContentProperties) \ ( (This)->lpVtbl -> put_QueryContentProperties(This,pszContentProperties) ) #define ISearchQueryHelper_get_QueryContentProperties(This,ppszContentProperties) \ ( (This)->lpVtbl -> get_QueryContentProperties(This,ppszContentProperties) ) #define ISearchQueryHelper_put_QuerySelectColumns(This,pszSelectColumns) \ ( (This)->lpVtbl -> put_QuerySelectColumns(This,pszSelectColumns) ) #define ISearchQueryHelper_get_QuerySelectColumns(This,ppszSelectColumns) \ ( (This)->lpVtbl -> get_QuerySelectColumns(This,ppszSelectColumns) ) #define ISearchQueryHelper_put_QueryWhereRestrictions(This,pszRestrictions) \ ( (This)->lpVtbl -> put_QueryWhereRestrictions(This,pszRestrictions) ) #define ISearchQueryHelper_get_QueryWhereRestrictions(This,ppszRestrictions) \ ( (This)->lpVtbl -> get_QueryWhereRestrictions(This,ppszRestrictions) ) #define ISearchQueryHelper_put_QuerySorting(This,pszSorting) \ ( (This)->lpVtbl -> put_QuerySorting(This,pszSorting) ) #define ISearchQueryHelper_get_QuerySorting(This,ppszSorting) \ ( (This)->lpVtbl -> get_QuerySorting(This,ppszSorting) ) #define ISearchQueryHelper_GenerateSQLFromUserQuery(This,pszQuery,ppszSQL) \ ( (This)->lpVtbl -> GenerateSQLFromUserQuery(This,pszQuery,ppszSQL) ) #define ISearchQueryHelper_WriteProperties(This,itemID,dwNumberOfColumns,pColumns,pValues,pftGatherModifiedTime) \ ( (This)->lpVtbl -> WriteProperties(This,itemID,dwNumberOfColumns,pColumns,pValues,pftGatherModifiedTime) ) #define ISearchQueryHelper_put_QueryMaxResults(This,cMaxResults) \ ( (This)->lpVtbl -> put_QueryMaxResults(This,cMaxResults) ) #define ISearchQueryHelper_get_QueryMaxResults(This,pcMaxResults) \ ( (This)->lpVtbl -> get_QueryMaxResults(This,pcMaxResults) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchQueryHelper_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0022 */ /* [local] */ typedef /* [public][public][public][v1_enum] */ enum __MIDL___MIDL_itf_searchapi_0000_0022_0001 { PRIORITY_LEVEL_FOREGROUND = 0, PRIORITY_LEVEL_HIGH = 1, PRIORITY_LEVEL_LOW = 2, PRIORITY_LEVEL_DEFAULT = 3 } PRIORITY_LEVEL; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0022_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0022_v0_0_s_ifspec; #ifndef __IRowsetPrioritization_INTERFACE_DEFINED__ #define __IRowsetPrioritization_INTERFACE_DEFINED__ /* interface IRowsetPrioritization */ /* [unique][uuid][object] */ EXTERN_C const IID IID_IRowsetPrioritization; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("42811652-079D-481B-87A2-09A69ECC5F44") IRowsetPrioritization : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE SetScopePriority( /* [in] */ PRIORITY_LEVEL priority, /* [in] */ DWORD scopeStatisticsEventFrequency) = 0; virtual HRESULT STDMETHODCALLTYPE GetScopePriority( /* [out] */ __RPC__out PRIORITY_LEVEL *priority, /* [out] */ __RPC__out DWORD *scopeStatisticsEventFrequency) = 0; virtual HRESULT STDMETHODCALLTYPE GetScopeStatistics( /* [out] */ __RPC__out DWORD *indexedDocumentCount, /* [out] */ __RPC__out DWORD *oustandingAddCount, /* [out] */ __RPC__out DWORD *oustandingModifyCount) = 0; }; #else /* C style interface */ typedef struct IRowsetPrioritizationVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IRowsetPrioritization * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IRowsetPrioritization * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IRowsetPrioritization * This); HRESULT ( STDMETHODCALLTYPE *SetScopePriority )( __RPC__in IRowsetPrioritization * This, /* [in] */ PRIORITY_LEVEL priority, /* [in] */ DWORD scopeStatisticsEventFrequency); HRESULT ( STDMETHODCALLTYPE *GetScopePriority )( __RPC__in IRowsetPrioritization * This, /* [out] */ __RPC__out PRIORITY_LEVEL *priority, /* [out] */ __RPC__out DWORD *scopeStatisticsEventFrequency); HRESULT ( STDMETHODCALLTYPE *GetScopeStatistics )( __RPC__in IRowsetPrioritization * This, /* [out] */ __RPC__out DWORD *indexedDocumentCount, /* [out] */ __RPC__out DWORD *oustandingAddCount, /* [out] */ __RPC__out DWORD *oustandingModifyCount); END_INTERFACE } IRowsetPrioritizationVtbl; interface IRowsetPrioritization { CONST_VTBL struct IRowsetPrioritizationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IRowsetPrioritization_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IRowsetPrioritization_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IRowsetPrioritization_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IRowsetPrioritization_SetScopePriority(This,priority,scopeStatisticsEventFrequency) \ ( (This)->lpVtbl -> SetScopePriority(This,priority,scopeStatisticsEventFrequency) ) #define IRowsetPrioritization_GetScopePriority(This,priority,scopeStatisticsEventFrequency) \ ( (This)->lpVtbl -> GetScopePriority(This,priority,scopeStatisticsEventFrequency) ) #define IRowsetPrioritization_GetScopeStatistics(This,indexedDocumentCount,oustandingAddCount,oustandingModifyCount) \ ( (This)->lpVtbl -> GetScopeStatistics(This,indexedDocumentCount,oustandingAddCount,oustandingModifyCount) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IRowsetPrioritization_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0023 */ /* [local] */ typedef /* [public][public][public][public][public][v1_enum] */ enum __MIDL___MIDL_itf_searchapi_0000_0023_0001 { ROWSETEVENT_ITEMSTATE_NOTINROWSET = 0, ROWSETEVENT_ITEMSTATE_INROWSET = 1, ROWSETEVENT_ITEMSTATE_UNKNOWN = 2 } ROWSETEVENT_ITEMSTATE; typedef /* [public][public][v1_enum] */ enum __MIDL___MIDL_itf_searchapi_0000_0023_0002 { ROWSETEVENT_TYPE_DATAEXPIRED = 0, ROWSETEVENT_TYPE_FOREGROUNDLOST = 1, ROWSETEVENT_TYPE_SCOPESTATISTICS = 2 } ROWSETEVENT_TYPE; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0023_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0023_v0_0_s_ifspec; #ifndef __IRowsetEvents_INTERFACE_DEFINED__ #define __IRowsetEvents_INTERFACE_DEFINED__ /* interface IRowsetEvents */ /* [unique][uuid][object] */ EXTERN_C const IID IID_IRowsetEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("1551AEA5-5D66-4B11-86F5-D5634CB211B9") IRowsetEvents : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnNewItem( /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE newItemState) = 0; virtual HRESULT STDMETHODCALLTYPE OnChangedItem( /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE rowsetItemState, /* [in] */ ROWSETEVENT_ITEMSTATE changedItemState) = 0; virtual HRESULT STDMETHODCALLTYPE OnDeletedItem( /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE deletedItemState) = 0; virtual HRESULT STDMETHODCALLTYPE OnRowsetEvent( /* [in] */ ROWSETEVENT_TYPE eventType, /* [in] */ __RPC__in REFPROPVARIANT eventData) = 0; }; #else /* C style interface */ typedef struct IRowsetEventsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IRowsetEvents * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IRowsetEvents * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IRowsetEvents * This); HRESULT ( STDMETHODCALLTYPE *OnNewItem )( __RPC__in IRowsetEvents * This, /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE newItemState); HRESULT ( STDMETHODCALLTYPE *OnChangedItem )( __RPC__in IRowsetEvents * This, /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE rowsetItemState, /* [in] */ ROWSETEVENT_ITEMSTATE changedItemState); HRESULT ( STDMETHODCALLTYPE *OnDeletedItem )( __RPC__in IRowsetEvents * This, /* [in] */ __RPC__in REFPROPVARIANT itemID, /* [in] */ ROWSETEVENT_ITEMSTATE deletedItemState); HRESULT ( STDMETHODCALLTYPE *OnRowsetEvent )( __RPC__in IRowsetEvents * This, /* [in] */ ROWSETEVENT_TYPE eventType, /* [in] */ __RPC__in REFPROPVARIANT eventData); END_INTERFACE } IRowsetEventsVtbl; interface IRowsetEvents { CONST_VTBL struct IRowsetEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IRowsetEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IRowsetEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IRowsetEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IRowsetEvents_OnNewItem(This,itemID,newItemState) \ ( (This)->lpVtbl -> OnNewItem(This,itemID,newItemState) ) #define IRowsetEvents_OnChangedItem(This,itemID,rowsetItemState,changedItemState) \ ( (This)->lpVtbl -> OnChangedItem(This,itemID,rowsetItemState,changedItemState) ) #define IRowsetEvents_OnDeletedItem(This,itemID,deletedItemState) \ ( (This)->lpVtbl -> OnDeletedItem(This,itemID,deletedItemState) ) #define IRowsetEvents_OnRowsetEvent(This,eventType,eventData) \ ( (This)->lpVtbl -> OnRowsetEvent(This,eventType,eventData) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IRowsetEvents_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0024 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0024_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0024_v0_0_s_ifspec; #ifndef __ISearchManager_INTERFACE_DEFINED__ #define __ISearchManager_INTERFACE_DEFINED__ /* interface ISearchManager */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("AB310581-AC80-11D1-8DF3-00C04FB6EF69") ISearchManager : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetIndexerVersionStr( /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszVersionString) = 0; virtual HRESULT STDMETHODCALLTYPE GetIndexerVersion( /* [out] */ __RPC__out DWORD *pdwMajor, /* [out] */ __RPC__out DWORD *pdwMinor) = 0; virtual HRESULT STDMETHODCALLTYPE GetParameter( /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue) = 0; virtual HRESULT STDMETHODCALLTYPE SetParameter( /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in const PROPVARIANT *pValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProxyName( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszProxyName) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BypassList( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszBypassList) = 0; virtual HRESULT STDMETHODCALLTYPE SetProxy( /* [in] */ PROXY_ACCESS sUseProxy, /* [in] */ BOOL fLocalByPassProxy, /* [in] */ DWORD dwPortNumber, /* [string][in] */ __RPC__in_string LPCWSTR pszProxyName, /* [string][in] */ __RPC__in_string LPCWSTR pszByPassList) = 0; virtual HRESULT STDMETHODCALLTYPE GetCatalog( /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog, /* [retval][out] */ __RPC__deref_out_opt ISearchCatalogManager **ppCatalogManager) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UserAgent( /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszUserAgent) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_UserAgent( /* [string][in] */ __RPC__in_string LPCWSTR pszUserAgent) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UseProxy( /* [retval][out] */ __RPC__out PROXY_ACCESS *pUseProxy) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LocalBypass( /* [retval][out] */ __RPC__out BOOL *pfLocalBypass) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PortNumber( /* [retval][out] */ __RPC__out DWORD *pdwPortNumber) = 0; }; #else /* C style interface */ typedef struct ISearchManagerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchManager * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchManager * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchManager * This); HRESULT ( STDMETHODCALLTYPE *GetIndexerVersionStr )( __RPC__in ISearchManager * This, /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszVersionString); HRESULT ( STDMETHODCALLTYPE *GetIndexerVersion )( __RPC__in ISearchManager * This, /* [out] */ __RPC__out DWORD *pdwMajor, /* [out] */ __RPC__out DWORD *pdwMinor); HRESULT ( STDMETHODCALLTYPE *GetParameter )( __RPC__in ISearchManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue); HRESULT ( STDMETHODCALLTYPE *SetParameter )( __RPC__in ISearchManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in const PROPVARIANT *pValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProxyName )( __RPC__in ISearchManager * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszProxyName); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BypassList )( __RPC__in ISearchManager * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszBypassList); HRESULT ( STDMETHODCALLTYPE *SetProxy )( __RPC__in ISearchManager * This, /* [in] */ PROXY_ACCESS sUseProxy, /* [in] */ BOOL fLocalByPassProxy, /* [in] */ DWORD dwPortNumber, /* [string][in] */ __RPC__in_string LPCWSTR pszProxyName, /* [string][in] */ __RPC__in_string LPCWSTR pszByPassList); HRESULT ( STDMETHODCALLTYPE *GetCatalog )( __RPC__in ISearchManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog, /* [retval][out] */ __RPC__deref_out_opt ISearchCatalogManager **ppCatalogManager); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UserAgent )( __RPC__in ISearchManager * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszUserAgent); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_UserAgent )( __RPC__in ISearchManager * This, /* [string][in] */ __RPC__in_string LPCWSTR pszUserAgent); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UseProxy )( __RPC__in ISearchManager * This, /* [retval][out] */ __RPC__out PROXY_ACCESS *pUseProxy); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalBypass )( __RPC__in ISearchManager * This, /* [retval][out] */ __RPC__out BOOL *pfLocalBypass); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PortNumber )( __RPC__in ISearchManager * This, /* [retval][out] */ __RPC__out DWORD *pdwPortNumber); END_INTERFACE } ISearchManagerVtbl; interface ISearchManager { CONST_VTBL struct ISearchManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchManager_GetIndexerVersionStr(This,ppszVersionString) \ ( (This)->lpVtbl -> GetIndexerVersionStr(This,ppszVersionString) ) #define ISearchManager_GetIndexerVersion(This,pdwMajor,pdwMinor) \ ( (This)->lpVtbl -> GetIndexerVersion(This,pdwMajor,pdwMinor) ) #define ISearchManager_GetParameter(This,pszName,ppValue) \ ( (This)->lpVtbl -> GetParameter(This,pszName,ppValue) ) #define ISearchManager_SetParameter(This,pszName,pValue) \ ( (This)->lpVtbl -> SetParameter(This,pszName,pValue) ) #define ISearchManager_get_ProxyName(This,ppszProxyName) \ ( (This)->lpVtbl -> get_ProxyName(This,ppszProxyName) ) #define ISearchManager_get_BypassList(This,ppszBypassList) \ ( (This)->lpVtbl -> get_BypassList(This,ppszBypassList) ) #define ISearchManager_SetProxy(This,sUseProxy,fLocalByPassProxy,dwPortNumber,pszProxyName,pszByPassList) \ ( (This)->lpVtbl -> SetProxy(This,sUseProxy,fLocalByPassProxy,dwPortNumber,pszProxyName,pszByPassList) ) #define ISearchManager_GetCatalog(This,pszCatalog,ppCatalogManager) \ ( (This)->lpVtbl -> GetCatalog(This,pszCatalog,ppCatalogManager) ) #define ISearchManager_get_UserAgent(This,ppszUserAgent) \ ( (This)->lpVtbl -> get_UserAgent(This,ppszUserAgent) ) #define ISearchManager_put_UserAgent(This,pszUserAgent) \ ( (This)->lpVtbl -> put_UserAgent(This,pszUserAgent) ) #define ISearchManager_get_UseProxy(This,pUseProxy) \ ( (This)->lpVtbl -> get_UseProxy(This,pUseProxy) ) #define ISearchManager_get_LocalBypass(This,pfLocalBypass) \ ( (This)->lpVtbl -> get_LocalBypass(This,pfLocalBypass) ) #define ISearchManager_get_PortNumber(This,pdwPortNumber) \ ( (This)->lpVtbl -> get_PortNumber(This,pdwPortNumber) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchManager_INTERFACE_DEFINED__ */ #ifndef __ISearchManager2_INTERFACE_DEFINED__ #define __ISearchManager2_INTERFACE_DEFINED__ /* interface ISearchManager2 */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchManager2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DBAB3F73-DB19-4A79-BFC0-A61A93886DDF") ISearchManager2 : public ISearchManager { public: virtual HRESULT STDMETHODCALLTYPE CreateCatalog( /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog, /* [out] */ __RPC__deref_out_opt ISearchCatalogManager **ppCatalogManager) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteCatalog( /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog) = 0; }; #else /* C style interface */ typedef struct ISearchManager2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchManager2 * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchManager2 * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchManager2 * This); HRESULT ( STDMETHODCALLTYPE *GetIndexerVersionStr )( __RPC__in ISearchManager2 * This, /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszVersionString); HRESULT ( STDMETHODCALLTYPE *GetIndexerVersion )( __RPC__in ISearchManager2 * This, /* [out] */ __RPC__out DWORD *pdwMajor, /* [out] */ __RPC__out DWORD *pdwMinor); HRESULT ( STDMETHODCALLTYPE *GetParameter )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [retval][out] */ __RPC__deref_out_opt PROPVARIANT **ppValue); HRESULT ( STDMETHODCALLTYPE *SetParameter )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszName, /* [in] */ __RPC__in const PROPVARIANT *pValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProxyName )( __RPC__in ISearchManager2 * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszProxyName); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BypassList )( __RPC__in ISearchManager2 * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszBypassList); HRESULT ( STDMETHODCALLTYPE *SetProxy )( __RPC__in ISearchManager2 * This, /* [in] */ PROXY_ACCESS sUseProxy, /* [in] */ BOOL fLocalByPassProxy, /* [in] */ DWORD dwPortNumber, /* [string][in] */ __RPC__in_string LPCWSTR pszProxyName, /* [string][in] */ __RPC__in_string LPCWSTR pszByPassList); HRESULT ( STDMETHODCALLTYPE *GetCatalog )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog, /* [retval][out] */ __RPC__deref_out_opt ISearchCatalogManager **ppCatalogManager); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UserAgent )( __RPC__in ISearchManager2 * This, /* [string][retval][out] */ __RPC__deref_out_opt_string LPWSTR *ppszUserAgent); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_UserAgent )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszUserAgent); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UseProxy )( __RPC__in ISearchManager2 * This, /* [retval][out] */ __RPC__out PROXY_ACCESS *pUseProxy); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalBypass )( __RPC__in ISearchManager2 * This, /* [retval][out] */ __RPC__out BOOL *pfLocalBypass); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PortNumber )( __RPC__in ISearchManager2 * This, /* [retval][out] */ __RPC__out DWORD *pdwPortNumber); HRESULT ( STDMETHODCALLTYPE *CreateCatalog )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog, /* [out] */ __RPC__deref_out_opt ISearchCatalogManager **ppCatalogManager); HRESULT ( STDMETHODCALLTYPE *DeleteCatalog )( __RPC__in ISearchManager2 * This, /* [string][in] */ __RPC__in_string LPCWSTR pszCatalog); END_INTERFACE } ISearchManager2Vtbl; interface ISearchManager2 { CONST_VTBL struct ISearchManager2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchManager2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchManager2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchManager2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchManager2_GetIndexerVersionStr(This,ppszVersionString) \ ( (This)->lpVtbl -> GetIndexerVersionStr(This,ppszVersionString) ) #define ISearchManager2_GetIndexerVersion(This,pdwMajor,pdwMinor) \ ( (This)->lpVtbl -> GetIndexerVersion(This,pdwMajor,pdwMinor) ) #define ISearchManager2_GetParameter(This,pszName,ppValue) \ ( (This)->lpVtbl -> GetParameter(This,pszName,ppValue) ) #define ISearchManager2_SetParameter(This,pszName,pValue) \ ( (This)->lpVtbl -> SetParameter(This,pszName,pValue) ) #define ISearchManager2_get_ProxyName(This,ppszProxyName) \ ( (This)->lpVtbl -> get_ProxyName(This,ppszProxyName) ) #define ISearchManager2_get_BypassList(This,ppszBypassList) \ ( (This)->lpVtbl -> get_BypassList(This,ppszBypassList) ) #define ISearchManager2_SetProxy(This,sUseProxy,fLocalByPassProxy,dwPortNumber,pszProxyName,pszByPassList) \ ( (This)->lpVtbl -> SetProxy(This,sUseProxy,fLocalByPassProxy,dwPortNumber,pszProxyName,pszByPassList) ) #define ISearchManager2_GetCatalog(This,pszCatalog,ppCatalogManager) \ ( (This)->lpVtbl -> GetCatalog(This,pszCatalog,ppCatalogManager) ) #define ISearchManager2_get_UserAgent(This,ppszUserAgent) \ ( (This)->lpVtbl -> get_UserAgent(This,ppszUserAgent) ) #define ISearchManager2_put_UserAgent(This,pszUserAgent) \ ( (This)->lpVtbl -> put_UserAgent(This,pszUserAgent) ) #define ISearchManager2_get_UseProxy(This,pUseProxy) \ ( (This)->lpVtbl -> get_UseProxy(This,pUseProxy) ) #define ISearchManager2_get_LocalBypass(This,pfLocalBypass) \ ( (This)->lpVtbl -> get_LocalBypass(This,pfLocalBypass) ) #define ISearchManager2_get_PortNumber(This,pdwPortNumber) \ ( (This)->lpVtbl -> get_PortNumber(This,pdwPortNumber) ) #define ISearchManager2_CreateCatalog(This,pszCatalog,ppCatalogManager) \ ( (This)->lpVtbl -> CreateCatalog(This,pszCatalog,ppCatalogManager) ) #define ISearchManager2_DeleteCatalog(This,pszCatalog) \ ( (This)->lpVtbl -> DeleteCatalog(This,pszCatalog) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchManager2_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0026 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) EXTERN_C const CLSID CLSID_CSearchLanguageSupport; #ifdef __cplusplus class DECLSPEC_UUID("6A68CC80-4337-4dbc-BD27-FBFB1053820B") CSearchLanguageSupport; #endif extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0026_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0026_v0_0_s_ifspec; #ifndef __ISearchLanguageSupport_INTERFACE_DEFINED__ #define __ISearchLanguageSupport_INTERFACE_DEFINED__ /* interface ISearchLanguageSupport */ /* [unique][uuid][object] */ EXTERN_C const IID IID_ISearchLanguageSupport; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("24C3CBAA-EBC1-491a-9EF1-9F6D8DEB1B8F") ISearchLanguageSupport : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE SetDiacriticSensitivity( /* [in] */ BOOL fDiacriticSensitive) = 0; virtual HRESULT STDMETHODCALLTYPE GetDiacriticSensitivity( /* [retval][out] */ __RPC__out BOOL *pfDiacriticSensitive) = 0; virtual HRESULT STDMETHODCALLTYPE LoadWordBreaker( /* [in] */ LCID lcid, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppWordBreaker, /* [out] */ __RPC__out LCID *pLcidUsed) = 0; virtual HRESULT STDMETHODCALLTYPE LoadStemmer( /* [in] */ LCID lcid, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppStemmer, /* [out] */ __RPC__out LCID *pLcidUsed) = 0; virtual HRESULT STDMETHODCALLTYPE IsPrefixNormalized( /* [size_is][in] */ __RPC__in_ecount_full(cwcQueryToken) LPCWSTR pwcsQueryToken, /* [in] */ ULONG cwcQueryToken, /* [size_is][in] */ __RPC__in_ecount_full(cwcDocumentToken) LPCWSTR pwcsDocumentToken, /* [in] */ ULONG cwcDocumentToken, /* [out] */ __RPC__out ULONG *pulPrefixLength) = 0; }; #else /* C style interface */ typedef struct ISearchLanguageSupportVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in ISearchLanguageSupport * This, /* [in] */ __RPC__in REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in ISearchLanguageSupport * This); ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in ISearchLanguageSupport * This); HRESULT ( STDMETHODCALLTYPE *SetDiacriticSensitivity )( __RPC__in ISearchLanguageSupport * This, /* [in] */ BOOL fDiacriticSensitive); HRESULT ( STDMETHODCALLTYPE *GetDiacriticSensitivity )( __RPC__in ISearchLanguageSupport * This, /* [retval][out] */ __RPC__out BOOL *pfDiacriticSensitive); HRESULT ( STDMETHODCALLTYPE *LoadWordBreaker )( __RPC__in ISearchLanguageSupport * This, /* [in] */ LCID lcid, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppWordBreaker, /* [out] */ __RPC__out LCID *pLcidUsed); HRESULT ( STDMETHODCALLTYPE *LoadStemmer )( __RPC__in ISearchLanguageSupport * This, /* [in] */ LCID lcid, /* [in] */ __RPC__in REFIID riid, /* [iid_is][out] */ __RPC__deref_out_opt void **ppStemmer, /* [out] */ __RPC__out LCID *pLcidUsed); HRESULT ( STDMETHODCALLTYPE *IsPrefixNormalized )( __RPC__in ISearchLanguageSupport * This, /* [size_is][in] */ __RPC__in_ecount_full(cwcQueryToken) LPCWSTR pwcsQueryToken, /* [in] */ ULONG cwcQueryToken, /* [size_is][in] */ __RPC__in_ecount_full(cwcDocumentToken) LPCWSTR pwcsDocumentToken, /* [in] */ ULONG cwcDocumentToken, /* [out] */ __RPC__out ULONG *pulPrefixLength); END_INTERFACE } ISearchLanguageSupportVtbl; interface ISearchLanguageSupport { CONST_VTBL struct ISearchLanguageSupportVtbl *lpVtbl; }; #ifdef COBJMACROS #define ISearchLanguageSupport_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ISearchLanguageSupport_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define ISearchLanguageSupport_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define ISearchLanguageSupport_SetDiacriticSensitivity(This,fDiacriticSensitive) \ ( (This)->lpVtbl -> SetDiacriticSensitivity(This,fDiacriticSensitive) ) #define ISearchLanguageSupport_GetDiacriticSensitivity(This,pfDiacriticSensitive) \ ( (This)->lpVtbl -> GetDiacriticSensitivity(This,pfDiacriticSensitive) ) #define ISearchLanguageSupport_LoadWordBreaker(This,lcid,riid,ppWordBreaker,pLcidUsed) \ ( (This)->lpVtbl -> LoadWordBreaker(This,lcid,riid,ppWordBreaker,pLcidUsed) ) #define ISearchLanguageSupport_LoadStemmer(This,lcid,riid,ppStemmer,pLcidUsed) \ ( (This)->lpVtbl -> LoadStemmer(This,lcid,riid,ppStemmer,pLcidUsed) ) #define ISearchLanguageSupport_IsPrefixNormalized(This,pwcsQueryToken,cwcQueryToken,pwcsDocumentToken,cwcDocumentToken,pulPrefixLength) \ ( (This)->lpVtbl -> IsPrefixNormalized(This,pwcsQueryToken,cwcQueryToken,pwcsDocumentToken,cwcDocumentToken,pulPrefixLength) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __ISearchLanguageSupport_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0027 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0027_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0027_v0_0_s_ifspec; #ifndef __SearchAPILib_LIBRARY_DEFINED__ #define __SearchAPILib_LIBRARY_DEFINED__ /* library SearchAPILib */ /* [version][uuid] */ EXTERN_C const IID LIBID_SearchAPILib; EXTERN_C const CLSID CLSID_CSearchManager; #ifdef __cplusplus class DECLSPEC_UUID("7D096C5F-AC08-4f1f-BEB7-5C22C517CE39") CSearchManager; #endif EXTERN_C const CLSID CLSID_CSearchRoot; #ifdef __cplusplus class DECLSPEC_UUID("30766BD2-EA1C-4F28-BF27-0B44E2F68DB7") CSearchRoot; #endif EXTERN_C const CLSID CLSID_CSearchScopeRule; #ifdef __cplusplus class DECLSPEC_UUID("E63DE750-3BD7-4BE5-9C84-6B4281988C44") CSearchScopeRule; #endif EXTERN_C const CLSID CLSID_FilterRegistration; #ifdef __cplusplus class DECLSPEC_UUID("9E175B8D-F52A-11D8-B9A5-505054503030") FilterRegistration; #endif #endif /* __SearchAPILib_LIBRARY_DEFINED__ */ /* interface __MIDL_itf_searchapi_0000_0028 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0028_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_searchapi_0000_0028_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); /* [local] */ HRESULT STDMETHODCALLTYPE ISearchCrawlScopeManager2_GetVersion_Proxy( ISearchCrawlScopeManager2 * This, /* [out] */ long **plVersion, /* [out] */ HANDLE *phFileMapping); /* [call_as] */ HRESULT STDMETHODCALLTYPE ISearchCrawlScopeManager2_GetVersion_Stub( __RPC__in ISearchCrawlScopeManager2 * This, /* [out] */ __RPC__out long *plVersion); /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
98,414
634
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.smartPointers; import com.intellij.openapi.editor.Document; import com.intellij.openapi.util.Segment; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import javax.annotation.Nonnull; import javax.annotation.Nullable; abstract class SmartPointerElementInfo { @Nullable Document getDocumentToSynchronize() { return null; } void fastenBelt(@Nonnull SmartPointerManagerImpl manager) { } @Nullable abstract PsiElement restoreElement(@Nonnull SmartPointerManagerImpl manager); @Nullable abstract PsiFile restoreFile(@Nonnull SmartPointerManagerImpl manager); abstract int elementHashCode(); // must be immutable abstract boolean pointsToTheSameElementAs(@Nonnull SmartPointerElementInfo other, @Nonnull SmartPointerManagerImpl manager); abstract VirtualFile getVirtualFile(); @Nullable abstract Segment getRange(@Nonnull SmartPointerManagerImpl manager); void cleanup() { } @Nullable abstract Segment getPsiRange(@Nonnull SmartPointerManagerImpl manager); }
378
3,934
# This sample tests the type analyzer's handling of the built-in # __import__ function. reveal_type(__path__, expected_text="Iterable[str]") # This should not generate a type error. __path__ = __import__("pkgutil").extend_path(__path__, __name__)
80
1,351
/** @file * * A brief file description * * @section license License * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <map> #include <tscore/ink_memory.h> #include <openssl/ssl.h> #include "QUICTypes.h" #include <cstddef> class QUICTransportParameterId { public: enum { ORIGINAL_DESTINATION_CONNECTION_ID, MAX_IDLE_TIMEOUT, STATELESS_RESET_TOKEN, MAX_UDP_PAYLOAD_SIZE, INITIAL_MAX_DATA, INITIAL_MAX_STREAM_DATA_BIDI_LOCAL, INITIAL_MAX_STREAM_DATA_BIDI_REMOTE, INITIAL_MAX_STREAM_DATA_UNI, INITIAL_MAX_STREAMS_BIDI, INITIAL_MAX_STREAMS_UNI, ACK_DELAY_EXPONENT, MAX_ACK_DELAY, DISABLE_ACTIVE_MIGRATION, PREFERRED_ADDRESS, ACTIVE_CONNECTION_ID_LIMIT, INITIAL_SOURCE_CONNECTION_ID, RETRY_SOURCE_CONNECTION_ID, }; explicit operator bool() const { return true; } bool operator==(const QUICTransportParameterId &x) const { return this->_id == x._id; } bool operator==(const uint16_t &x) const { return this->_id == x; } operator uint16_t() const { return _id; }; QUICTransportParameterId() : _id(0){}; QUICTransportParameterId(uint16_t id) : _id(id){}; private: uint16_t _id = 0; }; class QUICTransportParameters { public: QUICTransportParameters(const uint8_t *buf, size_t len, QUICVersion version); virtual ~QUICTransportParameters(); bool is_valid() const; const uint8_t *getAsBytes(QUICTransportParameterId id, uint16_t &len) const; uint64_t getAsUInt(QUICTransportParameterId id) const; bool contains(QUICTransportParameterId id) const; void set(QUICTransportParameterId id, const uint8_t *value, uint16_t value_len); void set(QUICTransportParameterId id, uint64_t value); void store(uint8_t *buf, uint16_t *len) const; protected: class Value { public: Value(const uint8_t *data, uint16_t len); ~Value(); const uint8_t *data() const; uint16_t len() const; private: uint8_t *_data = nullptr; uint16_t _len = 0; }; QUICTransportParameters(){}; void _load(const uint8_t *buf, size_t len, QUICVersion version); bool _valid = false; virtual std::ptrdiff_t _parameters_offset(const uint8_t *buf) const = 0; virtual int _validate_parameters(QUICVersion version) const; void _print() const; std::map<QUICTransportParameterId, Value *> _parameters; }; class QUICTransportParametersInClientHello : public QUICTransportParameters { public: QUICTransportParametersInClientHello() : QUICTransportParameters(){}; QUICTransportParametersInClientHello(const uint8_t *buf, size_t len, QUICVersion version); protected: std::ptrdiff_t _parameters_offset(const uint8_t *buf) const override; int _validate_parameters(QUICVersion version) const override; private: }; class QUICTransportParametersInEncryptedExtensions : public QUICTransportParameters { public: QUICTransportParametersInEncryptedExtensions() : QUICTransportParameters(){}; QUICTransportParametersInEncryptedExtensions(const uint8_t *buf, size_t len, QUICVersion version); protected: std::ptrdiff_t _parameters_offset(const uint8_t *buf) const override; int _validate_parameters(QUICVersion version) const override; };
1,400
362
<filename>whois-commons/src/main/java/net/ripe/db/whois/common/domain/IpRanges.java package net.ripe.db.whois.common.domain; import com.google.common.collect.Sets; import net.ripe.db.whois.common.ip.Interval; import net.ripe.db.whois.common.ip.IpInterval; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Set; @Component public class IpRanges { private static final Logger LOGGER = LoggerFactory.getLogger(IpRanges.class); private Set<Interval> trusted; private Set<Interval> loadbalancers; @Value("${ipranges.trusted}") public void setTrusted(final String... trusted) { this.trusted = getIntervals(trusted); LOGGER.info("Trusted ranges: {}", this.trusted); } public boolean isTrusted(final Interval ipResource) { return contains(ipResource, trusted); } @Value("${ipranges.loadbalancer}") public void setLoadbalancers(final String... loadbalancers) { this.loadbalancers = getIntervals(loadbalancers); LOGGER.info("Loadbalancer ranges: {}", this.loadbalancers); } public boolean isLoadbalancer(final Interval ipResource) { return contains(ipResource, loadbalancers); } private Set<Interval> getIntervals(String[] trusted) { final Set<Interval> ipResources = Sets.newLinkedHashSetWithExpectedSize(trusted.length); for (final String trustedRange : trusted) { ipResources.add(IpInterval.parse(trustedRange)); } return ipResources; } private boolean contains(Interval ipResource, Set<Interval> ipRanges) { for (final Interval resource : ipRanges) { if (resource.getClass().equals(ipResource.getClass()) && resource.contains(ipResource)) { return true; } } return false; } }
749
14,668
<gh_stars>1000+ // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/exo/wayland/zwp_text_input_manager.h" #include <text-input-extension-unstable-v1-server-protocol.h> #include <text-input-unstable-v1-server-protocol.h> #include <wayland-server-core.h> #include <wayland-server-protocol-core.h> #include <xkbcommon/xkbcommon.h> #include "base/memory/weak_ptr.h" #include "base/strings/string_piece.h" #include "base/strings/utf_offset_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/exo/display.h" #include "components/exo/text_input.h" #include "components/exo/wayland/serial_tracker.h" #include "components/exo/wayland/server_util.h" #include "components/exo/xkb_tracker.h" #include "ui/base/ime/utf_offset.h" #include "ui/events/event.h" #include "ui/events/keycodes/dom/keycode_converter.h" namespace exo { namespace wayland { namespace { //////////////////////////////////////////////////////////////////////////////// // text_input_v1 interface: class WaylandTextInputDelegate : public TextInput::Delegate { public: WaylandTextInputDelegate(wl_resource* text_input, const XkbTracker* xkb_tracker, SerialTracker* serial_tracker) : text_input_(text_input), xkb_tracker_(xkb_tracker), serial_tracker_(serial_tracker) {} ~WaylandTextInputDelegate() override = default; void set_surface(wl_resource* surface) { surface_ = surface; } void set_extended_text_input(wl_resource* extended_text_input) { extended_text_input_ = extended_text_input; } bool has_extended_text_input() const { return extended_text_input_; } base::WeakPtr<WaylandTextInputDelegate> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } private: wl_client* client() { return wl_resource_get_client(text_input_); } // TextInput::Delegate: void Activated() override { zwp_text_input_v1_send_enter(text_input_, surface_); wl_client_flush(client()); } void Deactivated() override { zwp_text_input_v1_send_leave(text_input_); wl_client_flush(client()); } void OnVirtualKeyboardVisibilityChanged(bool is_visible) override { zwp_text_input_v1_send_input_panel_state(text_input_, is_visible); wl_client_flush(client()); } void SetCompositionText(const ui::CompositionText& composition) override { SendPreeditStyle(composition.text, composition.ime_text_spans); std::vector<size_t> offsets = {composition.selection.start()}; const std::string utf8 = base::UTF16ToUTF8AndAdjustOffsets(composition.text, &offsets); if (offsets[0] != std::string::npos) zwp_text_input_v1_send_preedit_cursor(text_input_, offsets[0]); zwp_text_input_v1_send_preedit_string( text_input_, serial_tracker_->GetNextSerial(SerialTracker::EventType::OTHER_EVENT), utf8.c_str(), utf8.c_str()); wl_client_flush(client()); } void Commit(const std::u16string& text) override { zwp_text_input_v1_send_commit_string( text_input_, serial_tracker_->GetNextSerial(SerialTracker::EventType::OTHER_EVENT), base::UTF16ToUTF8(text).c_str()); wl_client_flush(client()); } void SetCursor(base::StringPiece16 surrounding_text, const gfx::Range& selection) override { std::vector<size_t> offsets{selection.start(), selection.end()}; base::UTF16ToUTF8AndAdjustOffsets(surrounding_text, &offsets); zwp_text_input_v1_send_cursor_position(text_input_, static_cast<uint32_t>(offsets[1]), static_cast<uint32_t>(offsets[0])); } void DeleteSurroundingText(base::StringPiece16 surrounding_text, const gfx::Range& range) override { std::vector<size_t> offsets{range.GetMin(), range.GetMax()}; base::UTF16ToUTF8AndAdjustOffsets(surrounding_text, &offsets); // Currently, the arguments are conflicting with spec. // However, the only client, Lacros, also interprets wrongly in the same // way so just fixing here could cause visible regression. // TODO(crbug.com/1227590): Fix the behavior with versioning. zwp_text_input_v1_send_delete_surrounding_text( text_input_, static_cast<uint32_t>(offsets[0]), static_cast<uint32_t>(offsets[1] - offsets[0])); } void SendKey(const ui::KeyEvent& event) override { uint32_t keysym = xkb_tracker_->GetKeysym( ui::KeycodeConverter::DomCodeToNativeKeycode(event.code())); bool pressed = (event.type() == ui::ET_KEY_PRESSED); // TODO(mukai): consolidate the definition of this modifiers_mask with other // similar ones in components/exo/keyboard.cc or arc_ime_service.cc. constexpr uint32_t modifiers_mask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | ui::EF_ALTGR_DOWN | ui::EF_MOD3_DOWN; // 1-bit shifts to adjust the bitpattern for the modifiers; see also // WaylandTextInputDelegate::SendModifiers(). uint32_t modifiers = (event.flags() & modifiers_mask) >> 1; zwp_text_input_v1_send_keysym( text_input_, TimeTicksToMilliseconds(event.time_stamp()), serial_tracker_->GetNextSerial(SerialTracker::EventType::OTHER_EVENT), keysym, pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, modifiers); wl_client_flush(client()); } void OnTextDirectionChanged(base::i18n::TextDirection direction) override { uint32_t wayland_direction = ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_AUTO; switch (direction) { case base::i18n::RIGHT_TO_LEFT: wayland_direction = ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_LTR; break; case base::i18n::LEFT_TO_RIGHT: wayland_direction = ZWP_TEXT_INPUT_V1_TEXT_DIRECTION_RTL; break; case base::i18n::UNKNOWN_DIRECTION: LOG(ERROR) << "Unrecognized direction: " << direction; } zwp_text_input_v1_send_text_direction( text_input_, serial_tracker_->GetNextSerial(SerialTracker::EventType::OTHER_EVENT), wayland_direction); } void SetCompositionFromExistingText( base::StringPiece16 surrounding_text, const gfx::Range& cursor, const gfx::Range& range, const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override { if (!extended_text_input_) return; uint32_t begin = range.GetMin(); uint32_t end = range.GetMax(); SendPreeditStyle(surrounding_text.substr(begin, range.length()), ui_ime_text_spans); std::vector<size_t> offsets = {begin, end, cursor.end()}; base::UTF16ToUTF8AndAdjustOffsets(surrounding_text, &offsets); int32_t index = static_cast<int32_t>(offsets[0]) - static_cast<int32_t>(offsets[2]); uint32_t length = static_cast<uint32_t>(offsets[1] - offsets[0]); zcr_extended_text_input_v1_send_set_preedit_region(extended_text_input_, index, length); wl_client_flush(client()); } void SendPreeditStyle(base::StringPiece16 text, const std::vector<ui::ImeTextSpan>& spans) { if (spans.empty()) return; // Convert all offsets from UTF16 to UTF8. std::vector<size_t> offsets; offsets.reserve(spans.size() * 2); for (const auto& span : spans) { auto minmax = std::minmax(span.start_offset, span.end_offset); offsets.push_back(minmax.first); offsets.push_back(minmax.second); } base::UTF16ToUTF8AndAdjustOffsets(text, &offsets); for (size_t i = 0; i < spans.size(); ++i) { if (offsets[i * 2] == std::string::npos || offsets[i * 2 + 1] == std::string::npos) { // Invalid span is specified. continue; } const auto& span = spans[i]; const uint32_t begin = offsets[i * 2]; const uint32_t end = offsets[i * 2 + 1]; uint32_t style = ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_DEFAULT; switch (span.type) { case ui::ImeTextSpan::Type::kComposition: if (span.thickness == ui::ImeTextSpan::Thickness::kThick) { style = ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT; } else { style = ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_UNDERLINE; } break; case ui::ImeTextSpan::Type::kSuggestion: style = ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_SELECTION; break; case ui::ImeTextSpan::Type::kMisspellingSuggestion: case ui::ImeTextSpan::Type::kAutocorrect: case ui::ImeTextSpan::Type::kGrammarSuggestion: style = ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INCORRECT; break; } zwp_text_input_v1_send_preedit_styling(text_input_, begin, end - begin, style); } } wl_resource* text_input_; wl_resource* extended_text_input_ = nullptr; wl_resource* surface_ = nullptr; // Owned by Seat, which is updated before calling the callbacks of this // class. const XkbTracker* const xkb_tracker_; // Owned by Server, which always outlives this delegate. SerialTracker* const serial_tracker_; base::WeakPtrFactory<WaylandTextInputDelegate> weak_factory_{this}; }; // Holds WeakPtr to WaylandTextInputDelegate, and the lifetime of this class's // instance is tied to zcr_extended_text_input connection. // If text_input connection is destroyed earlier than extended_text_input, // then delegate_ will return nullptr automatically. class WaylandExtendedTextInput { public: explicit WaylandExtendedTextInput( base::WeakPtr<WaylandTextInputDelegate> delegate) : delegate_(delegate) {} WaylandExtendedTextInput(const WaylandExtendedTextInput&) = delete; WaylandExtendedTextInput& operator=(const WaylandExtendedTextInput&) = delete; ~WaylandExtendedTextInput() { if (delegate_) delegate_->set_extended_text_input(nullptr); } private: base::WeakPtr<WaylandTextInputDelegate> delegate_; }; void text_input_activate(wl_client* client, wl_resource* resource, wl_resource* seat, wl_resource* surface_resource) { TextInput* text_input = GetUserDataAs<TextInput>(resource); Surface* surface = GetUserDataAs<Surface>(surface_resource); static_cast<WaylandTextInputDelegate*>(text_input->delegate()) ->set_surface(surface_resource); text_input->Activate(surface); // Sending modifiers. constexpr const char* kModifierNames[] = { XKB_MOD_NAME_SHIFT, XKB_MOD_NAME_CTRL, XKB_MOD_NAME_ALT, XKB_MOD_NAME_LOGO, "Mod5", "Mod3", }; wl_array modifiers; wl_array_init(&modifiers); for (const char* modifier : kModifierNames) { char* p = static_cast<char*>(wl_array_add(&modifiers, ::strlen(modifier) + 1)); ::strcpy(p, modifier); } zwp_text_input_v1_send_modifiers_map(resource, &modifiers); wl_array_release(&modifiers); } void text_input_deactivate(wl_client* client, wl_resource* resource, wl_resource* seat) { TextInput* text_input = GetUserDataAs<TextInput>(resource); text_input->Deactivate(); } void text_input_show_input_panel(wl_client* client, wl_resource* resource) { GetUserDataAs<TextInput>(resource)->ShowVirtualKeyboardIfEnabled(); } void text_input_hide_input_panel(wl_client* client, wl_resource* resource) { GetUserDataAs<TextInput>(resource)->HideVirtualKeyboard(); } void text_input_reset(wl_client* client, wl_resource* resource) { GetUserDataAs<TextInput>(resource)->Reset(); } void text_input_set_surrounding_text(wl_client* client, wl_resource* resource, const char* text, uint32_t cursor, uint32_t anchor) { TextInput* text_input = GetUserDataAs<TextInput>(resource); // TODO(crbug.com/1227590): Selection range should keep cursor/anchor // relationship. auto minmax = std::minmax(cursor, anchor); std::vector<size_t> offsets{minmax.first, minmax.second}; std::u16string u16_text = base::UTF8ToUTF16AndAdjustOffsets(text, &offsets); if (offsets[0] == std::u16string::npos || offsets[1] == std::u16string::npos) return; text_input->SetSurroundingText(u16_text, gfx::Range(offsets[0], offsets[1])); } void text_input_set_content_type(wl_client* client, wl_resource* resource, uint32_t hint, uint32_t purpose) { TextInput* text_input = GetUserDataAs<TextInput>(resource); ui::TextInputType type = ui::TEXT_INPUT_TYPE_TEXT; ui::TextInputMode mode = ui::TEXT_INPUT_MODE_DEFAULT; int flags = ui::TEXT_INPUT_FLAG_NONE; bool should_do_learning = true; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_COMPLETION) flags |= ui::TEXT_INPUT_FLAG_AUTOCOMPLETE_ON; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_CORRECTION) flags |= ui::TEXT_INPUT_FLAG_AUTOCORRECT_ON; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_AUTO_CAPITALIZATION) flags |= ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_SENTENCES; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_LOWERCASE) flags |= ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_NONE; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_UPPERCASE) flags |= ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_CHARACTERS; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_TITLECASE) flags |= ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_WORDS; if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_HIDDEN_TEXT) { flags |= ui::TEXT_INPUT_FLAG_AUTOCOMPLETE_OFF | ui::TEXT_INPUT_FLAG_AUTOCORRECT_OFF; } if (hint & ZWP_TEXT_INPUT_V1_CONTENT_HINT_SENSITIVE_DATA) should_do_learning = false; // Unused hints: LATIN, MULTILINE. switch (purpose) { case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DIGITS: mode = ui::TEXT_INPUT_MODE_DECIMAL; type = ui::TEXT_INPUT_TYPE_NUMBER; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NUMBER: mode = ui::TEXT_INPUT_MODE_NUMERIC; type = ui::TEXT_INPUT_TYPE_NUMBER; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_PHONE: mode = ui::TEXT_INPUT_MODE_TEL; type = ui::TEXT_INPUT_TYPE_TELEPHONE; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_URL: mode = ui::TEXT_INPUT_MODE_URL; type = ui::TEXT_INPUT_TYPE_URL; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_EMAIL: mode = ui::TEXT_INPUT_MODE_EMAIL; type = ui::TEXT_INPUT_TYPE_EMAIL; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_PASSWORD: DCHECK(!should_do_learning); type = ui::TEXT_INPUT_TYPE_PASSWORD; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DATE: type = ui::TEXT_INPUT_TYPE_DATE; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_TIME: type = ui::TEXT_INPUT_TYPE_TIME; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_DATETIME: type = ui::TEXT_INPUT_TYPE_DATE_TIME; break; case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NORMAL: case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_ALPHA: case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_NAME: case ZWP_TEXT_INPUT_V1_CONTENT_PURPOSE_TERMINAL: // No special type / mode are set. break; } text_input->SetTypeModeFlags(type, mode, flags, should_do_learning); } void text_input_set_cursor_rectangle(wl_client* client, wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height) { GetUserDataAs<TextInput>(resource)->SetCaretBounds( gfx::Rect(x, y, width, height)); } void text_input_set_preferred_language(wl_client* client, wl_resource* resource, const char* language) { // Nothing needs to be done. } void text_input_commit_state(wl_client* client, wl_resource* resource, uint32_t serial) { // Nothing needs to be done. } void text_input_invoke_action(wl_client* client, wl_resource* resource, uint32_t button, uint32_t index) { GetUserDataAs<TextInput>(resource)->Resync(); } constexpr struct zwp_text_input_v1_interface text_input_v1_implementation = { text_input_activate, text_input_deactivate, text_input_show_input_panel, text_input_hide_input_panel, text_input_reset, text_input_set_surrounding_text, text_input_set_content_type, text_input_set_cursor_rectangle, text_input_set_preferred_language, text_input_commit_state, text_input_invoke_action, }; //////////////////////////////////////////////////////////////////////////////// // text_input_manager_v1 interface: void text_input_manager_create_text_input(wl_client* client, wl_resource* resource, uint32_t id) { auto* data = GetUserDataAs<WaylandTextInputManager>(resource); wl_resource* text_input_resource = wl_resource_create(client, &zwp_text_input_v1_interface, 1, id); SetImplementation( text_input_resource, &text_input_v1_implementation, std::make_unique<TextInput>(std::make_unique<WaylandTextInputDelegate>( text_input_resource, data->xkb_tracker, data->serial_tracker))); } constexpr struct zwp_text_input_manager_v1_interface text_input_manager_implementation = { text_input_manager_create_text_input, }; //////////////////////////////////////////////////////////////////////////////// // extended_text_input_v1 interface: void extended_text_input_destroy(wl_client* client, wl_resource* resource) { wl_resource_destroy(resource); } constexpr struct zcr_extended_text_input_v1_interface extended_text_input_implementation = {extended_text_input_destroy}; //////////////////////////////////////////////////////////////////////////////// // text_input_extension_v1 interface: void text_input_extension_get_extended_text_input( wl_client* client, wl_resource* resource, uint32_t id, wl_resource* text_input_resource) { TextInput* text_input = GetUserDataAs<TextInput>(text_input_resource); auto* delegate = static_cast<WaylandTextInputDelegate*>(text_input->delegate()); if (delegate->has_extended_text_input()) { wl_resource_post_error( resource, ZCR_TEXT_INPUT_EXTENSION_V1_ERROR_EXTENDED_TEXT_INPUT_EXISTS, "text_input has already been associated with a extended_text_input " "object"); return; } uint32_t version = wl_resource_get_version(resource); wl_resource* extended_text_input_resource = wl_resource_create( client, &zcr_extended_text_input_v1_interface, version, id); delegate->set_extended_text_input(extended_text_input_resource); SetImplementation( extended_text_input_resource, &extended_text_input_implementation, std::make_unique<WaylandExtendedTextInput>(delegate->GetWeakPtr())); } constexpr struct zcr_text_input_extension_v1_interface text_input_extension_implementation = { text_input_extension_get_extended_text_input}; } // namespace void bind_text_input_manager(wl_client* client, void* data, uint32_t version, uint32_t id) { wl_resource* resource = wl_resource_create(client, &zwp_text_input_manager_v1_interface, 1, id); wl_resource_set_implementation(resource, &text_input_manager_implementation, data, nullptr); } void bind_text_input_extension(wl_client* client, void* data, uint32_t version, uint32_t id) { wl_resource* resource = wl_resource_create( client, &zcr_text_input_extension_v1_interface, version, id); wl_resource_set_implementation(resource, &text_input_extension_implementation, data, nullptr); } } // namespace wayland } // namespace exo
9,012
344
<filename>src/lac/tests/tst-lac.cpp<gh_stars>100-1000 /* * dynamatic array test program. * * @author hain * @email <EMAIL> */ #include "gtest/gtest.h" #include "glog/logging.h" #include <map> #include <list> #include <vector> #include <string> #include <sys/time.h> #include <iostream> #include "stdlib.h" #include "ilac.h" using namespace std; void* g_lac_handle = NULL; int max_result_num = 100; int init_dict(const char* conf_dir) { g_lac_handle = lac_create(conf_dir); std::cerr << "create lac handle successfully" << std::endl; return 0; } int destroy_dict() { lac_destroy(g_lac_handle); return 0; } TEST(LacTest, INIT) { LOG(INFO) << " init."; init_dict("../../../../var/test/lac/conf"); if (g_lac_handle == NULL) { std::cerr << "creat g_lac_handle error" << std::endl; } void* lac_buff = lac_buff_create(g_lac_handle); if (lac_buff == NULL) { std::cerr << "creat lac_buff error" << std::endl; } std::string line("9月2日开始,北京中小学正式开学。据介绍,公交集团将启用新版行车时刻表,在早晚高峰时段增发3500车次,便利市民集中出行。"); tag_t *results = new tag_t[max_result_num]; int result_num = lac_tagging(g_lac_handle, lac_buff, line.c_str(), results, max_result_num); if (result_num < 0) { std::cerr << "lac tagging failed : line = " << line << std::endl; } for (int i = 0; i < result_num; i++) { std::string name = line.substr(results[i].offset, results[i].length); if (i >= 1) { LOG(INFO) << "\t"; } LOG(INFO) << name << " " << results[i].type << " " << results[i].offset << " " << results[i].length; } }
837
839
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.cxf.binding.soap.jms.interceptor; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.namespace.QName; public class JMSFaultType { @XmlElement(name = "FaultCode", required = true) protected QName faultCode; @XmlAnyElement(lax = true) protected List<Object> any; @XmlAnyAttribute private Map<QName, String> otherAttributes = new HashMap<>(); /** * Gets the value of the faultCode property. * * @return possible object is {@link QName } */ public QName getFaultCode() { return faultCode; } /** * Sets the value of the faultCode property. * * @param value allowed object is {@link QName } */ public void setFaultCode(QName value) { this.faultCode = value; } public boolean isSetFaultCode() { return this.faultCode != null; } /** * Gets the value of the any property. * <p> * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification * you make to the returned list will be present inside the JAXB object. This is why there is not a * <CODE>set</CODE> method for the any property. * <p> * For example, to add a new item, do as follows: * * <pre> * getAny().add(newItem); * </pre> * <p> * Objects of the following type(s) are allowed in the list {@link Object } {@link Element } */ public List<Object> getAny() { if (any == null) { any = new ArrayList<>(); } return this.any; } public boolean isSetAny() { return (this.any != null) && (!this.any.isEmpty()); } public void unsetAny() { this.any = null; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * <p> * the map is keyed by the name of the attribute and the value is the string value of the attribute. the * map returned by this method is live, and you can add new attribute by updating the map directly. * Because of this design, there's no setter. * * @return always non-null */ public Map<QName, String> getOtherAttributes() { return otherAttributes; } }
1,141
1,844
/* * Copyright 2010-2013 Ning, Inc. * Copyright 2014-2015 Groupon, Inc * Copyright 2014-2015 The Billing Project, LLC * * The Billing Project licenses this file to you under the Apache License, version 2.0 * (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package org.killbill.billing.server.listeners; import java.io.IOException; import java.net.URISyntaxException; import javax.servlet.ServletContext; import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.server.filter.EncodingFilter; import org.killbill.billing.jaxrs.resources.JaxRsResourceBase; import org.killbill.billing.jaxrs.util.KillbillEventHandler; import org.killbill.billing.platform.api.KillbillConfigSource; import org.killbill.billing.platform.config.DefaultKillbillConfigSource; import org.killbill.billing.server.filters.Jersey1BackwardCompatibleFilter; import org.killbill.billing.server.filters.KillbillMDCInsertingServletFilter; import org.killbill.billing.server.filters.ProfilingContainerResponseFilter; import org.killbill.billing.server.filters.RequestDataFilter; import org.killbill.billing.server.filters.ResponseCorsFilter; import org.killbill.billing.server.modules.KillbillServerModule; import org.killbill.billing.server.notifications.PushNotificationListener; import org.killbill.billing.server.providers.KillbillExceptionListener; import org.killbill.billing.server.security.TenantFilter; import org.killbill.billing.util.nodes.KillbillVersions; import org.killbill.bus.api.PersistentBus; import org.killbill.commons.skeleton.modules.BaseServerModuleBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.helpers.MDCInsertingServletFilter; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.google.common.collect.ImmutableMap; import com.google.inject.Module; import com.google.inject.servlet.ServletModule; import io.swagger.jaxrs.config.BeanConfig; public class KillbillGuiceListener extends KillbillPlatformGuiceListener { private static final Logger logger = LoggerFactory.getLogger(KillbillGuiceListener.class); // See io.swagger.jaxrs.listing.ApiListingResource private static final String SWAGGER_PATH = "swagger.*"; private KillbillEventHandler killbilleventHandler; @Override protected ServletModule getServletModule() { // Don't filter all requests through Jersey, only the JAX-RS APIs (otherwise, // things like static resources, favicon, etc. are 404'ed) final BaseServerModuleBuilder builder = new BaseServerModuleBuilder().setJaxrsUriPattern("/" + SWAGGER_PATH + "|((/" + SWAGGER_PATH + "|" + JaxRsResourceBase.PREFIX + "|" + JaxRsResourceBase.PLUGINS_PATH + ")" + "/.*)") .addJerseyResourcePackage("org.killbill.billing.jaxrs.mappers") .addJerseyResourcePackage("org.killbill.billing.jaxrs.resources") // Swagger integration .addJerseyResourcePackage("io.swagger.jaxrs.listing"); // Jackson integration builder.addJerseyResourceClass(JacksonJsonProvider.class.getName()); // Set the per-thread RequestData first builder.addJerseyResourceClass(RequestDataFilter.class.getName()); // Logback default MDC builder.addFilter("/*", MDCInsertingServletFilter.class); // Kill Bill specific MDC builder.addJerseyResourceClass(KillbillMDCInsertingServletFilter.class.getName()); // Jersey 1 backward compatibility builder.addJerseyResourceClass(Jersey1BackwardCompatibleFilter.class.getName()); // Disable WADL builder.addJerseyParam("jersey.config.server.wadl.disableWadl", "true"); if (config.isConfiguredToReturnGZIPResponses()) { logger.info("Enable http gzip responses"); builder.addJerseyResourceClass(EncodingFilter.class.getName()); builder.addJerseyResourceClass(GZipEncoder.class.getName()); } builder.addJerseyResourceClass(ProfilingContainerResponseFilter.class.getName()); // Broader, to support the "Try it out!" feature //builder.addFilter("/" + SWAGGER_PATH + "*", ResponseCorsFilter.class); builder.addFilter("/*", ResponseCorsFilter.class); // Add TenantFilter right after if multi-tenancy has been configured. if (config.isMultiTenancyEnabled()) { builder.addFilter("/*", TenantFilter.class); } // We use Jersey's LoggingFeature -- this adds additional logging builder.addJerseyResourceClass(KillbillExceptionListener.class.getName()); return builder.build(); } @Override protected Module getModule(final ServletContext servletContext) { return new KillbillServerModule(servletContext, config, configSource); } @Override protected KillbillConfigSource getConfigSource() throws IOException, URISyntaxException { final ImmutableMap<String, String> defaultProperties = ImmutableMap.<String, String>of("org.killbill.server.updateCheck.url", "https://raw.github.com/killbill/killbill/master/profiles/killbill/src/main/resources/update-checker/killbill-server-update-list.properties"); return new DefaultKillbillConfigSource(defaultProperties); } @Override protected void startLifecycleStage2() { killbilleventHandler = injector.getInstance(KillbillEventHandler.class); // Perform Bus registration try { killbillBusService.getBus().register(killbilleventHandler); } catch (final PersistentBus.EventBusException e) { logger.error("Failed to register for event notifications, this is bad exiting!", e); System.exit(1); } } @Override protected void stopLifecycleStage2() { super.stopLifecycleStage2(); try { killbillBusService.getBus().unregister(killbilleventHandler); } catch (final PersistentBus.EventBusException e) { logger.warn("Failed to unregister for event notifications", e); } } @Override protected void startLifecycleStage3() { super.startLifecycleStage3(); final BeanConfig beanConfig = new BeanConfig(); beanConfig.setResourcePackage("org.killbill.billing.jaxrs.resources"); beanConfig.setTitle("Kill Bill"); beanConfig.setDescription("Kill Bill is an open-source billing and payments platform"); beanConfig.setContact("<EMAIL>"); beanConfig.setLicense("Apache License, Version 2.0"); beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html"); beanConfig.setVersion(KillbillVersions.getKillbillVersion()); beanConfig.setScan(true); } @Override protected void stopLifecycleStage3() { super.stopLifecycleStage3(); final PushNotificationListener pushNotificationListener = injector.getInstance(PushNotificationListener.class); try { pushNotificationListener.shutdown(); } catch (final IOException e) { logger.warn("Failed close the push notifications client", e); } } }
2,988
31,545
<filename>test/cmake_target_include_directories/project/Bar.hpp #include <nlohmann/json.hpp> #include "Foo.hpp" class Bar : public Foo{};
54
1,980
<filename>builder/index/src/main/java/proto/PoseidonIf.java // Generated by the protocol buffer compiler. DO NOT EDIT! // source: poseidon_if.proto package proto; public final class PoseidonIf { private PoseidonIf() { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } public interface DocGzMetaOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.DocGzMeta) com.google.protobuf.MessageOrBuilder { /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ java.lang.String getPath(); /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ com.google.protobuf.ByteString getPathBytes(); /** * <code>optional uint64 offset = 2;</code> * <p> * <pre> * 数据起始偏移量 * </pre> */ long getOffset(); /** * <code>optional uint32 length = 3;</code> * <p> * <pre> * 数据长度 * </pre> */ int getLength(); } /** * Protobuf type {@code proto.DocGzMeta} * <p> * <pre> * 原始数据按照gz压缩文件格式存放在hdfs中 * 每128行原始数据合在一起称为一个 Document(文档) * 一个hdfs文件按照2GB大小计算,大约可以容纳 10w 个压缩后的 Document * 我们用 DocGzMeta 结构来描述文档相关的元数据信息 * </pre> */ public static final class DocGzMeta extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.DocGzMeta) DocGzMetaOrBuilder { // Use DocGzMeta.newBuilder() to construct. private DocGzMeta(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private DocGzMeta() { path_ = ""; offset_ = 0L; length_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private DocGzMeta( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { java.lang.String s = input.readStringRequireUtf8(); path_ = s; break; } case 16: { offset_ = input.readUInt64(); break; } case 24: { length_ = input.readUInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocGzMeta_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocGzMeta_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocGzMeta.class, proto.PoseidonIf.DocGzMeta.Builder.class); } public static final int PATH_FIELD_NUMBER = 1; private volatile java.lang.Object path_; /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } } /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int OFFSET_FIELD_NUMBER = 2; private long offset_; /** * <code>optional uint64 offset = 2;</code> * <p> * <pre> * 数据起始偏移量 * </pre> */ public long getOffset() { return offset_; } public static final int LENGTH_FIELD_NUMBER = 3; private int length_; /** * <code>optional uint32 length = 3;</code> * <p> * <pre> * 数据长度 * </pre> */ public int getLength() { return length_; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getPathBytes().isEmpty()) { com.google.protobuf.GeneratedMessage.writeString(output, 1, path_); } if (offset_ != 0L) { output.writeUInt64(2, offset_); } if (length_ != 0) { output.writeUInt32(3, length_); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getPathBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessage.computeStringSize(1, path_); } if (offset_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(2, offset_); } if (length_ != 0) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(3, length_); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.DocGzMeta parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocGzMeta parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocGzMeta parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocGzMeta parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocGzMeta parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocGzMeta parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocGzMeta parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.DocGzMeta parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocGzMeta parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocGzMeta parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.DocGzMeta prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.DocGzMeta} * <p> * <pre> * 原始数据按照gz压缩文件格式存放在hdfs中 * 每128行原始数据合在一起称为一个 Document(文档) * 一个hdfs文件按照2GB大小计算,大约可以容纳 10w 个压缩后的 Document * 我们用 DocGzMeta 结构来描述文档相关的元数据信息 * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.DocGzMeta) proto.PoseidonIf.DocGzMetaOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocGzMeta_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocGzMeta_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocGzMeta.class, proto.PoseidonIf.DocGzMeta.Builder.class); } // Construct using proto.PoseidonIf.DocGzMeta.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); path_ = ""; offset_ = 0L; length_ = 0; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_DocGzMeta_descriptor; } public proto.PoseidonIf.DocGzMeta getDefaultInstanceForType() { return proto.PoseidonIf.DocGzMeta.getDefaultInstance(); } public proto.PoseidonIf.DocGzMeta build() { proto.PoseidonIf.DocGzMeta result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.DocGzMeta buildPartial() { proto.PoseidonIf.DocGzMeta result = new proto.PoseidonIf.DocGzMeta(this); result.path_ = path_; result.offset_ = offset_; result.length_ = length_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.DocGzMeta) { return mergeFrom((proto.PoseidonIf.DocGzMeta) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.DocGzMeta other) { if (other == proto.PoseidonIf.DocGzMeta.getDefaultInstance()) return this; if (!other.getPath().isEmpty()) { path_ = other.path_; onChanged(); } if (other.getOffset() != 0L) { setOffset(other.getOffset()); } if (other.getLength() != 0) { setLength(other.getLength()); } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.DocGzMeta parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.DocGzMeta) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object path_ = ""; /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public Builder setPath( java.lang.String value) { if (value == null) { throw new NullPointerException(); } path_ = value; onChanged(); return this; } /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public Builder clearPath() { path_ = getDefaultInstance().getPath(); onChanged(); return this; } /** * <code>optional string path = 1;</code> * <p> * <pre> * HDFS路径,例如:/the/path/to/log/business/2014-04-22/00/log1.zwt.2014-04-22-00-17.gz, 实际离线存储的时候会做一定的压缩,例如不存储公共前缀。 * </pre> */ public Builder setPathBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); path_ = value; onChanged(); return this; } private long offset_; /** * <code>optional uint64 offset = 2;</code> * <p> * <pre> * 数据起始偏移量 * </pre> */ public long getOffset() { return offset_; } /** * <code>optional uint64 offset = 2;</code> * <p> * <pre> * 数据起始偏移量 * </pre> */ public Builder setOffset(long value) { offset_ = value; onChanged(); return this; } /** * <code>optional uint64 offset = 2;</code> * <p> * <pre> * 数据起始偏移量 * </pre> */ public Builder clearOffset() { offset_ = 0L; onChanged(); return this; } private int length_; /** * <code>optional uint32 length = 3;</code> * <p> * <pre> * 数据长度 * </pre> */ public int getLength() { return length_; } /** * <code>optional uint32 length = 3;</code> * <p> * <pre> * 数据长度 * </pre> */ public Builder setLength(int value) { length_ = value; onChanged(); return this; } /** * <code>optional uint32 length = 3;</code> * <p> * <pre> * 数据长度 * </pre> */ public Builder clearLength() { length_ = 0; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.DocGzMeta) } // @@protoc_insertion_point(class_scope:proto.DocGzMeta) private static final proto.PoseidonIf.DocGzMeta DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.DocGzMeta(); } public static proto.PoseidonIf.DocGzMeta getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DocGzMeta> PARSER = new com.google.protobuf.AbstractParser<DocGzMeta>() { public DocGzMeta parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new DocGzMeta(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<DocGzMeta> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DocGzMeta> getParserForType() { return PARSER; } public proto.PoseidonIf.DocGzMeta getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface DocIdOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.DocId) com.google.protobuf.MessageOrBuilder { /** * <code>optional uint64 docId = 1;</code> * <p> * <pre> * Document ID * </pre> */ long getDocId(); /** * <code>optional uint32 rowIndex = 2;</code> * <p> * <pre> * 在文档中的行号,从0开始编号 * </pre> */ int getRowIndex(); } /** * Protobuf type {@code proto.DocId} */ public static final class DocId extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.DocId) DocIdOrBuilder { // Use DocId.newBuilder() to construct. private DocId(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private DocId() { docId_ = 0L; rowIndex_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private DocId( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 8: { docId_ = input.readUInt64(); break; } case 16: { rowIndex_ = input.readUInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocId_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocId_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocId.class, proto.PoseidonIf.DocId.Builder.class); } public static final int DOCID_FIELD_NUMBER = 1; private long docId_; /** * <code>optional uint64 docId = 1;</code> * <p> * <pre> * Document ID * </pre> */ public long getDocId() { return docId_; } public static final int ROWINDEX_FIELD_NUMBER = 2; private int rowIndex_; /** * <code>optional uint32 rowIndex = 2;</code> * <p> * <pre> * 在文档中的行号,从0开始编号 * </pre> */ public int getRowIndex() { return rowIndex_; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (docId_ != 0L) { output.writeUInt64(1, docId_); } if (rowIndex_ != 0) { output.writeUInt32(2, rowIndex_); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (docId_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(1, docId_); } if (rowIndex_ != 0) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, rowIndex_); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.DocId parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocId parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocId parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocId parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocId parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocId parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocId parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.DocId parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocId parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocId parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.DocId prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.DocId} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.DocId) proto.PoseidonIf.DocIdOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocId_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocId_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocId.class, proto.PoseidonIf.DocId.Builder.class); } // Construct using proto.PoseidonIf.DocId.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); docId_ = 0L; rowIndex_ = 0; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_DocId_descriptor; } public proto.PoseidonIf.DocId getDefaultInstanceForType() { return proto.PoseidonIf.DocId.getDefaultInstance(); } public proto.PoseidonIf.DocId build() { proto.PoseidonIf.DocId result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.DocId buildPartial() { proto.PoseidonIf.DocId result = new proto.PoseidonIf.DocId(this); result.docId_ = docId_; result.rowIndex_ = rowIndex_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.DocId) { return mergeFrom((proto.PoseidonIf.DocId) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.DocId other) { if (other == proto.PoseidonIf.DocId.getDefaultInstance()) return this; if (other.getDocId() != 0L) { setDocId(other.getDocId()); } if (other.getRowIndex() != 0) { setRowIndex(other.getRowIndex()); } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.DocId parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.DocId) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private long docId_; /** * <code>optional uint64 docId = 1;</code> * <p> * <pre> * Document ID * </pre> */ public long getDocId() { return docId_; } /** * <code>optional uint64 docId = 1;</code> * <p> * <pre> * Document ID * </pre> */ public Builder setDocId(long value) { docId_ = value; onChanged(); return this; } /** * <code>optional uint64 docId = 1;</code> * <p> * <pre> * Document ID * </pre> */ public Builder clearDocId() { docId_ = 0L; onChanged(); return this; } private int rowIndex_; /** * <code>optional uint32 rowIndex = 2;</code> * <p> * <pre> * 在文档中的行号,从0开始编号 * </pre> */ public int getRowIndex() { return rowIndex_; } /** * <code>optional uint32 rowIndex = 2;</code> * <p> * <pre> * 在文档中的行号,从0开始编号 * </pre> */ public Builder setRowIndex(int value) { rowIndex_ = value; onChanged(); return this; } /** * <code>optional uint32 rowIndex = 2;</code> * <p> * <pre> * 在文档中的行号,从0开始编号 * </pre> */ public Builder clearRowIndex() { rowIndex_ = 0; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.DocId) } // @@protoc_insertion_point(class_scope:proto.DocId) private static final proto.PoseidonIf.DocId DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.DocId(); } public static proto.PoseidonIf.DocId getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DocId> PARSER = new com.google.protobuf.AbstractParser<DocId>() { public DocId parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new DocId(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<DocId> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DocId> getParserForType() { return PARSER; } public proto.PoseidonIf.DocId getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface DocIdListOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.DocIdList) com.google.protobuf.MessageOrBuilder { /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ java.util.List<proto.PoseidonIf.DocId> getDocIdsList(); /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ proto.PoseidonIf.DocId getDocIds(int index); /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ int getDocIdsCount(); /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ java.util.List<? extends proto.PoseidonIf.DocIdOrBuilder> getDocIdsOrBuilderList(); /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ proto.PoseidonIf.DocIdOrBuilder getDocIdsOrBuilder( int index); } /** * Protobuf type {@code proto.DocIdList} * <p> * <pre> * 一个分词可能会出现多个文档中,由于每个文档有多行原始数据组成 * 每个关联数据需要 docId、rawIndex 两个信息来描述 * </pre> */ public static final class DocIdList extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.DocIdList) DocIdListOrBuilder { // Use DocIdList.newBuilder() to construct. private DocIdList(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private DocIdList() { docIds_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private DocIdList( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { docIds_ = new java.util.ArrayList<proto.PoseidonIf.DocId>(); mutable_bitField0_ |= 0x00000001; } docIds_.add(input.readMessage(proto.PoseidonIf.DocId.parser(), extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { docIds_ = java.util.Collections.unmodifiableList(docIds_); } makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocIdList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocIdList_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocIdList.class, proto.PoseidonIf.DocIdList.Builder.class); } public static final int DOCIDS_FIELD_NUMBER = 1; private java.util.List<proto.PoseidonIf.DocId> docIds_; /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public java.util.List<proto.PoseidonIf.DocId> getDocIdsList() { return docIds_; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public java.util.List<? extends proto.PoseidonIf.DocIdOrBuilder> getDocIdsOrBuilderList() { return docIds_; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public int getDocIdsCount() { return docIds_.size(); } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocId getDocIds(int index) { return docIds_.get(index); } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocIdOrBuilder getDocIdsOrBuilder( int index) { return docIds_.get(index); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < docIds_.size(); i++) { output.writeMessage(1, docIds_.get(i)); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < docIds_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, docIds_.get(i)); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.DocIdList parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocIdList parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocIdList parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.DocIdList parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.DocIdList parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocIdList parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocIdList parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.DocIdList parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.DocIdList parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.DocIdList parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.DocIdList prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.DocIdList} * <p> * <pre> * 一个分词可能会出现多个文档中,由于每个文档有多行原始数据组成 * 每个关联数据需要 docId、rawIndex 两个信息来描述 * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.DocIdList) proto.PoseidonIf.DocIdListOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_DocIdList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_DocIdList_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.DocIdList.class, proto.PoseidonIf.DocIdList.Builder.class); } // Construct using proto.PoseidonIf.DocIdList.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getDocIdsFieldBuilder(); } } public Builder clear() { super.clear(); if (docIdsBuilder_ == null) { docIds_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { docIdsBuilder_.clear(); } return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_DocIdList_descriptor; } public proto.PoseidonIf.DocIdList getDefaultInstanceForType() { return proto.PoseidonIf.DocIdList.getDefaultInstance(); } public proto.PoseidonIf.DocIdList build() { proto.PoseidonIf.DocIdList result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.DocIdList buildPartial() { proto.PoseidonIf.DocIdList result = new proto.PoseidonIf.DocIdList(this); int from_bitField0_ = bitField0_; if (docIdsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { docIds_ = java.util.Collections.unmodifiableList(docIds_); bitField0_ = (bitField0_ & ~0x00000001); } result.docIds_ = docIds_; } else { result.docIds_ = docIdsBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.DocIdList) { return mergeFrom((proto.PoseidonIf.DocIdList) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.DocIdList other) { if (other == proto.PoseidonIf.DocIdList.getDefaultInstance()) return this; if (docIdsBuilder_ == null) { if (!other.docIds_.isEmpty()) { if (docIds_.isEmpty()) { docIds_ = other.docIds_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureDocIdsIsMutable(); docIds_.addAll(other.docIds_); } onChanged(); } } else { if (!other.docIds_.isEmpty()) { if (docIdsBuilder_.isEmpty()) { docIdsBuilder_.dispose(); docIdsBuilder_ = null; docIds_ = other.docIds_; bitField0_ = (bitField0_ & ~0x00000001); docIdsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getDocIdsFieldBuilder() : null; } else { docIdsBuilder_.addAllMessages(other.docIds_); } } } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.DocIdList parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.DocIdList) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<proto.PoseidonIf.DocId> docIds_ = java.util.Collections.emptyList(); private void ensureDocIdsIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { docIds_ = new java.util.ArrayList<proto.PoseidonIf.DocId>(docIds_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< proto.PoseidonIf.DocId, proto.PoseidonIf.DocId.Builder, proto.PoseidonIf.DocIdOrBuilder> docIdsBuilder_; /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public java.util.List<proto.PoseidonIf.DocId> getDocIdsList() { if (docIdsBuilder_ == null) { return java.util.Collections.unmodifiableList(docIds_); } else { return docIdsBuilder_.getMessageList(); } } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public int getDocIdsCount() { if (docIdsBuilder_ == null) { return docIds_.size(); } else { return docIdsBuilder_.getCount(); } } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocId getDocIds(int index) { if (docIdsBuilder_ == null) { return docIds_.get(index); } else { return docIdsBuilder_.getMessage(index); } } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder setDocIds( int index, proto.PoseidonIf.DocId value) { if (docIdsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDocIdsIsMutable(); docIds_.set(index, value); onChanged(); } else { docIdsBuilder_.setMessage(index, value); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder setDocIds( int index, proto.PoseidonIf.DocId.Builder builderForValue) { if (docIdsBuilder_ == null) { ensureDocIdsIsMutable(); docIds_.set(index, builderForValue.build()); onChanged(); } else { docIdsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder addDocIds(proto.PoseidonIf.DocId value) { if (docIdsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDocIdsIsMutable(); docIds_.add(value); onChanged(); } else { docIdsBuilder_.addMessage(value); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder addDocIds( int index, proto.PoseidonIf.DocId value) { if (docIdsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDocIdsIsMutable(); docIds_.add(index, value); onChanged(); } else { docIdsBuilder_.addMessage(index, value); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder addDocIds( proto.PoseidonIf.DocId.Builder builderForValue) { if (docIdsBuilder_ == null) { ensureDocIdsIsMutable(); docIds_.add(builderForValue.build()); onChanged(); } else { docIdsBuilder_.addMessage(builderForValue.build()); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder addDocIds( int index, proto.PoseidonIf.DocId.Builder builderForValue) { if (docIdsBuilder_ == null) { ensureDocIdsIsMutable(); docIds_.add(index, builderForValue.build()); onChanged(); } else { docIdsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder addAllDocIds( java.lang.Iterable<? extends proto.PoseidonIf.DocId> values) { if (docIdsBuilder_ == null) { ensureDocIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, docIds_); onChanged(); } else { docIdsBuilder_.addAllMessages(values); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder clearDocIds() { if (docIdsBuilder_ == null) { docIds_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { docIdsBuilder_.clear(); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public Builder removeDocIds(int index) { if (docIdsBuilder_ == null) { ensureDocIdsIsMutable(); docIds_.remove(index); onChanged(); } else { docIdsBuilder_.remove(index); } return this; } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocId.Builder getDocIdsBuilder( int index) { return getDocIdsFieldBuilder().getBuilder(index); } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocIdOrBuilder getDocIdsOrBuilder( int index) { if (docIdsBuilder_ == null) { return docIds_.get(index); } else { return docIdsBuilder_.getMessageOrBuilder(index); } } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public java.util.List<? extends proto.PoseidonIf.DocIdOrBuilder> getDocIdsOrBuilderList() { if (docIdsBuilder_ != null) { return docIdsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(docIds_); } } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocId.Builder addDocIdsBuilder() { return getDocIdsFieldBuilder().addBuilder( proto.PoseidonIf.DocId.getDefaultInstance()); } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public proto.PoseidonIf.DocId.Builder addDocIdsBuilder( int index) { return getDocIdsFieldBuilder().addBuilder( index, proto.PoseidonIf.DocId.getDefaultInstance()); } /** * <code>repeated .proto.DocId docIds = 1;</code> * <p> * <pre> * 该分词所关联的 Document ID。按照 docId 升序排列 * 为了方便 protobuf 的 varint 压缩存储,采用差分数据来存储 * 差分数据:后一个数据的存储值等于它的原始值减去前一个数据的原始值 * 举例如下: * 假如原始 docId 列表为:1,3,4,7,9,115,120,121,226 * 那么实际存储的数据为: 1,2,1,3,2,106,6,1,105 * </pre> */ public java.util.List<proto.PoseidonIf.DocId.Builder> getDocIdsBuilderList() { return getDocIdsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< proto.PoseidonIf.DocId, proto.PoseidonIf.DocId.Builder, proto.PoseidonIf.DocIdOrBuilder> getDocIdsFieldBuilder() { if (docIdsBuilder_ == null) { docIdsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< proto.PoseidonIf.DocId, proto.PoseidonIf.DocId.Builder, proto.PoseidonIf.DocIdOrBuilder>( docIds_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); docIds_ = null; } return docIdsBuilder_; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.DocIdList) } // @@protoc_insertion_point(class_scope:proto.DocIdList) private static final proto.PoseidonIf.DocIdList DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.DocIdList(); } public static proto.PoseidonIf.DocIdList getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DocIdList> PARSER = new com.google.protobuf.AbstractParser<DocIdList>() { public DocIdList parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new DocIdList(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<DocIdList> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DocIdList> getParserForType() { return PARSER; } public proto.PoseidonIf.DocIdList getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface FastPForCompressedDocIdListOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.FastPForCompressedDocIdList) com.google.protobuf.MessageOrBuilder { /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ java.util.List<java.lang.Long> getDocListList(); /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ int getDocListCount(); /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ long getDocList(int index); /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ java.util.List<java.lang.Integer> getRowListList(); /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ int getRowListCount(); /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ int getRowList(int index); } /** * Protobuf type {@code proto.FastPForCompressedDocIdList} * <p> * <pre> * 压缩的docIdList, 使用FastPFOR算法压缩,两个数组解压后等长 * </pre> */ public static final class FastPForCompressedDocIdList extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.FastPForCompressedDocIdList) FastPForCompressedDocIdListOrBuilder { // Use FastPForCompressedDocIdList.newBuilder() to construct. private FastPForCompressedDocIdList(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private FastPForCompressedDocIdList() { docList_ = java.util.Collections.emptyList(); rowList_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private FastPForCompressedDocIdList( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 8: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { docList_ = new java.util.ArrayList<java.lang.Long>(); mutable_bitField0_ |= 0x00000001; } docList_.add(input.readUInt64()); break; } case 10: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) { docList_ = new java.util.ArrayList<java.lang.Long>(); mutable_bitField0_ |= 0x00000001; } while (input.getBytesUntilLimit() > 0) { docList_.add(input.readUInt64()); } input.popLimit(limit); break; } case 16: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { rowList_ = new java.util.ArrayList<java.lang.Integer>(); mutable_bitField0_ |= 0x00000002; } rowList_.add(input.readUInt32()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { rowList_ = new java.util.ArrayList<java.lang.Integer>(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { rowList_.add(input.readUInt32()); } input.popLimit(limit); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { docList_ = java.util.Collections.unmodifiableList(docList_); } if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { rowList_ = java.util.Collections.unmodifiableList(rowList_); } makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedDocIdList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedDocIdList_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.FastPForCompressedDocIdList.class, proto.PoseidonIf.FastPForCompressedDocIdList.Builder.class); } public static final int DOCLIST_FIELD_NUMBER = 1; private java.util.List<java.lang.Long> docList_; /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public java.util.List<java.lang.Long> getDocListList() { return docList_; } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public int getDocListCount() { return docList_.size(); } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public long getDocList(int index) { return docList_.get(index); } private int docListMemoizedSerializedSize = -1; public static final int ROWLIST_FIELD_NUMBER = 2; private java.util.List<java.lang.Integer> rowList_; /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public java.util.List<java.lang.Integer> getRowListList() { return rowList_; } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public int getRowListCount() { return rowList_.size(); } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public int getRowList(int index) { return rowList_.get(index); } private int rowListMemoizedSerializedSize = -1; private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (getDocListList().size() > 0) { output.writeRawVarint32(10); output.writeRawVarint32(docListMemoizedSerializedSize); } for (int i = 0; i < docList_.size(); i++) { output.writeUInt64NoTag(docList_.get(i)); } if (getRowListList().size() > 0) { output.writeRawVarint32(18); output.writeRawVarint32(rowListMemoizedSerializedSize); } for (int i = 0; i < rowList_.size(); i++) { output.writeUInt32NoTag(rowList_.get(i)); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; { int dataSize = 0; for (int i = 0; i < docList_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeUInt64SizeNoTag(docList_.get(i)); } size += dataSize; if (!getDocListList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(dataSize); } docListMemoizedSerializedSize = dataSize; } { int dataSize = 0; for (int i = 0; i < rowList_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeUInt32SizeNoTag(rowList_.get(i)); } size += dataSize; if (!getRowListList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(dataSize); } rowListMemoizedSerializedSize = dataSize; } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.FastPForCompressedDocIdList parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.FastPForCompressedDocIdList prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.FastPForCompressedDocIdList} * <p> * <pre> * 压缩的docIdList, 使用FastPFOR算法压缩,两个数组解压后等长 * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.FastPForCompressedDocIdList) proto.PoseidonIf.FastPForCompressedDocIdListOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedDocIdList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedDocIdList_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.FastPForCompressedDocIdList.class, proto.PoseidonIf.FastPForCompressedDocIdList.Builder.class); } // Construct using proto.PoseidonIf.FastPForCompressedDocIdList.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); docList_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); rowList_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedDocIdList_descriptor; } public proto.PoseidonIf.FastPForCompressedDocIdList getDefaultInstanceForType() { return proto.PoseidonIf.FastPForCompressedDocIdList.getDefaultInstance(); } public proto.PoseidonIf.FastPForCompressedDocIdList build() { proto.PoseidonIf.FastPForCompressedDocIdList result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.FastPForCompressedDocIdList buildPartial() { proto.PoseidonIf.FastPForCompressedDocIdList result = new proto.PoseidonIf.FastPForCompressedDocIdList(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { docList_ = java.util.Collections.unmodifiableList(docList_); bitField0_ = (bitField0_ & ~0x00000001); } result.docList_ = docList_; if (((bitField0_ & 0x00000002) == 0x00000002)) { rowList_ = java.util.Collections.unmodifiableList(rowList_); bitField0_ = (bitField0_ & ~0x00000002); } result.rowList_ = rowList_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.FastPForCompressedDocIdList) { return mergeFrom((proto.PoseidonIf.FastPForCompressedDocIdList) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.FastPForCompressedDocIdList other) { if (other == proto.PoseidonIf.FastPForCompressedDocIdList.getDefaultInstance()) return this; if (!other.docList_.isEmpty()) { if (docList_.isEmpty()) { docList_ = other.docList_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureDocListIsMutable(); docList_.addAll(other.docList_); } onChanged(); } if (!other.rowList_.isEmpty()) { if (rowList_.isEmpty()) { rowList_ = other.rowList_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureRowListIsMutable(); rowList_.addAll(other.rowList_); } onChanged(); } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.FastPForCompressedDocIdList parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.FastPForCompressedDocIdList) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<java.lang.Long> docList_ = java.util.Collections.emptyList(); private void ensureDocListIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { docList_ = new java.util.ArrayList<java.lang.Long>(docList_); bitField0_ |= 0x00000001; } } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public java.util.List<java.lang.Long> getDocListList() { return java.util.Collections.unmodifiableList(docList_); } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public int getDocListCount() { return docList_.size(); } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public long getDocList(int index) { return docList_.get(index); } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public Builder setDocList( int index, long value) { ensureDocListIsMutable(); docList_.set(index, value); onChanged(); return this; } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public Builder addDocList(long value) { ensureDocListIsMutable(); docList_.add(value); onChanged(); return this; } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public Builder addAllDocList( java.lang.Iterable<? extends java.lang.Long> values) { ensureDocListIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, docList_); onChanged(); return this; } /** * <code>repeated uint64 docList = 1;</code> * <p> * <pre> * 压缩的 doc id 列表 * </pre> */ public Builder clearDocList() { docList_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } private java.util.List<java.lang.Integer> rowList_ = java.util.Collections.emptyList(); private void ensureRowListIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { rowList_ = new java.util.ArrayList<java.lang.Integer>(rowList_); bitField0_ |= 0x00000002; } } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public java.util.List<java.lang.Integer> getRowListList() { return java.util.Collections.unmodifiableList(rowList_); } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public int getRowListCount() { return rowList_.size(); } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public int getRowList(int index) { return rowList_.get(index); } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public Builder setRowList( int index, int value) { ensureRowListIsMutable(); rowList_.set(index, value); onChanged(); return this; } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public Builder addRowList(int value) { ensureRowListIsMutable(); rowList_.add(value); onChanged(); return this; } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public Builder addAllRowList( java.lang.Iterable<? extends java.lang.Integer> values) { ensureRowListIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, rowList_); onChanged(); return this; } /** * <code>repeated uint32 rowList = 2;</code> * <p> * <pre> * 压缩的 row index 列表 * </pre> */ public Builder clearRowList() { rowList_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.FastPForCompressedDocIdList) } // @@protoc_insertion_point(class_scope:proto.FastPForCompressedDocIdList) private static final proto.PoseidonIf.FastPForCompressedDocIdList DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.FastPForCompressedDocIdList(); } public static proto.PoseidonIf.FastPForCompressedDocIdList getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<FastPForCompressedDocIdList> PARSER = new com.google.protobuf.AbstractParser<FastPForCompressedDocIdList>() { public FastPForCompressedDocIdList parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new FastPForCompressedDocIdList(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<FastPForCompressedDocIdList> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<FastPForCompressedDocIdList> getParserForType() { return PARSER; } public proto.PoseidonIf.FastPForCompressedDocIdList getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface InvertedIndexOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.InvertedIndex) com.google.protobuf.MessageOrBuilder { /** * <code>map&lt;string, .proto.DocIdList&gt; index = 1;</code> */ java.util.Map<java.lang.String, proto.PoseidonIf.DocIdList> getIndex(); } /** * Protobuf type {@code proto.InvertedIndex} * <p> * <pre> * Token-&gt;DocIds 倒排索引表结构。这个索引数据压缩后最终每天需要占用2TB空间。 * hashid=hash64(token)%100亿,重复(冲突)不影响 * 直接在hdfs上进行分词,中间数据文件(按照hashid排序,总共100亿行):hashid token list&lt;DocId&gt; * 索引文件创建过程: * N := 200 取N=200,每200个左右的分词组建一个InvertedIndex对象 * for i := 0; ; i++ { * 1. 取 hashid 在 [ i*N,(i+1)*N ) 这个区间中的分词及其DocId列表 * 2. 生成一个 InvertedIndex 对象,序列化,gz压缩,追加到hdfs文件中 * 3. 记录下四元组: &lt;hdfspath, i, offset, length&gt; * } * 上述第3步中记录的四元组中 hdfspath、hashid 两个字段可以根据规则推测出来,因此只需要记录offset、length即可 * 总共需要记录 5000w (=总分词数/N) 条数,每个8字节,总计需要400M,这个文件可以存放在hdfs中,加载的时候可以加载到缓存中(NoSQL) * </pre> */ public static final class InvertedIndex extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.InvertedIndex) InvertedIndexOrBuilder { // Use InvertedIndex.newBuilder() to construct. private InvertedIndex(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private InvertedIndex() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private InvertedIndex( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000001; } com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.DocIdList> index = input.readMessage( IndexDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); index_.getMutableMap().put(index.getKey(), index.getValue()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_InvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_InvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.InvertedIndex.class, proto.PoseidonIf.InvertedIndex.Builder.class); } public static final int INDEX_FIELD_NUMBER = 1; private static final class IndexDefaultEntryHolder { static final com.google.protobuf.MapEntry< java.lang.String, proto.PoseidonIf.DocIdList> defaultEntry = com.google.protobuf.MapEntry .<java.lang.String, proto.PoseidonIf.DocIdList>newDefaultInstance( proto.PoseidonIf.internal_static_proto_InvertedIndex_IndexEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.MESSAGE, proto.PoseidonIf.DocIdList.getDefaultInstance()); } private com.google.protobuf.MapField< java.lang.String, proto.PoseidonIf.DocIdList> index_; private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.DocIdList> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } /** * <code>map&lt;string, .proto.DocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.DocIdList> getIndex() { return internalGetIndex().getMap(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (java.util.Map.Entry<java.lang.String, proto.PoseidonIf.DocIdList> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.DocIdList> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); output.writeMessage(1, index); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (java.util.Map.Entry<java.lang.String, proto.PoseidonIf.DocIdList> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.DocIdList> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, index); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.InvertedIndex parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.InvertedIndex parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.InvertedIndex parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.InvertedIndex parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.InvertedIndex parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.InvertedIndex parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.InvertedIndex parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.InvertedIndex parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.InvertedIndex parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.InvertedIndex parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.InvertedIndex prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.InvertedIndex} * <p> * <pre> * Token-&gt;DocIds 倒排索引表结构。这个索引数据压缩后最终每天需要占用2TB空间。 * hashid=hash64(token)%100亿,重复(冲突)不影响 * 直接在hdfs上进行分词,中间数据文件(按照hashid排序,总共100亿行):hashid token list&lt;DocId&gt; * 索引文件创建过程: * N := 200 取N=200,每200个左右的分词组建一个InvertedIndex对象 * for i := 0; ; i++ { * 1. 取 hashid 在 [ i*N,(i+1)*N ) 这个区间中的分词及其DocId列表 * 2. 生成一个 InvertedIndex 对象,序列化,gz压缩,追加到hdfs文件中 * 3. 记录下四元组: &lt;hdfspath, i, offset, length&gt; * } * 上述第3步中记录的四元组中 hdfspath、hashid 两个字段可以根据规则推测出来,因此只需要记录offset、length即可 * 总共需要记录 5000w (=总分词数/N) 条数,每个8字节,总计需要400M,这个文件可以存放在hdfs中,加载的时候可以加载到缓存中(NoSQL) * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.InvertedIndex) proto.PoseidonIf.InvertedIndexOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_InvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMutableMapField( int number) { switch (number) { case 1: return internalGetMutableIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_InvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.InvertedIndex.class, proto.PoseidonIf.InvertedIndex.Builder.class); } // Construct using proto.PoseidonIf.InvertedIndex.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); internalGetMutableIndex().clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_InvertedIndex_descriptor; } public proto.PoseidonIf.InvertedIndex getDefaultInstanceForType() { return proto.PoseidonIf.InvertedIndex.getDefaultInstance(); } public proto.PoseidonIf.InvertedIndex build() { proto.PoseidonIf.InvertedIndex result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.InvertedIndex buildPartial() { proto.PoseidonIf.InvertedIndex result = new proto.PoseidonIf.InvertedIndex(this); int from_bitField0_ = bitField0_; result.index_ = internalGetIndex(); result.index_.makeImmutable(); onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.InvertedIndex) { return mergeFrom((proto.PoseidonIf.InvertedIndex) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.InvertedIndex other) { if (other == proto.PoseidonIf.InvertedIndex.getDefaultInstance()) return this; internalGetMutableIndex().mergeFrom( other.internalGetIndex()); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.InvertedIndex parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.InvertedIndex) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.MapField< java.lang.String, proto.PoseidonIf.DocIdList> index_; private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.DocIdList> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.DocIdList> internalGetMutableIndex() { onChanged(); ; if (index_ == null) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); } if (!index_.isMutable()) { index_ = index_.copy(); } return index_; } /** * <code>map&lt;string, .proto.DocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.DocIdList> getIndex() { return internalGetIndex().getMap(); } /** * <code>map&lt;string, .proto.DocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.DocIdList> getMutableIndex() { return internalGetMutableIndex().getMutableMap(); } /** * <code>map&lt;string, .proto.DocIdList&gt; index = 1;</code> */ public Builder putAllIndex( java.util.Map<java.lang.String, proto.PoseidonIf.DocIdList> values) { getMutableIndex().putAll(values); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.InvertedIndex) } // @@protoc_insertion_point(class_scope:proto.InvertedIndex) private static final proto.PoseidonIf.InvertedIndex DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.InvertedIndex(); } public static proto.PoseidonIf.InvertedIndex getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<InvertedIndex> PARSER = new com.google.protobuf.AbstractParser<InvertedIndex>() { public InvertedIndex parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new InvertedIndex(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<InvertedIndex> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<InvertedIndex> getParserForType() { return PARSER; } public proto.PoseidonIf.InvertedIndex getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface FastPForCompressedInvertedIndexOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.FastPForCompressedInvertedIndex) com.google.protobuf.MessageOrBuilder { /** * <code>map&lt;string, .proto.FastPForCompressedDocIdList&gt; index = 1;</code> */ java.util.Map<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> getIndex(); } /** * Protobuf type {@code proto.FastPForCompressedInvertedIndex} */ public static final class FastPForCompressedInvertedIndex extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.FastPForCompressedInvertedIndex) FastPForCompressedInvertedIndexOrBuilder { // Use FastPForCompressedInvertedIndex.newBuilder() to construct. private FastPForCompressedInvertedIndex(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private FastPForCompressedInvertedIndex() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private FastPForCompressedInvertedIndex( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000001; } com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> index = input.readMessage( IndexDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); index_.getMutableMap().put(index.getKey(), index.getValue()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.FastPForCompressedInvertedIndex.class, proto.PoseidonIf.FastPForCompressedInvertedIndex.Builder.class); } public static final int INDEX_FIELD_NUMBER = 1; private static final class IndexDefaultEntryHolder { static final com.google.protobuf.MapEntry< java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> defaultEntry = com.google.protobuf.MapEntry .<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList>newDefaultInstance( proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.MESSAGE, proto.PoseidonIf.FastPForCompressedDocIdList.getDefaultInstance()); } private com.google.protobuf.MapField< java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> index_; private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } /** * <code>map&lt;string, .proto.FastPForCompressedDocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> getIndex() { return internalGetIndex().getMap(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (java.util.Map.Entry<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); output.writeMessage(1, index); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (java.util.Map.Entry<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, index); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.FastPForCompressedInvertedIndex prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.FastPForCompressedInvertedIndex} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.FastPForCompressedInvertedIndex) proto.PoseidonIf.FastPForCompressedInvertedIndexOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMutableMapField( int number) { switch (number) { case 1: return internalGetMutableIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.FastPForCompressedInvertedIndex.class, proto.PoseidonIf.FastPForCompressedInvertedIndex.Builder.class); } // Construct using proto.PoseidonIf.FastPForCompressedInvertedIndex.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); internalGetMutableIndex().clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_FastPForCompressedInvertedIndex_descriptor; } public proto.PoseidonIf.FastPForCompressedInvertedIndex getDefaultInstanceForType() { return proto.PoseidonIf.FastPForCompressedInvertedIndex.getDefaultInstance(); } public proto.PoseidonIf.FastPForCompressedInvertedIndex build() { proto.PoseidonIf.FastPForCompressedInvertedIndex result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.FastPForCompressedInvertedIndex buildPartial() { proto.PoseidonIf.FastPForCompressedInvertedIndex result = new proto.PoseidonIf.FastPForCompressedInvertedIndex(this); int from_bitField0_ = bitField0_; result.index_ = internalGetIndex(); result.index_.makeImmutable(); onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.FastPForCompressedInvertedIndex) { return mergeFrom((proto.PoseidonIf.FastPForCompressedInvertedIndex) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.FastPForCompressedInvertedIndex other) { if (other == proto.PoseidonIf.FastPForCompressedInvertedIndex.getDefaultInstance()) return this; internalGetMutableIndex().mergeFrom( other.internalGetIndex()); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.FastPForCompressedInvertedIndex parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.FastPForCompressedInvertedIndex) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.MapField< java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> index_; private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } private com.google.protobuf.MapField<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> internalGetMutableIndex() { onChanged(); ; if (index_ == null) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); } if (!index_.isMutable()) { index_ = index_.copy(); } return index_; } /** * <code>map&lt;string, .proto.FastPForCompressedDocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> getIndex() { return internalGetIndex().getMap(); } /** * <code>map&lt;string, .proto.FastPForCompressedDocIdList&gt; index = 1;</code> */ public java.util.Map<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> getMutableIndex() { return internalGetMutableIndex().getMutableMap(); } /** * <code>map&lt;string, .proto.FastPForCompressedDocIdList&gt; index = 1;</code> */ public Builder putAllIndex( java.util.Map<java.lang.String, proto.PoseidonIf.FastPForCompressedDocIdList> values) { getMutableIndex().putAll(values); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.FastPForCompressedInvertedIndex) } // @@protoc_insertion_point(class_scope:proto.FastPForCompressedInvertedIndex) private static final proto.PoseidonIf.FastPForCompressedInvertedIndex DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.FastPForCompressedInvertedIndex(); } public static proto.PoseidonIf.FastPForCompressedInvertedIndex getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<FastPForCompressedInvertedIndex> PARSER = new com.google.protobuf.AbstractParser<FastPForCompressedInvertedIndex>() { public FastPForCompressedInvertedIndex parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new FastPForCompressedInvertedIndex(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<FastPForCompressedInvertedIndex> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<FastPForCompressedInvertedIndex> getParserForType() { return PARSER; } public proto.PoseidonIf.FastPForCompressedInvertedIndex getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PdzCompressedInvertedIndexOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.PdzCompressedInvertedIndex) com.google.protobuf.MessageOrBuilder { /** * <code>map&lt;string, string&gt; index = 1;</code> */ java.util.Map<java.lang.String, java.lang.String> getIndex(); } /** * Protobuf type {@code proto.PdzCompressedInvertedIndex} * <p> * <pre> * Pdz 压缩算法是针对Protobuf的 Repeated 字段的一种压缩算法,详细实现情况请见: pdz_compress.go * </pre> */ public static final class PdzCompressedInvertedIndex extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.PdzCompressedInvertedIndex) PdzCompressedInvertedIndexOrBuilder { // Use PdzCompressedInvertedIndex.newBuilder() to construct. private PdzCompressedInvertedIndex(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private PdzCompressedInvertedIndex() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private PdzCompressedInvertedIndex( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000001; } com.google.protobuf.MapEntry<java.lang.String, java.lang.String> index = input.readMessage( IndexDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); index_.getMutableMap().put(index.getKey(), index.getValue()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.PdzCompressedInvertedIndex.class, proto.PoseidonIf.PdzCompressedInvertedIndex.Builder.class); } public static final int INDEX_FIELD_NUMBER = 1; private static final class IndexDefaultEntryHolder { static final com.google.protobuf.MapEntry< java.lang.String, java.lang.String> defaultEntry = com.google.protobuf.MapEntry .<java.lang.String, java.lang.String>newDefaultInstance( proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.STRING, ""); } private com.google.protobuf.MapField< java.lang.String, java.lang.String> index_; private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } /** * <code>map&lt;string, string&gt; index = 1;</code> */ public java.util.Map<java.lang.String, java.lang.String> getIndex() { return internalGetIndex().getMap(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, java.lang.String> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); output.writeMessage(1, index); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : internalGetIndex().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, java.lang.String> index = IndexDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, index); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.PdzCompressedInvertedIndex parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.PdzCompressedInvertedIndex prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.PdzCompressedInvertedIndex} * <p> * <pre> * Pdz 压缩算法是针对Protobuf的 Repeated 字段的一种压缩算法,详细实现情况请见: pdz_compress.go * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.PdzCompressedInvertedIndex) proto.PoseidonIf.PdzCompressedInvertedIndexOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 1: return internalGetIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMutableMapField( int number) { switch (number) { case 1: return internalGetMutableIndex(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.PdzCompressedInvertedIndex.class, proto.PoseidonIf.PdzCompressedInvertedIndex.Builder.class); } // Construct using proto.PoseidonIf.PdzCompressedInvertedIndex.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); internalGetMutableIndex().clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_PdzCompressedInvertedIndex_descriptor; } public proto.PoseidonIf.PdzCompressedInvertedIndex getDefaultInstanceForType() { return proto.PoseidonIf.PdzCompressedInvertedIndex.getDefaultInstance(); } public proto.PoseidonIf.PdzCompressedInvertedIndex build() { proto.PoseidonIf.PdzCompressedInvertedIndex result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.PdzCompressedInvertedIndex buildPartial() { proto.PoseidonIf.PdzCompressedInvertedIndex result = new proto.PoseidonIf.PdzCompressedInvertedIndex(this); int from_bitField0_ = bitField0_; result.index_ = internalGetIndex(); result.index_.makeImmutable(); onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.PdzCompressedInvertedIndex) { return mergeFrom((proto.PoseidonIf.PdzCompressedInvertedIndex) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.PdzCompressedInvertedIndex other) { if (other == proto.PoseidonIf.PdzCompressedInvertedIndex.getDefaultInstance()) return this; internalGetMutableIndex().mergeFrom( other.internalGetIndex()); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.PdzCompressedInvertedIndex parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.PdzCompressedInvertedIndex) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.MapField< java.lang.String, java.lang.String> index_; private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetIndex() { if (index_ == null) { return com.google.protobuf.MapField.emptyMapField( IndexDefaultEntryHolder.defaultEntry); } return index_; } private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMutableIndex() { onChanged(); ; if (index_ == null) { index_ = com.google.protobuf.MapField.newMapField( IndexDefaultEntryHolder.defaultEntry); } if (!index_.isMutable()) { index_ = index_.copy(); } return index_; } /** * <code>map&lt;string, string&gt; index = 1;</code> */ public java.util.Map<java.lang.String, java.lang.String> getIndex() { return internalGetIndex().getMap(); } /** * <code>map&lt;string, string&gt; index = 1;</code> */ public java.util.Map<java.lang.String, java.lang.String> getMutableIndex() { return internalGetMutableIndex().getMutableMap(); } /** * <code>map&lt;string, string&gt; index = 1;</code> */ public Builder putAllIndex( java.util.Map<java.lang.String, java.lang.String> values) { getMutableIndex().putAll(values); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.PdzCompressedInvertedIndex) } // @@protoc_insertion_point(class_scope:proto.PdzCompressedInvertedIndex) private static final proto.PoseidonIf.PdzCompressedInvertedIndex DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.PdzCompressedInvertedIndex(); } public static proto.PoseidonIf.PdzCompressedInvertedIndex getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<PdzCompressedInvertedIndex> PARSER = new com.google.protobuf.AbstractParser<PdzCompressedInvertedIndex>() { public PdzCompressedInvertedIndex parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new PdzCompressedInvertedIndex(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<PdzCompressedInvertedIndex> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<PdzCompressedInvertedIndex> getParserForType() { return PARSER; } public proto.PoseidonIf.PdzCompressedInvertedIndex getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface InvertedIndexGzMetaOrBuilder extends // @@protoc_insertion_point(interface_extends:proto.InvertedIndexGzMeta) com.google.protobuf.MessageOrBuilder { /** * <code>optional uint64 offset = 1;</code> * <p> * <pre> * 某一个 *InvertedIndexGzMeta* 所在 hdfs 文件中的起始地址偏移量 * </pre> */ long getOffset(); /** * <code>optional uint32 length = 2;</code> * <p> * <pre> * *InvertedIndexGzMeta* 的所占数据长度 * </pre> */ int getLength(); /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ java.lang.String getPath(); /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ com.google.protobuf.ByteString getPathBytes(); } /** * Protobuf type {@code proto.InvertedIndexGzMeta} * <p> * <pre> * 存入NoSQL中,Key=int(hashid/N) * </pre> */ public static final class InvertedIndexGzMeta extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:proto.InvertedIndexGzMeta) InvertedIndexGzMetaOrBuilder { // Use InvertedIndexGzMeta.newBuilder() to construct. private InvertedIndexGzMeta(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); } private InvertedIndexGzMeta() { offset_ = 0L; length_ = 0; path_ = ""; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private InvertedIndexGzMeta( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 8: { offset_ = input.readUInt64(); break; } case 16: { length_ = input.readUInt32(); break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); path_ = s; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw new RuntimeException(e.setUnfinishedMessage(this)); } catch (java.io.IOException e) { throw new RuntimeException( new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this)); } finally { makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_InvertedIndexGzMeta_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_InvertedIndexGzMeta_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.InvertedIndexGzMeta.class, proto.PoseidonIf.InvertedIndexGzMeta.Builder.class); } public static final int OFFSET_FIELD_NUMBER = 1; private long offset_; /** * <code>optional uint64 offset = 1;</code> * <p> * <pre> * 某一个 *InvertedIndexGzMeta* 所在 hdfs 文件中的起始地址偏移量 * </pre> */ public long getOffset() { return offset_; } public static final int LENGTH_FIELD_NUMBER = 2; private int length_; /** * <code>optional uint32 length = 2;</code> * <p> * <pre> * *InvertedIndexGzMeta* 的所占数据长度 * </pre> */ public int getLength() { return length_; } public static final int PATH_FIELD_NUMBER = 3; private volatile java.lang.Object path_; /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } } /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (offset_ != 0L) { output.writeUInt64(1, offset_); } if (length_ != 0) { output.writeUInt32(2, length_); } if (!getPathBytes().isEmpty()) { com.google.protobuf.GeneratedMessage.writeString(output, 3, path_); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (offset_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(1, offset_); } if (length_ != 0) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, length_); } if (!getPathBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessage.computeStringSize(3, path_); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static proto.PoseidonIf.InvertedIndexGzMeta parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static proto.PoseidonIf.InvertedIndexGzMeta parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static proto.PoseidonIf.InvertedIndexGzMeta parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(proto.PoseidonIf.InvertedIndexGzMeta prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code proto.InvertedIndexGzMeta} * <p> * <pre> * 存入NoSQL中,Key=int(hashid/N) * </pre> */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:proto.InvertedIndexGzMeta) proto.PoseidonIf.InvertedIndexGzMetaOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return proto.PoseidonIf.internal_static_proto_InvertedIndexGzMeta_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return proto.PoseidonIf.internal_static_proto_InvertedIndexGzMeta_fieldAccessorTable .ensureFieldAccessorsInitialized( proto.PoseidonIf.InvertedIndexGzMeta.class, proto.PoseidonIf.InvertedIndexGzMeta.Builder.class); } // Construct using proto.PoseidonIf.InvertedIndexGzMeta.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); offset_ = 0L; length_ = 0; path_ = ""; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return proto.PoseidonIf.internal_static_proto_InvertedIndexGzMeta_descriptor; } public proto.PoseidonIf.InvertedIndexGzMeta getDefaultInstanceForType() { return proto.PoseidonIf.InvertedIndexGzMeta.getDefaultInstance(); } public proto.PoseidonIf.InvertedIndexGzMeta build() { proto.PoseidonIf.InvertedIndexGzMeta result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public proto.PoseidonIf.InvertedIndexGzMeta buildPartial() { proto.PoseidonIf.InvertedIndexGzMeta result = new proto.PoseidonIf.InvertedIndexGzMeta(this); result.offset_ = offset_; result.length_ = length_; result.path_ = path_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof proto.PoseidonIf.InvertedIndexGzMeta) { return mergeFrom((proto.PoseidonIf.InvertedIndexGzMeta) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(proto.PoseidonIf.InvertedIndexGzMeta other) { if (other == proto.PoseidonIf.InvertedIndexGzMeta.getDefaultInstance()) return this; if (other.getOffset() != 0L) { setOffset(other.getOffset()); } if (other.getLength() != 0) { setLength(other.getLength()); } if (!other.getPath().isEmpty()) { path_ = other.path_; onChanged(); } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { proto.PoseidonIf.InvertedIndexGzMeta parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (proto.PoseidonIf.InvertedIndexGzMeta) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private long offset_; /** * <code>optional uint64 offset = 1;</code> * <p> * <pre> * 某一个 *InvertedIndexGzMeta* 所在 hdfs 文件中的起始地址偏移量 * </pre> */ public long getOffset() { return offset_; } /** * <code>optional uint64 offset = 1;</code> * <p> * <pre> * 某一个 *InvertedIndexGzMeta* 所在 hdfs 文件中的起始地址偏移量 * </pre> */ public Builder setOffset(long value) { offset_ = value; onChanged(); return this; } /** * <code>optional uint64 offset = 1;</code> * <p> * <pre> * 某一个 *InvertedIndexGzMeta* 所在 hdfs 文件中的起始地址偏移量 * </pre> */ public Builder clearOffset() { offset_ = 0L; onChanged(); return this; } private int length_; /** * <code>optional uint32 length = 2;</code> * <p> * <pre> * *InvertedIndexGzMeta* 的所占数据长度 * </pre> */ public int getLength() { return length_; } /** * <code>optional uint32 length = 2;</code> * <p> * <pre> * *InvertedIndexGzMeta* 的所占数据长度 * </pre> */ public Builder setLength(int value) { length_ = value; onChanged(); return this; } /** * <code>optional uint32 length = 2;</code> * <p> * <pre> * *InvertedIndexGzMeta* 的所占数据长度 * </pre> */ public Builder clearLength() { length_ = 0; onChanged(); return this; } private java.lang.Object path_ = ""; /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public Builder setPath( java.lang.String value) { if (value == null) { throw new NullPointerException(); } path_ = value; onChanged(); return this; } /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public Builder clearPath() { path_ = getDefaultInstance().getPath(); onChanged(); return this; } /** * <code>optional string path = 3;</code> * <p> * <pre> * 可以根据时间、索引表名、hashid等信息推断出来 * </pre> */ public Builder setPathBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); path_ = value; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:proto.InvertedIndexGzMeta) } // @@protoc_insertion_point(class_scope:proto.InvertedIndexGzMeta) private static final proto.PoseidonIf.InvertedIndexGzMeta DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new proto.PoseidonIf.InvertedIndexGzMeta(); } public static proto.PoseidonIf.InvertedIndexGzMeta getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<InvertedIndexGzMeta> PARSER = new com.google.protobuf.AbstractParser<InvertedIndexGzMeta>() { public InvertedIndexGzMeta parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { try { return new InvertedIndexGzMeta(input, extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof com.google.protobuf.InvalidProtocolBufferException) { throw (com.google.protobuf.InvalidProtocolBufferException) e.getCause(); } throw e; } } }; public static com.google.protobuf.Parser<InvertedIndexGzMeta> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<InvertedIndexGzMeta> getParserForType() { return PARSER; } public proto.PoseidonIf.InvertedIndexGzMeta getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_DocGzMeta_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_DocGzMeta_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_DocId_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_DocId_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_DocIdList_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_DocIdList_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_FastPForCompressedDocIdList_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_FastPForCompressedDocIdList_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_InvertedIndex_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_InvertedIndex_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_InvertedIndex_IndexEntry_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_InvertedIndex_IndexEntry_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_FastPForCompressedInvertedIndex_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_FastPForCompressedInvertedIndex_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_PdzCompressedInvertedIndex_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_PdzCompressedInvertedIndex_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_proto_InvertedIndexGzMeta_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_proto_InvertedIndexGzMeta_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\021poseidon_if.proto\022\005proto\"9\n\tDocGzMeta\022" + "\014\n\004path\030\001 \001(\t\022\016\n\006offset\030\002 \001(\004\022\016\n\006length\030" + "\003 \001(\r\"(\n\005DocId\022\r\n\005docId\030\001 \001(\004\022\020\n\010rowInde" + "x\030\002 \001(\r\")\n\tDocIdList\022\034\n\006docIds\030\001 \003(\0132\014.p" + "roto.DocId\"?\n\033FastPForCompressedDocIdLis" + "t\022\017\n\007docList\030\001 \003(\004\022\017\n\007rowList\030\002 \003(\r\"\177\n\rI" + "nvertedIndex\022.\n\005index\030\001 \003(\0132\037.proto.Inve" + "rtedIndex.IndexEntry\032>\n\nIndexEntry\022\013\n\003ke" + "y\030\001 \001(\t\022\037\n\005value\030\002 \001(\0132\020.proto.DocIdList" + ":\0028\001\"\265\001\n\037FastPForCompressedInvertedIndex", "\022@\n\005index\030\001 \003(\01321.proto.FastPForCompress" + "edInvertedIndex.IndexEntry\032P\n\nIndexEntry" + "\022\013\n\003key\030\001 \001(\t\0221\n\005value\030\002 \001(\0132\".proto.Fas" + "tPForCompressedDocIdList:\0028\001\"\207\001\n\032PdzComp" + "ressedInvertedIndex\022;\n\005index\030\001 \003(\0132,.pro" + "to.PdzCompressedInvertedIndex.IndexEntry" + "\032,\n\nIndexEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001" + "(\t:\0028\001\"C\n\023InvertedIndexGzMeta\022\016\n\006offset\030" + "\001 \001(\004\022\016\n\006length\030\002 \001(\r\022\014\n\004path\030\003 \001(\tB\014B\nP" + "oseidonIfb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; return null; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[]{ }, assigner); internal_static_proto_DocGzMeta_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_proto_DocGzMeta_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_DocGzMeta_descriptor, new java.lang.String[]{"Path", "Offset", "Length",}); internal_static_proto_DocId_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_proto_DocId_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_DocId_descriptor, new java.lang.String[]{"DocId", "RowIndex",}); internal_static_proto_DocIdList_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_proto_DocIdList_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_DocIdList_descriptor, new java.lang.String[]{"DocIds",}); internal_static_proto_FastPForCompressedDocIdList_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_proto_FastPForCompressedDocIdList_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_FastPForCompressedDocIdList_descriptor, new java.lang.String[]{"DocList", "RowList",}); internal_static_proto_InvertedIndex_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_proto_InvertedIndex_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_InvertedIndex_descriptor, new java.lang.String[]{"Index",}); internal_static_proto_InvertedIndex_IndexEntry_descriptor = internal_static_proto_InvertedIndex_descriptor.getNestedTypes().get(0); internal_static_proto_InvertedIndex_IndexEntry_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_InvertedIndex_IndexEntry_descriptor, new java.lang.String[]{"Key", "Value",}); internal_static_proto_FastPForCompressedInvertedIndex_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_proto_FastPForCompressedInvertedIndex_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_FastPForCompressedInvertedIndex_descriptor, new java.lang.String[]{"Index",}); internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_descriptor = internal_static_proto_FastPForCompressedInvertedIndex_descriptor.getNestedTypes().get(0); internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_FastPForCompressedInvertedIndex_IndexEntry_descriptor, new java.lang.String[]{"Key", "Value",}); internal_static_proto_PdzCompressedInvertedIndex_descriptor = getDescriptor().getMessageTypes().get(6); internal_static_proto_PdzCompressedInvertedIndex_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_PdzCompressedInvertedIndex_descriptor, new java.lang.String[]{"Index",}); internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_descriptor = internal_static_proto_PdzCompressedInvertedIndex_descriptor.getNestedTypes().get(0); internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_PdzCompressedInvertedIndex_IndexEntry_descriptor, new java.lang.String[]{"Key", "Value",}); internal_static_proto_InvertedIndexGzMeta_descriptor = getDescriptor().getMessageTypes().get(7); internal_static_proto_InvertedIndexGzMeta_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_proto_InvertedIndexGzMeta_descriptor, new java.lang.String[]{"Offset", "Length", "Path",}); } // @@protoc_insertion_point(outer_class_scope) }
117,764
1,208
<filename>aws_lambda_powertools/utilities/batch/exceptions.py """ Batch processing exceptions """ import traceback class SQSBatchProcessingError(Exception): """When at least one message within a batch could not be processed""" def __init__(self, msg="", child_exceptions=()): super().__init__(msg) self.msg = msg self.child_exceptions = child_exceptions # Overriding this method so we can output all child exception tracebacks when we raise this exception to prevent # errors being lost. See https://github.com/awslabs/aws-lambda-powertools-python/issues/275 def __str__(self): parent_exception_str = super(SQSBatchProcessingError, self).__str__() exception_list = [f"{parent_exception_str}\n"] for exception in self.child_exceptions: extype, ex, tb = exception formatted = "".join(traceback.format_exception(extype, ex, tb)) exception_list.append(formatted) return "\n".join(exception_list)
370
310
/* * Copyright (C) 2015 Ribot Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.co.ribot.easyadapterdemo.util; import java.util.Arrays; import java.util.List; import uk.co.ribot.easyadapterdemo.Person; import uk.co.ribot.easyadapterdemo.R; public final class DataUtil { public static List<Person> getSomePeople() { Person person1 = createPerson("<NAME>"); Person person2 = createPerson("<NAME>"); return Arrays.asList(person1, person2); } public static Person createPerson(String name) { return new Person(name, "07888999777", R.drawable.ic_launcher); } }
371
343
// Copyright 2012 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Implementation of the basic-block entry hook instrumentation transform. #ifndef SYZYGY_INSTRUMENT_TRANSFORMS_BASIC_BLOCK_ENTRY_HOOK_TRANSFORM_H_ #define SYZYGY_INSTRUMENT_TRANSFORMS_BASIC_BLOCK_ENTRY_HOOK_TRANSFORM_H_ #include <string> #include <vector> #include "base/strings/string_piece.h" #include "syzygy/block_graph/basic_block_assembler.h" #include "syzygy/block_graph/iterate.h" #include "syzygy/block_graph/transforms/iterative_transform.h" #include "syzygy/block_graph/transforms/named_transform.h" #include "syzygy/instrument/transforms/add_indexed_frequency_data_transform.h" namespace instrument { namespace transforms { // An iterative block transformation that augments the binary with an import // for a basic-block entry-hook function and, for each code basic-block, // prepends a call to the entry-hook function taking a unique basic-block ID. // The entry-hook function is responsible for being non-disruptive to the // calling environment. I.e., it must preserve all volatile registers, any // registers it uses, and the processor flags. class BasicBlockEntryHookTransform : public block_graph::transforms::IterativeTransformImpl< BasicBlockEntryHookTransform>, public block_graph::transforms::NamedBasicBlockSubGraphTransformImpl< BasicBlockEntryHookTransform> { public: typedef block_graph::BasicBlockSubGraph BasicBlockSubGraph; typedef block_graph::BlockGraph BlockGraph; typedef block_graph::TransformPolicyInterface TransformPolicyInterface; typedef core::RelativeAddress RelativeAddress; typedef core::AddressRange<RelativeAddress, size_t> RelativeAddressRange; typedef std::vector<RelativeAddressRange> RelativeAddressRangeVector; // Initialize a new BasicBlockEntryHookTransform instance using the default // module and function names. BasicBlockEntryHookTransform(); // @returns the RVAs and sizes in the original image of the instrumented basic // blocks. They are in the order in which they were encountered during // instrumentation, such that the index of the BB in the vector serves // as its unique ID. const RelativeAddressRangeVector& bb_ranges() const { return bb_ranges_; } // Overrides the default instrument dll name used by this transform. void set_instrument_dll_name(const base::StringPiece& value) { DCHECK(!value.empty()); instrument_dll_name_.assign(value.begin(), value.end()); } // Set a flag denoting whether or not src ranges should be created for the // thunks to the module entry hooks. void set_src_ranges_for_thunks(bool value) { set_src_ranges_for_thunks_ = value; } // Returns a flag denoting whether or not the instrumented application should // call the fast-path hook. bool inline_fast_path() { return set_inline_fast_path_; } // Set a flag denoting whether or not the instrumented application should // call the fast-path hook. void set_inline_fast_path(bool value) { set_inline_fast_path_ = value; } protected: typedef std::map<BlockGraph::Offset, BlockGraph::Block*> ThunkBlockMap; friend NamedBlockGraphTransformImpl<BasicBlockEntryHookTransform>; friend IterativeTransformImpl<BasicBlockEntryHookTransform>; friend NamedBasicBlockSubGraphTransformImpl<BasicBlockEntryHookTransform>; // @name IterativeTransformImpl implementation. // @{ bool PreBlockGraphIteration(const TransformPolicyInterface* policy, BlockGraph* block_graph, BlockGraph::Block* header_block); bool OnBlock(const TransformPolicyInterface* policy, BlockGraph* block_graph, BlockGraph::Block* block); bool PostBlockGraphIteration(const TransformPolicyInterface* policy, BlockGraph* block_graph, BlockGraph::Block* header_block); // @} // @name BasicBlockSubGraphTransformInterface implementation. // @{ virtual bool TransformBasicBlockSubGraph( const TransformPolicyInterface* policy, BlockGraph* block_graph, BasicBlockSubGraph* basic_block_subgraph) override; // @} // Add basic-block entry counting thunks for all entry points of a // @p code_block which is not basic-block decomposable. // @param block_graph The block graph in which to create the thunk. // @param code_block The code block which cannot be basic-block decomposed. // @returns true on success; false otherwise. bool ThunkNonDecomposableCodeBlock(BlockGraph* block_graph, BlockGraph::Block* code_block); // Redirects the given referrer to a thunk, creating the thunk if necessary. // @param referrer The details of the original referrer. // @param block_graph The block graph in which to create the thunk. // @param code_block The target block being thunked. // @param thunk_block_map A map (by target offset) of the thunks already // created. We only create a single thunk per target offset, which is // reused across referrers to the same target offset. // @returns true on success; false otherwise. bool EnsureReferrerIsThunked(const BlockGraph::Block::Referrer& referrer, BlockGraph* block_graph, BlockGraph::Block* block, ThunkBlockMap* thunk_block_map); // Add a basic-block entry counting thunk for an entry point at a given // @p offset of a @p code_block which is unsuitable for basic-block // decomposition. // @param block_graph The block graph in which to create the thunk. // @param thunk_block_map A catalog of thunk blocks created by this transform. // This will be updated if this function creates a new think. // @param code_block The code block which cannot be basic-block decomposed. // @param offset The offset of the entry point in @p code_block to thunk. // @param thunk The newly created thunk will be returned here. // @returns true on success; false otherwise. bool FindOrCreateThunk(BlockGraph* block_graph, ThunkBlockMap* thunk_block_map, BlockGraph::Block* code_block, BlockGraph::Offset offset, BlockGraph::Block** thunk); // Create a fast path thunk in the instrumented application which updates the // basic block count or calls the hook in the agent. // @param block_graph The block graph in which to create the thunk. // @param fast_path_block On success, contains the newly created thunk. // @returns true on success; false otherwise. bool CreateBasicBlockEntryThunk(BlockGraph* block_graph, BlockGraph::Block** fast_path_block); // Adds the basic-block frequency data referenced by the coverage agent. AddIndexedFrequencyDataTransform add_frequency_data_; // Stores the RVAs in the original image for each instrumented basic block. RelativeAddressRangeVector bb_ranges_; // The entry hook to which basic-block entry events are directed. BlockGraph::Reference bb_entry_hook_ref_; // The section where the entry-point thunks were placed. This will only be // non-NULL after a successful application of the transform. This value is // retained for unit-testing purposes. BlockGraph::Section* thunk_section_; // The instrumentation dll used by this transform. std::string instrument_dll_name_; // If true, the thunks will have src ranges corresponding to the original // code; otherwise, the thunks will not have src ranges set. bool set_src_ranges_for_thunks_; // If true, the instrumented application calls a fast injected hook before // falling back to the hook in the agent. bool set_inline_fast_path_; // The name of this transform. static const char kTransformName[]; private: DISALLOW_COPY_AND_ASSIGN(BasicBlockEntryHookTransform); }; } // namespace transforms } // namespace instrument #endif // SYZYGY_INSTRUMENT_TRANSFORMS_BASIC_BLOCK_ENTRY_HOOK_TRANSFORM_H_
2,764
30,023
"""The yeelightsunflower component."""
11
575
<filename>include/dds/core/xtypes/TypeProvider.hpp<gh_stars>100-1000 /* * Copyright 2010, Object Management Group, Inc. * Copyright 2010, PrismTech, Corp. * Copyright 2010, Real-Time Innovations, Inc. * Copyright 2019, Proyectos y Sistemas de Mantenimiento SL (eProsima). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ #define OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ #include <dds/core/xtypes/detail/TypeProvider.hpp> #include <dds/core/xtypes/DynamicType.hpp> namespace dds { namespace core { namespace xtypes { /** * TypeProvider that allows creation of types from external representations. */ template<typename DELEGATE> class TTypeProvider { public: /** * Load a type from the specified URI. If multiple types are defined * only the first one is returned. */ static TDynamicType<DELEGATE> load_type( const std::string& uri) { throw "Not implemented"; } /** * Load a type from the specified URI. If multiple types are defined * only the first one is returned. */ static std::vector<TDynamicType<DELEGATE> > load_types( const std::string& uri) { throw "Not implemented"; } /** * Load a named type from the specified URI. */ static TDynamicType<DELEGATE> load_type( const std::string& uri, const std::string& name) { throw "Not implemented"; } }; typedef TTypeProvider<detail::TypeProvider> TypeProvider; } //namespace xtypes } //namespace core } //namespace dds #endif //OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_
767
1,199
<filename>language/question_answering/decatt_docreader/layers/document_reader.py # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Simplified version of Document Reader.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from language.common.layers import cudnn_layers from language.common.utils import tensor_utils import tensorflow.compat.v1 as tf def _attend_to_question(context_emb, question_emb, question_mask, hidden_size): """Compute similarity scores with the dot product of two linear layers. Args: context_emb: <float32> [batch_size, max_context_len, hidden_size] question_emb: <float32> [batch_size, max_question_len, hidden_size] question_mask: <float32> [batch_size, max_question_len] hidden_size: Integer indicating the size of the projection. Returns: attended_emb: <float32> [batch_size, max_context_len, hidden_size] """ with tf.variable_scope("question_projection"): # [batch_size, max_question_len, hidden_size] projected_question_emb = tf.layers.dense(question_emb, hidden_size) with tf.variable_scope("context_projection"): # [batch_size, max_context_len, hidden_size] projected_context_emb = tf.layers.dense(context_emb, hidden_size) # [batch_size, max_context_len, max_question_len] attention_scores = tf.matmul( projected_context_emb, projected_question_emb, transpose_b=True) attention_scores += tf.expand_dims(tf.log(question_mask), 1) attention_weights = tf.nn.softmax(attention_scores) # [batch_size, max_context_len, hidden_size] attended_emb = tf.matmul(attention_weights, question_emb) return attended_emb def _attention_pool(question_emb, question_mask): """Reduce variable length question embeddings to fixed length via attention. Args: question_emb: <float32> [batch_size, max_question_len, hidden_size] question_mask: <float32> [batch_size, max_question_len] Returns: pooled_emb: <float32> [batch_size, hidden_size] """ # [batch_size, max_question_len, 1] attention_scores = tf.layers.dense(question_emb, 1) attention_scores += tf.expand_dims(tf.log(question_mask), -1) attention_weights = tf.nn.softmax(attention_scores, 1) # [batch_size, 1, hidden_size] pooled_emb = tf.matmul(attention_weights, question_emb, transpose_a=True) # [batch_size, hidden_size] pooled_emb = tf.squeeze(pooled_emb, 1) return pooled_emb def _bilinear_score(context_emb, question_emb): """Compute a bilinear score between the context and question embeddings. Args: context_emb: <float32> [batch_size, max_context_len, hidden_size] question_emb: <float32> [batch_size, hidden_size] Returns: scores: <float32> [batch_size, max_context_len] """ # [batch_size, hidden_size] projected_question_emb = tf.layers.dense(question_emb, tensor_utils.shape(context_emb, -1)) # [batch_size, max_context_len, 1] scores = tf.matmul(context_emb, tf.expand_dims(projected_question_emb, -1)) return tf.squeeze(scores, -1) def score_endpoints(question_emb, question_len, context_emb, context_len, hidden_size, num_layers, dropout_ratio, mode, use_cudnn=None): """Compute two scores over context words based on the input embeddings. Args: question_emb: <float32> [batch_size, max_question_len, hidden_size] question_len: <int32> [batch_size] context_emb: <float32>[batch_size, max_context_len, hidden_size] context_len: <int32> [batch_size] hidden_size: Size of hidden layers. num_layers: Number of LSTM layers. dropout_ratio: The probability of dropping out hidden units. mode: Object of type tf.estimator.ModeKeys. use_cudnn: Specify the use of cudnn. `None` denotes automatic selection. Returns: start_scores: <float32> [batch_size, max_context_words] end_scores: <float32> [batch_size, max_context_words] """ # [batch_size, max_question_len] question_mask = tf.sequence_mask( question_len, tensor_utils.shape(question_emb, 1), dtype=tf.float32) # [batch_size, max_context_len, hidden_size] attended_emb = _attend_to_question( context_emb=context_emb, question_emb=question_emb, question_mask=question_mask, hidden_size=hidden_size) # [batch_size, max_context_len, hidden_size * 2] context_emb = tf.concat([context_emb, attended_emb], -1) with tf.variable_scope("contextualize_context"): # [batch_size, max_context_len, hidden_size] contextualized_context_emb = cudnn_layers.stacked_bilstm( input_emb=context_emb, input_len=context_len, hidden_size=hidden_size, num_layers=num_layers, dropout_ratio=dropout_ratio, mode=mode, use_cudnn=use_cudnn) with tf.variable_scope("contextualize_question"): # [batch_size, max_question_len, hidden_size] contextualized_question_emb = cudnn_layers.stacked_bilstm( input_emb=question_emb, input_len=question_len, hidden_size=hidden_size, num_layers=num_layers, dropout_ratio=dropout_ratio, mode=mode, use_cudnn=use_cudnn) if mode == tf.estimator.ModeKeys.TRAIN: contextualized_context_emb = tf.nn.dropout(contextualized_context_emb, 1.0 - dropout_ratio) contextualized_question_emb = tf.nn.dropout(contextualized_question_emb, 1.0 - dropout_ratio) # [batch_size, hidden_size] pooled_question_emb = _attention_pool(contextualized_question_emb, question_mask) if mode == tf.estimator.ModeKeys.TRAIN: pooled_question_emb = tf.nn.dropout(pooled_question_emb, 1.0 - dropout_ratio) # [batch_size, max_context_len] with tf.variable_scope("start_scores"): start_scores = _bilinear_score(contextualized_context_emb, pooled_question_emb) with tf.variable_scope("end_scores"): end_scores = _bilinear_score(contextualized_context_emb, pooled_question_emb) context_log_mask = tf.log( tf.sequence_mask( context_len, tensor_utils.shape(context_emb, 1), dtype=tf.float32)) start_scores += context_log_mask end_scores += context_log_mask return start_scores, end_scores
2,889
2,338
#import <XCTest/XCTest.h> @interface XCTestCase (WMFBundleConvenience) - (NSBundle *)wmf_bundle; @end
48
26,932
#pragma once #include <tchar.h> #include <Windows.h> #include <comdef.h> #include <Shtypes.h> #include <DocObj.h> struct __declspec(uuid("1AC7516E-E6BB-4A69-B63F-E841904DC5A6")) IIEUserBroker : IUnknown { virtual HRESULT STDMETHODCALLTYPE Initialize(HWND *, LPCWSTR, LPDWORD) = 0; virtual HRESULT STDMETHODCALLTYPE CreateProcessW(DWORD pid, LPWSTR appName, LPWSTR cmdline, DWORD, DWORD, LPCSTR, WORD*, /* _BROKER_STARTUPINFOW*/ void *, /* _BROKER_PROCESS_INFORMATION */ void*) = 0; virtual HRESULT STDMETHODCALLTYPE WinExec(DWORD pid, LPCSTR, DWORD, DWORD*) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerCreateKnownObject(_GUID const &, _GUID const &, IUnknown * *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerCoCreateInstance() = 0; virtual HRESULT STDMETHODCALLTYPE BrokerCoCreateInstanceEx(DWORD pid, _GUID const &, IUnknown *, DWORD, _COSERVERINFO *, DWORD, /* tagBROKER_MULTI_QI */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerCoGetClassObject(DWORD pid, _GUID const &, DWORD, _COSERVERINFO *, _GUID const &, IUnknown * *) = 0; }; struct __declspec(uuid("BDB57FF2-79B9-4205-9447-F5FE85F37312")) CIEAxInstallBroker { }; struct __declspec(uuid("B2103BDB-B79E-4474-8424-4363161118D5")) IIEAxInstallBrokerBroker : IUnknown { virtual HRESULT STDMETHODCALLTYPE BrokerGetAxInstallBroker(REFCLSID rclsid, REFIID riid, int unknown, int type, HWND, IUnknown** ppv) = 0; }; _COM_SMARTPTR_TYPEDEF(IIEAxInstallBrokerBroker, __uuidof(IIEAxInstallBrokerBroker)); struct ERF { //+0x000 erfOper : Int4B // + 0x004 erfType : Int4B // + 0x008 fError : Int4B int erfOper; int erfType; int fError; }; struct FNAME { /*+0x000 pszFilename : Ptr32 Char + 0x004 pNextName : Ptr32 sFNAME + 0x008 status : Uint4B*/ char* pszFilenane; FNAME* pNextName; UINT status; }; struct SESSION { /*+0x000 cbCabSize : Uint4B + 0x004 erf : ERF + 0x010 pFileList : Ptr32 sFNAME + 0x014 cFiles : Uint4B + 0x018 flags : Uint4B + 0x01c achLocation : [260] Char + 0x120 achFile : [260] Char + 0x224 achCabPath : [260] Char + 0x328 pFilesToExtract : Ptr32 sFNAME*/ UINT cbCabSize; ERF erf; FNAME* pFileList; UINT cFiles; UINT flags; char achLocation[260]; char achFile[260]; char achCabPath[260]; FNAME* pFilesToExtract; }; struct __declspec(uuid("BC0EC710-A3ED-4F99-B14F-5FD59FDACEA3")) IIeAxiInstaller2 : IUnknown { virtual HRESULT STDMETHODCALLTYPE VerifyFile(BSTR, HWND__ *, BSTR, BSTR, BSTR, unsigned int, unsigned int, _GUID const &, BSTR*, unsigned int *, unsigned char **) = 0; virtual HRESULT STDMETHODCALLTYPE RunSetupCommand(BSTR, HWND__ *, BSTR, BSTR, BSTR, BSTR, unsigned int, unsigned int *) = 0; virtual HRESULT STDMETHODCALLTYPE InstallFile(BSTR sessionGuid, HWND__ *, BSTR sourcePath, BSTR sourceFile, BSTR destPath, BSTR destFile, unsigned int unk) = 0; virtual HRESULT STDMETHODCALLTYPE RegisterExeFile(BSTR sessionGuid, BSTR cmdline, int unk, _PROCESS_INFORMATION *) = 0; virtual HRESULT STDMETHODCALLTYPE RegisterDllFile(BSTR, BSTR, int) = 0; virtual HRESULT STDMETHODCALLTYPE InstallCatalogFile(BSTR, BSTR) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateLanguageCheck(BSTR, unsigned short const *, _FILETIME) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateDistributionUnit(BSTR, unsigned short const *, unsigned short const *, unsigned int, unsigned int *, unsigned short const *, int, unsigned short const *, unsigned short const *, long, unsigned short const *, unsigned short const *, unsigned short const *, unsigned int, unsigned short const * *, unsigned int, unsigned short const * *, unsigned int, unsigned short const * *, unsigned short const * *) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateModuleUsage(BSTR, char const *, char const *, char const *, char const *, unsigned int) = 0; virtual HRESULT STDMETHODCALLTYPE EnumerateFiles(BSTR sessionGuid, char const * cabPath, SESSION *session) = 0; virtual HRESULT STDMETHODCALLTYPE ExtractFiles(BSTR sessionGuid, char const * cabPath, SESSION *session) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveExtractedFilesAndDirs(BSTR, SESSION *) = 0; virtual HRESULT STDMETHODCALLTYPE CreateExtensionsManager(BSTR, _GUID const &, IUnknown * *) = 0; virtual HRESULT STDMETHODCALLTYPE RegisterDllFile2(BSTR, BSTR, int, int) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateDistributionUnit2(BSTR, unsigned short const *, unsigned short const *, unsigned int, unsigned int *, unsigned short const *, int, unsigned short const *, unsigned short const *, long, unsigned short const *, unsigned short const *, unsigned short const *, unsigned int, unsigned short const * *, int *, unsigned int, unsigned short const * *, unsigned int, unsigned short const * *, unsigned short const * *) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateAllowedDomainsList(_GUID const &, BSTR, int) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteExtractedFile(char const *) = 0; }; _COM_SMARTPTR_TYPEDEF(IIeAxiInstaller2, __uuidof(IIeAxiInstaller2)); struct __declspec(uuid("9AEA8A59-E0C9-40F1-87DD-757061D56177")) IIeAxiAdminInstaller : IUnknown { virtual HRESULT STDMETHODCALLTYPE InitializeAdminInstaller(BSTR, BSTR, BSTR*) = 0; }; _COM_SMARTPTR_TYPEDEF(IIeAxiAdminInstaller, __uuidof(IIeAxiAdminInstaller)); struct __declspec(uuid("A4AAAE00-22E5-4742-ABB7-379D9493A3B7")) IShdocvwBroker : IUnknown { virtual HRESULT STDMETHODCALLTYPE RedirectUrl(WORD const *, DWORD, /* _BROKER_REDIRECT_DETAIL */ void *, /* IXMicTestMode */ void*) = 0; virtual HRESULT STDMETHODCALLTYPE RedirectShortcut(WORD const *, WORD const *, DWORD, /* _BROKER_REDIRECT_DETAIL */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE RedirectUrlWithBindInfo(/* _BROKER_BIND_INFO */ void *, /* _BROKER_REDIRECT_DETAIL */ void *, /* IXMicTestMode */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE NavigateUrlInNewTabInstance(/* _BROKER_BIND_INFO */ void *, /*_BROKER_REDIRECT_DETAIL */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowInternetOptions(HWND *, WORD const *, WORD const *, long, ITEMIDLIST_ABSOLUTE * *, DWORD, int *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowInternetOptionsZones(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowInternetOptionsLanguages(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowPopupManager(HWND *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowCachesAndDatabases(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE ConfigurePopupExemption(HWND *, int, WORD const *, int *) = 0; virtual HRESULT STDMETHODCALLTYPE ConfigurePopupMgr(HWND *, int) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveFirstHomePage(void) = 0; virtual HRESULT STDMETHODCALLTYPE SetHomePage(HWND *, long, ITEMIDLIST_ABSOLUTE * *, long) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveHomePage(HWND *, int) = 0; virtual HRESULT STDMETHODCALLTYPE FixInternetSecurity(HWND *, int *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowManageAddons(HWND *, DWORD, _GUID *, DWORD, int) = 0; virtual HRESULT STDMETHODCALLTYPE CacheExtFileVersion(_GUID const &, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowAxApprovalDlg(HWND *, _GUID const &, int, WORD const *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE SendLink(ITEMIDLIST_ABSOLUTE const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE SendPage(HWND *, IDataObject *) = 0; virtual HRESULT STDMETHODCALLTYPE NewMessage(void) = 0; virtual HRESULT STDMETHODCALLTYPE ReadMail(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE SetAsBackground(LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE ShowSaveBrowseFile(HWND *, WORD const *, WORD const *, int, int, WORD * *, DWORD *, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE SaveAsComplete(void) = 0; virtual HRESULT STDMETHODCALLTYPE SaveAsFile(void) = 0; virtual HRESULT STDMETHODCALLTYPE StartImportExportWizard(int, HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE EditWith(HWND *, DWORD, HANDLE, DWORD, LPCWSTR, LPCWSTR, LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE ShowSaveImage(HWND *, WORD const *, DWORD, WORD * *) = 0; virtual HRESULT STDMETHODCALLTYPE SaveImage(WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE CreateShortcut(/* _internet_shortcut_params */ void*, int, HWND *, WORD *, int) = 0; virtual HRESULT STDMETHODCALLTYPE ShowSynchronizeUI(void) = 0; virtual HRESULT STDMETHODCALLTYPE OpenFolderAndSelectItem(WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE DoGetOpenFileNameDialog(/* _SOpenDlg */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE DoGetLocationPlatformConsent(HWND *, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowSaveFileName(HWND *, WORD const *, WORD const *, WORD const *, WORD const *, DWORD, WORD *, DWORD, WORD const *, WORD * *) = 0; virtual HRESULT STDMETHODCALLTYPE SaveFile(HWND *, DWORD, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE VerifyTrustAndExecute(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE GetFeedByUrl(WORD const *, WORD * *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerAddToFavoritesEx(HWND *, ITEMIDLIST_ABSOLUTE const *, WORD const *, DWORD, IOleCommandTarget *, WORD *, DWORD, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE Subscribe(HWND *, WORD const *, WORD const *, int, int, int) = 0; virtual HRESULT STDMETHODCALLTYPE MarkAllItemsRead(WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE MarkItemsRead(WORD const *, DWORD *, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE Properties(HWND *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteFeedItem(HWND *, WORD const *, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteFeed(HWND *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteFolder(HWND *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE Refresh(WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE MoveFeed(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE MoveFeedFolder(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE RenameFeed(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE RenameFeedFolder(HWND *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE NewFeedFolder(LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE FeedRefreshAll(void) = 0; virtual HRESULT STDMETHODCALLTYPE ShowFeedAuthDialog(HWND *, WORD const *, /* FEEDTASKS_AUTHTYPE */ DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE ShowAddSearchProvider(HWND *, WORD const *, WORD const *, int) = 0; virtual HRESULT STDMETHODCALLTYPE InitHKCUSearchScopesRegKey(void) = 0; virtual HRESULT STDMETHODCALLTYPE DoShowDeleteBrowsingHistoryDialog(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE StartAutoProxyDetection(void) = 0; virtual HRESULT STDMETHODCALLTYPE EditAntiPhishingOptinSetting(HWND *, DWORD, int *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowMyPictures(void) = 0; virtual HRESULT STDMETHODCALLTYPE ChangeIntranetSettings(HWND *, int) = 0; virtual HRESULT STDMETHODCALLTYPE FixProtectedModeSettings(void) = 0; virtual HRESULT STDMETHODCALLTYPE ShowAddService(HWND *, WORD const *, WORD const *, int) = 0; virtual HRESULT STDMETHODCALLTYPE ShowAddWebFilter(HWND *, WORD const *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE DoBrowserRegister() = 0; virtual HRESULT STDMETHODCALLTYPE DoBrowserRevoke(long) = 0; virtual HRESULT STDMETHODCALLTYPE DoOnNavigate(long, VARIANT *) = 0; virtual HRESULT STDMETHODCALLTYPE AddDesktopComponent(WORD *, WORD *, VARIANT *, VARIANT *, VARIANT *, VARIANT *) = 0; virtual HRESULT STDMETHODCALLTYPE DoOnCreated(long, IUnknown *) = 0; virtual HRESULT STDMETHODCALLTYPE GetShellWindows(IUnknown * *) = 0; virtual HRESULT STDMETHODCALLTYPE CustomizeSettings(short, short, WORD *) = 0; virtual HRESULT STDMETHODCALLTYPE OnFocus(int) = 0; virtual HRESULT STDMETHODCALLTYPE IsProtectedModeUrl(LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE DoDiagnoseConnectionProblems(HWND *, WORD *, WORD *) = 0; virtual HRESULT STDMETHODCALLTYPE PerformDoDragDrop(HWND *, /* IEDataObjectWrapper */ void *, /* IEDropSourceWrapper */ void *, DWORD, DWORD, DWORD *, long *) = 0; virtual HRESULT STDMETHODCALLTYPE TurnOnFeedSyncEngine(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE InternetSetPerSiteCookieDecisionW(WORD const *, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE SetAttachmentUserOverride(LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE WriteClassesOfCategory(_GUID const &, int, int) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerSetFocus(DWORD, HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerShellNotifyIconA(DWORD, /* _BROKER_NOTIFYICONDATAA */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerShellNotifyIconW(DWORD, /* _BROKER_NOTIFYICONDATAW */ void*) = 0; virtual HRESULT STDMETHODCALLTYPE DisplayVirtualizedFolder(void) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerSetWindowPos(HWND *, HWND *, int, int, int, int, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE WriteUntrustedControlDetails(_GUID const &, WORD const *, WORD const *, DWORD, BYTE *) = 0; virtual HRESULT STDMETHODCALLTYPE SetComponentDeclined(char const *, char const *) = 0; virtual HRESULT STDMETHODCALLTYPE DoShowPrintDialog(/* _BROKER_PRINTDLG */ void*) = 0; virtual HRESULT STDMETHODCALLTYPE NavigateHomePages(void) = 0; virtual HRESULT STDMETHODCALLTYPE ShowAxDomainApprovalDlg(HWND *, _GUID const &, int, WORD const *, WORD const *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ActivateExtensionFromCLSID(HWND *, WORD const *, DWORD, DWORD, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerCoCreateNewIEWindow(DWORD, _GUID const &, void * *, int, DWORD, int, int) = 0; virtual HRESULT STDMETHODCALLTYPE BeginFakeModalityForwardingToTab() = 0; virtual HRESULT STDMETHODCALLTYPE BrokerEnableWindow(int, int *) = 0; virtual HRESULT STDMETHODCALLTYPE EndFakeModalityForwardingToTab(HWND *, long) = 0; virtual HRESULT STDMETHODCALLTYPE CloseOldTabIfFailed(void) = 0; virtual HRESULT STDMETHODCALLTYPE EnableSuggestedSites(HWND *, int) = 0; virtual HRESULT STDMETHODCALLTYPE SetProgressValue(HWND *, DWORD, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerStartNewIESession(void) = 0; virtual HRESULT STDMETHODCALLTYPE CompatDetachInputQueue(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE CompatAttachInputQueue(void) = 0; virtual HRESULT STDMETHODCALLTYPE SetToggleKeys(DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE RepositionInfrontIE(HWND *, int, int, int, int, DWORD) = 0; //virtual HRESULT STDMETHODCALLTYPE ReportShipAssert(DWORD, DWORD, DWORD, WORD const *, WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowOpenSafeOpenDialog(HWND *, /* _BROKER_SAFEOPENDLGPARAM */ void *, DWORD *, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerAddSiteToStart(HWND *, WORD *, WORD const *, long, DWORD) = 0; virtual HRESULT STDMETHODCALLTYPE SiteModeAddThumbnailButton(DWORD *, HWND *, WORD *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE SiteModeAddButtonStyle(int *, HWND *, DWORD, WORD *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE IsSiteModeFirstRun(int, WORD *) = 0; virtual HRESULT STDMETHODCALLTYPE IsImmersiveSiteModeFirstRun(int, WORD const *, WORD *) = 0; virtual HRESULT STDMETHODCALLTYPE GetImmersivePinnedState(DWORD, int, int *) = 0; virtual HRESULT STDMETHODCALLTYPE BrokerDoSiteModeDragDrop(DWORD, long *, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE EnterUILock(long) = 0; virtual HRESULT STDMETHODCALLTYPE LeaveUILock(long) = 0; virtual HRESULT STDMETHODCALLTYPE CredentialAdd(/* _IECREDENTIAL */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE CredentialGet(WORD const *, WORD const *, /*_IECREDENTIAL */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE CredentialFindAllByUrl(WORD const *, DWORD *, /* _IECREDENTIAL */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE CredentialRemove(WORD const *, WORD const *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowOpenFile(HWND *, DWORD, DWORD, WORD *, WORD *, WORD const *, WORD const *, WORD const *, /* _OPEN_FILE_RESULT */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowImmersiveOpenFilePicker(HWND *, int, WORD const *, IUnknown * *, /* _OPEN_FILE_RESULT */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE RegisterFileDragDrop(HWND *, DWORD, unsigned char *) = 0; virtual HRESULT STDMETHODCALLTYPE RevokeFileDragDrop(HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE GetFileTokensForDragDropA(HWND *, DWORD, char * *, /* _OPEN_FILE_RESULT */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE GetFileTokensForDragDropW(HWND *, DWORD, WORD * *, /* _OPEN_FILE_RESULT */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE ShowEPMCompatDocHostConsent(HWND *, WORD const *, WORD const *, int *) = 0; virtual HRESULT STDMETHODCALLTYPE GetModuleInfoFromSignature(WORD const *, WORD * *, DWORD, WORD * *, WORD * *, WORD * *) = 0; virtual HRESULT STDMETHODCALLTYPE ShellExecWithActivationHandler(HWND *, LPCWSTR, LPCWSTR, int, /* _MSLAUNCH_HANDLER_STATUS */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE ShellExecFolderUri(LPCWSTR) = 0; virtual HRESULT STDMETHODCALLTYPE ShowIMMessageDialog(HWND *, WORD const *, WORD const *, /* _IM_BUTTON_LABEL_ID */ void *, DWORD, DWORD, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE GetFileHandle(HWND *, BSTR filename, BYTE * hash, DWORD hashlen, HANDLE*) = 0; virtual HRESULT STDMETHODCALLTYPE MOTWCreateFileW(DWORD dwProcessId, BSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, int dwOpenMode, DWORD dwFlagsAndAttributes, ULONGLONG* h, DWORD *error) = 0; virtual HRESULT STDMETHODCALLTYPE MOTWFindFileW() = 0; virtual HRESULT STDMETHODCALLTYPE MOTWGetFileDataW() = 0; virtual HRESULT STDMETHODCALLTYPE WinRTInitializeWithWindow(IUnknown *, HWND *) = 0; virtual HRESULT STDMETHODCALLTYPE DoProvisionNetworks(HWND *, WORD const *, DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE GetAccessibilityStylesheet(DWORD, unsigned __int64 *) = 0; virtual HRESULT STDMETHODCALLTYPE GetAppCacheUsage(WORD const *, unsigned __int64 *, unsigned __int64 *) = 0; virtual HRESULT STDMETHODCALLTYPE HiddenTabRequest(/* _BROKER_BIND_INFO */ void *, /* _BROKER_REDIRECT_DETAIL */ void *, /* _HIDDENTAB_REQUEST_INFO */ void *) = 0; virtual HRESULT STDMETHODCALLTYPE GetMaxCpuSpeed(DWORD *) = 0; virtual HRESULT STDMETHODCALLTYPE GetProofOfPossessionTokensForUrl(WORD const *, DWORD *, /* _IEProofOfPossessionToken */ void * *) = 0; virtual HRESULT STDMETHODCALLTYPE GetLoginUrl(LPWSTR*) = 0; virtual HRESULT STDMETHODCALLTYPE ScheduleDeleteEncryptedMediaData() = 0; virtual HRESULT STDMETHODCALLTYPE IsDeleteEncryptedMediaDataPending() = 0; virtual HRESULT STDMETHODCALLTYPE GetFrameAppDataPathA() = 0; virtual HRESULT STDMETHODCALLTYPE BrokerHandlePrivateNetworkFailure() = 0; }; _COM_SMARTPTR_TYPEDEF(IIEUserBroker, __uuidof(IIEUserBroker)); _COM_SMARTPTR_TYPEDEF(IShdocvwBroker, __uuidof(IShdocvwBroker));
6,959
5,169
<filename>Specs/2/1/2/EVNCustomSearchBar/0.0.1/EVNCustomSearchBar.podspec.json { "name": "EVNCustomSearchBar", "version": "0.0.1", "summary": "Born for iOS 11 SearchBar", "description": "EVNCustomSearchBar: 自定义SearchBar,custom SearchBar 用于暂时适配iOS 11", "homepage": "https://github.com/zonghongyan/EVNCustomSearchBar/blob/master/README.md", "license": "MIT", "authors": { "zonghongyan": "<EMAIL>" }, "platforms": { "ios": "8.0" }, "source": { "git": "https://github.com/zonghongyan/EVNCustomSearchBar.git", "tag": "0.0.1" }, "source_files": [ "EVNCustomSearchBar", "EVNCustomSearchBar/*.{h,m}" ], "requires_arc": true, "resources": "EVNCustomSearchBar/EVNCustomSearchBar.bundle" }
327
5,169
<reponame>Gantios/Specs { "name": "podSpecLFMS", "version": "0.0.4", "summary": "This file maily used for create a login form.", "description": "The framework will show the login form and user can easily mange thire login through this framework", "homepage": "https://github.com/Lalson/CocoPodsTest", "license": "MIT", "authors": { "lalsoncl": "<EMAIL>" }, "source": { "git": "https://github.com/Lalson/CocoPodsTest.git", "tag": "0.0.2", "commit": "<PASSWORD>" }, "swift_versions": "5.0", "source_files": [ "LensFM", "LensFM/**/*.{h, swift}" ], "platforms": { "ios": "13.0" }, "swift_version": "5.0" }
280
10,225
<gh_stars>1000+ package io.quarkus.it.mailer; import java.time.Duration; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import io.quarkus.mailer.Mail; import io.quarkus.mailer.MailTemplate; import io.quarkus.mailer.Mailer; import io.quarkus.qute.CheckedTemplate; import io.vertx.mutiny.core.Vertx; import io.vertx.mutiny.core.buffer.Buffer; @Path("/mail") @Produces(MediaType.TEXT_PLAIN) public class MailResource { @Inject Mailer mailer; @Inject Vertx vertx; @CheckedTemplate static class Templates { public static native MailTemplate.MailTemplateInstance hello(String name); } /** * Send a simple text email. */ @GET @Path("/text") public String sendSimpleTextEmail() { mailer.send(Mail.withText("<EMAIL>", "simple test email", "This is a simple test email.\nRegards,\nRoger the robot")); return "ok"; } /** * Send a simple text email with a text attachment (not inlined) */ @GET @Path("/text-with-attachment") public String sendSimpleTextEmailWithASingleAttachment() { Buffer lorem = vertx.fileSystem().readFile("META-INF/resources/lorem.txt").await().atMost(Duration.ofSeconds(1)); mailer.send(Mail.withText("<EMAIL>", "simple test email with an attachment", "This is a simple test email.\nRegards,\nRoger the robot") .addAttachment("lorem.txt", lorem.getBytes(), "text/plain")); return "ok"; } /** * Send a simple HTML email. */ @GET @Path("/html") public String sendSimpleHtmlEmail() { mailer.send(Mail.withHtml("<EMAIL>", "html test email", "<h3>Hello!</h3><p>This is a simple test email.</p><p>Regards,</p><p>Roger the robot</p>")); return "ok"; } /** * Send a simple text email to multiple recipients. */ @GET @Path("/multiple-recipients") public String sendSimpleTextEmailToMultipleRecipients() { mailer.send(Mail.withText("<EMAIL>", "simple test email", "This is a simple test email.\nRegards,\nRoger the robot") .addTo("<EMAIL>")); return "ok"; } /** * Send a text email from template. */ @GET @Path("/text-from-template") public String sendEmailFromTemplate() { Templates.hello("John") .subject("template mail") .to("<EMAIL>") .send() .await().indefinitely(); return "ok"; } /** * Send a simple text email with custom header. */ @GET @Path("/text-with-headers") public String sendSimpleTextEmailWithCustomHeader() { mailer.send(Mail.withText("<EMAIL>", "simple test email", "This is a simple test email.\nRegards,\nRoger the robot") .addHeader("Accept", "http")); return "ok"; } }
1,405
686
/* * X11 tablet driver * * Copyright 2003 CodeWeavers (<NAME>) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" #include "wine/port.h" #include <stdlib.h> #include <stdarg.h> #include "windef.h" #include "winbase.h" #include "winnls.h" #include "x11drv.h" #include "wine/unicode.h" #include "wine/debug.h" #include "wintab.h" WINE_DEFAULT_DEBUG_CHANNEL(wintab32); #define WT_MAX_NAME_LEN 256 typedef struct tagWTI_CURSORS_INFO { WCHAR NAME[WT_MAX_NAME_LEN]; /* a displayable zero-terminated string containing the name of the * cursor. */ BOOL ACTIVE; /* whether the cursor is currently connected. */ WTPKT PKTDATA; /* a bit mask indicating the packet data items supported when this * cursor is connected. */ BYTE BUTTONS; /* the number of buttons on this cursor. */ BYTE BUTTONBITS; /* the number of bits of raw button data returned by the hardware.*/ DWORD cchBTNNAMES; WCHAR *BTNNAMES; /* a list of zero-terminated strings containing the names of the * cursor's buttons. The number of names in the list is the same as the * number of buttons on the cursor. The names are separated by a single * zero character; the list is terminated by two zero characters. */ BYTE BUTTONMAP[32]; /* a 32 byte array of logical button numbers, one for each physical * button. */ BYTE SYSBTNMAP[32]; /* a 32 byte array of button action codes, one for each logical * button. */ BYTE NPBUTTON; /* the physical button number of the button that is controlled by normal * pressure. */ UINT NPBTNMARKS[2]; /* an array of two UINTs, specifying the button marks for the normal * pressure button. The first UINT contains the release mark; the second * contains the press mark. */ UINT *NPRESPONSE; /* an array of UINTs describing the pressure response curve for normal * pressure. */ BYTE TPBUTTON; /* the physical button number of the button that is controlled by * tangential pressure. */ UINT TPBTNMARKS[2]; /* an array of two UINTs, specifying the button marks for the tangential * pressure button. The first UINT contains the release mark; the second * contains the press mark. */ UINT *TPRESPONSE; /* an array of UINTs describing the pressure response curve for * tangential pressure. */ DWORD PHYSID; /* a manufacturer-specific physical identifier for the cursor. This * value will distinguish the physical cursor from others on the same * device. This physical identifier allows applications to bind * functions to specific physical cursors, even if category numbers * change and multiple, otherwise identical, physical cursors are * present. */ UINT MODE; /* the cursor mode number of this cursor type, if this cursor type has * the CRC_MULTIMODE capability. */ UINT MINPKTDATA; /* the minimum set of data available from a physical cursor in this * cursor type, if this cursor type has the CRC_AGGREGATE capability. */ UINT MINBUTTONS; /* the minimum number of buttons of physical cursors in the cursor type, * if this cursor type has the CRC_AGGREGATE capability. */ UINT CAPABILITIES; /* flags indicating cursor capabilities, as defined below: CRC_MULTIMODE Indicates this cursor type describes one of several modes of a single physical cursor. Consecutive cursor type categories describe the modes; the CSR_MODE data item gives the mode number of each cursor type. CRC_AGGREGATE Indicates this cursor type describes several physical cursors that cannot be distinguished by software. CRC_INVERT Indicates this cursor type describes the physical cursor in its inverted orientation; the previous consecutive cursor type category describes the normal orientation. */ UINT TYPE; /* Manufacturer Unique id for the item type */ } WTI_CURSORS_INFO, *LPWTI_CURSORS_INFO; typedef struct tagWTI_DEVICES_INFO { WCHAR NAME[WT_MAX_NAME_LEN]; /* a displayable null- terminated string describing the device, * manufacturer, and revision level. */ UINT HARDWARE; /* flags indicating hardware and driver capabilities, as defined * below: HWC_INTEGRATED: Indicates that the display and digitizer share the same surface. HWC_TOUCH Indicates that the cursor must be in physical contact with the device to report position. HWC_HARDPROX Indicates that device can generate events when the cursor is entering and leaving the physical detection range. HWC_PHYSID_CURSORS Indicates that device can uniquely identify the active cursor in hardware. */ UINT NCSRTYPES; /* the number of supported cursor types.*/ UINT FIRSTCSR; /* the first cursor type number for the device. */ UINT PKTRATE; /* the maximum packet report rate in Hertz. */ WTPKT PKTDATA; /* a bit mask indicating which packet data items are always available.*/ WTPKT PKTMODE; /* a bit mask indicating which packet data items are physically * relative, i.e., items for which the hardware can only report change, * not absolute measurement. */ WTPKT CSRDATA; /* a bit mask indicating which packet data items are only available when * certain cursors are connected. The individual cursor descriptions * must be consulted to determine which cursors return which data. */ INT XMARGIN; INT YMARGIN; INT ZMARGIN; /* the size of tablet context margins in tablet native coordinates, in * the x, y, and z directions, respectively. */ AXIS X; AXIS Y; AXIS Z; /* the tablet's range and resolution capabilities, in the x, y, and z * axes, respectively. */ AXIS NPRESSURE; AXIS TPRESSURE; /* the tablet's range and resolution capabilities, for the normal and * tangential pressure inputs, respectively. */ AXIS ORIENTATION[3]; /* a 3-element array describing the tablet's orientation range and * resolution capabilities. */ AXIS ROTATION[3]; /* a 3-element array describing the tablet's rotation range and * resolution capabilities. */ WCHAR PNPID[WT_MAX_NAME_LEN]; /* a null-terminated string containing the devices Plug and Play ID.*/ } WTI_DEVICES_INFO, *LPWTI_DEVICES_INFO; /*********************************************************************** * WACOM WINTAB EXTENSIONS TO SUPPORT CSR_TYPE * In Wintab 1.2, a CSR_TYPE feature was added. This adds the * ability to return a type of cursor on a tablet. * Unfortunately, we cannot get the cursor type directly from X, * and it is not specified directly anywhere. So we virtualize * the type here. (This is unfortunate, the kernel module has * the exact type, but we have no way of getting that module to * pass us that type). * * Reference linuxwacom driver project wcmCommon.c function * idtotype for a much larger list of CSR_TYPE. * * http://linuxwacom.cvs.sourceforge.net/linuxwacom/linuxwacom-prod/src/xdrv/wcmCommon.c?view=markup * * The WTI_CURSORS_INFO.TYPE data is supposed to be used like this: * (cursor.TYPE & 0x0F06) == target_cursor_type * Reference: Section Unique ID * http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html */ #define CSR_TYPE_PEN 0x822 #define CSR_TYPE_ERASER 0x82a #define CSR_TYPE_MOUSE_2D 0x007 #define CSR_TYPE_MOUSE_4D 0x094 /* CSR_TYPE_OTHER is a special value! assumed no real world significance * if a stylus type or eraser type eventually have this value * it'll be a bug. As of 2008 05 21 we can be sure because * linux wacom lists all the known values and this isn't one of them */ #define CSR_TYPE_OTHER 0x000 typedef struct tagWTPACKET { HCTX pkContext; UINT pkStatus; LONG pkTime; WTPKT pkChanged; UINT pkSerialNumber; UINT pkCursor; DWORD pkButtons; DWORD pkX; DWORD pkY; DWORD pkZ; UINT pkNormalPressure; UINT pkTangentPressure; ORIENTATION pkOrientation; ROTATION pkRotation; /* 1.1 */ } WTPACKET, *LPWTPACKET; #ifdef SONAME_LIBXI #include <X11/Xlib.h> #include <X11/extensions/XInput.h> static int motion_type; static int button_press_type; static int button_release_type; static int key_press_type; static int key_release_type; static int proximity_in_type; static int proximity_out_type; static HWND hwndTabletDefault; static WTPACKET gMsgPacket; static DWORD gSerial; static WTPACKET last_packet; /* Reference: http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html * * Cursors come in sets of 3 normally * Cursor #0 = puck device 1 * Cursor #1 = stylus device 1 * Cursor #2 = eraser device 1 * Cursor #3 = puck device 2 * Cursor #4 = stylus device 2 * Cursor #5 = eraser device 2 * etc.... * * A dual tracking/multimode tablet is one * that supports 2 independent cursors of the same or * different types simultaneously on a single tablet. * This makes our cursor layout potentially like this * Cursor #0 = puck 1 device 1 * Cursor #1 = stylus 1 device 1 * Cursor #2 = eraser 1 device 1 * Cursor #3 = puck 2 device 1 * Cursor #4 = stylus 2 device 1 * Cursor #5 = eraser 2 device 1 * Cursor #6 = puck 1 device 2 * etc..... * * So with multimode tablets we could potentially need * 2 slots of the same type per tablet i.e. * you are using 2 styluses at once so they would * get placed in Cursors #1 and Cursor #4 * * Now say someone has 2 multimode tablets with 2 erasers each * now we would need Cursor #2, #5, #8, #11 * So to support that we need CURSORMAX of 12 (0 to 11) * FIXME: we don't support more than 4 regular tablets or 2 multimode tablets */ #define CURSORMAX 12 static INT button_state[CURSORMAX]; static LOGCONTEXTW gSysContext; static WTI_DEVICES_INFO gSysDevice; static WTI_CURSORS_INFO gSysCursor[CURSORMAX]; static INT gNumCursors; /* do NOT use this to iterate through gSysCursor slots */ /* XInput stuff */ static void *xinput_handle; #define MAKE_FUNCPTR(f) static typeof(f) * p##f; MAKE_FUNCPTR(XListInputDevices) MAKE_FUNCPTR(XFreeDeviceList) MAKE_FUNCPTR(XOpenDevice) MAKE_FUNCPTR(XQueryDeviceState) MAKE_FUNCPTR(XGetDeviceButtonMapping) MAKE_FUNCPTR(XCloseDevice) MAKE_FUNCPTR(XSelectExtensionEvent) MAKE_FUNCPTR(XFreeDeviceState) #undef MAKE_FUNCPTR static INT X11DRV_XInput_Init(void) { xinput_handle = dlopen(SONAME_LIBXI, RTLD_NOW); if (xinput_handle) { #define LOAD_FUNCPTR(f) if((p##f = dlsym(xinput_handle, #f)) == NULL) goto sym_not_found LOAD_FUNCPTR(XListInputDevices); LOAD_FUNCPTR(XFreeDeviceList); LOAD_FUNCPTR(XOpenDevice); LOAD_FUNCPTR(XGetDeviceButtonMapping); LOAD_FUNCPTR(XCloseDevice); LOAD_FUNCPTR(XSelectExtensionEvent); LOAD_FUNCPTR(XQueryDeviceState); LOAD_FUNCPTR(XFreeDeviceState); #undef LOAD_FUNCPTR return 1; } sym_not_found: return 0; } static int Tablet_ErrorHandler(Display *dpy, XErrorEvent *event, void* arg) { return 1; } static void trace_axes(XValuatorInfoPtr val) { int i; XAxisInfoPtr axis; for (i = 0, axis = val->axes ; i < val->num_axes; i++, axis++) TRACE(" Axis %d: [resolution %d|min_value %d|max_value %d]\n", i, axis->resolution, axis->min_value, axis->max_value); } static BOOL match_token(const char *haystack, const char *needle) { const char *p, *q; for (p = haystack; *p; ) { while (*p && isspace(*p)) p++; if (! *p) break; for (q = needle; *q && *p && tolower(*p) == tolower(*q); q++) p++; if (! *q && (isspace(*p) || !*p)) return TRUE; while (*p && ! isspace(*p)) p++; } return FALSE; } /* Determining if an X device is a Tablet style device is an imperfect science. ** We rely on common conventions around device names as well as the type reported ** by Wacom tablets. This code will likely need to be expanded for alternate tablet types ** ** Wintab refers to any device that interacts with the tablet as a cursor, ** (stylus, eraser, tablet mouse, airbrush, etc) ** this is not to be confused with wacom x11 configuration "cursor" device. ** Wacoms x11 config "cursor" refers to its device slot (which we mirror with ** our gSysCursors) for puck like devices (tablet mice essentially). */ static BOOL is_tablet_cursor(const char *name, const char *type) { int i; static const char *tablet_cursor_allowlist[] = { "wacom", "wizardpen", "acecad", "tablet", "cursor", "stylus", "eraser", "pad", NULL }; for (i=0; tablet_cursor_allowlist[i] != NULL; i++) { if (name && match_token(name, tablet_cursor_allowlist[i])) return TRUE; if (type && match_token(type, tablet_cursor_allowlist[i])) return TRUE; } return FALSE; } static UINT get_cursor_type(const char *name, const char *type) { int i; static const char* tablet_stylus_allowlist[] = { "stylus", "wizardpen", "acecad", "pen", NULL }; /* First check device type to avoid cases where name is "Pen and Eraser" and type is "ERASER" */ for (i=0; tablet_stylus_allowlist[i] != NULL; i++) { if (type && match_token(type, tablet_stylus_allowlist[i])) return CSR_TYPE_PEN; } if (type && match_token(type, "eraser")) return CSR_TYPE_ERASER; for (i=0; tablet_stylus_allowlist[i] != NULL; i++) { if (name && match_token(name, tablet_stylus_allowlist[i])) return CSR_TYPE_PEN; } if (name && match_token(name, "eraser")) return CSR_TYPE_ERASER; return CSR_TYPE_OTHER; } /* cursors are placed in gSysCursor rows depending on their type * see CURSORMAX comments for more detail */ static BOOL add_system_cursor(LPWTI_CURSORS_INFO cursor) { UINT offset = 0; if (cursor->TYPE == CSR_TYPE_PEN) offset = 1; else if (cursor->TYPE == CSR_TYPE_ERASER) offset = 2; for (; offset < CURSORMAX; offset += 3) { if (!gSysCursor[offset].ACTIVE) { gSysCursor[offset] = *cursor; ++gNumCursors; return TRUE; } } return FALSE; } static void disable_system_cursors(void) { UINT i; for (i = 0; i < CURSORMAX; ++i) { gSysCursor[i].ACTIVE = 0; } gNumCursors = 0; } /*********************************************************************** * X11DRV_LoadTabletInfo (X11DRV.@) */ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) { static const WCHAR SZ_CONTEXT_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0}; static const WCHAR SZ_DEVICE_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','D','e','v','i','c','e',0}; static const WCHAR SZ_NON_PLUG_N_PLAY[] = {'n','o','n','-','p','l','u','g','-','n','-','p','l','a','y',0}; struct x11drv_thread_data *data = x11drv_init_thread_data(); int num_devices; int loop; XDeviceInfo *devices; XDeviceInfo *target = NULL; BOOL axis_read_complete= FALSE; XAnyClassPtr any; XButtonInfoPtr Button; XValuatorInfoPtr Val; XAxisInfoPtr Axis; XDevice *opendevice; if (!X11DRV_XInput_Init()) { ERR("Unable to initialize the XInput library.\n"); return FALSE; } hwndTabletDefault = hwnddefault; /* Do base initialization */ strcpyW(gSysContext.lcName, SZ_CONTEXT_NAME); strcpyW(gSysDevice.NAME, SZ_DEVICE_NAME); gSysContext.lcOptions = CXO_SYSTEM; gSysContext.lcLocks = CXL_INSIZE | CXL_INASPECT | CXL_MARGIN | CXL_SENSITIVITY | CXL_SYSOUT; gSysContext.lcMsgBase= WT_DEFBASE; gSysContext.lcDevice = 0; gSysContext.lcPktData = PK_CONTEXT | PK_STATUS | PK_SERIAL_NUMBER| PK_TIME | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION; gSysContext.lcMoveMask= PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION; gSysContext.lcStatus = CXS_ONTOP; gSysContext.lcPktRate = 100; gSysContext.lcBtnDnMask = 0xffffffff; gSysContext.lcBtnUpMask = 0xffffffff; gSysContext.lcSensX = 65536; gSysContext.lcSensY = 65536; gSysContext.lcSensX = 65536; gSysContext.lcSensZ = 65536; gSysContext.lcSysSensX= 65536; gSysContext.lcSysSensY= 65536; gSysContext.lcSysExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN); gSysContext.lcSysExtY = GetSystemMetrics(SM_CYVIRTUALSCREEN); /* initialize cursors */ disable_system_cursors(); /* Device Defaults */ gSysDevice.HARDWARE = HWC_HARDPROX|HWC_PHYSID_CURSORS; gSysDevice.FIRSTCSR= 0; gSysDevice.PKTRATE = 100; gSysDevice.PKTDATA = PK_CONTEXT | PK_STATUS | PK_SERIAL_NUMBER| PK_TIME | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION; strcpyW(gSysDevice.PNPID, SZ_NON_PLUG_N_PLAY); devices = pXListInputDevices(data->display, &num_devices); if (!devices) { WARN("XInput Extensions reported as not available\n"); return FALSE; } TRACE("XListInputDevices reports %d devices\n", num_devices); for (loop=0; loop < num_devices; loop++) { int class_loop; char *device_type = devices[loop].type ? XGetAtomName(data->display, devices[loop].type) : NULL; WTI_CURSORS_INFO cursor; TRACE("Device %i: [id %d|name %s|type %s|num_classes %d|use %d]\n", loop, (int) devices[loop].id, devices[loop].name, debugstr_a(device_type), devices[loop].num_classes, devices[loop].use ); switch (devices[loop].use) { case IsXExtensionDevice: #ifdef IsXExtensionPointer case IsXExtensionPointer: #endif #ifdef IsXExtensionKeyboard case IsXExtensionKeyboard: #endif TRACE("Is XExtension: Device, Keyboard, or Pointer\n"); target = &devices[loop]; if (strlen(target->name) >= WT_MAX_NAME_LEN) { ERR("Input device '%s' name too long - skipping\n", wine_dbgstr_a(target->name)); break; } X11DRV_expect_error(data->display, Tablet_ErrorHandler, NULL); opendevice = pXOpenDevice(data->display,target->id); if (!X11DRV_check_error() && opendevice) { unsigned char map[32]; int i; int shft = 0; X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL); cursor.BUTTONS = pXGetDeviceButtonMapping(data->display, opendevice, map, 32); if (X11DRV_check_error() || cursor.BUTTONS <= 0) { TRACE("No buttons, Non Tablet Device\n"); pXCloseDevice(data->display, opendevice); break; } for (i=0; i< cursor.BUTTONS; i++,shft++) { cursor.BUTTONMAP[i] = map[i]; cursor.SYSBTNMAP[i] = (1<<shft); } pXCloseDevice(data->display, opendevice); } else { WARN("Unable to open device %s\n",target->name); break; } MultiByteToWideChar(CP_UNIXCP, 0, target->name, -1, cursor.NAME, WT_MAX_NAME_LEN); if (! is_tablet_cursor(target->name, device_type)) { WARN("Skipping device %d [name %s|type %s]; not apparently a tablet cursor type device\n", loop, devices[loop].name, debugstr_a(device_type)); break; } cursor.ACTIVE = 1; cursor.PKTDATA = PK_TIME | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ORIENTATION; cursor.PHYSID = target->id; cursor.NPBUTTON = 1; cursor.NPBTNMARKS[0] = 0 ; cursor.NPBTNMARKS[1] = 1 ; cursor.CAPABILITIES = CRC_MULTIMODE; cursor.TYPE = get_cursor_type(target->name, device_type); any = target->inputclassinfo; for (class_loop = 0; class_loop < target->num_classes; class_loop++) { switch (any->class) { case ValuatorClass: Val = (XValuatorInfoPtr) any; TRACE(" ValidatorInput %d: [class %d|length %d|num_axes %d|mode %d|motion_buffer %ld]\n", class_loop, (int) Val->class, Val->length, Val->num_axes, Val->mode, Val->motion_buffer); if (TRACE_ON(wintab32)) trace_axes(Val); /* FIXME: This is imperfect; we compute our devices capabilities based upon the ** first pen type device we find. However, a more correct implementation ** would require acquiring a wide variety of tablets and running through ** the various inputs to see what the values are. Odds are that a ** more 'correct' algorithm would condense to this one anyway. */ if (!axis_read_complete && cursor.TYPE == CSR_TYPE_PEN) { Axis = (XAxisInfoPtr) ((char *) Val + sizeof (XValuatorInfo)); if (Val->num_axes>=1) { /* Axis 1 is X */ gSysDevice.X.axMin = Axis->min_value; gSysDevice.X.axMax= Axis->max_value; gSysDevice.X.axUnits = TU_INCHES; gSysDevice.X.axResolution = Axis->resolution; gSysContext.lcInOrgX = Axis->min_value; gSysContext.lcOutOrgX = Axis->min_value; gSysContext.lcInExtX = Axis->max_value; gSysContext.lcOutExtX = Axis->max_value; Axis++; } if (Val->num_axes>=2) { /* Axis 2 is Y */ gSysDevice.Y.axMin = Axis->min_value; gSysDevice.Y.axMax= Axis->max_value; gSysDevice.Y.axUnits = TU_INCHES; gSysDevice.Y.axResolution = Axis->resolution; gSysContext.lcInOrgY = Axis->min_value; gSysContext.lcOutOrgY = Axis->min_value; gSysContext.lcInExtY = Axis->max_value; gSysContext.lcOutExtY = Axis->max_value; Axis++; } if (Val->num_axes>=3) { /* Axis 3 is Normal Pressure */ gSysDevice.NPRESSURE.axMin = Axis->min_value; gSysDevice.NPRESSURE.axMax= Axis->max_value; gSysDevice.NPRESSURE.axUnits = TU_INCHES; gSysDevice.NPRESSURE.axResolution = Axis->resolution; Axis++; } if (Val->num_axes >= 5) { /* Axis 4 and 5 are X and Y tilt */ XAxisInfoPtr XAxis = Axis; Axis++; if (max (abs(Axis->max_value), abs(XAxis->max_value))) { gSysDevice.ORIENTATION[0].axMin = 0; gSysDevice.ORIENTATION[0].axMax = 3600; gSysDevice.ORIENTATION[0].axUnits = TU_CIRCLE; gSysDevice.ORIENTATION[0].axResolution = CASTFIX32(3600); gSysDevice.ORIENTATION[1].axMin = -1000; gSysDevice.ORIENTATION[1].axMax = 1000; gSysDevice.ORIENTATION[1].axUnits = TU_CIRCLE; gSysDevice.ORIENTATION[1].axResolution = CASTFIX32(3600); gSysDevice.ORIENTATION[2].axMin = 0; gSysDevice.ORIENTATION[2].axMax = 3600; gSysDevice.ORIENTATION[2].axUnits = TU_CIRCLE; gSysDevice.ORIENTATION[2].axResolution = CASTFIX32(3600); Axis++; } } axis_read_complete = TRUE; } break; case ButtonClass: { int cchBuf = 512; int cchPos = 0; int i; Button = (XButtonInfoPtr) any; TRACE(" ButtonInput %d: [class %d|length %d|num_buttons %d]\n", class_loop, (int) Button->class, Button->length, Button->num_buttons); cursor.BTNNAMES = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*cchBuf); for (i = 0; i < cursor.BUTTONS; i++) { /* FIXME - these names are probably incorrect */ int cch = strlenW(cursor.NAME) + 1; while (cch > cchBuf - cchPos - 1) /* we want one extra byte for the last NUL */ { cchBuf *= 2; cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchBuf); } strcpyW(cursor.BTNNAMES + cchPos, cursor.NAME); cchPos += cch; } cursor.BTNNAMES[cchPos++] = 0; cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchPos); cursor.cchBTNNAMES = cchPos; } break; } /* switch any->class */ any = (XAnyClassPtr) ((char*) any + any->length); } /* for class_loop */ if (!add_system_cursor(&cursor)) FIXME("Skipping this cursor due to lack of system cursor slots.\n"); break; } /* switch devices.use */ XFree(device_type); } /* for XListInputDevices */ pXFreeDeviceList(devices); if (!axis_read_complete) { disable_system_cursors(); WARN("Did not find a valid stylus, unable to determine system context parameters. Wintab is disabled.\n"); return FALSE; } gSysDevice.NCSRTYPES = gNumCursors; return TRUE; } static int figure_deg(int x, int y) { float angle; angle = atan2((float)y, (float)x); angle += M_PI_2; if (angle <= 0) angle += 2 * M_PI; return (0.5 + (angle * 1800.0 / M_PI)); } static int get_button_state(int curnum) { return button_state[curnum]; } static void set_button_state(int curnum, XID deviceid) { struct x11drv_thread_data *data = x11drv_thread_data(); XDevice *device; XDeviceState *state; XInputClass *class; int loop; int rc = 0; device = pXOpenDevice(data->display,deviceid); state = pXQueryDeviceState(data->display,device); if (state) { class = state->data; for (loop = 0; loop < state->num_classes; loop++) { if (class->class == ButtonClass) { int loop2; XButtonState *button_state = (XButtonState*)class; for (loop2 = 0; loop2 < button_state->num_buttons; loop2++) { if (button_state->buttons[loop2 / 8] & (1 << (loop2 % 8))) { rc |= (1<<loop2); } } } class = (XInputClass *) ((char *) class + class->length); } } pXFreeDeviceState(state); button_state[curnum] = rc; } static int cursor_from_device(DWORD deviceid, LPWTI_CURSORS_INFO *cursorp) { int i; for (i = 0; i < CURSORMAX; i++) if (gSysCursor[i].ACTIVE && gSysCursor[i].PHYSID == deviceid) { *cursorp = &gSysCursor[i]; return i; } ERR("Could not map device id %d to a cursor\n", (int) deviceid); return -1; } static DWORD get_changed_state( WTPACKET *pkt) { DWORD change = 0; if (pkt->pkX != last_packet.pkX) change |= PK_X; if (pkt->pkY != last_packet.pkY) change |= PK_Y; if (pkt->pkZ != last_packet.pkZ) change |= PK_Z; if (pkt->pkSerialNumber != last_packet.pkSerialNumber) change |= PK_SERIAL_NUMBER; if (pkt->pkTime != last_packet.pkTime) change |= PK_TIME; if (pkt->pkNormalPressure != last_packet.pkNormalPressure) change |= PK_NORMAL_PRESSURE; if (pkt->pkTangentPressure != last_packet.pkTangentPressure) change |= PK_TANGENT_PRESSURE; if (pkt->pkCursor != last_packet.pkCursor) change |= PK_CURSOR; if (pkt->pkButtons != last_packet.pkButtons) change |= PK_BUTTONS; if (pkt->pkOrientation.orAzimuth != last_packet.pkOrientation.orAzimuth || pkt->pkOrientation.orAltitude != last_packet.pkOrientation.orAltitude || pkt->pkOrientation.orTwist != last_packet.pkOrientation.orTwist) change |= PK_ORIENTATION; if (pkt->pkRotation.roPitch != last_packet.pkRotation.roPitch || pkt->pkRotation.roRoll != last_packet.pkRotation.roRoll || pkt->pkRotation.roYaw != last_packet.pkRotation.roYaw) change |= PK_ROTATION; return change; } static BOOL motion_event( HWND hwnd, XEvent *event ) { XDeviceMotionEvent *motion = (XDeviceMotionEvent *)event; LPWTI_CURSORS_INFO cursor; int curnum = cursor_from_device(motion->deviceid, &cursor); if (curnum < 0) return FALSE; memset(&gMsgPacket,0,sizeof(WTPACKET)); TRACE("Received tablet motion event (%p); device id %d, cursor num %d\n",hwnd, (int) motion->deviceid, curnum); /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(motion->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; gMsgPacket.pkX = motion->axis_data[0]; gMsgPacket.pkY = motion->axis_data[1]; gMsgPacket.pkOrientation.orAzimuth = figure_deg(motion->axis_data[3],motion->axis_data[4]); gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max (abs(motion->axis_data[3]), abs(motion->axis_data[4]))) * (gMsgPacket.pkStatus & TPS_INVERT?-1:1)); gMsgPacket.pkNormalPressure = motion->axis_data[2]; gMsgPacket.pkButtons = get_button_state(curnum); gMsgPacket.pkChanged = get_changed_state(&gMsgPacket); SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd); last_packet = gMsgPacket; return TRUE; } static BOOL button_event( HWND hwnd, XEvent *event ) { XDeviceButtonEvent *button = (XDeviceButtonEvent *) event; LPWTI_CURSORS_INFO cursor; int curnum = cursor_from_device(button->deviceid, &cursor); if (curnum < 0) return FALSE; memset(&gMsgPacket,0,sizeof(WTPACKET)); TRACE("Received tablet button %s event\n", (event->type == button_press_type)?"press":"release"); /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); set_button_state(curnum, button->deviceid); gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(button->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; if (button->axes_count > 0) { gMsgPacket.pkX = button->axis_data[0]; gMsgPacket.pkY = button->axis_data[1]; gMsgPacket.pkOrientation.orAzimuth = figure_deg(button->axis_data[3],button->axis_data[4]); gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max(abs(button->axis_data[3]), abs(button->axis_data[4]))) * (gMsgPacket.pkStatus & TPS_INVERT?-1:1)); gMsgPacket.pkNormalPressure = button->axis_data[2]; } else { gMsgPacket.pkX = last_packet.pkX; gMsgPacket.pkY = last_packet.pkY; gMsgPacket.pkOrientation = last_packet.pkOrientation; gMsgPacket.pkNormalPressure = last_packet.pkNormalPressure; } gMsgPacket.pkButtons = get_button_state(curnum); gMsgPacket.pkChanged = get_changed_state(&gMsgPacket); SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd); last_packet = gMsgPacket; return TRUE; } static BOOL key_event( HWND hwnd, XEvent *event ) { if (event->type == key_press_type) FIXME("Received tablet key press event\n"); else FIXME("Received tablet key release event\n"); return FALSE; } static BOOL proximity_event( HWND hwnd, XEvent *event ) { XProximityNotifyEvent *proximity = (XProximityNotifyEvent *) event; LPWTI_CURSORS_INFO cursor; int curnum = cursor_from_device(proximity->deviceid, &cursor); LPARAM proximity_info; TRACE("hwnd=%p\n", hwnd); if (curnum < 0) return FALSE; memset(&gMsgPacket,0,sizeof(WTPACKET)); /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); gMsgPacket.pkStatus |= (event->type==proximity_out_type)?TPS_PROXIMITY:0; gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(proximity->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; gMsgPacket.pkX = proximity->axis_data[0]; gMsgPacket.pkY = proximity->axis_data[1]; gMsgPacket.pkOrientation.orAzimuth = figure_deg(proximity->axis_data[3],proximity->axis_data[4]); gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max(abs(proximity->axis_data[3]), abs(proximity->axis_data[4]))) * (gMsgPacket.pkStatus & TPS_INVERT?-1:1)); gMsgPacket.pkNormalPressure = proximity->axis_data[2]; gMsgPacket.pkButtons = get_button_state(curnum); /* FIXME: LPARAM loword is true when cursor entering context, false when leaving context * This needs to be handled here or in wintab32. Using the proximity_in_type is not correct * but kept for now. * LPARAM hiword is "non-zero when the cursor is leaving or entering hardware proximity" * WPARAM contains context handle. * HWND to HCTX is handled by wintab32. */ proximity_info = MAKELPARAM((event->type == proximity_in_type), (event->type == proximity_in_type) || (event->type == proximity_out_type)); SendMessageW(hwndTabletDefault, WT_PROXIMITY, (WPARAM)hwnd, proximity_info); return TRUE; } /*********************************************************************** * X11DRV_AttachEventQueueToTablet (X11DRV.@) */ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) { struct x11drv_thread_data *data = x11drv_init_thread_data(); int num_devices; int loop; int cur_loop; XDeviceInfo *devices; XDeviceInfo *target = NULL; XDevice *the_device; XEventClass event_list[7]; Window win = X11DRV_get_whole_window( hOwner ); if (!win || !xinput_handle) return 0; TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors); devices = pXListInputDevices(data->display, &num_devices); X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL); for (cur_loop=0; cur_loop < CURSORMAX; cur_loop++) { char cursorNameA[WT_MAX_NAME_LEN]; int event_number=0; if (!gSysCursor[cur_loop].ACTIVE) continue; /* the cursor name fits in the buffer because too long names are skipped */ WideCharToMultiByte(CP_UNIXCP, 0, gSysCursor[cur_loop].NAME, -1, cursorNameA, WT_MAX_NAME_LEN, NULL, NULL); for (loop=0; loop < num_devices; loop ++) if (strcmp(devices[loop].name, cursorNameA) == 0) target = &devices[loop]; if (!target) { WARN("Cursor Name %s not found in list of targets.\n", cursorNameA); continue; } TRACE("Opening cursor %i id %i\n",cur_loop,(INT)target->id); the_device = pXOpenDevice(data->display, target->id); if (!the_device) { WARN("Unable to Open device\n"); continue; } if (the_device->num_classes > 0) { DeviceKeyPress(the_device, key_press_type, event_list[event_number]); if (key_press_type) event_number++; DeviceKeyRelease(the_device, key_release_type, event_list[event_number]); if (key_release_type) event_number++; DeviceButtonPress(the_device, button_press_type, event_list[event_number]); if (button_press_type) event_number++; DeviceButtonRelease(the_device, button_release_type, event_list[event_number]); if (button_release_type) event_number++; DeviceMotionNotify(the_device, motion_type, event_list[event_number]); if (motion_type) event_number++; ProximityIn(the_device, proximity_in_type, event_list[event_number]); if (proximity_in_type) event_number++; ProximityOut(the_device, proximity_out_type, event_list[event_number]); if (proximity_out_type) event_number++; if (key_press_type) X11DRV_register_event_handler( key_press_type, key_event, "XInput KeyPress" ); if (key_release_type) X11DRV_register_event_handler( key_release_type, key_event, "XInput KeyRelease" ); if (button_press_type) X11DRV_register_event_handler( button_press_type, button_event, "XInput ButtonPress" ); if (button_release_type) X11DRV_register_event_handler( button_release_type, button_event, "XInput ButtonRelease" ); if (motion_type) X11DRV_register_event_handler( motion_type, motion_event, "XInput MotionNotify" ); if (proximity_in_type) X11DRV_register_event_handler( proximity_in_type, proximity_event, "XInput ProximityIn" ); if (proximity_out_type) X11DRV_register_event_handler( proximity_out_type, proximity_event, "XInput ProximityOut" ); pXSelectExtensionEvent(data->display, win, event_list, event_number); } } XSync(data->display, False); X11DRV_check_error(); if (NULL != devices) pXFreeDeviceList(devices); return 0; } /*********************************************************************** * X11DRV_GetCurrentPacket (X11DRV.@) */ int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) { *packet = gMsgPacket; return 1; } static inline int CopyTabletData(LPVOID target, LPCVOID src, INT size) { /* * It is valid to call CopyTabletData with NULL. * This handles the WTInfo() case where lpOutput is null. */ if(target != NULL) memcpy(target,src,size); return(size); } /*********************************************************************** * X11DRV_WTInfoW (X11DRV.@) */ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) { /* * It is valid to call WTInfoA with lpOutput == NULL, as per standard. * lpOutput == NULL signifies the user only wishes * to find the size of the data. * NOTE: * From now on use CopyTabletData to fill lpOutput. memcpy will break * the code. */ int rc = 0; LPWTI_CURSORS_INFO tgtcursor; TRACE("(%u, %u, %p)\n", wCategory, nIndex, lpOutput); if (!xinput_handle) return 0; switch(wCategory) { case 0: /* return largest necessary buffer */ TRACE("%i cursors\n",gNumCursors); if (gNumCursors>0) { FIXME("Return proper size\n"); rc = 200; } break; case WTI_INTERFACE: switch (nIndex) { WORD version; UINT num; case IFC_WINTABID: { static const WCHAR driver[] = {'W','i','n','e',' ','W','i','n','t','a','b',' ','1','.','1',0}; rc = CopyTabletData(lpOutput, driver, (strlenW(driver) + 1) * sizeof(WCHAR)); break; } case IFC_SPECVERSION: version = (0x01) | (0x01 << 8); rc = CopyTabletData(lpOutput, &version,sizeof(WORD)); break; case IFC_IMPLVERSION: version = (0x00) | (0x01 << 8); rc = CopyTabletData(lpOutput, &version,sizeof(WORD)); break; case IFC_NDEVICES: num = 1; rc = CopyTabletData(lpOutput, &num,sizeof(num)); break; case IFC_NCURSORS: num = gNumCursors; rc = CopyTabletData(lpOutput, &num,sizeof(num)); break; default: FIXME("WTI_INTERFACE unhandled index %i\n",nIndex); rc = 0; } break; case WTI_DEFSYSCTX: case WTI_DDCTXS: case WTI_DEFCONTEXT: switch (nIndex) { case 0: /* report 0 if wintab is disabled */ if (0 == gNumCursors) rc = 0; else rc = CopyTabletData(lpOutput, &gSysContext, sizeof(LOGCONTEXTW)); break; case CTX_NAME: rc = CopyTabletData(lpOutput, gSysContext.lcName, (strlenW(gSysContext.lcName)+1) * sizeof(WCHAR)); break; case CTX_OPTIONS: rc = CopyTabletData(lpOutput, &gSysContext.lcOptions, sizeof(UINT)); break; case CTX_STATUS: rc = CopyTabletData(lpOutput, &gSysContext.lcStatus, sizeof(UINT)); break; case CTX_LOCKS: rc= CopyTabletData (lpOutput, &gSysContext.lcLocks, sizeof(UINT)); break; case CTX_MSGBASE: rc = CopyTabletData(lpOutput, &gSysContext.lcMsgBase, sizeof(UINT)); break; case CTX_DEVICE: rc = CopyTabletData(lpOutput, &gSysContext.lcDevice, sizeof(UINT)); break; case CTX_PKTRATE: rc = CopyTabletData(lpOutput, &gSysContext.lcPktRate, sizeof(UINT)); break; case CTX_PKTDATA: rc = CopyTabletData(lpOutput, &gSysContext.lcPktData, sizeof(WTPKT)); break; case CTX_PKTMODE: rc = CopyTabletData(lpOutput, &gSysContext.lcPktMode, sizeof(WTPKT)); break; case CTX_MOVEMASK: rc = CopyTabletData(lpOutput, &gSysContext.lcMoveMask, sizeof(WTPKT)); break; case CTX_BTNDNMASK: rc = CopyTabletData(lpOutput, &gSysContext.lcBtnDnMask, sizeof(DWORD)); break; case CTX_BTNUPMASK: rc = CopyTabletData(lpOutput, &gSysContext.lcBtnUpMask, sizeof(DWORD)); break; case CTX_INORGX: rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgX, sizeof(LONG)); break; case CTX_INORGY: rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgY, sizeof(LONG)); break; case CTX_INORGZ: rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgZ, sizeof(LONG)); break; case CTX_INEXTX: rc = CopyTabletData(lpOutput, &gSysContext.lcInExtX, sizeof(LONG)); break; case CTX_INEXTY: rc = CopyTabletData(lpOutput, &gSysContext.lcInExtY, sizeof(LONG)); break; case CTX_INEXTZ: rc = CopyTabletData(lpOutput, &gSysContext.lcInExtZ, sizeof(LONG)); break; case CTX_OUTORGX: rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgX, sizeof(LONG)); break; case CTX_OUTORGY: rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgY, sizeof(LONG)); break; case CTX_OUTORGZ: rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgZ, sizeof(LONG)); break; case CTX_OUTEXTX: rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtX, sizeof(LONG)); break; case CTX_OUTEXTY: rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtY, sizeof(LONG)); break; case CTX_OUTEXTZ: rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtZ, sizeof(LONG)); break; case CTX_SENSX: rc = CopyTabletData(lpOutput, &gSysContext.lcSensX, sizeof(LONG)); break; case CTX_SENSY: rc = CopyTabletData(lpOutput, &gSysContext.lcSensY, sizeof(LONG)); break; case CTX_SENSZ: rc = CopyTabletData(lpOutput, &gSysContext.lcSensZ, sizeof(LONG)); break; case CTX_SYSMODE: rc = CopyTabletData(lpOutput, &gSysContext.lcSysMode, sizeof(LONG)); break; case CTX_SYSORGX: rc = CopyTabletData(lpOutput, &gSysContext.lcSysOrgX, sizeof(LONG)); break; case CTX_SYSORGY: rc = CopyTabletData(lpOutput, &gSysContext.lcSysOrgY, sizeof(LONG)); break; case CTX_SYSEXTX: rc = CopyTabletData(lpOutput, &gSysContext.lcSysExtX, sizeof(LONG)); break; case CTX_SYSEXTY: rc = CopyTabletData(lpOutput, &gSysContext.lcSysExtY, sizeof(LONG)); break; case CTX_SYSSENSX: rc = CopyTabletData(lpOutput, &gSysContext.lcSysSensX, sizeof(LONG)); break; case CTX_SYSSENSY: rc = CopyTabletData(lpOutput, &gSysContext.lcSysSensY, sizeof(LONG)); break; default: FIXME("WTI_DEFSYSCTX unhandled index %i\n",nIndex); rc = 0; } break; case WTI_CURSORS: case WTI_CURSORS+1: case WTI_CURSORS+2: case WTI_CURSORS+3: case WTI_CURSORS+4: case WTI_CURSORS+5: case WTI_CURSORS+6: case WTI_CURSORS+7: case WTI_CURSORS+8: case WTI_CURSORS+9: case WTI_CURSORS+10: case WTI_CURSORS+11: /* CURSORMAX == 12 */ /* FIXME: dynamic cursor support */ /* Apps will poll different slots to detect what cursors are available * if there isn't a cursor for this slot return 0 */ if (!gSysCursor[wCategory - WTI_CURSORS].ACTIVE) rc = 0; else { tgtcursor = &gSysCursor[wCategory - WTI_CURSORS]; switch (nIndex) { case CSR_NAME: rc = CopyTabletData(lpOutput, tgtcursor->NAME, (strlenW(tgtcursor->NAME)+1) * sizeof(WCHAR)); break; case CSR_ACTIVE: rc = CopyTabletData(lpOutput,&tgtcursor->ACTIVE, sizeof(BOOL)); break; case CSR_PKTDATA: rc = CopyTabletData(lpOutput,&tgtcursor->PKTDATA, sizeof(WTPKT)); break; case CSR_BUTTONS: rc = CopyTabletData(lpOutput,&tgtcursor->BUTTONS, sizeof(BYTE)); break; case CSR_BUTTONBITS: rc = CopyTabletData(lpOutput,&tgtcursor->BUTTONBITS, sizeof(BYTE)); break; case CSR_BTNNAMES: FIXME("Button Names not returned correctly\n"); rc = CopyTabletData(lpOutput,&tgtcursor->BTNNAMES, tgtcursor->cchBTNNAMES*sizeof(WCHAR)); break; case CSR_BUTTONMAP: rc = CopyTabletData(lpOutput,tgtcursor->BUTTONMAP, sizeof(BYTE)*32); break; case CSR_SYSBTNMAP: rc = CopyTabletData(lpOutput,tgtcursor->SYSBTNMAP, sizeof(BYTE)*32); break; case CSR_NPBTNMARKS: rc = CopyTabletData(lpOutput,tgtcursor->NPBTNMARKS, sizeof(UINT)*2); break; case CSR_NPBUTTON: rc = CopyTabletData(lpOutput,&tgtcursor->NPBUTTON, sizeof(BYTE)); break; case CSR_NPRESPONSE: FIXME("Not returning CSR_NPRESPONSE correctly\n"); rc = 0; break; case CSR_TPBUTTON: rc = CopyTabletData(lpOutput,&tgtcursor->TPBUTTON, sizeof(BYTE)); break; case CSR_TPBTNMARKS: rc = CopyTabletData(lpOutput,tgtcursor->TPBTNMARKS, sizeof(UINT)*2); break; case CSR_TPRESPONSE: FIXME("Not returning CSR_TPRESPONSE correctly\n"); rc = 0; break; case CSR_PHYSID: { DWORD id; id = tgtcursor->PHYSID; rc = CopyTabletData(lpOutput,&id,sizeof(DWORD)); } break; case CSR_MODE: rc = CopyTabletData(lpOutput,&tgtcursor->MODE,sizeof(UINT)); break; case CSR_MINPKTDATA: rc = CopyTabletData(lpOutput,&tgtcursor->MINPKTDATA, sizeof(UINT)); break; case CSR_MINBUTTONS: rc = CopyTabletData(lpOutput,&tgtcursor->MINBUTTONS, sizeof(UINT)); break; case CSR_CAPABILITIES: rc = CopyTabletData(lpOutput,&tgtcursor->CAPABILITIES, sizeof(UINT)); break; case CSR_TYPE: rc = CopyTabletData(lpOutput,&tgtcursor->TYPE, sizeof(UINT)); break; default: FIXME("WTI_CURSORS unhandled index %i\n",nIndex); rc = 0; } } break; case WTI_DEVICES: switch (nIndex) { case DVC_NAME: rc = CopyTabletData(lpOutput,gSysDevice.NAME, (strlenW(gSysDevice.NAME)+1) * sizeof(WCHAR)); break; case DVC_HARDWARE: rc = CopyTabletData(lpOutput,&gSysDevice.HARDWARE, sizeof(UINT)); break; case DVC_NCSRTYPES: rc = CopyTabletData(lpOutput,&gSysDevice.NCSRTYPES, sizeof(UINT)); break; case DVC_FIRSTCSR: rc = CopyTabletData(lpOutput,&gSysDevice.FIRSTCSR, sizeof(UINT)); break; case DVC_PKTRATE: rc = CopyTabletData(lpOutput,&gSysDevice.PKTRATE, sizeof(UINT)); break; case DVC_PKTDATA: rc = CopyTabletData(lpOutput,&gSysDevice.PKTDATA, sizeof(WTPKT)); break; case DVC_PKTMODE: rc = CopyTabletData(lpOutput,&gSysDevice.PKTMODE, sizeof(WTPKT)); break; case DVC_CSRDATA: rc = CopyTabletData(lpOutput,&gSysDevice.CSRDATA, sizeof(WTPKT)); break; case DVC_XMARGIN: rc = CopyTabletData(lpOutput,&gSysDevice.XMARGIN, sizeof(INT)); break; case DVC_YMARGIN: rc = CopyTabletData(lpOutput,&gSysDevice.YMARGIN, sizeof(INT)); break; case DVC_ZMARGIN: rc = 0; /* unsupported */ /* rc = CopyTabletData(lpOutput,&gSysDevice.ZMARGIN, sizeof(INT)); */ break; case DVC_X: rc = CopyTabletData(lpOutput,&gSysDevice.X, sizeof(AXIS)); break; case DVC_Y: rc = CopyTabletData(lpOutput,&gSysDevice.Y, sizeof(AXIS)); break; case DVC_Z: rc = 0; /* unsupported */ /* rc = CopyTabletData(lpOutput,&gSysDevice.Z, sizeof(AXIS)); */ break; case DVC_NPRESSURE: rc = CopyTabletData(lpOutput,&gSysDevice.NPRESSURE, sizeof(AXIS)); break; case DVC_TPRESSURE: rc = 0; /* unsupported */ /* rc = CopyTabletData(lpOutput,&gSysDevice.TPRESSURE, sizeof(AXIS)); */ break; case DVC_ORIENTATION: rc = CopyTabletData(lpOutput,gSysDevice.ORIENTATION, sizeof(AXIS)*3); break; case DVC_ROTATION: rc = 0; /* unsupported */ /* rc = CopyTabletData(lpOutput,&gSysDevice.ROTATION, sizeof(AXIS)*3); */ break; case DVC_PNPID: rc = CopyTabletData(lpOutput,gSysDevice.PNPID, (strlenW(gSysDevice.PNPID)+1)*sizeof(WCHAR)); break; default: FIXME("WTI_DEVICES unhandled index %i\n",nIndex); rc = 0; } break; default: FIXME("Unhandled Category %i\n",wCategory); } return rc; } #else /* SONAME_LIBXI */ /*********************************************************************** * AttachEventQueueToTablet (X11DRV.@) */ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) { return 0; } /*********************************************************************** * GetCurrentPacket (X11DRV.@) */ int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) { return 0; } /*********************************************************************** * LoadTabletInfo (X11DRV.@) */ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) { return FALSE; } /*********************************************************************** * WTInfoW (X11DRV.@) */ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) { return 0; } #endif /* SONAME_LIBXI */
33,534
3,227
#include <iostream> #include <CGAL/Arithmetic_kernel.h> #if defined(CGAL_HAS_DEFAULT_ARITHMETIC_KERNEL) #include <CGAL/Test/_test_arithmetic_kernel.h> int main() { typedef CGAL::Arithmetic_kernel AK; CGAL::test_arithmetic_kernel<AK>(); return 0; } #else #warning CGAL has no default CGAL::Arithmetic kernel int main() { return 0; } #endif
137
504
<reponame>steakknife/pcgeos #define FORM_PASSWORD_CHARACTER '*' #define MAX_FORM_ELEMENT_EDIT_TEXT_CHARS 200 #define FORM_TEXT_POINT_SIZE 12 #define FORM_TEXT_POINT_SIZE_TV 16 #define SELECT_LIST_MIN_WIDTH 18 #define MAX_FORM_ELEMENT_OPTION_LENGTH 200 #define FORM_MAX_CHARACTERS_IN_SUBMIT_OR_RESET_BUTTON 80 #define FORM_MAX_TEXT_SIZE 80 /* maximum visible field size */ #define FORM_STANDARD_TEXT_SIZE 30 /* default visible field size */ #define FORM_MAX_CHARACTERS_IN_TEXT_LINE 120 #define FORM_MAX_CHARACTERS_IN_TEXT_AREA MAX_STORED_CONTENT word FormGetPointSize(void); word FormGetFont(void); void FormSetTextAttr(GStateHandle gstate);
306
530
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the Apache 2.0 License. #pragma once #include "crypto/openssl/openssl_wrappers.h" #include <openssl/bn.h> #include <openssl/ecdsa.h> #include <vector> namespace crypto { /** Converts an ECDSA signature in IEEE P1363 encoding to RFC 3279 DER * encoding. * @param signature The signature in IEEE P1363 encoding */ static std::vector<uint8_t> ecdsa_sig_p1363_to_der( const std::vector<uint8_t>& signature) { auto signature_size = signature.size(); auto half_size = signature_size / 2; OpenSSL::Unique_BIGNUM r; OpenSSL::Unique_BIGNUM s; OpenSSL::CHECKNULL(BN_bin2bn(signature.data(), half_size, r)); OpenSSL::CHECKNULL(BN_bin2bn(signature.data() + half_size, half_size, s)); OpenSSL::Unique_ECDSA_SIG sig; OpenSSL::CHECK1(ECDSA_SIG_set0(sig, r, s)); r.release(); s.release(); auto der_size = i2d_ECDSA_SIG(sig, nullptr); OpenSSL::CHECK0(der_size); std::vector<uint8_t> der_sig(der_size); auto der_sig_buf = der_sig.data(); OpenSSL::CHECK0(i2d_ECDSA_SIG(sig, &der_sig_buf)); return der_sig; } }
479
3,301
<reponame>okjay/Alink package com.alibaba.alink.params.io.shared; import org.apache.flink.ml.api.misc.param.ParamInfo; import org.apache.flink.ml.api.misc.param.ParamInfoFactory; import org.apache.flink.ml.api.misc.param.WithParams; public interface HasFileSystemUri<T> extends WithParams <T> { ParamInfo <String> FS_URI = ParamInfoFactory .createParamInfo("fsUri", String.class) .setDescription("Uri of the file system.") .setHasDefaultValue(null) .build(); default String getFSUri() { return get(FS_URI); } default T setFSUri(String value) { return set(FS_URI, value); } }
224
6,224
/* * Copyright (c) 2020 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_sim_ec_host_cmd_periph #include <device.h> #include <drivers/ec_host_cmd_periph.h> #include <string.h> #ifndef CONFIG_ARCH_POSIX #error Simulator only valid on posix #endif static uint8_t rx_buffer[256]; static size_t rx_buffer_len; /* Allow writing to rx buff at startup and block on reading. */ static K_SEM_DEFINE(handler_owns, 0, 1); static K_SEM_DEFINE(dev_owns, 1, 1); static ec_host_cmd_periph_api_send tx; int ec_host_cmd_periph_sim_init(const struct device *dev, struct ec_host_cmd_periph_rx_ctx *rx_ctx) { if (rx_ctx == NULL) { return -EINVAL; } rx_ctx->buf = rx_buffer; rx_ctx->len = &rx_buffer_len; rx_ctx->dev_owns = &dev_owns; rx_ctx->handler_owns = &handler_owns; return 0; } int ec_host_cmd_periph_sim_send(const struct device *dev, const struct ec_host_cmd_periph_tx_buf *buf) { if (tx != NULL) { return tx(dev, buf); } return 0; } void ec_host_cmd_periph_sim_install_send_cb(ec_host_cmd_periph_api_send cb) { tx = cb; } int ec_host_cmd_periph_sim_data_received(const uint8_t *buffer, size_t len) { if (sizeof(rx_buffer) < len) { return -ENOMEM; } if (k_sem_take(&dev_owns, K_NO_WAIT) != 0) { return -EBUSY; } memcpy(rx_buffer, buffer, len); rx_buffer_len = len; k_sem_give(&handler_owns); return 0; } static const struct ec_host_cmd_periph_api ec_host_cmd_api = { .init = &ec_host_cmd_periph_sim_init, .send = &ec_host_cmd_periph_sim_send, }; static int ec_host_cmd_sim_init(const struct device *dev) { return 0; } /* Assume only one simulator */ DEVICE_DT_INST_DEFINE(0, ec_host_cmd_sim_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ec_host_cmd_api);
788
14,668
// Copyright (c) 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_AUDIO_AUDIO_PROCESSOR_H_ #define SERVICES_AUDIO_AUDIO_PROCESSOR_H_ #include <string> #include "base/callback.h" #include "base/memory/raw_ptr.h" #include "base/sequence_checker.h" #include "base/strings/string_piece.h" #include "services/audio/reference_output.h" namespace media { class AudioBus; } // namespace media namespace audio { class DeviceOutputListener; class AudioProcessor final : public ReferenceOutput::Listener { public: using LogCallback = base::RepeatingCallback<void(base::StringPiece)>; AudioProcessor(DeviceOutputListener* device_output_listener, LogCallback log_callback); AudioProcessor(const AudioProcessor&) = delete; AudioProcessor& operator=(const AudioProcessor&) = delete; ~AudioProcessor() final; void SetOutputDeviceForAec(const std::string& output_device_id); void Start(); void Stop(); private: class UmaLogger; // Listener void OnPlayoutData(const media::AudioBus& audio_bus, int sample_rate, base::TimeDelta delay) final; void StartListening(); SEQUENCE_CHECKER(owning_sequence_); bool active_ = false; std::string output_device_id_; raw_ptr<DeviceOutputListener> const device_output_listener_; const LogCallback log_callback_; std::unique_ptr<UmaLogger> uma_logger_; }; } // namespace audio #endif // SERVICES_AUDIO_AUDIO_PROCESSOR_H_
546
678
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/Symbolication.framework/Symbolication */ #import <Foundation/NSObject.h> #import <Symbolication/Symbolication-Structs.h> @class NSMutableArray, NSMapTable; @interface VMUVMRegionIdentifier : NSObject { NSMutableArray *_regions; // 4 = 0x4 NSMapTable *_mallocZoneStatisticsMap; // 8 = 0x8 } @property(readonly, retain) NSMutableArray *regions; // G=0x373b4; converted property - (id)initWithTask:(unsigned)task options:(unsigned)options; // 0x3bb28 - (id)initWithTask:(unsigned)task; // 0x38794 - (void)dealloc; // 0x3ad18 // converted property getter: - (id)regions; // 0x373b4 - (id)descriptionForRange:(VMURange)range; // 0x387a8 - (id)descriptionForRange:(VMURange)range options:(unsigned)options; // 0x3b888 - (id)descriptionForMallocZoneTotalsWithOptions:(unsigned)options; // 0x3ad98 - (id)descriptionForRegionTotalsWithOptions:(unsigned)options; // 0x39884 @end
353
4,812
#!/usr/bin/env python import sys InterestingVar = 0 input = open(sys.argv[1], "r") for line in input: i = line.find(';') if i >= 0: line = line[:i] if line.startswith("@interesting = global") or "@interesting" in line: InterestingVar += 1 if InterestingVar == 4: sys.exit(0) # interesting! sys.exit(1)
126
915
""" Experimental ============ A bunch of routines useful when doing measurements and experiments. """ __all__ = [ "measure_ir", "physics", "point_cloud", "delay_calibration", "deconvolution", "localization", "signals", "rt60", ] from .measure_ir import measure_ir from .physics import calculate_speed_of_sound from .point_cloud import PointCloud from .delay_calibration import DelayCalibration from .deconvolution import deconvolve, wiener_deconvolve from .localization import tdoa, tdoa_loc, edm_line_search from .signals import window, exponential_sweep, linear_sweep from .rt60 import measure_rt60
218
1,163
<filename>cassandra/datastax/insights/util.py # Copyright DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging import traceback from warnings import warn from cassandra.util import Version DSE_60 = Version('6.0.0') DSE_51_MIN_SUPPORTED = Version('5.1.13') DSE_60_MIN_SUPPORTED = Version('6.0.5') log = logging.getLogger(__name__) def namespace(cls): """ Best-effort method for getting the namespace in which a class is defined. """ try: # __module__ can be None module = cls.__module__ or '' except Exception: warn("Unable to obtain namespace for {cls} for Insights, returning ''. " "Exception: \n{e}".format(e=traceback.format_exc(), cls=cls)) module = '' module_internal_namespace = _module_internal_namespace_or_emtpy_string(cls) if module_internal_namespace: return '.'.join((module, module_internal_namespace)) return module def _module_internal_namespace_or_emtpy_string(cls): """ Best-effort method for getting the module-internal namespace in which a class is defined -- i.e. the namespace _inside_ the module. """ try: qualname = cls.__qualname__ except AttributeError: return '' return '.'.join( # the last segment is the name of the class -- use everything else qualname.split('.')[:-1] ) def version_supports_insights(dse_version): if dse_version: try: dse_version = Version(dse_version) return (DSE_51_MIN_SUPPORTED <= dse_version < DSE_60 or DSE_60_MIN_SUPPORTED <= dse_version) except Exception: warn("Unable to check version {v} for Insights compatibility, returning False. " "Exception: \n{e}".format(e=traceback.format_exc(), v=dse_version)) return False
901
360
import numpy as np import torch from lietorch import SO3, SE3, Sim3 from .graph_utils import graph_to_edge_list def pose_metrics(dE): """ Translation/Rotation/Scaling metrics from Sim3 """ t, q, s = dE.data.split([3, 4, 1], -1) ang = SO3(q).log().norm(dim=-1) # convert radians to degrees r_err = (180 / np.pi) * ang t_err = t.norm(dim=-1) s_err = (s - 1.0).abs() return r_err, t_err, s_err def geodesic_loss(Ps, Gs, graph, gamma=0.9): """ Loss function for training network """ # relative pose ii, jj, kk = graph_to_edge_list(graph) dP = Ps[:,jj] * Ps[:,ii].inv() n = len(Gs) geodesic_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) dG = Gs[i][:,jj] * Gs[i][:,ii].inv() # pose error d = (dG * dP.inv()).log() if isinstance(dG, SE3): tau, phi = d.split([3,3], dim=-1) geodesic_loss += w * ( tau.norm(dim=-1).mean() + phi.norm(dim=-1).mean()) elif isinstance(dG, Sim3): tau, phi, sig = d.split([3,3,1], dim=-1) geodesic_loss += w * ( tau.norm(dim=-1).mean() + phi.norm(dim=-1).mean() + 0.05 * sig.norm(dim=-1).mean()) dE = Sim3(dG * dP.inv()).detach() r_err, t_err, s_err = pose_metrics(dE) metrics = { 'r_error': r_err.mean().item(), 't_error': t_err.mean().item(), 's_error': s_err.mean().item(), } return geodesic_loss, metrics def residual_loss(residuals, gamma=0.9): """ loss on system residuals """ residual_loss = 0.0 n = len(residuals) for i in range(n): w = gamma ** (n - i - 1) residual_loss += w * residuals[i].abs().mean() return residual_loss, {'residual': residual_loss.item()}
963
777
<gh_stars>100-1000 /* * Artificial Intelligence for Humans * Volume 1: Fundamental Algorithms * Java Version * http://www.aifh.org * http://www.jeffheaton.com * * Code repository: * https://github.com/jeffheaton/aifh * Copyright 2013 by <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * For more information on Heaton Research copyrights, licenses * and trademarks visit: * http://www.heatonresearch.com/copyright */ package com.heatonresearch.aifh.examples.learning; import com.heatonresearch.aifh.general.data.BasicData; import com.heatonresearch.aifh.learning.TrainGreedyRandom; import com.heatonresearch.aifh.learning.score.ScoreFunction; import com.heatonresearch.aifh.learning.score.ScoreRegressionData; import java.util.ArrayList; import java.util.List; /** * Learn a simple polynomial with the Greedy Random algorithm. */ public class LearnPolynomial extends SimpleLearn { public List<BasicData> generateTrainingData() { final List<BasicData> result = new ArrayList<BasicData>(); for (double x = -50; x < 50; x++) { final double y = (2 * Math.pow(x, 2)) + (4 * x) + 6; final BasicData pair = new BasicData(1, 1); pair.getInput()[0] = x; pair.getIdeal()[0] = y; result.add(pair); } return result; } /** * Run the example. */ public void process() { final List<BasicData> trainingData = generateTrainingData(); final PolynomialFn poly = new PolynomialFn(3); final ScoreFunction score = new ScoreRegressionData(trainingData); final TrainGreedyRandom train = new TrainGreedyRandom(true, poly, score); performIterations(train, 1000000, 0.01, true); System.out.println(poly.toString()); } /** * The main method. * * @param args Not used. */ public static void main(final String[] args) { final LearnPolynomial prg = new LearnPolynomial(); prg.process(); } }
892
539
<reponame>rathann/flite /*************************************************************************/ /* */ /* Language Technologies Institute */ /* Carnegie Mellon University */ /* Copyright (c) 2001 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author: <NAME> (<EMAIL>) */ /* Date: January 2001 */ /*************************************************************************/ /* */ /* Without a real garbage collector we need some basic constant val */ /* to avoid having to create them on the fly */ /* */ /*************************************************************************/ #include "cst_val.h" #include "cst_features.h" #include "cst_string.h" DEF_CONST_VAL_STRING(val_string_0,"0"); DEF_CONST_VAL_STRING(val_string_1,"1"); DEF_CONST_VAL_STRING(val_string_2,"2"); DEF_CONST_VAL_STRING(val_string_3,"3"); DEF_CONST_VAL_STRING(val_string_4,"4"); DEF_CONST_VAL_STRING(val_string_5,"5"); DEF_CONST_VAL_STRING(val_string_6,"6"); DEF_CONST_VAL_STRING(val_string_7,"7"); DEF_CONST_VAL_STRING(val_string_8,"8"); DEF_CONST_VAL_STRING(val_string_9,"9"); DEF_CONST_VAL_STRING(val_string_10,"10"); DEF_CONST_VAL_STRING(val_string_11,"11"); DEF_CONST_VAL_STRING(val_string_12,"12"); DEF_CONST_VAL_STRING(val_string_13,"13"); DEF_CONST_VAL_STRING(val_string_14,"14"); DEF_CONST_VAL_STRING(val_string_15,"15"); DEF_CONST_VAL_STRING(val_string_16,"16"); DEF_CONST_VAL_STRING(val_string_17,"17"); DEF_CONST_VAL_STRING(val_string_18,"18"); DEF_CONST_VAL_STRING(val_string_19,"19"); DEF_CONST_VAL_STRING(val_string_20,"20"); DEF_CONST_VAL_STRING(val_string_21,"21"); DEF_CONST_VAL_STRING(val_string_22,"22"); DEF_CONST_VAL_STRING(val_string_23,"23"); DEF_CONST_VAL_STRING(val_string_24,"24"); DEF_CONST_VAL_INT(val_int_0,0); DEF_CONST_VAL_INT(val_int_1,1); DEF_CONST_VAL_INT(val_int_2,2); DEF_CONST_VAL_INT(val_int_3,3); DEF_CONST_VAL_INT(val_int_4,4); DEF_CONST_VAL_INT(val_int_5,5); DEF_CONST_VAL_INT(val_int_6,6); DEF_CONST_VAL_INT(val_int_7,7); DEF_CONST_VAL_INT(val_int_8,8); DEF_CONST_VAL_INT(val_int_9,9); DEF_CONST_VAL_INT(val_int_10,10); DEF_CONST_VAL_INT(val_int_11,11); DEF_CONST_VAL_INT(val_int_12,12); DEF_CONST_VAL_INT(val_int_13,13); DEF_CONST_VAL_INT(val_int_14,14); DEF_CONST_VAL_INT(val_int_15,15); DEF_CONST_VAL_INT(val_int_16,16); DEF_CONST_VAL_INT(val_int_17,17); DEF_CONST_VAL_INT(val_int_18,18); DEF_CONST_VAL_INT(val_int_19,19); DEF_CONST_VAL_INT(val_int_20,20); DEF_CONST_VAL_INT(val_int_21,21); DEF_CONST_VAL_INT(val_int_22,22); DEF_CONST_VAL_INT(val_int_23,23); DEF_CONST_VAL_INT(val_int_24,24); static const int val_int_const_max = 25; static const cst_val * const val_int_const [] = { VAL_INT_0, VAL_INT_1, VAL_INT_2, VAL_INT_3, VAL_INT_4, VAL_INT_5, VAL_INT_6, VAL_INT_7, VAL_INT_8, VAL_INT_9, VAL_INT_10, VAL_INT_11, VAL_INT_12, VAL_INT_13, VAL_INT_14, VAL_INT_15, VAL_INT_16, VAL_INT_17, VAL_INT_18, VAL_INT_19, VAL_INT_20, VAL_INT_21, VAL_INT_22, VAL_INT_23, VAL_INT_24}; static const cst_val * const val_string_const [] = { VAL_STRING_0, VAL_STRING_1, VAL_STRING_2, VAL_STRING_3, VAL_STRING_4, VAL_STRING_5, VAL_STRING_6, VAL_STRING_7, VAL_STRING_8, VAL_STRING_9, VAL_STRING_10, VAL_STRING_11, VAL_STRING_12, VAL_STRING_13, VAL_STRING_14, VAL_STRING_15, VAL_STRING_16, VAL_STRING_17, VAL_STRING_18, VAL_STRING_19, VAL_STRING_20, VAL_STRING_21, VAL_STRING_22, VAL_STRING_23, VAL_STRING_24}; const cst_val *val_int_n(int n) { if (n < val_int_const_max) return val_int_const[n]; else return val_int_const[val_int_const_max-1]; } /* carts are pretty confused about strings/ints, and some features */ /* are actually used as floats and as int/strings */ const cst_val *val_string_n(int n) { if (n < 0) return val_string_const[0]; else if (n < val_int_const_max) /* yes I mean *int*, its the table size */ return val_string_const[n]; else return val_string_const[val_int_const_max-1]; } #if 0 /* This technique isn't thread safe, so I replaced it with val_consts */ static cst_features *val_string_consts = NULL; const cst_val *val_string_x(const char *n) { const cst_val *v; /* *BUG* This will have to be fixed soon */ if (val_string_consts == NULL) val_string_consts = new_features(); v = feat_val(val_string_consts,n); if (v) return v; else { feat_set_string(val_string_consts,n,n); return feat_val(val_string_consts,n); } } #endif
3,481
11,356
// Copyright <NAME> 2002. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <boost/python/operators.hpp> #include <boost/python/class.hpp> #include <boost/python/module.hpp> #include <boost/python/def.hpp> #include "test_class.hpp" #include <boost/python/module.hpp> #include <boost/python/class.hpp> #include <boost/python/operators.hpp> #include <boost/operators.hpp> //#include <boost/python/str.hpp> // Just use math.h here; trying to use std::pow() causes too much // trouble for non-conforming compilers and libraries. #include <math.h> #if __GNUC__ != 2 # include <ostream> #else # include <ostream.h> #endif using namespace boost::python; using namespace boost::python; struct X : test_class<> { typedef test_class<> base_t; X(int x) : base_t(x) {} X const operator+(X const& r) const { return X(value() + r.value()); } // typedef int (X::*safe_bool)() const; // operator safe_bool() const { return value() != 0 ? &X::value : 0; } }; X operator-(X const& l, X const& r) { return X(l.value() - r.value()); } X operator-(int l, X const& r) { return X(l - r.value()); } X operator-(X const& l, int r) { return X(l.value() - r); } X operator-(X const& x) { return X(-x.value()); } X& operator-=(X& l, X const& r) { l.set(l.value() - r.value()); return l; } bool operator<(X const& x, X const& y) { return x.value() < y.value(); } bool operator<(X const& x, int y) { return x.value() < y; } bool operator<(int x, X const& y) { return x < y.value(); } X abs(X x) { return X(x.value() < 0 ? -x.value() : x.value()); } X pow(X x, int y) { return X(int(pow(double(x.value()), double(y)))); } X pow(X x, X y) { return X(int(pow(double(x.value()), double(y.value())))); } int pow(int x, X y) { return int(pow(double(x), double(y.value()))); } std::ostream& operator<<(std::ostream& s, X const& x) { return s << x.value(); } struct number : boost::integer_arithmetic<number> { explicit number(long x_) : x(x_) {} operator long() const { return x; } template <class T> number& operator+=(T const& rhs) { x += rhs; return *this; } template <class T> number& operator-=(T const& rhs) { x -= rhs; return *this; } template <class T> number& operator*=(T const& rhs) { x *= rhs; return *this; } template <class T> number& operator/=(T const& rhs) { x /= rhs; return *this; } template <class T> number& operator%=(T const& rhs) { x %= rhs; return *this; } long x; }; BOOST_PYTHON_MODULE(operators_ext) { class_<X>("X", init<int>()) .def("value", &X::value) .def(self + self) .def(self - self) .def(self - int()) .def(other<int>() - self) .def(-self) .def(self < other<int>()) .def(self < self) .def(1 < self) .def(self -= self) .def(abs(self)) .def(str(self)) .def(pow(self,self)) .def(pow(self,int())) .def(pow(int(),self)) .def( !self // "not self" is legal here but causes friction on a few // nonconforming compilers; it's cute because it looks // like python, but doing it here doesn't prove much and // just causes tests to fail or complicated workarounds to // be enacted. ) ; class_<number>("number", init<long>()) // interoperate with self .def(self += self) .def(self + self) .def(self -= self) .def(self - self) .def(self *= self) .def(self * self) .def(self /= self) .def(self / self) .def(self %= self) .def(self % self) // Convert to Python int .def(int_(self)) // interoperate with long .def(self += long()) .def(self + long()) .def(long() + self) .def(self -= long()) .def(self - long()) .def(long() - self) .def(self *= long()) .def(self * long()) .def(long() * self) .def(self /= long()) .def(self / long()) .def(long() / self) .def(self %= long()) .def(self % long()) .def(long() % self) ; class_<test_class<1> >("Z", init<int>()) .def(int_(self)) .def(float_(self)) .def(complex_(self)) ; } #include "module_tail.cpp"
1,974
1,235
<filename>core/include/holojs/private/holojs-view.h #pragma once #include "app-model.h" #include "script-host-errors.h" #include <functional> #include <memory> namespace HoloJs { class IHoloJsScriptHostInternal; class IBackgroundWorkItem { public: virtual ~IBackgroundWorkItem() {} virtual long execute() = 0; }; class IForegroundWorkItem { public: virtual ~IForegroundWorkItem(){} virtual void execute() = 0; virtual long long getTag() = 0; }; class IHoloJsView { public: virtual ~IHoloJsView() {} virtual long initialize(IHoloJsScriptHostInternal* host) = 0; virtual void setViewWindow(void* nativeWindow) = 0; virtual void run() = 0; virtual void stop() = 0; virtual long executeApp(std::shared_ptr<HoloJs::AppModel::HoloJsApp> app) = 0; virtual long executeScript(const wchar_t* script) = 0; virtual long executeOnViewThread(IForegroundWorkItem* workItem) = 0; virtual long executeInBackground(IBackgroundWorkItem* workItem) = 0; virtual void onError(HoloJs::ScriptHostErrorType errorType) = 0; virtual bool isWindingOrderReversed() = 0; virtual void setIcon(void* platformIcon) = 0; virtual void setTitle(const std::wstring& title) = 0; virtual long getStationaryCoordinateSystem(void** coordinateSystem) = 0; }; } // namespace HoloJs
462
506
package com.xnx3.template; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.JDialog; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import com.xnx3.BaseVO; import com.xnx3.StringUtil; import com.xnx3.file.FileUtil; import com.xnx3.template.bean.ElementDiffRecord; import com.xnx3.template.bean.Template; import com.xnx3.template.ui.Diff; import com.xnx3.template.ui.diffJeditorPanel; import com.xnx3.template.vo.ElementDiffListVO; import com.xnx3.template.vo.ElementDiffVO; import com.xnx3.util.StringDiff; /** * 模版页面计算,模版计算,将不同处计算出来 * @author 管雷鸣 */ public class TemplateCompute { private Template template; //当前操作的模板页面 // public static List<Template> templateList; // public static Map<String, Template> templateMap; public List<ElementDiffRecord> recordList; //对比的结果 public TemplateCompute(Template template) { this.template = template; recordList = new ArrayList<ElementDiffRecord>(); } /** * 传入一个元素,对比传入的元素与所有模版页面中是否有相同的或者相近的 */ public void diffChindElement(Element e){ Global.log(template.getFile().getName()+":"+e.tagName()+"-->"+e.toString().length()); Elements childElements = e.children(); if(childElements.size() > 0){ //如果其子元素数量》1,或者子元素跟父元素不是完全一样的,那肯定就是有子元素了,判断子元素 //将所有子元素便利出来 for (int j = 0; j < childElements.size(); j++) { Element diffE = childElements.get(j); //将其子元素再所有模板中寻找,看是否存在。若存在,且相似度>0.98,直接进行替换操作 ElementDiffListVO vo = findElementByAllTemplate(diffE); //所有页面通用模版的相似度,0~1 double sim = vo.getDiffEqualNum()/Global.templateMap.size(); int ipentityNum = vo.getIpentityNum(); //模板变量在模板页面中,完全相同的的个数 //进行模版变量的提取,看是否有符合的 extraceTemplateVar(vo); if(sim == 1){ //完全相同,终止继续下级元素的扫描 }else{ //只要不是完全相同,那么就继续往下扫描 //判断其是否还有子元素,若有子元素,将子元素找出来,找到到底是哪。如过没有子元素了,那估计就是此处的问题了,将此处暴露出来,以供人工审查 if(diffE.children().size() == 0){ //没有下级子元素了,那就是此处了 // previewDiffUI(vo); }else{ //还有子元素,继续搜索其子元素 diffChindElement(diffE); } } } } } /** * 提取模版变量 */ public void extraceTemplateVar(ElementDiffListVO vo){ //判断是否有可提取的模版变量,认为可提取的,有两张或者以上,相似度超过Global.sim的 int fuheNum = 0; for (int i = 0; i < vo.getList().size(); i++) { ElementDiffVO edvo = vo.getList().get(i); if(edvo.getD() > Global.sim){ fuheNum++; } } if(fuheNum > 1){ //有超过1个的,那么进行记录 //完全相同,记录,同时终止继续下级元素的扫描 ElementDiffRecord record = new ElementDiffRecord(); record.setElementDiffVO(vo.getList().get(0)); record.setElementDiffListVO(vo); recordList.add(record); } } public void previewDiffUI(ElementDiffListVO vo){ //找出的完全相同的 key:file.name Map<String, ElementDiffVO> equalMap = new HashMap<String, ElementDiffVO>(); //找出不完全相同,但是绝大多数相同的 Map<String, ElementDiffVO> similarMap = new HashMap<String, ElementDiffVO>(); for (int i = 0; i < vo.getList().size(); i++) { ElementDiffVO ed = vo.getList().get(i); if(ed.getD() == 1){ equalMap.put(ed.getTargetFile().getName(), ed); }else if (ed.getD() > 0.9) { similarMap.put(ed.getTargetFile().getName(), ed); } } if(similarMap.size() == 0 ){ //根本没有相似的要进行对比,退出判断 return; } //判断一下,是完全相同的数量多,还是极近相同的多 if(similarMap.size() > equalMap.size()){ //极近相同的多,那么,对比一下这些极近相同的里面,是否这些是一样的,而完全相同的只是个例而已 /* * */ System.out.println("极近相同的多,那么,对比一下这些极近相同的里面,是否这些是一样的,而完全相同的只是个例而已"); } //进行相似度diff展示 Diff d = new Diff(); /** diff第一个 **/ String fileNames1 = ""; Element firstElement = null; for (Map.Entry<String, ElementDiffVO> entry : equalMap.entrySet()) { fileNames1 = fileNames1 + entry.getKey()+", "; if(firstElement == null){ firstElement = entry.getValue().getTargetElement(); } } // diffItemPanel item1 = new diffItemPanel(); // item1.getTextArea().setText(text1); // item1.getLblNewLabel().setText(fileNames1); // d.getContentPane().add(item1); diffJeditorPanel item1 = new diffJeditorPanel(); item1.getLblNewLabel().setText(fileNames1); item1.originalElement = firstElement; /** diff其他不相似的列表 **/ for (Map.Entry<String, ElementDiffVO> entry : similarMap.entrySet()) { StringDiff sd = new StringDiff(firstElement.toString(), entry.getValue().getTargetElement().toString()); diffJeditorPanel jp = new diffJeditorPanel(); jp.getEditorPane().setText(sd.getTwoStrDiff()); jp.getLblNewLabel().setText(entry.getValue().getTargetFile().getName()); jp.originalElement = entry.getValue().getTargetElement(); d.getContentPane().add(jp); item1.getEditorPane().setText(sd.getFirstStrDiff()); } d.getContentPane().add(item1); d.setVisible(true); while(d.use){ try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } } } /** * 将某行的字符串,在所有模板页面中进行对比,看此行在模板页面中有几个模板页匹配 * @param list 要挨个对比的模板 * @param diffElement 对比的元素 * @return 字符串匹配的模板的数量,个数 */ public ElementDiffListVO findElementByAllTemplate(Element diffElement){ ElementDiffListVO vo = new ElementDiffListVO(); List<ElementDiffVO> list = new ArrayList<ElementDiffVO>(); //首先便利出所有模板来 for (Map.Entry<String, Template> entry : Global.templateMap.entrySet()) { Template t = entry.getValue(); ElementDiffVO edVO = findElementByTemplate(t, diffElement); list.add(edVO); if(edVO.getResult() - BaseVO.SUCCESS == 0){ vo.setDiffEqualNum(vo.getDiffEqualNum()+edVO.getD()); // System.out.println(edVO.getD()+"----"+(edVO.getD())); if(edVO.getD() - 0.99999 > 0){ vo.setIpentityNum(vo.getIpentityNum()+1); } } } vo.setList(list); return vo; } /** * 判断某个模板(body)中,是否有此Element存在 * @param bodyElement 要判断的模板的body元素 * @param diff 要判断寻找的元素 * @return 0~1 越相似,越靠近1 */ public ElementDiffVO findElementByTemplate(Template template, Element diff){ Element bodyElement = template.getBodyElement(); ElementDiffVO vo = new ElementDiffVO(); vo.setDiffElement(diff); vo.setTargetFile(template.getFile()); Elements es = bodyElement.getElementsByTag(diff.tagName()); if(es.size() == 0){ //没有找到这个Element的Tag,那么直接返回0 vo.setResult(BaseVO.FAILURE); return vo; } for (int i = 0; i < es.size(); i++) { Element e = es.get(i); //进行对比 double d1 = com.xnx3.util.StringUtil.similarity(diff, e); if(d1 > vo.getD()){ vo.setD(d1); vo.setTargetElement(e); } } return vo; } }
4,246
697
<reponame>Qt-Widgets/vpaint // Copyright (C) 2012-2019 The VPaint Developers. // See the COPYRIGHT file at the top-level directory of this distribution // and at https://github.com/dalboris/vpaint/blob/master/COPYRIGHT // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef UPDATECHECK_H #define UPDATECHECK_H #include <VAC/Version.h> #include <QObject> class QNetworkAccessManager; class QNetworkReply; class QWidget; class UpdateCheckDialog; class UpdateCheck: public QObject { Q_OBJECT public: UpdateCheck(QWidget * parent = 0); virtual ~UpdateCheck(); Version versionChecked() const; Version latestVersion() const; void showWhenReady(); void checkForUpdates(); private slots: void requestFinished_(); void updateSettings_(); private: QNetworkAccessManager * networkManager_; QNetworkReply * reply_; QWidget * parent_; UpdateCheckDialog * dialog_; Version versionToCheck_, latestVersion_; bool isReady_; }; #endif // UPDATECHECK_H
478
1,216
package com.bottomsheetbehavior; import android.graphics.Color; import android.view.View; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.WritableMap; import com.facebook.react.common.MapBuilder; import com.facebook.react.uimanager.LayoutShadowNode; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.events.RCTEventEmitter; import java.util.Map; import javax.annotation.Nullable; public class FloatingActionButtonManager extends SimpleViewManager<FloatingActionButtonView> { private final static String REACT_CLASS = "BSBFloatingActionButtonAndroid"; private final static int COMMAND_SET_ANCHOR_ID = 1; private final static int COMMAND_SHOW = 2; private final static int COMMAND_HIDE = 3; @Override public String getName() { return REACT_CLASS; } @Override public FloatingActionButtonView createViewInstance(ThemedReactContext reactContext) { FloatingActionButtonView view = new FloatingActionButtonView(reactContext); view.setOnClickListener(new FloatingActionButtonListener()); return view; } @Override public LayoutShadowNode createShadowNodeInstance() { return new FloatingActionButtonShadowNode(); } @Override public Class getShadowNodeClass() { return FloatingActionButtonShadowNode.class; } @ReactProp(name = "src") public void setSrc(FloatingActionButtonView view, String src) { view.setSrc(src); } @ReactProp(name = "icon") public void setIcon(FloatingActionButtonView view, String uri) { view.setIcon(uri); } @ReactProp(name = "iconColor") public void setIconColor(FloatingActionButtonView view, String color) { view.setIconColorDefault(Color.parseColor(color)); toggleFab(view); } @ReactProp(name = "iconColorExpanded") public void setIconColorExpanded(FloatingActionButtonView view, String color) { view.setIconColorExpanded(Color.parseColor(color)); toggleFab(view); } @ReactProp(name = "backgroundColor") public void setBackground(FloatingActionButtonView view, String background) { int color = Color.parseColor(background); view.setBackgroundDefault(color); view.setBackground(color); toggleFab(view); } @ReactProp(name = "backgroundColorExpanded") public void setBackgroundExpanded(FloatingActionButtonView view, String background) { view.setBackgroundExpanded(Color.parseColor(background)); toggleFab(view); } @ReactProp(name = "hidden", defaultBoolean = false) public void setHidden(FloatingActionButtonView view, boolean hidden) { view.setHidden(hidden); } @ReactProp(name = "rippleEffect", defaultBoolean = true) public void setRippleEffect(FloatingActionButtonView view, boolean rippleEffect) { view.setRippleEffect(rippleEffect); } @ReactProp(name = "rippleColor") public void setRippleColor(FloatingActionButtonView view, String rippleColor) { view.setRippleColor(rippleColor); } @ReactProp(name = "elevation", defaultFloat = 18) public void setElevation(FloatingActionButtonView view, float elevation) { view.setFabElevation(elevation); } @ReactProp(name = "autoAnchor") public void setAutoAnchor(FloatingActionButtonView view, boolean autoAnchor) { view.setAutoAnchor(autoAnchor); } private void toggleFab(FloatingActionButtonView view) { BottomSheetHeaderView header = view.getHeader(); if (header != null) { header.toggleFab(header.getToggled()); } } @Override public Map<String,Integer> getCommandsMap() { return MapBuilder.of( "setAnchorId", COMMAND_SET_ANCHOR_ID, "show", COMMAND_SHOW, "hide", COMMAND_HIDE ); } @Override public void receiveCommand(FloatingActionButtonView view, int commandType, @Nullable ReadableArray args) { switch (commandType) { case COMMAND_SET_ANCHOR_ID: int bottomSheetId = args.getInt(0); view.setAnchor(bottomSheetId); break; case COMMAND_SHOW: view.showFab(); break; case COMMAND_HIDE: view.hideFab(); break; } } public class FloatingActionButtonListener implements View.OnClickListener { @Override public void onClick(View v) { WritableMap event = Arguments.createMap(); ReactContext reactContext = (ReactContext) v.getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(v.getId(), "topChange", event); } } }
1,937
680
<gh_stars>100-1000 #!/usr/bin/env python """manage state transition details""" # # Copyright 2017-2018 IBM Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import os import logging import threading # I seem to have problems exiting directly, so, this sleep seems to help. # My unsubstantiated theory is that gRPC needs time to flush. # Note since we signaled, we won't actually wait n seconds, the # job monitor will delete us. SLEEP_BEFORE_EXIT_TIME = 15 SLEEP_BEFORE_LC_DONE = 4.0 DURATION_SHUTDOWN_DELAY = 10.00 DURATION_SHUTDOWN_DELAY_TF = 5.00 global_state_lock = threading.Lock() global_scanner_count = 0 def register_scanner(): global global_scanner_count with global_state_lock: global_scanner_count += 1 def unregister_scanner(): global global_scanner_count with global_state_lock: global_scanner_count -= 1 def is_learner_done(logger=None): logger = logger or logging.getLogger() learner_exit_file_path = os.path.join(os.environ["JOB_STATE_DIR"], "learner.exit") halt_file_path = os.path.join(os.environ["JOB_STATE_DIR"], "halt") # logging.debug("Checking is learner done: %s, %s", learner_exit_file_path, halt_file_path) learner_is_done = os.path.exists(learner_exit_file_path) or os.path.exists(halt_file_path) if learner_is_done: logger.debug("Learner is done!") return learner_is_done def signal_lc_done(exit_code=0, logger=logging.getLogger()): global global_scanner_count logger.info("signal_lc_done, global_scanner_count (after release): %d", global_scanner_count) with global_state_lock: global_scanner_count -= 1 pass
752
787
<filename>jenetics/src/main/java/io/jenetics/BitGene.java /* * Java Genetic Algorithm Library (@__identifier__@). * Copyright (c) @__year__@ <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: * <NAME> (<EMAIL>) */ package io.jenetics; import io.jenetics.util.RandomRegistry; /** * Implementation of a BitGene. * * @see BitChromosome * * @author <a href="mailto:<EMAIL>"><NAME></a> * @since 1.0 * @version 6.0 */ public enum BitGene implements Gene<Boolean, BitGene>, Comparable<BitGene> { FALSE, TRUE; private static final long serialVersionUID = 3L; public static final BitGene ZERO = FALSE; public static final BitGene ONE = TRUE; /** * Return the value of the BitGene. * * @see #allele() * @see #booleanValue() * * @return The value of the BitGene. */ public final boolean bit() { return this == TRUE; } /** * Return the {@code boolean} value of this gene. * * @see #allele() * @see #bit() * * @return the {@code boolean} value of this gene. */ public boolean booleanValue() { return this == TRUE; } @Override public Boolean allele() { return this == TRUE; } /** * Return always {@code true}. * * @return always {@code true} */ @Override public boolean isValid() { return true; } /** * Create a new, <em>random</em> gene. */ @Override public BitGene newInstance() { return RandomRegistry.random().nextBoolean() ? TRUE : FALSE; } /** * Create a new gene from the given {@code value}. * * @since 1.6 * @param value the value of the new gene. * @return a new gene with the given value. */ public BitGene newInstance(final Boolean value) { return value ? TRUE : FALSE; } @Override public String toString() { return booleanValue() ? "true" : "false"; } /** * Return the corresponding {@code BitGene} for the given {@code boolean} * value. * * @param value the value of the returned {@code BitGene}. * @return the {@code BitGene} for the given {@code boolean} value. */ public static BitGene of(final boolean value) { return value ? TRUE : FALSE; } }
873
2,268
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $Workfile: $ // $NoKeywords: $ //=============================================================================// #if !defined( C_HL2_PLAYERLOCALDATA_H ) #define C_HL2_PLAYERLOCALDATA_H #ifdef _WIN32 #pragma once #endif #include "dt_recv.h" #include "hl2/hl_movedata.h" EXTERN_RECV_TABLE( DT_HL2Local ); class C_HL2PlayerLocalData { public: DECLARE_PREDICTABLE(); DECLARE_CLASS_NOBASE( C_HL2PlayerLocalData ); DECLARE_EMBEDDED_NETWORKVAR(); C_HL2PlayerLocalData(); float m_flSuitPower; bool m_bZooming; int m_bitsActiveDevices; int m_iSquadMemberCount; int m_iSquadMedicCount; bool m_fSquadInFollowMode; bool m_bWeaponLowered; EHANDLE m_hAutoAimTarget; Vector m_vecAutoAimPoint; bool m_bDisplayReticle; bool m_bStickyAutoAim; bool m_bAutoAimTarget; #ifdef HL2_EPISODIC float m_flFlashBattery; Vector m_vecLocatorOrigin; #endif // Ladder related data EHANDLE m_hLadder; LadderMove_t m_LadderMove; }; #endif
434
17,703
<filename>test/mocks/compression/compressor/mocks.h #pragma once #include "envoy/compression/compressor/compressor.h" #include "envoy/compression/compressor/config.h" #include "gmock/gmock.h" namespace Envoy { namespace Compression { namespace Compressor { class MockCompressor : public Compressor { public: MockCompressor(); ~MockCompressor() override; // Compressor::Compressor MOCK_METHOD(void, compress, (Buffer::Instance & buffer, State state)); }; class MockCompressorFactory : public CompressorFactory { public: MockCompressorFactory(); ~MockCompressorFactory() override; // Compressor::CompressorFactory MOCK_METHOD(CompressorPtr, createCompressor, ()); MOCK_METHOD(const std::string&, statsPrefix, (), (const)); MOCK_METHOD(const std::string&, contentEncoding, (), (const)); const std::string stats_prefix_{"mock"}; const std::string content_encoding_{"mock"}; }; } // namespace Compressor } // namespace Compression } // namespace Envoy
307
6,445
<reponame>LaudateCorpus1/llvm-project<filename>third-party/benchmark/test/output_test_helper.cc #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <memory> #include <random> #include <sstream> #include <streambuf> #include "../src/benchmark_api_internal.h" #include "../src/check.h" // NOTE: check.h is for internal use only! #include "../src/log.h" // NOTE: log.h is for internal use only #include "../src/re.h" // NOTE: re.h is for internal use only #include "output_test.h" // ========================================================================= // // ------------------------------ Internals -------------------------------- // // ========================================================================= // namespace internal { namespace { using TestCaseList = std::vector<TestCase>; // Use a vector because the order elements are added matters during iteration. // std::map/unordered_map don't guarantee that. // For example: // SetSubstitutions({{"%HelloWorld", "Hello"}, {"%Hello", "Hi"}}); // Substitute("%HelloWorld") // Always expands to Hello. using SubMap = std::vector<std::pair<std::string, std::string>>; TestCaseList& GetTestCaseList(TestCaseID ID) { // Uses function-local statics to ensure initialization occurs // before first use. static TestCaseList lists[TC_NumID]; return lists[ID]; } SubMap& GetSubstitutions() { // Don't use 'dec_re' from header because it may not yet be initialized. // clang-format off static std::string safe_dec_re = "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?"; static std::string time_re = "([0-9]+[.])?[0-9]+"; static std::string percentage_re = "[0-9]+[.][0-9]{2}"; static SubMap map = { {"%float", "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?"}, // human-readable float {"%hrfloat", "[0-9]*[.]?[0-9]+([eE][-+][0-9]+)?[kMGTPEZYmunpfazy]?"}, {"%percentage", percentage_re}, {"%int", "[ ]*[0-9]+"}, {" %s ", "[ ]+"}, {"%time", "[ ]*" + time_re + "[ ]+ns"}, {"%console_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*[0-9]+"}, {"%console_percentage_report", "[ ]*" + percentage_re + "[ ]+% [ ]*" + percentage_re + "[ ]+% [ ]*[0-9]+"}, {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, {"%console_ms_report", "[ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*[0-9]+"}, {"%console_s_report", "[ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*[0-9]+"}, {"%console_time_only_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns"}, {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, {"%console_us_time_only_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us"}, {"%csv_header", "name,iterations,real_time,cpu_time,time_unit,bytes_per_second," "items_per_second,label,error_occurred,error_message"}, {"%csv_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,,,,,"}, {"%csv_us_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",us,,,,,"}, {"%csv_ms_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ms,,,,,"}, {"%csv_s_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",s,,,,,"}, {"%csv_bytes_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns," + safe_dec_re + ",,,,"}, {"%csv_items_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,," + safe_dec_re + ",,,"}, {"%csv_bytes_items_report", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns," + safe_dec_re + "," + safe_dec_re + ",,,"}, {"%csv_label_report_begin", "[0-9]+," + safe_dec_re + "," + safe_dec_re + ",ns,,,"}, {"%csv_label_report_end", ",,"}}; // clang-format on return map; } std::string PerformSubstitutions(std::string source) { SubMap const& subs = GetSubstitutions(); using SizeT = std::string::size_type; for (auto const& KV : subs) { SizeT pos; SizeT next_start = 0; while ((pos = source.find(KV.first, next_start)) != std::string::npos) { next_start = pos + KV.second.size(); source.replace(pos, KV.first.size(), KV.second); } } return source; } void CheckCase(std::stringstream& remaining_output, TestCase const& TC, TestCaseList const& not_checks) { std::string first_line; bool on_first = true; std::string line; while (remaining_output.eof() == false) { BM_CHECK(remaining_output.good()); std::getline(remaining_output, line); if (on_first) { first_line = line; on_first = false; } for (const auto& NC : not_checks) { BM_CHECK(!NC.regex->Match(line)) << "Unexpected match for line \"" << line << "\" for MR_Not regex \"" << NC.regex_str << "\"" << "\n actual regex string \"" << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } if (TC.regex->Match(line)) return; BM_CHECK(TC.match_rule != MR_Next) << "Expected line \"" << line << "\" to match regex \"" << TC.regex_str << "\"" << "\n actual regex string \"" << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } BM_CHECK(remaining_output.eof() == false) << "End of output reached before match for regex \"" << TC.regex_str << "\" was found" << "\n actual regex string \"" << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } void CheckCases(TestCaseList const& checks, std::stringstream& output) { std::vector<TestCase> not_checks; for (size_t i = 0; i < checks.size(); ++i) { const auto& TC = checks[i]; if (TC.match_rule == MR_Not) { not_checks.push_back(TC); continue; } CheckCase(output, TC, not_checks); not_checks.clear(); } } class TestReporter : public benchmark::BenchmarkReporter { public: TestReporter(std::vector<benchmark::BenchmarkReporter*> reps) : reporters_(std::move(reps)) {} virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE { bool last_ret = false; bool first = true; for (auto rep : reporters_) { bool new_ret = rep->ReportContext(context); BM_CHECK(first || new_ret == last_ret) << "Reports return different values for ReportContext"; first = false; last_ret = new_ret; } (void)first; return last_ret; } void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE { for (auto rep : reporters_) rep->ReportRuns(report); } void Finalize() BENCHMARK_OVERRIDE { for (auto rep : reporters_) rep->Finalize(); } private: std::vector<benchmark::BenchmarkReporter*> reporters_; }; } // namespace } // end namespace internal // ========================================================================= // // -------------------------- Results checking ----------------------------- // // ========================================================================= // namespace internal { // Utility class to manage subscribers for checking benchmark results. // It works by parsing the CSV output to read the results. class ResultsChecker { public: struct PatternAndFn : public TestCase { // reusing TestCase for its regexes PatternAndFn(const std::string& rx, ResultsCheckFn fn_) : TestCase(rx), fn(std::move(fn_)) {} ResultsCheckFn fn; }; std::vector<PatternAndFn> check_patterns; std::vector<Results> results; std::vector<std::string> field_names; void Add(const std::string& entry_pattern, const ResultsCheckFn& fn); void CheckResults(std::stringstream& output); private: void SetHeader_(const std::string& csv_header); void SetValues_(const std::string& entry_csv_line); std::vector<std::string> SplitCsv_(const std::string& line); }; // store the static ResultsChecker in a function to prevent initialization // order problems ResultsChecker& GetResultsChecker() { static ResultsChecker rc; return rc; } // add a results checker for a benchmark void ResultsChecker::Add(const std::string& entry_pattern, const ResultsCheckFn& fn) { check_patterns.emplace_back(entry_pattern, fn); } // check the results of all subscribed benchmarks void ResultsChecker::CheckResults(std::stringstream& output) { // first reset the stream to the start { auto start = std::stringstream::pos_type(0); // clear before calling tellg() output.clear(); // seek to zero only when needed if (output.tellg() > start) output.seekg(start); // and just in case output.clear(); } // now go over every line and publish it to the ResultsChecker std::string line; bool on_first = true; while (output.eof() == false) { BM_CHECK(output.good()); std::getline(output, line); if (on_first) { SetHeader_(line); // this is important on_first = false; continue; } SetValues_(line); } // finally we can call the subscribed check functions for (const auto& p : check_patterns) { BM_VLOG(2) << "--------------------------------\n"; BM_VLOG(2) << "checking for benchmarks matching " << p.regex_str << "...\n"; for (const auto& r : results) { if (!p.regex->Match(r.name)) { BM_VLOG(2) << p.regex_str << " is not matched by " << r.name << "\n"; continue; } else { BM_VLOG(2) << p.regex_str << " is matched by " << r.name << "\n"; } BM_VLOG(1) << "Checking results of " << r.name << ": ... \n"; p.fn(r); BM_VLOG(1) << "Checking results of " << r.name << ": OK.\n"; } } } // prepare for the names in this header void ResultsChecker::SetHeader_(const std::string& csv_header) { field_names = SplitCsv_(csv_header); } // set the values for a benchmark void ResultsChecker::SetValues_(const std::string& entry_csv_line) { if (entry_csv_line.empty()) return; // some lines are empty BM_CHECK(!field_names.empty()); auto vals = SplitCsv_(entry_csv_line); BM_CHECK_EQ(vals.size(), field_names.size()); results.emplace_back(vals[0]); // vals[0] is the benchmark name auto& entry = results.back(); for (size_t i = 1, e = vals.size(); i < e; ++i) { entry.values[field_names[i]] = vals[i]; } } // a quick'n'dirty csv splitter (eliminating quotes) std::vector<std::string> ResultsChecker::SplitCsv_(const std::string& line) { std::vector<std::string> out; if (line.empty()) return out; if (!field_names.empty()) out.reserve(field_names.size()); size_t prev = 0, pos = line.find_first_of(','), curr = pos; while (pos != line.npos) { BM_CHECK(curr > 0); if (line[prev] == '"') ++prev; if (line[curr - 1] == '"') --curr; out.push_back(line.substr(prev, curr - prev)); prev = pos + 1; pos = line.find_first_of(',', pos + 1); curr = pos; } curr = line.size(); if (line[prev] == '"') ++prev; if (line[curr - 1] == '"') --curr; out.push_back(line.substr(prev, curr - prev)); return out; } } // end namespace internal size_t AddChecker(const char* bm_name, const ResultsCheckFn& fn) { auto& rc = internal::GetResultsChecker(); rc.Add(bm_name, fn); return rc.results.size(); } int Results::NumThreads() const { auto pos = name.find("/threads:"); if (pos == name.npos) return 1; auto end = name.find('/', pos + 9); std::stringstream ss; ss << name.substr(pos + 9, end); int num = 1; ss >> num; BM_CHECK(!ss.fail()); return num; } double Results::NumIterations() const { return GetAs<double>("iterations"); } double Results::GetTime(BenchmarkTime which) const { BM_CHECK(which == kCpuTime || which == kRealTime); const char* which_str = which == kCpuTime ? "cpu_time" : "real_time"; double val = GetAs<double>(which_str); auto unit = Get("time_unit"); BM_CHECK(unit); if (*unit == "ns") { return val * 1.e-9; } else if (*unit == "us") { return val * 1.e-6; } else if (*unit == "ms") { return val * 1.e-3; } else if (*unit == "s") { return val; } else { BM_CHECK(1 == 0) << "unknown time unit: " << *unit; return 0; } } // ========================================================================= // // -------------------------- Public API Definitions------------------------ // // ========================================================================= // TestCase::TestCase(std::string re, int rule) : regex_str(std::move(re)), match_rule(rule), substituted_regex(internal::PerformSubstitutions(regex_str)), regex(std::make_shared<benchmark::Regex>()) { std::string err_str; regex->Init(substituted_regex, &err_str); BM_CHECK(err_str.empty()) << "Could not construct regex \"" << substituted_regex << "\"" << "\n originally \"" << regex_str << "\"" << "\n got error: " << err_str; } int AddCases(TestCaseID ID, std::initializer_list<TestCase> il) { auto& L = internal::GetTestCaseList(ID); L.insert(L.end(), il); return 0; } int SetSubstitutions( std::initializer_list<std::pair<std::string, std::string>> il) { auto& subs = internal::GetSubstitutions(); for (auto KV : il) { bool exists = false; KV.second = internal::PerformSubstitutions(KV.second); for (auto& EKV : subs) { if (EKV.first == KV.first) { EKV.second = std::move(KV.second); exists = true; break; } } if (!exists) subs.push_back(std::move(KV)); } return 0; } // Disable deprecated warnings temporarily because we need to reference // CSVReporter but don't want to trigger -Werror=-Wdeprecated-declarations BENCHMARK_DISABLE_DEPRECATED_WARNING void RunOutputTests(int argc, char* argv[]) { using internal::GetTestCaseList; benchmark::Initialize(&argc, argv); auto options = benchmark::internal::GetOutputOptions(/*force_no_color*/ true); benchmark::ConsoleReporter CR(options); benchmark::JSONReporter JR; benchmark::CSVReporter CSVR; struct ReporterTest { const char* name; std::vector<TestCase>& output_cases; std::vector<TestCase>& error_cases; benchmark::BenchmarkReporter& reporter; std::stringstream out_stream; std::stringstream err_stream; ReporterTest(const char* n, std::vector<TestCase>& out_tc, std::vector<TestCase>& err_tc, benchmark::BenchmarkReporter& br) : name(n), output_cases(out_tc), error_cases(err_tc), reporter(br) { reporter.SetOutputStream(&out_stream); reporter.SetErrorStream(&err_stream); } } TestCases[] = { {"ConsoleReporter", GetTestCaseList(TC_ConsoleOut), GetTestCaseList(TC_ConsoleErr), CR}, {"JSONReporter", GetTestCaseList(TC_JSONOut), GetTestCaseList(TC_JSONErr), JR}, {"CSVReporter", GetTestCaseList(TC_CSVOut), GetTestCaseList(TC_CSVErr), CSVR}, }; // Create the test reporter and run the benchmarks. std::cout << "Running benchmarks...\n"; internal::TestReporter test_rep({&CR, &JR, &CSVR}); benchmark::RunSpecifiedBenchmarks(&test_rep); for (auto& rep_test : TestCases) { std::string msg = std::string("\nTesting ") + rep_test.name + " Output\n"; std::string banner(msg.size() - 1, '-'); std::cout << banner << msg << banner << "\n"; std::cerr << rep_test.err_stream.str(); std::cout << rep_test.out_stream.str(); internal::CheckCases(rep_test.error_cases, rep_test.err_stream); internal::CheckCases(rep_test.output_cases, rep_test.out_stream); std::cout << "\n"; } // now that we know the output is as expected, we can dispatch // the checks to subscribees. auto& csv = TestCases[2]; // would use == but gcc spits a warning BM_CHECK(std::strcmp(csv.name, "CSVReporter") == 0); internal::GetResultsChecker().CheckResults(csv.out_stream); } BENCHMARK_RESTORE_DEPRECATED_WARNING int SubstrCnt(const std::string& haystack, const std::string& pat) { if (pat.length() == 0) return 0; int count = 0; for (size_t offset = haystack.find(pat); offset != std::string::npos; offset = haystack.find(pat, offset + pat.length())) ++count; return count; } static char ToHex(int ch) { return ch < 10 ? static_cast<char>('0' + ch) : static_cast<char>('a' + (ch - 10)); } static char RandomHexChar() { static std::mt19937 rd{std::random_device{}()}; static std::uniform_int_distribution<int> mrand{0, 15}; return ToHex(mrand(rd)); } static std::string GetRandomFileName() { std::string model = "test.%%%%%%"; for (auto& ch : model) { if (ch == '%') ch = RandomHexChar(); } return model; } static bool FileExists(std::string const& name) { std::ifstream in(name.c_str()); return in.good(); } static std::string GetTempFileName() { // This function attempts to avoid race conditions where two tests // create the same file at the same time. However, it still introduces races // similar to tmpnam. int retries = 3; while (--retries) { std::string name = GetRandomFileName(); if (!FileExists(name)) return name; } std::cerr << "Failed to create unique temporary file name" << std::endl; std::abort(); } std::string GetFileReporterOutput(int argc, char* argv[]) { std::vector<char*> new_argv(argv, argv + argc); assert(static_cast<decltype(new_argv)::size_type>(argc) == new_argv.size()); std::string tmp_file_name = GetTempFileName(); std::cout << "Will be using this as the tmp file: " << tmp_file_name << '\n'; std::string tmp = "--benchmark_out="; tmp += tmp_file_name; new_argv.emplace_back(const_cast<char*>(tmp.c_str())); argc = int(new_argv.size()); benchmark::Initialize(&argc, new_argv.data()); benchmark::RunSpecifiedBenchmarks(); // Read the output back from the file, and delete the file. std::ifstream tmp_stream(tmp_file_name); std::string output = std::string((std::istreambuf_iterator<char>(tmp_stream)), std::istreambuf_iterator<char>()); std::remove(tmp_file_name.c_str()); return output; }
6,914
1,844
<reponame>gomez-javier-github/killbill<gh_stars>1000+ /* * Copyright 2014-2019 Groupon, Inc * Copyright 2014-2019 The Billing Project, LLC * * The Billing Project licenses this file to you under the Apache License, version 2.0 * (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package org.killbill.billing.invoice.dao.serialization; import java.io.IOException; import org.killbill.billing.junction.BillingEventSet; import org.xerial.snappy.Snappy; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.joda.JodaModule; public class BillingEventSerializer { private static final JsonFactory jsonFactory = new JsonFactory(); private static ObjectMapper mapper = new ObjectMapper(jsonFactory); static { mapper.registerModule(new JodaModule()); mapper.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); } public static byte[] serialize(final BillingEventSet eventSet) throws IOException { final BillingEventSetJson json = new BillingEventSetJson(eventSet); final byte[] data = mapper.writeValueAsBytes(json); return Snappy.compress(data); } }
601
648
{"resourceType":"DataElement","id":"Conformance.kind","meta":{"lastUpdated":"2015-10-24T07:41:03.495+11:00"},"url":"http://hl7.org/fhir/DataElement/Conformance.kind","status":"draft","experimental":true,"stringency":"fully-specified","element":[{"path":"Conformance.kind","short":"instance | capability | requirements","definition":"The way that this statement is intended to be used, to describe an actual running instance of software, a particular product (kind not instance of software) or a class of implementation (e.g. a desired purchase).","requirements":"Allow searching the 3 modes.","min":1,"max":"1","type":[{"code":"code"}],"isSummary":true,"binding":{"strength":"required","description":"How a conformance statement is intended to be used.","valueSetReference":{"reference":"http://hl7.org/fhir/ValueSet/conformance-statement-kind"}}}]}
214
14,668
<filename>tools/perf/contrib/vr_benchmarks/webxr_sample_pages.py # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from contrib.vr_benchmarks.vr_sample_page import XrSamplePage from contrib.vr_benchmarks.vr_story_set import VrStorySet class WebXrSamplePage(XrSamplePage): def __init__(self, page_set, url_parameters, sample_page, extra_browser_args=None): super(WebXrSamplePage, self).__init__( sample_page=sample_page, page_set=page_set, url_parameters=url_parameters, extra_browser_args=extra_browser_args) def RunPageInteractions(self, action_runner): # The user-visible text differs per-page (e.g. "Enter VR"), but the # element's "title" attribute is currently always "Enter XR". action_runner.WaitForElement(selector='button[title="Enter XR"]') action_runner.TapElement(selector='button[title="Enter XR"]') action_runner.MeasureMemory(True) # We don't want to be in VR or on a page with a WebGL canvas at the end of # the test, as this generates unnecessary heat while the trace data is being # processed, so navigate to a blank page if we're on a platform that cares # about the heat generation. if self._shared_page_state.ShouldNavigateToBlankPageBeforeFinishing(): action_runner.Navigate("about:blank") class WebXrSamplePageSet(VrStorySet): """A page set using the official WebXR samples with settings tweaked.""" def __init__(self, use_fake_pose_tracker=True): super(WebXrSamplePageSet, self).__init__( use_fake_pose_tracker=use_fake_pose_tracker) # Test cases that use the synthetic cube field page cube_test_cases = [ # Standard sample app with no changes. ['framebufferScale=1.0'], # Increased render scale. ['framebufferScale=1.4'], # Default render scale, increased load. ['framebufferScale=1.0', 'heavyGpu=1', 'cubeScale=0.2', 'workTime=5'], # Further increased load. ['framebufferScale=1.0', 'heavyGpu=1', 'cubeScale=0.3', 'workTime=10'], # Absurd load for fill-rate testing. Only half the cube sea is rendered, # and the page automatically rotates the view between the rendered and # unrendered halves. ['frameBufferScale=1.4', 'heavyGpu=1', 'cubeScale=0.4', 'workTime=4', 'halfOnly=1', 'autorotate=1'], ] for url_parameters in cube_test_cases: self.AddStory(WebXrSamplePage(self, url_parameters, 'tests/cube-sea'))
925
367
import argparse import os import re import errno import subprocess import sys import gzip import shutil import traceback import json import urllib import csv import logging import datetime import strict_rfc3339 import codecs from itertools import chain from urllib.error import URLError import publicsuffix from utils.scan_utils import options as options_for_scan # global in-memory cache suffix_list = None # /Time Conveniences # # RFC 3339 timestamp for a given UTC time. # seconds can be a float, down to microseconds. # A given time needs to be passed in *as* UTC already. def utc_timestamp(seconds): if not seconds: return None return strict_rfc3339.timestamp_to_rfc3339_utcoffset(seconds) # Cut off floating point errors, always output duration down to # microseconds. def just_microseconds(duration: float) -> str: if duration is None: return None return "%.6f" % duration def format_datetime(obj): if isinstance(obj, datetime.date): return obj.isoformat() elif isinstance(obj, str): return obj else: return None # /Time Conveniences # # Wrapper to a run() method to catch exceptions. def run(run_method, additional=None): cli_options = options() configure_logging(cli_options) if additional: cli_options.update(additional) try: return run_method(cli_options) except Exception as exception: notify(exception) # TODO: Somewhat better error handling. def download(url, destination): # make sure path is present mkdir_p(os.path.dirname(destination)) filename, headers = urllib.request.urlretrieve(url, destination) # If it's a gzipped file, ungzip it and replace it if headers.get("Content-Encoding") == "gzip": unzipped_file = filename + ".unzipped" with gzip.GzipFile(filename, 'rb') as inf: with open(unzipped_file, 'w') as outf: outf.write(inf.read().decode('utf-8')) shutil.copyfile(unzipped_file, filename) return filename def options_endswith(end): """ Returns a function that checks that an argument ends ``end``. :arg str end: The string that is supposed to be at the end of the argument. :rtype: function """ def func(arg): if arg.endswith(end): return arg raise argparse.ArgumentTypeError("value must end in '%s'" % end) return func class ArgumentParser(argparse.ArgumentParser): """ This lets us test for errors from argparse by overriding the error method. See https://stackoverflow.com/questions/5943249 """ def _get_action_from_name(self, name): """Given a name, get the Action instance registered with this parser. If only it were made available in the ArgumentError object. It is passed as its first arg... """ container = self._actions if name is None: return None for action in container: if '/'.join(action.option_strings) == name: return action elif action.metavar == name: return action elif action.dest == name: return action def error(self, message): exc = sys.exc_info()[1] if exc: exc.argument = self._get_action_from_name(exc.argument_name) raise exc super(ArgumentParser, self).error(message) def options(): """ Checks to see whether ``gather`` or ``scan`` was called and returns the parsed options for the appropriate function call. :rtype: dict """ if sys.argv[0].endswith("gather"): return options_for_gather() elif sys.argv[0].endswith("scan"): return options_for_scan() def build_gather_options_parser(services): """ Takes a list of services that should be added as required flags, then builds the argparse parser object. :arg list[str] services: services with required flags. :rtype: ArgumentParser """ usage_message = "".join([ "%(prog)s GATHERERS --suffix [SUFFIX] ", "--[GATHERER] [GATHERER OPTIONS] [options] ", "(GATHERERS and SUFFIX are comma-separated lists)\n", "For example:\n", "./gather dap --suffix=.gov ", "--dap=https://analytics.usa.gov/data/live/sites-extended.csv" ]) parser = ArgumentParser(prefix_chars="--", usage=usage_message) for service in services: parser.add_argument("--%s" % service, nargs=1, required=True) parser.add_argument("--cache", action="store_true", help="Use local filesystem cache (censys only).") parser.add_argument("--debug", action="store_true", help="Show debug information.") parser.add_argument("--ignore-www", action="store_true", help="Ignore the www. prefixes of hostnames.") parser.add_argument("--include-parents", action="store_true", help="Include second-level domains.") parser.add_argument("--log", nargs=1) parser.add_argument("--parents", nargs=1, help="".join([ "A path or URL to a CSV whose first column is second-level domains. ", "Any subdomain not contained within these second-level domains will ", "be excluded." ])) parser.add_argument("--sort", action="store_true", help="".join([ "Sort result CSVs by domain name, alphabetically. (Note: this causes ", "the entire dataset to be read into memory.)", ])) parser.add_argument("--suffix", nargs=1, required=True, help="".join([ "Comma-separated list of suffixes, e.g '.gov' ", "or '.fed.us' or '.gov,.gov.uk' (required)." ])) parser.add_argument("--timeout", nargs=1, help="".join([ "Override the 10 minute job timeout (specify in seconds) ", "(censys only).", ])) parser.add_argument("--output", nargs=1, default=["./"], help="".join([ "Where to output the 'cache/' and 'results/' directories. ", "Defaults to './'.", ])) return parser def options_for_gather(): """ Parse options for the ``gather`` command. :rtype: dict Impure Reads from sys.argv. The gather command requires a comma-separated list of one or more gatherers, and an argument (with a value) whose name corresponds to each gatherer, as well as a mandatory suffix value. ``./gather dap --suffix=.gov`` is insuffucient, because the present of the ``dap`` gatherer means that ``--dap=<someurl>`` is therefore required as an argument. Hence we look for the first argument before building the parser, so that the additional required arguments can be passed to it. The ``set_services`` are those services, like ``censys``, that don't have a matching argument, and the inclusion of the help flags is necessary here so that they don't get added as services. """ set_services = ( ",", "--help", "-h", "censys", ) services = [s.strip() for s in sys.argv[1].split(",") if s not in set_services and s.strip()] if services and services[0].startswith("--"): raise argparse.ArgumentTypeError( "First argument must be a list of gatherers.") parser = build_gather_options_parser(services) parsed, remaining = parser.parse_known_args() for remainder in remaining: if remainder.startswith("--") or remainder == ",": raise argparse.ArgumentTypeError("%s isn't a valid argument here." % remainder) opts = {k: v for k, v in vars(parsed).items() if v is not None} """ The following expect a single argument, but argparse returns lists for them because that's how ``nargs=<n/'*'/'+'>`` works, so we need to extract the single values. """ should_be_singles = [ "parents", "suffix", "output", ] for service in services: should_be_singles.append(service) for kwd in should_be_singles: if kwd in opts: opts[kwd] = opts[kwd][0] opts["gatherers"] = [g.strip() for g in remaining[0].split(",") if g.strip()] if not opts["gatherers"]: raise argparse.ArgumentTypeError( "First argument must be a comma-separated list of gatherers") # If any hyphenated gatherers got sent in, override the hyphen-to-underscore # conversion that argparse does by default. # Also turn the array into a single one, since nargs=1 won't have been set. for gatherer in opts["gatherers"]: if "-" in gatherer: scored = gatherer.replace("-", "_") if opts.get(scored): opts[gatherer] = opts[scored][0] del opts[scored] # Derive some options not set directly at CLI: opts["_"] = { "cache_dir": os.path.join(opts.get("output", "./"), "cache"), "report_dir": opts.get("output", "./"), "results_dir": os.path.join(opts.get("output", "./"), "results"), } # Some of the arguments expect single values on the command line, but those # values may contain comma-separated multiple values, so create the # necessary lists here. def fix_suffix(suffix: str) -> str: return suffix if suffix.startswith(".") else ".%s" % suffix opts["suffix"] = [fix_suffix(s.strip()) for s in opts["suffix"].split(",") if s.strip()] return opts def configure_logging(options=None): options = {} if not options else options if options.get('debug', False): log_level = "debug" else: log_level = options.get("log", "warn") if log_level not in ["debug", "info", "warn", "error"]: print("Invalid log level (specify: debug, info, warn, error).") sys.exit(1) # In the case of AWS Lambda, the root logger is used BEFORE our # Lambda handler runs, and this creates a default handler that # goes to the console. Once logging has been configured, calling # logging.basicConfig() has no effect. We can get around this by # removing any root handlers (if present) before calling # logging.basicConfig(). This unconfigures logging and allows # --debug to affect the logging level that appears in the # CloudWatch logs. # # See # https://stackoverflow.com/questions/1943747/python-logging-before-you-run-logging-basicconfig # and # https://stackoverflow.com/questions/37703609/using-python-logging-with-aws-lambda # for more details. root = logging.getLogger() if root.handlers: for handler in root.handlers: root.removeHandler(handler) logging.basicConfig(format='%(message)s', level=log_level.upper()) # mkdir -p in python, from: # https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python def mkdir_p(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST: pass else: raise # JSON Conveniences # # Format datetimes, sort keys, pretty-print. def json_for(object): return json.dumps(object, sort_keys=True, indent=2, default=format_datetime) # Mirror image of json_for. def from_json(string): return json.loads(string) # /JSON Conveniences # def write(content, destination, binary=False): mkdir_p(os.path.dirname(destination)) if binary: f = open(destination, 'bw') else: f = open(destination, 'w', encoding='utf-8') f.write(content) f.close() def read(source): with open(source) as f: contents = f.read() return contents def report_dir(options): return options.get("output", "./") def cache_dir(options): return os.path.join(report_dir(options), "cache") def results_dir(options): return os.path.join(report_dir(options), "results") # Read in JSON file of known third party services. def known_services(): return from_json(read(os.path.join("./utils/known_services.json"))) def notify(body): try: if isinstance(body, Exception): body = format_last_exception() logging.error(body) # always print it except Exception: print("Exception logging message to admin, halting as to avoid loop") print(format_last_exception()) def format_last_exception(): exc_type, exc_value, exc_traceback = sys.exc_info() return "\n".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) # test if a command exists, don't print output def try_command(command): try: subprocess.check_call(["which", command], shell=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) return True except subprocess.CalledProcessError: logging.warning(format_last_exception()) logging.warning("No command found: %s" % (str(command))) return False def scan(command, env=None, allowed_return_codes=[]): try: response = subprocess.check_output( command, stderr=subprocess.STDOUT, shell=False, env=env ) return str(response, encoding='UTF-8') except subprocess.CalledProcessError as exc: if exc.returncode in allowed_return_codes: return str(exc.stdout, encoding='UTF-8') else: logging.warning("Error running %s." % (str(command))) logging.warning("Error running %s." % (str(exc.output))) logging.warning(format_last_exception()) return None # Turn shell on, when shell=False won't work. def unsafe_execute(command): try: response = subprocess.check_output(command, shell=True) return str(response, encoding='UTF-8') except subprocess.CalledProcessError: logging.warning("Error running %s." % (str(command))) return None # Predictable cache path for a domain and operation. def cache_path(domain, operation, ext="json", cache_dir="./cache"): return os.path.join(cache_dir, operation, ("%s.%s" % (domain, ext))) # cache a single one-off file, not associated with a domain or operation def cache_single(filename, cache_dir="./cache"): return os.path.join(cache_dir, filename) # Used to quickly get cached data for a domain. def data_for(domain, operation, cache_dir="./cache"): path = cache_path(domain, operation, cache_dir=cache_dir) if os.path.exists(path): raw = read(path) data = json.loads(raw) if isinstance(data, dict) and (data.get('invalid', False)): return None else: return data else: return {} # marker for a cached invalid response def invalid(data=None): if data is None: data = {} data['invalid'] = True return json_for(data) # Convert a RFC 3339 timestamp back into a local number of seconds. def utc_timestamp_to_local_now(timestamp): return strict_rfc3339.rfc3339_to_timestamp(timestamp) # Now, in UTC, in seconds (with decimal microseconds). def local_now(): return datetime.datetime.now().timestamp() # Return base domain for a subdomain, factoring in the Public Suffix List. def base_domain_for(subdomain, cache_dir="./cache"): global suffix_list """ For "x.y.domain.gov", return "domain.gov". If suffix_list is None, the caches have not been initialized, so do that. """ if suffix_list is None: suffix_list, discard = load_suffix_list(cache_dir=cache_dir) if suffix_list is None: logging.warning("Error downloading the PSL.") exit(1) return suffix_list.get_public_suffix(subdomain) # Returns an instantiated PublicSuffixList object, and the # list of lines read from the file. def load_suffix_list(cache_dir="./cache"): cached_psl = cache_single("public-suffix-list.txt", cache_dir=cache_dir) if os.path.exists(cached_psl): logging.debug("Using cached Public Suffix List...") with codecs.open(cached_psl, encoding='utf-8') as psl_file: suffixes = publicsuffix.PublicSuffixList(psl_file) content = psl_file.readlines() else: # File does not exist, download current list and cache it at given location. logging.debug("Downloading the Public Suffix List...") try: cache_file = publicsuffix.fetch() except URLError as err: logging.warning("Unable to download the Public Suffix List...") logging.debug("{}".format(err)) return None, None content = cache_file.readlines() suffixes = publicsuffix.PublicSuffixList(content) # Cache for later. write(''.join(content), cached_psl) return suffixes, content # Check whether we have HTTP behavior data cached for a domain. # If so, check if we know it doesn't support HTTPS. # Useful for saving time on TLS-related scanning. def domain_doesnt_support_https(domain, cache_dir="./cache"): # Make sure we have the cached data. inspection = data_for(domain, "pshtt", cache_dir=cache_dir) if not inspection: return False if (inspection.__class__ is dict) and inspection.get('invalid'): return False https = inspection.get("endpoints").get("https") httpswww = inspection.get("endpoints").get("httpswww") def endpoint_used(endpoint): # commented out next line to remove bad hostname check so we can still get info about weak crypto even if the cert doesn't match # return endpoint.get("live") and (not endpoint.get("https_bad_hostname")) return endpoint.get("live") return (not (endpoint_used(https) or endpoint_used(httpswww))) # Check whether we have HTTP behavior data cached for a domain. # If so, check if we know it canonically prepends 'www'. def domain_uses_www(domain, cache_dir="./cache"): # Don't prepend www to www. if domain.startswith("www."): return False # Make sure we have the data. inspection = data_for(domain, "pshtt", cache_dir=cache_dir) if not inspection: return False if (inspection.__class__ is dict) and inspection.get('invalid'): return False # We know the canonical URL, return True if it's www. url = inspection.get("Canonical URL") return ( url.startswith("http://www") or url.startswith("https://www") ) def domain_mail_servers_that_support_starttls(domain, cache_dir="./cache"): retVal = [] data = data_for(domain, 'trustymail', cache_dir=cache_dir) if data: starttls_results = data.get('Domain Supports STARTTLS Results') if starttls_results: retVal = starttls_results.split(', ') return retVal # Check whether we have HTTP behavior data cached for a domain. # If so, check if we know it's not live. # Useful for skipping scans on non-live domains. def domain_not_live(domain, cache_dir="./cache"): # Make sure we have the data. inspection = data_for(domain, "pshtt", cache_dir=cache_dir) if not inspection: return False return (not inspection.get("Live")) # Check whether we have HTTP behavior data cached for a domain. # If so, check if we know it redirects. # Useful for skipping scans on redirect domains. def domain_is_redirect(domain, cache_dir="./cache"): # Make sure we have the data. inspection = data_for(domain, "pshtt", cache_dir=cache_dir) if not inspection: return False return (inspection.get("Redirect") is True) # Check whether we have HTTP behavior data cached for a domain. # If so, check if we know its canonical URL. # Useful for focusing scans on the right endpoint. def domain_canonical(domain, cache_dir="./cache"): # Make sure we have the data. inspection = data_for(domain, "pshtt", cache_dir=cache_dir) if not inspection: return False return (inspection.get("Canonical URL")) # Load the first column of a CSV into memory as an array of strings. def load_domains(domain_csv, whole_rows=False): domains = [] with open(domain_csv, newline='') as csvfile: for row in csv.reader(csvfile): # Skip empty rows. if (not row) or (not row[0].strip()): continue row[0] = row[0].lower() # Skip any header row. if (not domains) and ((row[0] == "domain") or (row[0] == "domain name")): continue if whole_rows: domains.append(row) else: domains.append(row[0]) return domains # Sort a CSV by domain name, "in-place" (by making a temporary copy). # This loads the whole thing into memory: it's not a great solution for # super-large lists of domains. def sort_csv(input_filename): logging.warning("Sorting %s..." % input_filename) input_file = open(input_filename, encoding='utf-8', newline='') tmp_filename = "%s.tmp" % input_filename tmp_file = open(tmp_filename, 'w', newline='') tmp_writer = csv.writer(tmp_file) # store list of domains, to sort at the end domains = [] # index rows by domain rows = {} header = None for row in csv.reader(input_file): # keep the header around if (row[0].lower() == "domain"): header = row continue # index domain for later reference domain = row[0] domains.append(domain) rows[domain] = row # straight alphabet sort domains.sort() # write out to a new file tmp_writer.writerow(header) for domain in domains: tmp_writer.writerow(rows[domain]) # close the file handles input_file.close() tmp_file.close() # replace the original shutil.move(tmp_filename, input_filename) # Given a domain suffix, provide a compiled regex. # Assumes suffixes always begin with a dot. # # e.g. [".gov", ".gov.uk"] -> "(?:\\.gov|\\.gov.uk)$" def suffix_pattern(suffixes): prefixed = [suffix.replace(".", "\\.") for suffix in suffixes] center = str.join("|", prefixed) return re.compile("(?:%s)$" % center) def flatten(iterable): return list(chain.from_iterable(iterable))
8,642
309
/* * Copyright (C) 2021 Arm Limited or its affiliates. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the License); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __PLOT_UTILS_H__ #define __PLOT_UTILS_H__ #include <string> #include <vector> #define LCD_COLOR_ARM_BLUE ((uint32_t) 0xFF00C1DE) #define LCD_COLOR_ARM_DARK ((uint32_t) 0xFF333E48) class PlotUtils { public: PlotUtils(int numMfccFeatures, int numFrames); ~PlotUtils() = default; void ClearAll(); void ClearStringLine(int line); void DisplayStringAtCentreMode(uint16_t xPos, uint16_t yPos, std::string text); void PlotMfcc(std::vector<float>& mfccBuffer, int numMfccFeatures, int numFrames); void PlotWaveform(std::vector<int16_t>& audioBuffer, int audioBlockSize, int frameLen, int frameShift); private: int mfccUpdateCounter; uint32_t screenSizeX; uint32_t screenSizeY; std::vector<uint32_t> mfccPlotBuffer; std::vector<int> audioPlotBuffer; uint32_t CalculateRGB(int min, int max, int value); }; #endif /* __PLOT_UTILS_H__ */
532
348
{"nom":"Albas","circ":"1ère circonscription","dpt":"Aude","inscrits":71,"abs":23,"votants":48,"blancs":7,"nuls":2,"exp":39,"res":[{"nuance":"REM","nom":"<NAME>","voix":34},{"nuance":"FN","nom":"M. <NAME>","voix":5}]}
88
412
int main() { int i; for(i = 0; i < 10; i++) { int j; for(j = 0; j < 10; j++) { int k; k = 0; while(k < 10) { k++; } } } }
116
303
<reponame>mr-c/LightZone<gh_stars>100-1000 /* Copyright (C) 2005-2011 <NAME> */ package com.lightcrafts.prefs; import com.lightcrafts.image.export.ImageExportOptions; import com.lightcrafts.image.types.ImageType; import com.lightcrafts.image.types.JPEGImageType; import com.lightcrafts.image.types.TIFFImageType; import static com.lightcrafts.prefs.Locale.LOCALE; import com.lightcrafts.ui.export.ExportControls; import com.lightcrafts.ui.export.ExportLogic; import com.lightcrafts.ui.export.SaveOptions; import javax.swing.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.*; import java.util.ArrayList; import java.util.List; class SavePrefsPanel extends JPanel implements ItemListener { // The combo box of ExportComboItems, one per output ImageType private JComboBox typeCombo; // A container holding the combo box and a label private Box typeBox; // The settings controls for the current output ImageType private ExportControls ctrls; // A header for the ExportControls private JLabel ctrlsTitle; // A container holding the export controls and a label private Box ctrlsTitleBox; // Remember hidden options for the unselected output ImageType private ExportComboItem otherComboItem; // Explanatory text private HelpArea help; SavePrefsPanel() { SaveOptions options = SaveOptions.getDefaultSaveOptions(); ImageExportOptions export = SaveOptions.getExportOptions(options); List<ExportComboItem> filters = getExportAllComboItems(); ImageType defaultType = SaveOptions.getExportOptions(options).getImageType(); typeCombo = new JComboBox(); ExportComboItem defaultItem = null; for (ExportComboItem filter : filters) { ImageExportOptions filterOptions = filter.getExportOptions(); ImageType filterType = filterOptions.getImageType(); if (defaultType.equals(filterType)) { // For the default filter, use the default options: filter = new ExportComboItem(export); defaultItem = filter; } typeCombo.addItem(filter); } if (defaultItem != null) { typeCombo.setSelectedItem(defaultItem); } typeCombo.setMaximumSize(typeCombo.getPreferredSize()); typeCombo.addItemListener(this); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JLabel typeLabel = new JLabel(LOCALE.get("SaveTypeLabel")); typeBox = Box.createHorizontalBox(); typeBox.add(typeLabel); typeBox.add(typeCombo); ctrls = new ExportControls(export, false); ctrls.setBorder(BorderFactory.createTitledBorder("")); ctrlsTitle = new JLabel(defaultItem.toString() + " Options"); ctrlsTitleBox = Box.createHorizontalBox(); ctrlsTitleBox.add(ctrlsTitle); ctrlsTitleBox.add(Box.createHorizontalGlue()); String helpText = LOCALE.get("SaveHelp"); help = new HelpArea(); help.setText(helpText); Dimension helpSize = help.getPreferredSize(); helpSize = new Dimension(helpSize.width, 70); help.setPreferredSize(helpSize); help.setMaximumSize(helpSize); add(Box.createVerticalGlue()); add(Box.createVerticalStrut(8)); add(typeBox); add(Box.createVerticalStrut(8)); add(ctrlsTitleBox); add(Box.createVerticalStrut(8)); add(ctrls); add(Box.createVerticalStrut(8)); add(Box.createVerticalGlue()); add(help); } void commit() { ExportComboItem item = (ExportComboItem) typeCombo.getSelectedItem(); ImageExportOptions export = item.exportOptions; SaveOptions options; if (export.getImageType() == TIFFImageType.INSTANCE) { options = SaveOptions.createSidecarTiff(export); } else { options = SaveOptions.createSidecarJpeg(export); } SaveOptions.setDefaultSaveOptions(options); } // Respond to changes in the export image type combo box: public void itemStateChanged(ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { ExportComboItem exportComboItem = (ExportComboItem) typeCombo.getSelectedItem(); // The otherComboItem may be null, the first time this is called. ImageExportOptions newOptions = exportComboItem.getExportOptions(); if (otherComboItem != null) { ImageExportOptions oldOptions = otherComboItem.getExportOptions(); ExportLogic.mergeExportOptions(oldOptions, newOptions); } removeAll(); ctrls = new ExportControls(newOptions, false); ctrls.setBorder(BorderFactory.createTitledBorder("")); ctrlsTitle.setText(exportComboItem.toString() + " Options"); add(Box.createVerticalGlue()); add(Box.createVerticalStrut(8)); add(typeBox); add(Box.createVerticalStrut(8)); add(ctrlsTitleBox); add(Box.createVerticalStrut(8)); add(ctrls); add(Box.createVerticalStrut(8)); add(Box.createVerticalGlue()); add(help); repaint(); otherComboItem = exportComboItem; } } private static List<ExportComboItem> getExportAllComboItems() { ExportComboItem filter; ArrayList<ExportComboItem> filters = new ArrayList<ExportComboItem>(); filter = new ExportComboItem(TIFFImageType.INSTANCE.newExportOptions()); filters.add(filter); filter = new ExportComboItem(JPEGImageType.INSTANCE.newExportOptions()); filters.add(filter); return filters; } // Items for an export image type combo box: static class ExportComboItem { private ImageExportOptions exportOptions; private ExportComboItem(ImageExportOptions exportOptions) { this.exportOptions = exportOptions; } public String toString() { return exportOptions.getImageType().getName(); } private ImageExportOptions getExportOptions() { return exportOptions; } } }
2,593
3,012
<filename>NetworkPkg/Mtftp4Dxe/Mtftp4Option.h /** @file Routines to process MTFTP4 options. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __EFI_MTFTP4_OPTION_H__ #define __EFI_MTFTP4_OPTION_H__ #define MTFTP4_SUPPORTED_OPTIONS 5 #define MTFTP4_OPCODE_LEN 2 #define MTFTP4_ERRCODE_LEN 2 #define MTFTP4_BLKNO_LEN 2 #define MTFTP4_DATA_HEAD_LEN 4 #define MTFTP4_BLKSIZE_EXIST 0x01 #define MTFTP4_TIMEOUT_EXIST 0x02 #define MTFTP4_TSIZE_EXIST 0x04 #define MTFTP4_MCAST_EXIST 0x08 #define MTFTP4_WINDOWSIZE_EXIST 0x10 typedef struct { UINT16 BlkSize; UINT16 WindowSize; UINT8 Timeout; UINT32 Tsize; IP4_ADDR McastIp; UINT16 McastPort; BOOLEAN Master; UINT32 Exist; } MTFTP4_OPTION; /** Allocate and fill in a array of Mtftp options from the Packet. It first calls Mtftp4FillOption to get the option number, then allocate the array, at last, call Mtftp4FillOption again to save the options. @param Packet The packet to parse @param PacketLen The length of the packet @param OptionCount The number of options in the packet @param OptionList The point to get the option array. @retval EFI_INVALID_PARAMETER The parametera are invalid or packet isn't a well-formatted OACK packet. @retval EFI_SUCCESS The option array is build @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array **/ EFI_STATUS Mtftp4ExtractOptions ( IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, OUT UINT32 *OptionCount, OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL ); /** Parse the option in Options array to MTFTP4_OPTION which program can access directly. @param Options The option array, which contains addresses of each option's name/value string. @param Count The number of options in the Options @param Request Whether this is a request or OACK. The format of multicast is different according to this setting. @param Operation The current performed operation. @param MtftpOption The MTFTP4_OPTION for easy access. @retval EFI_INVALID_PARAMETER The option is malformatted @retval EFI_UNSUPPORTED Some option isn't supported @retval EFI_SUCCESS The option are OK and has been parsed. **/ EFI_STATUS Mtftp4ParseOption ( IN EFI_MTFTP4_OPTION *Options, IN UINT32 Count, IN BOOLEAN Request, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption ); /** Parse the options in the OACK packet to MTFTP4_OPTION which program can access directly. @param Packet The OACK packet to parse @param PacketLen The length of the packet @param Operation The current performed operation. @param MtftpOption The MTFTP_OPTION for easy access. @retval EFI_INVALID_PARAMETER The packet option is malformatted @retval EFI_UNSUPPORTED Some option isn't supported @retval EFI_SUCCESS The option are OK and has been parsed. **/ EFI_STATUS Mtftp4ParseOptionOack ( IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption ); extern CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS]; #endif
1,838
4,492
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. INCLUDES = """ /* define our OpenSSL API compatibility level to 1.0.1. Any symbols older than that will raise an error during compilation. We can raise this number again after we drop 1.0.2 support in the distant future. */ #define OPENSSL_API_COMPAT 0x10001000L #include <openssl/opensslv.h> #if defined(LIBRESSL_VERSION_NUMBER) #define CRYPTOGRAPHY_IS_LIBRESSL 1 #else #define CRYPTOGRAPHY_IS_LIBRESSL 0 #endif #if defined(OPENSSL_IS_BORINGSSL) #define CRYPTOGRAPHY_IS_BORINGSSL 1 #else #define CRYPTOGRAPHY_IS_BORINGSSL 0 #endif /* LibreSSL removed e_os2.h from the public headers so we'll only include it if we're using vanilla OpenSSL. */ #if !CRYPTOGRAPHY_IS_LIBRESSL #include <openssl/e_os2.h> #endif #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <Wincrypt.h> #include <Winsock2.h> #endif #if CRYPTOGRAPHY_IS_LIBRESSL #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_322 \ (LIBRESSL_VERSION_NUMBER < 0x3020200f) #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 \ (LIBRESSL_VERSION_NUMBER < 0x3030200f) #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 \ (LIBRESSL_VERSION_NUMBER < 0x3040000f) #else #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_322 (0) #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 (0) #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 (0) #endif #if OPENSSL_VERSION_NUMBER < 0x10100000 #error "pyca/cryptography MUST be linked with Openssl 1.1.0 or later" #endif #define CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER \ (OPENSSL_VERSION_NUMBER >= 0x10101040 && !CRYPTOGRAPHY_IS_LIBRESSL) #define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \ (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL) #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 \ (OPENSSL_VERSION_NUMBER < 0x10101000 || CRYPTOGRAPHY_IS_LIBRESSL) #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \ (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL) #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \ (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL) #if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \ !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING) #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1 #else #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0 #endif """ TYPES = """ static const int CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER; static const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER; static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111; static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B; static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE; static const int CRYPTOGRAPHY_IS_LIBRESSL; static const int CRYPTOGRAPHY_IS_BORINGSSL; """ FUNCTIONS = """ """ CUSTOMIZATIONS = """ """
1,239
2,659
/* * Copyright 2021 4Paradigm * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gtest/gtest.h" #include "schema/index_util.h" namespace openmldb { namespace schema { class IndexTest : public ::testing::Test { public: IndexTest() {} ~IndexTest() {} }; TEST_F(IndexTest, CheckUnique) { PBIndex indexs; auto index = indexs.Add(); index->set_index_name("index1"); index->add_col_name("col1"); index = indexs.Add(); index->set_index_name("index2"); index->add_col_name("col2"); ASSERT_TRUE(IndexUtil::CheckUnique(indexs).OK()); index = indexs.Add(); index->set_index_name("index3"); index->add_col_name("col2"); ASSERT_FALSE(IndexUtil::CheckUnique(indexs).OK()); } } // namespace schema } // namespace openmldb int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
484
323
/* * Copyright (c) 2013, SUSE Inc. * * This program is licensed under the BSD license, read LICENSE.BSD * for further information */ extern int solv_pgpvrfy(const unsigned char *pub, int publ, const unsigned char *sig, int sigl);
74
1,079
/** * Copyright (C) 2016, Canonical Ltd. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * Author: <NAME> <<EMAIL>> * */ #ifndef REACTPROPERTYHANDLER_H #define REACTPROPERTYHANDLER_H #include <QMap> #include <QObject> #include <QMetaProperty> class QQuickItem; class ReactPropertyHandler : public QObject { Q_OBJECT public: ReactPropertyHandler(QObject* object, bool exposeQmlProperties = true); virtual ~ReactPropertyHandler(); virtual QList<QMetaProperty> availableProperties(); virtual void applyProperties(const QVariantMap& properties); protected: bool m_exposeQmlProperties; bool m_cached = false; QObject* m_object; QMap<QString, QMetaProperty> m_coreProperties; QMap<QString, QMetaProperty> m_extraProperties; private: void buildPropertyMap(); }; #endif // REACTPROPERTYHANDLER_H
331
5,168
<reponame>Olalaye/MegEngine /** * \file imperative/src/impl/ops/tensorrt_runtime.cpp * MegEngine is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. */ #include "../op_trait.h" #include "megbrain/imperative/ops/autogen.h" #if MGB_CAMBRICON #include "megbrain/cambricon/cambricon_runtime_opr.h" namespace mgb::imperative { namespace { namespace cambricon_runtime { auto apply_on_var_node(const OpDef& def, const VarNodeArray& inputs) { auto&& op = static_cast<const CambriconRuntime&>(def); SymbolVarArray symbol_var_inputs(inputs.begin(), inputs.end()); OperatorNodeConfig config{op.make_name()}; return opr::CambriconRuntimeOpr::make( op.buf.c_str(), op.buf_size, op.symbol, symbol_var_inputs, op.tensor_dim_mutable, config); } OP_TRAIT_REG(CambriconRuntime, CambriconRuntime) .apply_on_var_node(apply_on_var_node) .fallback(); } // namespace cambricon_runtime } // namespace } // namespace mgb::imperative #endif
476
879
<gh_stars>100-1000 package org.zstack.sdk; import org.zstack.sdk.CertificateInventory; public class UpdateCertificateResult { public CertificateInventory inventory; public void setInventory(CertificateInventory inventory) { this.inventory = inventory; } public CertificateInventory getInventory() { return this.inventory; } }
124
435
{ "copyright_text": "Standard YouTube License", "description": "Se har\u00e1 un repaso hist\u00f3rico sobre como se ha ido afrontando el problema de la representaci\u00f3n de caracteres por de medios electr\u00f3nicos a lo largo de la historia desde el tel\u00e9grafo hasta el est\u00e1ndar actual.\n\nSeguidamente describiremos como se manejaba en Python 2 y qu\u00e9 cambios se produjeron con la llegada de Python 3.", "duration": 1471, "language": "spa", "recorded": "2017-09-23T12:30:00+02:00", "related_urls": [ { "label": "schedule", "url": "https://2017.es.pycon.org/es/schedule/" }, { "label": "talk schedule", "url": "https://2017.es.pycon.org/es/schedule/da3nde-esta-mi-a/" }, { "label": "speaker talks repo", "url": "https://github.com/migonzalvar/talks" } ], "speakers": [ "<NAME>\u00e1lez \u00c1lvarez" ], "tags": [ "unicode" ], "thumbnail_url": "https://i.ytimg.com/vi/BLJl3x8JLOQ/maxresdefault.jpg", "title": "\u00bfD\u00c3\u00b3nde est\u00c3\u00a1 mi \u00c3\u00b1?", "videos": [ { "type": "youtube", "url": "https://www.youtube.com/watch?v=BLJl3x8JLOQ" } ] }
562
303
/* _____ __ ___ __ ____ _ __ / ___/__ ___ _ ___ / |/ /__ ___ / /_____ __ __/ __/_______(_)__ / /_ / (_ / _ `/ ' \/ -_) /|_/ / _ \/ _ \/ '_/ -_) // /\ \/ __/ __/ / _ \/ __/ \___/\_,_/_/_/_/\__/_/ /_/\___/_//_/_/\_\\__/\_, /___/\__/_/ /_/ .__/\__/ /___/ /_/ See Copyright Notice in gmMachine.h */ #include "gmConfig.h" #include "gmMachineLib.h" #include "gmThread.h" #include "gmMachine.h" #include "gmUtil.h" // // machine // static int GM_CDECL gmVersion(gmThread * a_thread) { a_thread->PushNewString(GM_VERSION); return GM_OK; } static int GM_CDECL gmTypeId(gmThread * a_thread) // return int, or null { if(a_thread->GetNumParams() > 0) { a_thread->PushInt((gmptr) a_thread->Param(0).m_type); } return GM_OK; } static int GM_CDECL gmTypeName(gmThread * a_thread) // return string, or null { if(a_thread->GetNumParams() > 0) { const char * name = a_thread->GetMachine()->GetTypeName(a_thread->Param(0).m_type); a_thread->PushNewString(name); } return GM_OK; } static int GM_CDECL gmRegisterTypeOperator(gmThread * a_thread) // typeid, operatorname, function, returns true on success { GM_CHECK_NUM_PARAMS(3); GM_CHECK_INT_PARAM(typeId, 0); GM_CHECK_STRING_PARAM(operatorName, 1); GM_CHECK_FUNCTION_PARAM(function, 2); gmOperator op = gmGetOperator(operatorName); if(op != O_MAXOPERATORS) { a_thread->PushInt(a_thread->GetMachine()->RegisterTypeOperator((gmType) typeId, op, function) ? 1 : 0); return GM_OK; } a_thread->PushInt(0); return GM_OK; } static int GM_CDECL gmRegisterTypeVariable(gmThread * a_thread) // typeid, key (string), value { GM_CHECK_NUM_PARAMS(3); GM_CHECK_INT_PARAM(typeId, 0); GM_CHECK_STRING_PARAM(variable, 1); a_thread->GetMachine()->RegisterTypeVariable((gmType) typeId, variable, a_thread->Param(2)); return GM_OK; } static int GM_CDECL gmCollectGarbage(gmThread * a_thread) // returns true if gc was run { GM_INT_PARAM(forceFullCollect, 0, false); a_thread->PushInt(a_thread->GetMachine()->CollectGarbage(forceFullCollect != 0) ? 1 : 0); return GM_OK; } static int GM_CDECL gmGetCurrentMemoryUsage(gmThread * a_thread) // returns current memory usage in bytes { a_thread->PushInt(a_thread->GetMachine()->GetCurrentMemoryUsage()); return GM_OK; } static int GM_CDECL gmSetDesiredMemoryUsageHard(gmThread * a_thread) // mem usage in bytes { GM_CHECK_NUM_PARAMS(1); GM_CHECK_INT_PARAM(mem, 0); a_thread->GetMachine()->SetDesiredByteMemoryUsageHard(mem); return GM_OK; } static int GM_CDECL gmSetDesiredMemoryUsageSoft(gmThread * a_thread) // mem usage in bytes { GM_CHECK_NUM_PARAMS(1); GM_CHECK_INT_PARAM(mem, 0); a_thread->GetMachine()->SetDesiredByteMemoryUsageSoft(mem); return GM_OK; } static int GM_CDECL gmGetDesiredMemoryUsageHard(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->GetDesiredByteMemoryUsageHard()); return GM_OK; } static int GM_CDECL gmGetDesiredMemoryUsageSoft(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->GetDesiredByteMemoryUsageSoft()); return GM_OK; } static int GM_CDECL gmSetDesiredMemoryUsageAuto(gmThread * a_thread) // mem usage in bytes { GM_CHECK_NUM_PARAMS(1); GM_CHECK_INT_PARAM(autoEnable, 0); a_thread->GetMachine()->SetAutoMemoryUsage(autoEnable != 0); return GM_OK; } static int GM_CDECL gmSysGetStatsGCNumFullCollects(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->GetStatsGCNumFullCollects()); return GM_OK; } static int GM_CDECL gmSysGetStatsGCNumIncCollects(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->GetStatsGCNumIncCollects()); return GM_OK; } static int GM_CDECL gmSysGetStatsGCNumWarnings(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->GetStatsGCNumWarnings()); return GM_OK; } static int GM_CDECL gmSysIsGCRunning(gmThread * a_thread) { a_thread->PushInt(a_thread->GetMachine()->IsGCRunning()); return GM_OK; } static int GM_CDECL gmDoString(gmThread * a_thread) // string, now(int), returns thread id, null on error, exception on compile error { GM_CHECK_NUM_PARAMS(1); // Need at least 1 parameter GM_CHECK_STRING_PARAM(script, 0); // 1st param is script string GM_INT_PARAM(now, 1, 1); // 2nd param is execute now flag gmVariable paramThis = a_thread->Param(2, gmVariable::s_null); // 3rd param is 'this' int id = GM_INVALID_THREAD; if( script ) { int errors = a_thread->GetMachine()->ExecuteString(script, &id, (now) ? true : false, NULL, &paramThis); if( errors ) { return GM_EXCEPTION; } a_thread->PushInt(id); } return GM_OK; } static int GM_CDECL gmGlobals(gmThread * a_thread) // return table { a_thread->PushTable(a_thread->GetMachine()->GetGlobals()); return GM_OK; } static int GM_CDECL gmMachineTime(gmThread * a_thread) // return machine time { a_thread->PushInt(a_thread->GetMachine()->GetTime()); return GM_OK; } // // thread // static int GM_CDECL gmSleep(gmThread * a_thread) // float\int param time in seconds { GM_CHECK_NUM_PARAMS(1); gmType type = a_thread->ParamType(0); gmuint32 ms = 0; if(type == GM_INT) ms = a_thread->Param(0).m_value.m_int * 1000; else if(type == GM_FLOAT) ms = (gmuint32) floorf(a_thread->Param(0).m_value.m_float * 1000.0f); a_thread->Sys_SetTimeStamp(a_thread->GetMachine()->GetTime() + ms); return GM_SYS_SLEEP; } static int GM_CDECL gmYield(gmThread * a_thread) { return GM_SYS_YIELD; } static int GM_CDECL gmThreadTime(gmThread * a_thread) { a_thread->PushInt(a_thread->GetThreadTime()); return GM_OK; } static int GM_CDECL gmThreadId(gmThread * a_thread) // return thread id { a_thread->PushInt(a_thread->GetId()); return GM_OK; } // Callback iteration function for gmThreadAllIds static bool gmThreadIdIter(gmThread * a_thread, void * a_context) { gmTableObject* table = (gmTableObject*)a_context; gmVariable threadId; threadId.SetInt(a_thread->GetId()); table->Set(a_thread->GetMachine(), table->Count(), threadId); return true; } static int GM_CDECL gmThreadAllIds(gmThread * a_thread) // thread id { gmTableObject * threadIds = a_thread->PushNewTable(); a_thread->GetMachine()->ForEachThread(gmThreadIdIter, threadIds); return GM_OK; } static int GM_CDECL gmExit(gmThread * a_thread) { return GM_SYS_KILL; } static int GM_CDECL gmKillThread(gmThread * a_thread) // thread id { GM_INT_PARAM(id, 0, GM_INVALID_THREAD); // 1 optional param, default is this thread // Kill this thread if( (id == GM_INVALID_THREAD) || (id == a_thread->GetId()) ) { return GM_SYS_KILL; // Kill this thread } // Attempt to kill other thread by Id gmThread * thread = a_thread->GetMachine()->GetThread(id); if( thread ) { thread->GetMachine()->Sys_SwitchState(thread, gmThread::KILLED); // Kill other thread } return GM_OK; } // Callback iteration function for gmKillAllThreads() // Kills all threads except current, current thread is passed in as context. static bool threadIterKill(gmThread * a_thread, void * a_context) { gmThread* caller = (gmThread*)a_context; if(a_thread != caller) // Ignore calling thread { switch(a_thread->GetState()) { case gmThread::RUNNING: case gmThread::SLEEPING: case gmThread::BLOCKED: { // Kill the thread a_thread->GetMachine()->Sys_SwitchState(a_thread, gmThread::KILLED); break; } case gmThread::EXCEPTION: case gmThread::KILLED: default: { // Ignore threads of these states break; } } } return true; } static int GM_CDECL gmKillAllThreads(gmThread * a_thread) // thread id { GM_INT_PARAM(killCurrent, 0, 0); a_thread->GetMachine()->ForEachThread(threadIterKill, a_thread); if(killCurrent) { return GM_SYS_KILL; } return GM_OK; } static int GM_CDECL gmfThread(gmThread * a_thread) // fn, params, returns thread id (0) on error, else returns new thread id { GM_CHECK_NUM_PARAMS(1); GM_CHECK_FUNCTION_PARAM(function, 0); int id, i; gmThread * thread = a_thread->GetMachine()->CreateThread(&id); if(thread) { thread->Push(*a_thread->GetThis()); thread->PushFunction(function); int numParameters = a_thread->GetNumParams() - 1; for(i = 0; i < numParameters; ++i) thread->Push(a_thread->Param(i + 1)); thread->PushStackFrame(numParameters, 0); } a_thread->PushInt(id); return GM_OK; } static int GM_CDECL gmAssert(gmThread * a_thread) { if(a_thread->GetNumParams() > 0) { if(a_thread->Param(0).m_value.m_int) { return GM_OK; } } GM_STRING_PARAM(message, 1, "assert failed"); a_thread->GetMachine()->GetLog().LogEntry("%s", message); return GM_EXCEPTION; } static gmType s_gmStateUserType = GM_NULL; struct gmStateUserType { gmFunctionObject * m_lastState; // last state gmFunctionObject * m_currentState; // current state gmFunctionObject * m_setExitState; // leave hanlder }; static int GM_CDECL gmSetState(gmThread * a_thread) // fp, params { GM_CHECK_NUM_PARAMS(GM_STATE_NUM_PARAMS); GM_CHECK_FUNCTION_PARAM(function, 0); // make sure we have our state type. GM_ASSERT(s_gmStateUserType != GM_NULL); // save off the parameters to the new state gmVariable thisVar = *a_thread->GetThis(); int i, numParameters = a_thread->GetNumParams() - GM_STATE_NUM_PARAMS; gmVariable * params = (gmVariable *) alloca(sizeof(gmVariable) * numParameters); for(i = 0; i < numParameters; ++i) { params[i] = a_thread->Param(i + GM_STATE_NUM_PARAMS); } // get the current state gmVariable newStateVariable; gmVariable * currentStateVariable = a_thread->GetBottom(); if(currentStateVariable->m_type == s_gmStateUserType) { gmUserObject * userObj = (gmUserObject *) GM_OBJECT(currentStateVariable->m_value.m_ref); gmStateUserType * currentState = (gmStateUserType *) userObj->m_user; // call the on state leave if one exists. if(currentState->m_setExitState) { gmThread * thread = a_thread->GetMachine()->CreateThread(thisVar, gmVariable(GM_FUNCTION, currentState->m_setExitState->GetRef())); if(thread) { thread->Sys_Execute(); } } currentState->m_setExitState = NULL; currentState->m_lastState = currentState->m_currentState; currentState->m_currentState = function; newStateVariable = *currentStateVariable; } else { gmStateUserType * state = (gmStateUserType *) a_thread->GetMachine()->Sys_Alloc(sizeof(gmStateUserType)); state->m_setExitState = NULL; state->m_currentState = function; state->m_lastState = NULL; // create a new state variable newStateVariable.SetUser(a_thread->GetMachine()->AllocUserObject(state, s_gmStateUserType)); } // reset the stack. and push new state int user = a_thread->m_user; a_thread->Sys_Reset(a_thread->GetId()); a_thread->m_user = user; a_thread->Sys_SetStartTime(a_thread->GetMachine()->GetTime()); a_thread->Touch(4 + numParameters); a_thread->Push(newStateVariable); a_thread->Push(thisVar); a_thread->PushFunction(function); for(i = 0; i < numParameters; ++i) { a_thread->Push(params[i]); } return GM_SYS_STATE; } static int GM_CDECL gmSetStateOnThread(gmThread * a_thread) // (threadid, fp, params...) returns true or false. { GM_CHECK_NUM_PARAMS(2); GM_CHECK_INT_PARAM(threadId, 0); GM_CHECK_FUNCTION_PARAM(function, 1); // make sure we have our state type. GM_ASSERT(s_gmStateUserType != GM_NULL); // get the target thread gmThread * thread = a_thread->GetMachine()->GetThread(threadId); if(thread == a_thread) { a_thread->GetMachine()->GetLog().LogEntry("use setstate() on own thread"); return GM_EXCEPTION; } if(thread == NULL) { return GM_OK; } // get the current state of the thread gmVariable newStateVariable; gmVariable thisVar = *thread->GetThis(); gmVariable * currentStateVariable = thread->GetBottom(); if(currentStateVariable->m_type == s_gmStateUserType) { gmUserObject * userObj = (gmUserObject *) GM_OBJECT(currentStateVariable->m_value.m_ref); gmStateUserType * currentState = (gmStateUserType *) userObj->m_user; // call the on state leave if one exists. if(currentState->m_setExitState) { gmThread * thread = a_thread->GetMachine()->CreateThread(thisVar, gmVariable(GM_FUNCTION, currentState->m_setExitState->GetRef())); if(thread) { thread->Sys_Execute(); } } currentState->m_setExitState = NULL; currentState->m_lastState = currentState->m_currentState; currentState->m_currentState = function; newStateVariable = *currentStateVariable; } else { gmStateUserType * state = (gmStateUserType *) a_thread->GetMachine()->Sys_Alloc(sizeof(gmStateUserType)); state->m_setExitState = NULL; state->m_currentState = function; state->m_lastState = NULL; // create a new state variable newStateVariable.SetUser(a_thread->GetMachine()->AllocUserObject(state, s_gmStateUserType)); } // reset the stack. and push new state int numParameters = a_thread->GetNumParams() - 2; int user = thread->m_user; thread->Sys_Reset(thread->GetId()); thread->m_user = user; thread->Sys_SetStartTime(thread->GetMachine()->GetTime()); thread->Touch(4 + numParameters); thread->Push(newStateVariable); thread->Push(thisVar); thread->PushFunction(function); int i; for(i = 0; i < numParameters; ++i) { thread->Push(a_thread->Param(i+2)); } thread->PushStackFrame(numParameters); a_thread->GetMachine()->Sys_SwitchState(thread, gmThread::RUNNING); return GM_OK; } static int GM_CDECL gmGetState(gmThread * a_thread) // return var { GM_ASSERT(s_gmStateUserType != GM_NULL); gmThread * testThread = a_thread; //Optional parameter, threadId if(a_thread->GetNumParams() >= 1) { GM_CHECK_INT_PARAM(testThreadId, 0); testThread = a_thread->GetMachine()->GetThread(testThreadId); if(!testThread) { a_thread->PushNull(); return GM_OK; } } gmVariable * currentStateVariable = testThread->GetBottom(); if(currentStateVariable->m_type == s_gmStateUserType) { gmUserObject * userObj = (gmUserObject *) GM_OBJECT(currentStateVariable->m_value.m_ref); gmStateUserType * currentState = (gmStateUserType *) userObj->m_user; a_thread->PushFunction(currentState->m_currentState); } return GM_OK; } static int GM_CDECL gmGetLastState(gmThread * a_thread) // return var { GM_ASSERT(s_gmStateUserType != GM_NULL); gmThread * testThread = a_thread; //Optional parameter, threadId if(a_thread->GetNumParams() >= 1) { GM_CHECK_INT_PARAM(testThreadId, 0); testThread = a_thread->GetMachine()->GetThread(testThreadId); if(!testThread) { a_thread->PushNull(); return GM_OK; } } gmVariable * currentStateVariable = testThread->GetBottom(); if(currentStateVariable->m_type == s_gmStateUserType) { gmUserObject * userObj = (gmUserObject *) GM_OBJECT(currentStateVariable->m_value.m_ref); gmStateUserType * currentState = (gmStateUserType *) userObj->m_user; if(currentState->m_lastState) { a_thread->PushFunction(currentState->m_lastState); } } return GM_OK; } static int GM_CDECL gmSetExitState(gmThread * a_thread) // function { GM_CHECK_NUM_PARAMS(1); GM_CHECK_FUNCTION_PARAM(function, 0); GM_ASSERT(s_gmStateUserType != GM_NULL); gmVariable * currentStateVariable = a_thread->GetBottom(); if(currentStateVariable->m_type == s_gmStateUserType) { gmUserObject * userObj = (gmUserObject *) GM_OBJECT(currentStateVariable->m_value.m_ref); gmStateUserType * currentState = (gmStateUserType *) userObj->m_user; currentState->m_setExitState = function; } return GM_OK; } static int GM_CDECL gmSignal(gmThread * a_thread) // var, dest thread id { GM_CHECK_NUM_PARAMS(1); GM_INT_PARAM(dstThreadId, 1, GM_INVALID_THREAD); a_thread->GetMachine()->Signal(a_thread->Param(0), dstThreadId, a_thread->GetId()); return GM_OK; } static int GM_CDECL gmBlock(gmThread * a_thread) // var, ... { GM_CHECK_NUM_PARAMS(1); int res = a_thread->GetMachine()->Sys_Block(a_thread, a_thread->GetNumParams(), a_thread->GetBase()); if(res == -1) { return GM_SYS_BLOCK; } else if(res == -2) { // Failed to block, so exception to prevent undefined or unexpected behavior GM_EXCEPTION_MSG("cannot block on null"); return GM_EXCEPTION; } a_thread->Push(a_thread->Param(res)); return GM_OK; } #if GM_USE_ENDON static int GM_CDECL gmEndOn(gmThread * a_thread) { GM_CHECK_NUM_PARAMS(1); int res = a_thread->GetMachine()->Sys_Block(a_thread, a_thread->GetNumParams(), a_thread->GetBase(), true); if(res == -1) { return GM_OK; } else if(res == -3) { return GM_EXCEPTION; } a_thread->Push(a_thread->Param(res)); return GM_OK; } #endif //GM_USE_ENDON #if GM_USE_INCGC static void GM_CDECL gmGCDestructStateUserType(gmMachine * a_machine, gmUserObject* a_object) { gmStateUserType * state = (gmStateUserType *) a_object->m_user; a_machine->Sys_Free(state); } static bool GM_CDECL gmGCTraceStateUserType(gmMachine * a_machine, gmUserObject* a_object, gmGarbageCollector* a_gc, const int a_workLeftToGo, int& a_workDone) { gmStateUserType * state = (gmStateUserType *) a_object->m_user; if(state->m_currentState) a_gc->GetNextObject(state->m_currentState); if(state->m_lastState) a_gc->GetNextObject(state->m_lastState); if(state->m_setExitState) a_gc->GetNextObject(state->m_setExitState); a_workDone += 4; //contents + this return true; } #else //GM_USE_INCGC static void GM_CDECL gmGCStateUserType(gmMachine * a_machine, gmUserObject * a_object, gmuint32 a_mark) { gmStateUserType * state = (gmStateUserType *) a_object->m_user; a_machine->Sys_Free(state); } static void GM_CDECL gmMarkStateUserType(gmMachine * a_machine, gmUserObject * a_object, gmuint32 a_mark) { gmStateUserType * state = (gmStateUserType *) a_object->m_user; if(state->m_currentState && state->m_currentState->NeedsMark(a_mark)) state->m_currentState->Mark(a_machine, a_mark); if(state->m_lastState && state->m_lastState->NeedsMark(a_mark)) state->m_lastState->Mark(a_machine, a_mark); if(state->m_setExitState && state->m_setExitState->NeedsMark(a_mark)) state->m_setExitState->Mark(a_machine, a_mark); } #endif //GM_USE_INCGC // // table // static int GM_CDECL gmTableCount(gmThread * a_thread) { GM_CHECK_NUM_PARAMS(1); GM_CHECK_TABLE_PARAM(table, 0); a_thread->PushInt(table->Count()); return GM_OK; } static int GM_CDECL gmTableDuplicate(gmThread * a_thread) { GM_CHECK_NUM_PARAMS(1); GM_CHECK_TABLE_PARAM(table, 0); a_thread->PushTable(table->Duplicate(a_thread->GetMachine())); return GM_OK; } // // std // void gmConcat(gmMachine * a_machine, char * &a_dst, int &a_len, int &a_size, const char * a_src, int a_growBy = 32) { int len = (int)strlen(a_src); if((a_len + len + 1) >= a_size) { a_size = a_len + len + a_growBy + 1; char * str = (char *) a_machine->Sys_Alloc(a_size); if(a_dst != NULL) { memcpy(str, a_dst, a_len); a_machine->Sys_Free(a_dst); } a_dst = str; a_dst[a_len] = '\0'; } memcpy(a_dst + a_len, a_src, len); a_len += len; a_dst[a_len] = '\0'; } static int GM_CDECL gmPrint(gmThread * a_thread) { const int bufferSize = 256; int len = 0, size = 0, i; char * str = NULL, buffer[bufferSize]; // build the string for(i = 0; i < a_thread->GetNumParams(); ++i) { gmConcat(a_thread->GetMachine(), str, len, size, a_thread->Param(i).AsString(a_thread->GetMachine(), buffer, bufferSize), 64); if(str) { GM_ASSERT(len < size); str[len++] = ' '; str[len] = '\0'; } } // print the string if(str) { if(gmMachine::s_printCallback) { gmMachine::s_printCallback(a_thread->GetMachine(), str); } a_thread->GetMachine()->Sys_Free(str); } return GM_OK; } static int GM_CDECL gmfFormat(gmThread * a_thread) // string, params ... { GM_CHECK_NUM_PARAMS(1); GM_CHECK_STRING_PARAM(format, 0); int param = 1; int len = 0, size = 0; const int bufferSize = 1024; char * str = NULL, buffer[bufferSize] = {}; while(*format) { if(*format == '%') { switch(format[1]) { case 'S' : case 's' : { //GM_STRING_PARAM(pstr, param, ""); const char *pstr = a_thread->Param(param).GetCStringSafe(); if(!pstr) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected string as param %d",param); return GM_EXCEPTION; } gmConcat(a_thread->GetMachine(), str, len, size, pstr, 64); ++param; break; } case 'C' : case 'c' : { //GM_INT_PARAM(ival, param, 0); if(!a_thread->Param(param).IsInt()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected int as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%c", a_thread->Param(param).GetInt()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'D' : case 'd' : { //GM_INT_PARAM(ival, param, 0); if(!a_thread->Param(param).IsInt()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected int as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%d", a_thread->Param(param).GetInt()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'U' : case 'u' : { //GM_INT_PARAM(ival, param, 0); if(!a_thread->Param(param).IsInt()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected int as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%u", a_thread->Param(param).GetInt()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'B' : case 'b' : { //GM_INT_PARAM(ival, param, 0); if(!a_thread->Param(param).IsInt()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected int as param %d",param); return GM_EXCEPTION; } gmItoa(a_thread->Param(param).GetInt(), buffer, 2); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'X' : case 'x' : { //GM_INT_PARAM(ival, param, 0); if(!a_thread->Param(param).IsInt()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected int as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%x", a_thread->Param(param).GetInt()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'F' : case 'f' : { //GM_FLOAT_PARAM(fval, param, 0); if(!a_thread->Param(param).IsFloat()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected float as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%f", a_thread->Param(param).GetFloat()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'G' : case 'g' : { //GM_FLOAT_PARAM(fval, param, 0); if(!a_thread->Param(param).IsFloat()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected float as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%g", a_thread->Param(param).GetFloat()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case 'e' : case 'E' : { //GM_FLOAT_PARAM(fval, param, 0); if(!a_thread->Param(param).IsFloat()) { a_thread->GetMachine()->Sys_Free(str); GM_EXCEPTION_MSG("expected float as param %d",param); return GM_EXCEPTION; } sprintf(buffer, "%e", a_thread->Param(param).GetFloat()); gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); ++param; break; } case '%' : { if(len + 2 < size) str[len++] = '%'; else gmConcat(a_thread->GetMachine(), str, len, size, "%", 64); break; } default : break; } format += 2; } else { if(len + 2 < size) str[len++] = *(format++); else { buffer[0] = *(format++); buffer[1] = '\0'; gmConcat(a_thread->GetMachine(), str, len, size, buffer, 64); } } } if(str) { str[len] = '\0'; a_thread->PushNewString(str); a_thread->GetMachine()->Sys_Free(str); } return GM_OK; } // // lib // static gmFunctionEntry s_binding[] = { /*gm \lib gm \brief functions in the gm lib are all global scope */ /*gm \function gmVersion \brief gmVersion will return the gmMachine version string. version string is major type . minor type as a string and was added at version 1.1 \return string */ {"gmVersion", gmVersion}, /*gm \function typeId \brief typeId will return the type id of the passed var \param var \return integer type */ {"typeId", gmTypeId}, /*gm \function typeName \brief typeName will return the type name of the passed var \param var \return string */ {"typeName", gmTypeName}, /*gm \function typeRegisterOperator \brief typeRegisterOperator will register an operator for a type \param int typeid \param string operator name is one of "getdot", "setdot", "getind", "setind", "add", "sub", "mul", "div", "mod", "inc", "dec", "bitor", "bitxor", "bitand", "shiftleft", "shiftright", "bitinv", "lt", "gt", "lte", "gte", "eq", "neq", "neg", "pos", "not" \param function \return 1 on success, otherwise 0 */ {"typeRegisterOperator", gmRegisterTypeOperator}, /*gm \function typeRegisterVariable \brief typeRegisterVariable will register a variable with a type such that (type).varname will return the variable \param int typeid \param string var name \param var \return 1 on success, otherwise 0 */ {"typeRegisterVariable", gmRegisterTypeVariable}, /*gm \function sysCollectGarbage \brief sysCollectGarbage will run the garbage collector iff the current mem used is over the desired mem used \param forceFullCollect (false) Optionally perform full garbage collection immediately if garbage collection is not disabled. \return 1 if the gc was run, 0 otherwise */ {"sysCollectGarbage", gmCollectGarbage}, /*gm \function sysGetMemoryUsage \brief sysGetMemoryUsage will return the current memory used in bytes \return int memory usage */ {"sysGetMemoryUsage", gmGetCurrentMemoryUsage}, /*gm \function sysSetDesiredMemoryUsageHard \brief sysSetDesiredMemoryUsageHard will set the desired memory useage in bytes. when this is exceeded the garbage collector will be run. \param int desired mem usage in bytes */ {"sysSetDesiredMemoryUsageHard", gmSetDesiredMemoryUsageHard}, /*gm \function sysSetDesiredMemoryUsageSoft \brief sysSetDesiredMemoryUsageSoft will set the desired memory useage in bytes. when this is exceeded the garbage collector will be run. \param int desired mem usage in bytes */ {"sysSetDesiredMemoryUsageSoft", gmSetDesiredMemoryUsageSoft}, /*gm \function sysGetDesiredMemoryUsageHard \brief sysGetDesiredMemoryUsageHard will get the desired memory useage in bytes. Note that this value is used to start garbage collection, it is not a strict limit. \return int Desired memory usage in bytes. */ {"sysGetDesiredMemoryUsageHard", gmGetDesiredMemoryUsageHard}, /*gm \function sysGetDesiredMemoryUsageSoft \brief sysGetDesiredMemoryUsageSoft will get the desired memory useage in bytes. Note that this value is used to start garbage collection, it is not a strict limit. \return int Desired memory usage in bytes. */ {"sysGetDesiredMemoryUsageSoft", gmGetDesiredMemoryUsageSoft}, /*gm \function sysSetDesiredMemoryUsageAuto \brief sysSetDesiredMemoryUsageAuto will enable auto adjustment of the memory limit(s) for subsequent garbage collections. \param int enable or disable flag */ {"sysSetDesiredMemoryUsageAuto", gmSetDesiredMemoryUsageAuto}, /*gm \function sysGetStatsGCNumFullCollects \brief sysGetStatsGCNumFullCollects Return the number of times full garbage collection has occured. \return int Number of times full collect has occured. */ {"sysGetStatsGCNumFullCollects", gmSysGetStatsGCNumFullCollects}, /*gm \function sysGetStatsGCNumIncCollects \brief sysGetStatsGCNumIncCollects Return the number of times incremental garbage collection has occured. This number may increase in twos as the GC has multiple phases which appear as restarts. \return int Number of times incremental collect has occured. */ {"sysGetStatsGCNumIncCollects", gmSysGetStatsGCNumIncCollects}, /*gm \function sysGetStatsGCNumWarnings \brief sysGetStatsGCNumWarnings Return the number of warnings because the GC or VM thought the GC was poorly configured. If this number is large and growing rapidly, the GC soft and hard limits need to be configured better. Do not be concerned if this number grows slowly. \return int Number of warnings garbage collect has generated. */ {"sysGetStatsGCNumWarnings", gmSysGetStatsGCNumWarnings}, /*gm \function sysIsGCRunning \brief Returns true if GC is running a cycle. */ {"sysIsGCRunning", gmSysIsGCRunning}, /*gm \function sysTime \brief sysTime will return the machine time in milli seconds \return int */ {"sysTime", gmMachineTime}, /*gm \function doString \brief doString will execute the passed gm script \param string script \param int optional (1) set as true and the string will execute before returning to this thread \param ref optional (null) set 'this' \return int thread id of thread created for string execution */ {"doString", gmDoString}, /*gm \function globals \brief globals will return the globals table \return table containing all global variables */ {"globals", gmGlobals}, /*gm \function threadTime \brief threadTime will return the thread execution time in milliseconds \return int */ {"threadTime", gmThreadTime}, /*gm \function threadId \brief threadId will return the thread id of the current executing script \return int */ {"threadId", gmThreadId}, /*gm \function threadAllIds \brief threadIds returns a table of thread Ids \return table of thread Ids */ {"threadAllIds", gmThreadAllIds}, /*gm \function threadKill \brief threadKill will kill the thread with the given id \param int threadId optional (0) will kill this thread */ {"threadKill", gmKillThread}, /*gm \function threadKillAll \brief threadKillAll will kill all the threads except the current one \param bool optional (false) will kill this thread if true */ {"threadKillAll", gmKillAllThreads}, /*gm \function thread \brief thread will start a new thread \param function entry point of the thread \param ... parameters to pass to the entry function \return int threadid */ {"thread", gmfThread}, /*gm \function yield \brief yield will hand execution control to the next thread */ {"yield", gmYield}, /*gm \function exit \brief exit will kill this thread */ {"exit", gmExit}, /*gm \function assert \brief assert \param int expression if true, will do nothing, if false, will cause an exception */ {"assert", gmAssert}, /*gm \function sleep \brief sleep will sleep this thread for the given number of seconds \param int\float seconds */ {"sleep", gmSleep}, /*gm \function signal \brief signal will signal the given variable, this will unblock dest threads that are blocked on the same variable. \param var \param int destThreadId optional (0) 0 will signal all threads */ {"signal", gmSignal}, /*gm \function block \brief block will block on all passed vars, execution will halt until another thread signals one of the block variables. Will yield on null and return null. \param ... vars \return the unblocking var */ {"block", gmBlock}, #if GM_USE_ENDON /*gm \function endon \brief endon will kill the thread when a signal is sent from those matching the list \param ... vars \return the killing var */ {"endon", gmEndOn}, #endif //GM_USE_ENDON /*gm \function stateSet \brief stateSet will collapse the stack to nothing, and push the passed functions. \param function new state function to execute \param ... params for new state function */ {"stateSet", gmSetState}, /*gm \function stateSetOnThread \brief stateSetOnThread will collapse the stack of the given thread id to nothing, and push the passed functions. \param int thread id \param function new state function to execute \param ... params for new state function */ {"stateSetOnThread", gmSetStateOnThread}, /*gm \function stateGet \brief stateGet will return the function on the bottom of this threads execution stack iff it was pushed using stateSet \param a_threadId Optional Id of thread to get state on. \reutrn function \ null */ {"stateGet", gmGetState}, /*gm \function stateGetLast \brief stateGetLast will return the last state function of this thread \param a_threadId Optional Id of thread to get last state on. \reutrn function \ null */ {"stateGetLast", gmGetLastState}, /*gm \function stateSetExitFunction \brief stateSetExitFunction will set an exit function for this state, that will be called with no parameters if this thread switches state \param function */ {"stateSetExitFunction", gmSetExitState}, /*gm \function tableCount \brief tableCount will return the number of elements in a table object \param table \return int */ {"tableCount", gmTableCount}, /*gm \function tableDuplicate \brief tableDuplicate will duplicate the passed table object \param table \return table */ {"tableDuplicate", gmTableDuplicate}, /*gm \function print \brief print will print the given vars to the print handler. passed strings are concatinated together with a seperating space. \param ... strings */ {"print", gmPrint}, /*gm \function format \brief format (like sprintf, but returns a string) %d, %s, %f, %c, %b, %x, %e \param string */ {"format", gmfFormat}, }; void gmMachineLib(gmMachine * a_machine) { // create the state type s_gmStateUserType = a_machine->CreateUserType("gmState"); #if GM_USE_INCGC a_machine->RegisterUserCallbacks(s_gmStateUserType, gmGCTraceStateUserType, gmGCDestructStateUserType); #else //GM_USE_INCGC a_machine->RegisterUserCallbacks(s_gmStateUserType, gmMarkStateUserType, gmGCStateUserType); #endif //GM_USE_INCGC // default lib a_machine->RegisterLibrary(s_binding, sizeof(s_binding) / sizeof(gmFunctionEntry), NULL); }
13,900
2,406
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.pot.configs.config import Config from .utils.path import TOOL_CONFIG_PATH DEVICE = [ 'CPU', 'GPU', 'VPU' ] def test_target_device(): def read_config(filename): tool_config_path = TOOL_CONFIG_PATH.joinpath(filename).as_posix() config = Config.read_config(tool_config_path) config.configure_params() return config['compression']['algorithms'][0]['params']['target_device'] target_device = read_config('mobilenet-v2-pytorch_single_dataset_without_target_device.json') assert target_device == 'ANY' target_device = read_config('mobilenet-v2-pytorch_single_dataset.json') assert target_device in DEVICE
302
1,682
/* Copyright (c) 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.linkedin.data; import java.util.HashMap; /** * Custom hash table when {@link DataComplex} objects are used as keys. This utilizes the custom * {@link DataComplex#dataComplexHashCode()} as the hash for improved performance. */ class DataComplexTable { private final HashMap<DataComplexKey, DataComplex> _map; DataComplexTable() { _map = new HashMap<>(); } public DataComplex get(DataComplex index) { return _map.get(new DataComplexKey(index)); } public void put(DataComplex src, DataComplex clone) { _map.put(new DataComplexKey(src), clone); } private static class DataComplexKey { private final DataComplex _dataObject; private final int _hashCode; DataComplexKey(DataComplex dataObject) { _hashCode = dataObject.dataComplexHashCode(); _dataObject = dataObject; } @Override public int hashCode() { return _hashCode; } @Override public boolean equals(Object other) { // "other" is guaranteed to be DataComplex as this class is "private" scoped within DataComplexTable, which only // supports DataComplex objects. return _dataObject == ((DataComplexKey) other)._dataObject; } } }
594
2,023
from dal_4 import DAL4 ################################################################################ class DAL5: # DEFAULTS PATH_SEPARATOR = ' ' NAME_CHARACTERS = ''.join([chr(i) for i in range(256) \ if len(repr(chr(i))) == 3]) # Disk Abstraction Layer def __init__(self, blocks, size): self.__disk = DAL4(blocks, size) # Make New Directory def make_directory(self, path): block, name = self.__resolve_path(path) self.__disk.make_directory(block, name) # Remove Old Directory def remove_directory(self, path): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block assert self.__disk.is_directory(block) assert self.__disk.empty(block) self.__disk.remove_directory(block) # Make New File def make_file(self, path): block, name = self.__resolve_path(path) self.__disk.make_file(block, name) # Remove Old File def remove_file(self, path): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block assert self.__disk.is_file(block) self.__disk.remove_file(block) # Read From File def read_file(self, path): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block return self.__disk.read_file(block) # Write To File def write_file(self, path, data): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block self.__disk.write_file(block, data) # Get Directory Contents def list_directory(self, path): if path: block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block else: block = 1 directory = self.__disk.list_directory(block) names = [self.__disk.name(block) for block in directory] return names # Check If Empty def empty(self, path): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block return self.__disk.empty(block) # Changes Directory/File Name def rename(self, path, name): block, old_name = self.__resolve_path(path) block = self.__disk.find(block, old_name) assert block self.__disk.rename(block, name) # Test For Existance def exists(self, path): try: block, name = self.__resolve_path(path) block = self.__disk.find(block, name) assert block return True except: return False # Check If File def is_file(self, path): block, name = self.__resolve_path(path) block = self.__disk.find(block, name) return self.__disk.is_file(block) # Check If Directory def is_directory(self, path): assert type(path) is str if path: block, name = self.__resolve_path(path) block = self.__disk.find(block, name) return self.__disk.is_directory(block) else: return True # Seed Control Interface def seed(self, data=None): return self.__disk.seed(data) # Probability Of Failure def fail(self, probability): self.__disk.fail(probability) # Dump To File def dump(self, name): self.__disk.dump(name) # Load From File def load(self, name, abstract): assert type(abstract) is bool self.__disk.load(name, abstract) if abstract: self.__soft() else: self.__hard() # Fix All Errors def __soft(self): # Not Yet Implemented pass # Find Any Error def __hard(self): # Not Yet Implemented pass # Private Utility Function def __resolve_path(self, path): assert type(path) is str if path: table = ''.join([chr(i) for i in range(256)]) parts = path.split(self.PATH_SEPARATOR) block = 1 for name in parts[:-1]: assert len(name.translate(table, self.NAME_CHARACTERS)) == 0 block = self.__disk.find(block, name) assert block assert parts[-1] assert len(parts[-1].translate(table, self.NAME_CHARACTERS)) == 0 return block, parts[-1] else: return 1, '' ################################################################################ def test(): # Not Yet Implemented pass ################################################################################ if __name__ == '__main__': test()
2,133
417
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.janquadflieg.mrracer.controller; import de.janquadflieg.mrracer.Utils; import de.janquadflieg.mrracer.behaviour.Behaviour; import de.janquadflieg.mrracer.classification.AngleBasedClassifier; import de.janquadflieg.mrracer.classification.Situation; import de.janquadflieg.mrracer.classification.Situations; import de.janquadflieg.mrracer.telemetry.*; import de.janquadflieg.mrracer.track.*; import java.util.Properties; /** * * @author <NAME> */ public abstract class BaseController extends champ2011client.Controller { /** Text debug messages? */ private static final boolean TEXT_DEBUG = false; /** Extension for the parameter file. */ public static final String PARAMETER_EXT = ".params"; /** Telemetry object to log all data. */ protected Telemetry telemetry = null; /** Model of the track we're racing on. */ protected TrackModel trackModel = new TrackModel(); /** Collection of track models. */ protected TrackDB trackDB; /** StringBuilder to collect log data. */ protected StringBuilder controllerLog = new StringBuilder(500); /** A controller to handle situations not handled by this controller. */ protected Behaviour backupBehaviour; /** Coming back from the recovery behaviour? */ protected boolean wasRecovering = false; /** Classifier. */ protected AngleBasedClassifier classifier; /** Noise detector. */ protected NoiseDetector noise; /** First packet? */ protected boolean firstPacket = true; /** Precompile? */ protected boolean precompile = false; private static final String PC_WARMUP_FIRST = "(angle 0)(curLapTime 10.21)(damage 0)(distFromStart 6201.46)(distRaced 0)(fuel 94)(gear 0)(lastLapTime 0)(opponents 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200)(racePos 1)(rpm 942.478)(speedX 0)(speedY 0)(speedZ 0.0196266)(track 4.00001 4.06171 4.25672 4.61881 5.22164 6.22291 8.00001 11.6952 23.0351 200 46.0701 23.3904 16 12.4458 10.4433 9.2376 8.51342 8.12341 7.99999)(trackPos 0.333332)(wheelSpinVel 0 0 0 0)(z 0.339955)(focus -1 -1 -1 -1 -1)"; private static final String PC_WARMUP_SECOND = "(angle 0)(curLapTime 10.24)(damage 0)(distFromStart 6202.46)(distRaced 1)(fuel 94)(gear 0)(lastLapTime 0)(opponents 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200)(racePos 1)(rpm 942.478)(speedX 0)(speedY 0)(speedZ 0.0196266)(track 4.00001 4.06171 4.25672 4.61881 5.22164 6.22291 8.00001 11.6952 23.0351 200 46.0701 23.3904 16 12.4458 10.4433 9.2376 8.51342 8.12341 7.99999)(trackPos 0.333332)(wheelSpinVel 0 0 0 0)(z 0.339955)(focus -1 -1 -1 -1 -1)"; private static final String PC_WARMUP_OFFTRACK = "(angle 0)(curLapTime 10.21)(damage 0)(distFromStart 6201.46)(distRaced 0)(fuel 94)(gear 0)(lastLapTime 0)(opponents 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200)(racePos 1)(rpm 942.478)(speedX 0)(speedY 0)(speedZ 0.0196266)(track 4.00001 4.06171 4.25672 4.61881 5.22164 6.22291 8.00001 11.6952 23.0351 200 46.0701 23.3904 16 12.4458 10.4433 9.2376 8.51342 8.12341 7.99999)(trackPos -1.333332)(wheelSpinVel 0 0 0 0)(z 0.339955)(focus -1 -1 -1 -1 -1)"; private static final String PC_WARMUP_ONTRACK = "(angle -1.1)(curLapTime 10.21)(damage 0)(distFromStart 6201.46)(distRaced 0)(fuel 94)(gear 0)(lastLapTime 0)(opponents 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200)(racePos 1)(rpm 942.478)(speedX 0)(speedY 0)(speedZ 0.0196266)(track 4.00001 4.06171 4.25672 4.61881 5.22164 6.22291 8.00001 11.6952 23.0351 200 46.0701 23.3904 16 12.4458 10.4433 9.2376 8.51342 8.12341 7.99999)(trackPos 0.333332)(wheelSpinVel 0 0 0 0)(z 0.339955)(focus -1 -1 -1 -1 -1)"; public BaseController(Telemetry t) { this.telemetry = t; trackDB = TrackDB.create(); } public void setParameters(Properties params) { } public void getParameters(Properties params) { } @Override public final champ2011client.Action control(champ2011client.SensorModel model) { try { return unsaveControl(model); } catch (RuntimeException e) { if (TEXT_DEBUG) { System.out.println("Warning, calling control() caused an exception..."); e.printStackTrace(System.out); if (e.getCause() != null) { System.out.println("Cause:"); e.getCause().printStackTrace(System.out); } System.out.println("Trying to use the recovery behaviour"); } functionalReset(); wasRecovering = true; ModifiableAction action = new ModifiableAction(); try { SensorData data = new SensorData(model); Situation sit = classifier.classify(data); if (noise.isNoisy()) { sit = new Situation(Situations.ERROR_UNABLE_TO_CLASSIFY, 0, 0); } backupBehaviour.setSituation(sit); backupBehaviour.execute(data, action); } catch (RuntimeException e2) { if (TEXT_DEBUG) { System.out.println("BackupBehaviour crashed too..."); e2.printStackTrace(System.out); System.out.println("Returning a save action..."); } action.setAcceleration(0.5); action.setBrake(0.0); action.setClutch(0.0); action.setSteering(0.0); action.setGear(model.getGear()); action.setRestartRace(false); action.setFocusAngle(0); } return action.getRaceClientAction(); } } public abstract champ2011client.Action unsaveControl(champ2011client.SensorModel model); protected void logSituation(Situation s) { controllerLog.append(Situations.toShortString(s.getType())); controllerLog.append(" "); controllerLog.append(Situations.toShortString(s.getDirection())); controllerLog.append(" "); controllerLog.append(Utils.dTS(s.getMeasure())); } protected void logTrackSegment(SensorData data, int index, TrackSegment current) { controllerLog.append("#"); controllerLog.append(index); if (current.isUnknown()) { controllerLog.append("u"); } else { controllerLog.append(Situations.toShortString(current.getType())); if (current.isCorner()) { int subIndex = current.getIndex(data.getDistanceFromStartLine()); TrackSubSegment subSegment = current.getSubSegment(subIndex); controllerLog.append("["); controllerLog.append(subIndex); controllerLog.append("]"); controllerLog.append(Situations.toShortString(subSegment.getType())); } } controllerLog.append("/"); } /** * Method which executes two gameticks. This can be called in the constructor * of a derived class and will hopefully cause the jit compiler to do its job * at a time when it doesn't hurt. */ protected void precompile() { //System.out.println("************** PRECOMPILE ***********************"); precompile = true; //Stage oldStage = getStage(); String oldTrackName = getTrackName(); Telemetry tb = telemetry; telemetry = null; // precompile // warmup ontrack first packet setStage(Stage.WARMUP); setTrackName("precompile"); resetFull(); control(new champ2011client.MessageBasedSensorModel(PC_WARMUP_FIRST)); // second packet setStage(Stage.WARMUP); resetFull(); control(new champ2011client.MessageBasedSensorModel(PC_WARMUP_SECOND)); // offtrack setStage(Stage.WARMUP); resetFull(); control(new champ2011client.MessageBasedSensorModel(PC_WARMUP_OFFTRACK)); resetFull(); // ontrack setStage(Stage.WARMUP); resetFull(); control(new champ2011client.MessageBasedSensorModel(PC_WARMUP_ONTRACK)); resetFull(); Telemetry data = Telemetry.createPrecompile(); data.shutdown(); setTrackName("precompile2"); resetFull(); for (int i = 0; i < data.size() / 2; ++i) { //System.out.println("Packet["+i+"]"); champ2011client.Action a = control(data.getSensorData(i).getSensorModel()); } setTrackName("precompile2"); resetFull(); java.util.Random r = new java.util.Random(System.currentTimeMillis()); for (int i = 0; i < data.size() / 2; ++i) { SensorData wonoise = data.getSensorData(i); double[] track = wonoise.getTrackEdgeSensors(); for (int l = 0; l < track.length; ++l) { double random = r.nextGaussian() * 0.1; random += 1.0; track[l] *= random; } ModifiableSensorData wnoise = new ModifiableSensorData(); wnoise.setData(wonoise); wnoise.setTrackEdgeSensors(track); champ2011client.Action a = control(wnoise.getSensorModel()); } resetFull(); data = Telemetry.createPrecompile2(); data.shutdown(); setTrackName("Wheel 2"); setStage(Stage.RACE); resetFull(); for (int i = 0; i < data.size(); ++i) { //System.out.println("Packet["+i+"]"); champ2011client.Action a = control(data.getSensorData(i).getSensorModel()); } resetFull(); precompile = false; telemetry = tb; //setStage(oldStage); // doesn't make sense, since this hasn't been set setTrackName(oldTrackName); trackModel = new TrackModel(); resetFull(); //System.out.println("************** PRECOMPILE END *******************"); } public int getParameterSetCount() { return 0; } public void selectParameterSet(int i) { } @Override public void reset() { firstPacket = true; } protected void functionalReset(){ } public void resetFull() { firstPacket = true; } @Override public void shutdown() { } }
4,501
2,405
<filename>tools/win/src/maple_loader/src/processing/app/Preferences.java /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* Part of the Processing project - http://processing.org Copyright (c) 2004-09 <NAME> and <NAME> Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package processing.app; import java.io.*; import java.util.*; /** * Storage class for user preferences and environment settings. * <P> * This class no longer uses the Properties class, since * properties files are iso8859-1, which is highly likely to * be a problem when trying to save sketch folders and locations. * <p> * The GUI portion in here is really ugly, as it uses exact layout. This was * done in frustration one evening (and pre-Swing), but that's long since past, * and it should all be moved to a proper swing layout like BoxLayout. * <p> * This is very poorly put together, that the preferences panel and the actual * preferences i/o is part of the same code. But there hasn't yet been a * compelling reason to bother with the separation aside from concern about * being lectured by strangers who feel that it doesn't look like what they * learned in CS class. * <p> * Would also be possible to change this to use the Java Preferences API. * Some useful articles * <a href="http://www.onjava.com/pub/a/onjava/synd/2001/10/17/j2se.html">here</a> and * <a href="http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter10/Preferences.html">here</a>. * However, haven't implemented this yet for lack of time, but more * importantly, because it would entail writing to the registry (on Windows), * or an obscure file location (on Mac OS X) and make it far more difficult to * find the preferences to tweak them by hand (no! stay out of regedit!) * or to reset the preferences by simply deleting the preferences.txt file. */ public class Preferences { // what to call the feller static final String PREFS_FILE = "preferences.txt"; // prompt text stuff static final String PROMPT_YES = "Yes"; static final String PROMPT_NO = "No"; static final String PROMPT_CANCEL = "Cancel"; static final String PROMPT_OK = "OK"; static final String PROMPT_BROWSE = "Browse"; /** * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. */ static public int BUTTON_WIDTH = 80; /** * Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, * presumably because it now includes the blue border, where it didn't * in Java 1.3. Windows XP only wants 23 (not sure what default Linux * would be). Because of the disparity, on Mac OS X, it will be set * inside a static block. */ static public int BUTTON_HEIGHT = 24; // value for the size bars, buttons, etc static final int GRID_SIZE = 33; // indents and spacing standards. these probably need to be modified // per platform as well, since macosx is so huge, windows is smaller, // and linux is all over the map static final int GUI_BIG = 13; static final int GUI_BETWEEN = 10; static final int GUI_SMALL = 6; // data model static Hashtable table = new Hashtable();; static File preferencesFile; static protected void init(String commandLinePrefs) { } public Preferences() { } // ................................................................. // ................................................................. // ................................................................. // ................................................................. static public String get(String attribute) { return (String) table.get(attribute); } static public void set(String attribute, String value) { table.put(attribute, value); } static public boolean getBoolean(String attribute) { String value = get(attribute); return (new Boolean(value)).booleanValue(); } static public void setBoolean(String attribute, boolean value) { set(attribute, value ? "true" : "false"); } static public int getInteger(String attribute) { return Integer.parseInt(get(attribute)); } static public void setInteger(String key, int value) { set(key, String.valueOf(value)); } }
1,409
954
/* * Copyright 2003-2009 the original author or authors. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain event copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.jdon.controller.context.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import com.jdon.controller.context.AppContextWrapper; import com.jdon.controller.context.ContextHolder; import com.jdon.controller.context.RequestWrapper; import com.jdon.controller.context.SessionWrapper; public class RequestWrapperFactory { /** * create event HttpServletRequestWrapper with session supports. this method * will create HttpSession. * * @param request * @return */ public static RequestWrapper create(HttpServletRequest request) { HttpSession session = request.getSession(); AppContextWrapper acw = new ServletContextWrapper(session.getServletContext()); SessionWrapper sw = new HttpSessionWrapper(session); ContextHolder contextHolder = new ContextHolder(acw, sw); return new HttpServletRequestWrapper(request, contextHolder); } }
480
373
/** SocSerDes.h SoC Specific header file for SerDes Copyright 2017-2020 NXP SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef SOC_SERDES_H #define SOC_SERDES_H typedef enum { NONE = 0, PCIE1, PCIE2, PCIE3, PCIE4, PCIE5, PCIE6, SATA1, SATA2, SATA3, SATA4, XFI1, XFI2, XFI3, XFI4, XFI5, XFI6, XFI7, XFI8, XFI9, XFI10, XFI11, XFI12, XFI13, XFI14, SGMII1, SGMII2, SGMII3, SGMII4, SGMII5, SGMII6, SGMII7, SGMII8, SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16, SGMII17, SGMII18, GE100_1, GE100_2, GE50_1, GE50_2, GE40_1, GE40_2, GE25_1, GE25_2, GE25_3, GE25_4, GE25_5, GE25_6, GE25_7, GE25_8, GE25_9, GE25_10, SERDES_PROTOCOL_COUNT } SERDES_PROTOCOL; #endif
562
682
<reponame>HackerFoo/vtr-verilog-to-routing /**CFile**************************************************************** FileName [cecChoice.c] SystemName [ABC: Logic synthesis and verification system.] PackageName [Combinational equivalence checking.] Synopsis [Computation of structural choices.] Author [<NAME>] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] Revision [$Id: cecChoice.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] ***********************************************************************/ #include "cecInt.h" #include "aig/gia/giaAig.h" #include "proof/dch/dch.h" ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// static void Cec_ManCombSpecReduce_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj ); extern int Cec_ManResimulateCounterExamplesComb( Cec_ManSim_t * pSim, Vec_Int_t * vCexStore ); extern int Gia_ManCheckRefinements( Gia_Man_t * p, Vec_Str_t * vStatus, Vec_Int_t * vOutputs, Cec_ManSim_t * pSim, int fRings ); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Computes the real value of the literal w/o spec reduction.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ static inline int Cec_ManCombSpecReal( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjIsAnd(pObj) ); Cec_ManCombSpecReduce_rec( pNew, p, Gia_ObjFanin0(pObj) ); Cec_ManCombSpecReduce_rec( pNew, p, Gia_ObjFanin1(pObj) ); return Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); } /**Function************************************************************* Synopsis [Recursively performs speculative reduction for the object.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cec_ManCombSpecReduce_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj ) { Gia_Obj_t * pRepr; if ( ~pObj->Value ) return; if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) ) { Cec_ManCombSpecReduce_rec( pNew, p, pRepr ); pObj->Value = Abc_LitNotCond( pRepr->Value, Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) ); return; } pObj->Value = Cec_ManCombSpecReal( pNew, p, pObj ); } /**Function************************************************************* Synopsis [Derives SRM for signal correspondence.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Cec_ManCombSpecReduce( Gia_Man_t * p, Vec_Int_t ** pvOutputs, int fRings ) { Gia_Man_t * pNew, * pTemp; Gia_Obj_t * pObj, * pRepr; Vec_Int_t * vXorLits; int i, iPrev, iObj, iPrevNew, iObjNew; assert( p->pReprs != NULL ); Gia_ManSetPhase( p ); Gia_ManFillValue( p ); pNew = Gia_ManStart( Gia_ManObjNum(p) ); pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); Gia_ManHashAlloc( pNew ); Gia_ManConst0(p)->Value = 0; Gia_ManForEachCi( p, pObj, i ) pObj->Value = Gia_ManAppendCi(pNew); *pvOutputs = Vec_IntAlloc( 1000 ); vXorLits = Vec_IntAlloc( 1000 ); if ( fRings ) { Gia_ManForEachObj1( p, pObj, i ) { if ( Gia_ObjIsConst( p, i ) ) { iObjNew = Cec_ManCombSpecReal( pNew, p, pObj ); iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) ); if ( iObjNew != 0 ) { Vec_IntPush( *pvOutputs, 0 ); Vec_IntPush( *pvOutputs, i ); Vec_IntPush( vXorLits, iObjNew ); } } else if ( Gia_ObjIsHead( p, i ) ) { iPrev = i; Gia_ClassForEachObj1( p, i, iObj ) { iPrevNew = Cec_ManCombSpecReal( pNew, p, Gia_ManObj(p, iPrev) ); iObjNew = Cec_ManCombSpecReal( pNew, p, Gia_ManObj(p, iObj) ); iPrevNew = Abc_LitNotCond( iPrevNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(p, iPrev)) ); iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(p, iObj)) ); if ( iPrevNew != iObjNew && iPrevNew != 0 && iObjNew != 1 ) { Vec_IntPush( *pvOutputs, iPrev ); Vec_IntPush( *pvOutputs, iObj ); Vec_IntPush( vXorLits, Gia_ManHashAnd(pNew, iPrevNew, Abc_LitNot(iObjNew)) ); } iPrev = iObj; } iObj = i; iPrevNew = Cec_ManCombSpecReal( pNew, p, Gia_ManObj(p, iPrev) ); iObjNew = Cec_ManCombSpecReal( pNew, p, Gia_ManObj(p, iObj) ); iPrevNew = Abc_LitNotCond( iPrevNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(p, iPrev)) ); iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(p, iObj)) ); if ( iPrevNew != iObjNew && iPrevNew != 0 && iObjNew != 1 ) { Vec_IntPush( *pvOutputs, iPrev ); Vec_IntPush( *pvOutputs, iObj ); Vec_IntPush( vXorLits, Gia_ManHashAnd(pNew, iPrevNew, Abc_LitNot(iObjNew)) ); } } } } else { Gia_ManForEachObj1( p, pObj, i ) { pRepr = Gia_ObjReprObj( p, Gia_ObjId(p,pObj) ); if ( pRepr == NULL ) continue; iPrevNew = Gia_ObjIsConst(p, i)? 0 : Cec_ManCombSpecReal( pNew, p, pRepr ); iObjNew = Cec_ManCombSpecReal( pNew, p, pObj ); iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) ); if ( iPrevNew != iObjNew ) { Vec_IntPush( *pvOutputs, Gia_ObjId(p, pRepr) ); Vec_IntPush( *pvOutputs, Gia_ObjId(p, pObj) ); Vec_IntPush( vXorLits, Gia_ManHashXor(pNew, iPrevNew, iObjNew) ); } } } Vec_IntForEachEntry( vXorLits, iObjNew, i ) Gia_ManAppendCo( pNew, iObjNew ); Vec_IntFree( vXorLits ); Gia_ManHashStop( pNew ); //Abc_Print( 1, "Before sweeping = %d\n", Gia_ManAndNum(pNew) ); pNew = Gia_ManCleanup( pTemp = pNew ); //Abc_Print( 1, "After sweeping = %d\n", Gia_ManAndNum(pNew) ); Gia_ManStop( pTemp ); return pNew; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Cec_ManChoiceComputation_int( Gia_Man_t * pAig, Cec_ParChc_t * pPars ) { int nItersMax = 1000; Vec_Str_t * vStatus; Vec_Int_t * vOutputs; Vec_Int_t * vCexStore; Cec_ParSim_t ParsSim, * pParsSim = &ParsSim; Cec_ParSat_t ParsSat, * pParsSat = &ParsSat; Cec_ManSim_t * pSim; Gia_Man_t * pSrm; int r, RetValue; abctime clkSat = 0, clkSim = 0, clkSrm = 0, clkTotal = Abc_Clock(); abctime clk2, clk = Abc_Clock(); ABC_FREE( pAig->pReprs ); ABC_FREE( pAig->pNexts ); Gia_ManRandom( 1 ); // prepare simulation manager Cec_ManSimSetDefaultParams( pParsSim ); pParsSim->nWords = pPars->nWords; pParsSim->nFrames = pPars->nRounds; pParsSim->fVerbose = pPars->fVerbose; pParsSim->fLatchCorr = 0; pParsSim->fSeqSimulate = 0; // create equivalence classes of registers pSim = Cec_ManSimStart( pAig, pParsSim ); Cec_ManSimClassesPrepare( pSim, -1 ); Cec_ManSimClassesRefine( pSim ); // prepare SAT solving Cec_ManSatSetDefaultParams( pParsSat ); pParsSat->nBTLimit = pPars->nBTLimit; pParsSat->fVerbose = pPars->fVerbose; if ( pPars->fVerbose ) { Abc_Print( 1, "Obj = %7d. And = %7d. Conf = %5d. Ring = %d. CSat = %d.\n", Gia_ManObjNum(pAig), Gia_ManAndNum(pAig), pPars->nBTLimit, pPars->fUseRings, pPars->fUseCSat ); Cec_ManRefinedClassPrintStats( pAig, NULL, 0, Abc_Clock() - clk ); } // perform refinement of equivalence classes for ( r = 0; r < nItersMax; r++ ) { clk = Abc_Clock(); // perform speculative reduction clk2 = Abc_Clock(); pSrm = Cec_ManCombSpecReduce( pAig, &vOutputs, pPars->fUseRings ); assert( Gia_ManRegNum(pSrm) == 0 && Gia_ManCiNum(pSrm) == Gia_ManCiNum(pAig) ); clkSrm += Abc_Clock() - clk2; if ( Gia_ManCoNum(pSrm) == 0 ) { if ( pPars->fVerbose ) Cec_ManRefinedClassPrintStats( pAig, NULL, r+1, Abc_Clock() - clk ); Vec_IntFree( vOutputs ); Gia_ManStop( pSrm ); break; } //Gia_DumpAiger( pSrm, "choicesrm", r, 2 ); // found counter-examples to speculation clk2 = Abc_Clock(); if ( pPars->fUseCSat ) vCexStore = Cbs_ManSolveMiterNc( pSrm, pPars->nBTLimit, &vStatus, 0 ); else vCexStore = Cec_ManSatSolveMiter( pSrm, pParsSat, &vStatus ); Gia_ManStop( pSrm ); clkSat += Abc_Clock() - clk2; if ( Vec_IntSize(vCexStore) == 0 ) { if ( pPars->fVerbose ) Cec_ManRefinedClassPrintStats( pAig, vStatus, r+1, Abc_Clock() - clk ); Vec_IntFree( vCexStore ); Vec_StrFree( vStatus ); Vec_IntFree( vOutputs ); break; } // refine classes with these counter-examples clk2 = Abc_Clock(); RetValue = Cec_ManResimulateCounterExamplesComb( pSim, vCexStore ); Vec_IntFree( vCexStore ); clkSim += Abc_Clock() - clk2; Gia_ManCheckRefinements( pAig, vStatus, vOutputs, pSim, pPars->fUseRings ); if ( pPars->fVerbose ) Cec_ManRefinedClassPrintStats( pAig, vStatus, r+1, Abc_Clock() - clk ); Vec_StrFree( vStatus ); Vec_IntFree( vOutputs ); //Gia_ManEquivPrintClasses( pAig, 1, 0 ); } // check the overflow if ( r == nItersMax ) Abc_Print( 1, "The refinement was not finished. The result may be incorrect.\n" ); Cec_ManSimStop( pSim ); clkTotal = Abc_Clock() - clkTotal; // report the results if ( pPars->fVerbose ) { Abc_PrintTimeP( 1, "Srm ", clkSrm, clkTotal ); Abc_PrintTimeP( 1, "Sat ", clkSat, clkTotal ); Abc_PrintTimeP( 1, "Sim ", clkSim, clkTotal ); Abc_PrintTimeP( 1, "Other", clkTotal-clkSat-clkSrm-clkSim, clkTotal ); Abc_PrintTime( 1, "TOTAL", clkTotal ); } return 0; } /**Function************************************************************* Synopsis [Computes choices for the vector of AIGs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Cec_ManChoiceComputationVec( Gia_Man_t * pGia, int nGias, Cec_ParChc_t * pPars ) { Gia_Man_t * pNew; int RetValue; // compute equivalences of the miter // pMiter = Gia_ManChoiceMiter( vGias ); // Gia_ManSetRegNum( pMiter, 0 ); RetValue = Cec_ManChoiceComputation_int( pGia, pPars ); // derive AIG with choices pNew = Gia_ManEquivToChoices( pGia, nGias ); // Gia_ManHasChoices_very_old( pNew ); // Gia_ManStop( pMiter ); // report the results if ( pPars->fVerbose ) { // Abc_Print( 1, "NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n", // Gia_ManAndNum(pAig), Gia_ManAndNum(pNew), // 100.0*(Gia_ManAndNum(pAig)-Gia_ManAndNum(pNew))/(Gia_ManAndNum(pAig)?Gia_ManAndNum(pAig):1), // Gia_ManRegNum(pAig), Gia_ManRegNum(pNew), // 100.0*(Gia_ManRegNum(pAig)-Gia_ManRegNum(pNew))/(Gia_ManRegNum(pAig)?Gia_ManRegNum(pAig):1) ); } return pNew; } /**Function************************************************************* Synopsis [Computes choices for one AIGs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Cec_ManChoiceComputation( Gia_Man_t * pAig, Cec_ParChc_t * pParsChc ) { // extern Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ); Dch_Pars_t Pars, * pPars = &Pars; Aig_Man_t * pMan, * pManNew; Gia_Man_t * pGia; if ( 0 ) { pGia = Cec_ManChoiceComputationVec( pAig, 3, pParsChc ); } else { pMan = Gia_ManToAig( pAig, 0 ); Dch_ManSetDefaultParams( pPars ); pPars->fUseGia = 1; pPars->nBTLimit = pParsChc->nBTLimit; pPars->fUseCSat = pParsChc->fUseCSat; pPars->fVerbose = pParsChc->fVerbose; pManNew = Dar_ManChoiceNew( pMan, pPars ); pGia = Gia_ManFromAig( pManNew ); Aig_ManStop( pManNew ); // Aig_ManStop( pMan ); } return pGia; } /**Function************************************************************* Synopsis [Performs computation of AIGs with choices.] Description [Takes several AIGs and performs choicing.] SideEffects [] SeeAlso [] ***********************************************************************/ Aig_Man_t * Cec_ComputeChoices( Gia_Man_t * pGia, Dch_Pars_t * pPars ) { Cec_ParChc_t ParsChc, * pParsChc = &ParsChc; Aig_Man_t * pAig; if ( pPars->fVerbose ) Abc_PrintTime( 1, "Synthesis time", pPars->timeSynth ); Cec_ManChcSetDefaultParams( pParsChc ); pParsChc->nBTLimit = pPars->nBTLimit; pParsChc->fUseCSat = pPars->fUseCSat; if ( pParsChc->fUseCSat && pParsChc->nBTLimit > 100 ) pParsChc->nBTLimit = 100; pParsChc->fVerbose = pPars->fVerbose; pGia = Cec_ManChoiceComputationVec( pGia, 3, pParsChc ); Gia_ManSetRegNum( pGia, Gia_ManRegNum(pGia) ); pAig = Gia_ManToAig( pGia, 1 ); Gia_ManStop( pGia ); return pAig; } //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// ABC_NAMESPACE_IMPL_END
7,254
535
from sys import stdout # completely hides the system cursor async def hide_cursor(): stdout.write("\033[?25l") stdout.flush()
48
326
from typing import Tuple import numpy as np from etna.datasets import TSDataset from etna.metrics import MAE from etna.metrics import MAPE from etna.metrics import MSE from etna.metrics.utils import compute_metrics def test_compute_metrics(train_test_dfs: Tuple[TSDataset, TSDataset]): """Check that compute_metrics return correct metrics keys.""" forecast_df, true_df = train_test_dfs metrics = [MAE("per-segment"), MAE(mode="macro"), MSE("per-segment"), MAPE(mode="macro", eps=1e-5)] expected_keys = [ "MAE(mode = 'per-segment', )", "MAE(mode = 'macro', )", "MSE(mode = 'per-segment', )", "MAPE(mode = 'macro', eps = 1e-05, )", ] result = compute_metrics(metrics=metrics, y_true=true_df, y_pred=forecast_df) np.testing.assert_array_equal(sorted(expected_keys), sorted(result.keys()))
355