You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/09/01 15:36:07 UTC

cvs commit: xml-axis/c/src/server/samples/cppservice PPService.cpp PPService.h

susantha    2003/09/01 06:36:07

  Added:       c/src/server/samples/cppservice PPService.cpp PPService.h
  Log:
  new sample web services
  
  Revision  Changes    Path
  1.1                  xml-axis/c/src/server/samples/cppservice/PPService.cpp
  
  Index: PPService.cpp
  ===================================================================
  // PPService.cpp: implementation of the CPPService class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #include "PPService.h"
  #include <math.h>
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  
  CPPService::CPPService()
  {
  
  }
  
  CPPService::~CPPService()
  {
  
  }
  
  int CPPService::Add(int a, int b)
  {
  	return a+b;
  }
  
  Point* CPPService::AddPoint(Point *p1, Point *p2)
  {
  	Point* ret = new Point();
  	ret->x = p1->x + p2->x;
  	ret->y = p1->y + p2->y;
  	return ret;
  }
  
  double CPPService::Distance(Point *p1, Point *p2)
  {
  	return sqrt(pow((p1->x - p2->x),2) + pow((p1->y - p2->y),2));
  }
  
  double CPPService::Perimeter(const Triangle* pTri)
  {
  	double peri = 0;
  	peri = sqrt(pow((pTri->p1->x - pTri->p2->x),2) + pow((pTri->p1->y - pTri->p2->y),2));
  	peri += sqrt(pow((pTri->p3->x - pTri->p2->x),2) + pow((pTri->p3->y - pTri->p2->y),2));
  	peri += sqrt(pow((pTri->p1->x - pTri->p3->x),2) + pow((pTri->p1->y - pTri->p3->y),2));
  	return peri;
  }
  
  
  1.1                  xml-axis/c/src/server/samples/cppservice/PPService.h
  
  Index: PPService.h
  ===================================================================
  // PPService.h: interface for the CPPService class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #if !defined(AFX_PPSERVICE_H__7545C05C_B9EE_4F3A_8549_64B85A2DFF77__INCLUDED_)
  #define AFX_PPSERVICE_H__7545C05C_B9EE_4F3A_8549_64B85A2DFF77__INCLUDED_
  
  #if _MSC_VER > 1000
  #pragma once
  #endif // _MSC_VER > 1000
  
  class Point
  {
  public:
  	int x;
  	int y;
  };
  
  class Triangle
  {
  public:
  	Point* p1;
  	Point* p2;
  	Point* p3;
  } ;
  
  class CPPService  
  {
  public:
  	double Distance(Point* p1, Point* p2);
  	Point* AddPoint(Point* p1, Point* p2);
  	int Add(int a, int b);
  	double Perimeter(const Triangle* pTri);
  	CPPService();
  	virtual ~CPPService();
  };
  
  #endif // !defined(AFX_PPSERVICE_H__7545C05C_B9EE_4F3A_8549_64B85A2DFF77__INCLUDED_)