⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 region.h

📁 在LINUX下运行的仿真机器人服务器源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
//         const RegPoint*,//         const RegTri*,//         const RegRec*  > ConstVisitor;//       class TypeExtractor//         : public util::TypeExtractor10< RegNull*,//         RegQuad*,//         RegArc*,//         RegUnion*,//         RegNamed*,//         RegPoint*,//         RegTri*,//         RegRec* >//       {//       protected://         void//         visit( RegNull* reg )//         { setValue( reg ); }//         void//         visit( RegQuad* reg )//         { setValue( reg ); }//         void//         visit( RegArc* reg )//         { setValue( reg ); }//         void//         visit( RegUnion* reg )//         { setValue( reg ); }//         void//         visit( RegNamed* reg )//         { setValue( reg ); }//         void//         visit( RegPoint* reg )//         { setValue( reg ); }//         void//         visit( RegTri* reg )//         { setValue( reg ); }//         void//         visit( RegRec* reg )//         { setValue( reg ); }//       };//       class ConstTypeExtractor//         : public util::TypeExtractor10< const RegNull*,//         const RegQuad*,//         const RegArc*,//         const RegUnion*,//         const RegNamed*,//         const RegPoint*,//         const RegTri*,//         const RegRec* >//       {//       protected://         void//         visit( const RegNull* reg )//         { setValue( reg ); }//         void//         visit( const RegQuad* reg )//         { setValue( reg ); }//         void//         visit( const RegArc* reg )//         { setValue( reg ); }//         void//         visit( const RegUnion* reg )//         { setValue( reg ); }//         void//         visit( const RegNamed* reg )//         { setValue( reg ); }//         void//         visit( const RegPoint* reg )//         { setValue( reg ); }//         void//         visit( const RegTri* reg )//         { setValue( reg ); }//         void//         visit( const RegRec* reg )//         { setValue( reg ); }//       };      Region()      {}      virtual       ~Region()       {}            virtual      std::ostream&       print( std::ostream& out ) const = 0;      virtual      std::ostream&      printPretty( std::ostream& out, const std::string& line_header ) const = 0;  //       virtual//       void//       accept( Visitor& v ) = 0;//       virtual//       void//       accept( ConstVisitor& v ) const = 0;      virtual      std::auto_ptr< Region >      deepCopy() const = 0;    };      inline      std::ostream&      operator <<(std::ostream & os, const rcss::clang::Region& r )      { return r.print(os); }     class RegNull      : public Region    {    public:      RegNull()         : Region()      {}            ~RegNull()      {}      std::ostream&      print( std::ostream& out ) const      { return out << "(null)"; }            std::ostream&      printPretty( std::ostream& out, const std::string& line_header ) const      { return out << line_header << "null region" << std::endl; }//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      std::auto_ptr< Region >      deepCopy() const      { return std::auto_ptr< Region >( new RegNull( *this ) ); }    };    class RegQuad      : public Region    {    public:	RegQuad();      	RegQuad( std::auto_ptr< Point > pt0,		 std::auto_ptr< Point > pt1, 		 std::auto_ptr< Point > pt2,		 std::auto_ptr< Point > pt3 );	virtual	~RegQuad();	std::ostream&	print( std::ostream& out ) const;		std::ostream& 	printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      virtual      std::auto_ptr< Region >      deepCopy() const      { 	  std::auto_ptr< Point > pts[ 4 ];	  for( int i = 0; i < 4; ++i )	  {	      if( m_points[ i ].get() )		  pts[ i ] = m_points[ i ]->deepCopy();	  }	  return std::auto_ptr< Region >( new RegQuad( pts[ 0 ],						       pts[ 1 ],						       pts[ 2 ],						       pts[ 3 ] ) );       }  /* class specific */      const Point*       getPt( unsigned int i ) const      {	  if( i < 4 )	      return m_points[ i ].get();	  else	      return NULL;      }            void      setAllPts( std::auto_ptr< Point > pt0,                 std::auto_ptr< Point > pt1,                 std::auto_ptr< Point > pt2,                 std::auto_ptr< Point > pt3 );    private:	std::auto_ptr< Point > m_points[ 4 ];    };    class RegArc      : public Region    {    public:	RegArc();            RegArc( std::auto_ptr< Point > center,               const double& start_rad,               const double& end_rad,               const double& start_ang,              const double& span_ang );      virtual      ~RegArc();             std::ostream&       print( std::ostream& out ) const;            std::ostream&      printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      virtual      std::auto_ptr< Region >      deepCopy() const      {	  if( m_center.get() )	      return std::auto_ptr< Region >( new RegArc( m_center->deepCopy(),							  M_start_rad, M_end_rad,							  M_start_ang, M_span_ang ) ); 	  else	      return std::auto_ptr< Region >( new RegArc( std::auto_ptr< Point >(),							  M_start_rad, M_end_rad,							  M_start_ang, M_span_ang ) ); 	        }      const Point*      getCenter() const       { return m_center.get(); }        double          getStartRad() const      { return M_start_rad; }      double      getEndRad() const      { return M_end_rad; }            double      getStartAng() const      { return M_start_ang; }      double       getSpanAng() const      { return M_span_ang; }            bool      setRad( const double& start_rad, const double& end_rad );            bool      setAng( const double& start_ang, const double& span_ang);      private:      /* start rad <= end_rad */      double M_start_rad, M_end_rad;      double M_start_ang, M_span_ang;	std::auto_ptr< Point > m_center;    };    class RegUnion      : public Region    {    public:	typedef std::list< Region* > Storage;      RegUnion()         : Region()      {}            RegUnion( const Storage& regs) 	  : Region(),	    m_regs( regs )      {}      virtual      ~RegUnion()      {	  deleteAll();      }      std::ostream&       print( std::ostream& out ) const;            std::ostream&       printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      virtual      std::auto_ptr< Region >      deepCopy() const      { 	  Storage regs;	  for( Storage::const_iterator i = m_regs.begin(); i != m_regs.end(); ++i )	  {	      regs.push_front( (*i)->deepCopy().release() );	  }	  return std::auto_ptr< Region >( new RegUnion( regs ) );       }      const Storage&      getRegions() const      { return m_regs; }	      Storage&      getRegions()      { return m_regs; }	    private:	Storage m_regs;	void	deleteAll()	    {		for( Storage::iterator i = m_regs.begin();		     i != m_regs.end(); ++i )		    delete *i;		m_regs.clear();	    }    };    class RegNamed      : public Region    {    public:      RegNamed( const std::string& name = "" )         : Region(),          M_name(name)      {}      ~RegNamed()      {}            std::ostream&      print( std::ostream& out ) const      { return out << "\"" << M_name << "\""; }        std::ostream&      printPretty( std::ostream& out, const std::string& line_header ) const      {         return out << line_header << "region named \""                    << M_name << "\"" << std::endl;      }//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      std::auto_ptr< Region >      deepCopy() const      { return std::auto_ptr< Region >( new RegNamed( *this ) ); }      /* class specific */      std::string&      getName()      { return M_name; }        const std::string&      getName() const      { return M_name; }        void      setName( const std::string& name )      { M_name = name; }    private:      std::string M_name;    };    /**** RegPoint ****/    class RegPoint      : public Region    {    public:      RegPoint();      RegPoint( std::auto_ptr< Point > point );      RegPoint( const RegPoint& point ) ;      ~RegPoint();      RegPoint&      operator=( const RegPoint& point );      std::ostream&      print( std::ostream& out ) const;        std::ostream&      printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }      std::auto_ptr< Region >      deepCopy() const      { return std::auto_ptr< Region >( new RegPoint( *this ) ); }      Point*      getPoint();      const Point*      getPoint() const;      std::auto_ptr< Point >      detatchPoint();      void      setPoint( std::auto_ptr< Point > point );    private:      std::auto_ptr< Point > M_point;    };    class RegTri      : public Region    {    public:      RegTri();            RegTri( std::auto_ptr< Point > pt0,              std::auto_ptr< Point > pt1,              std::auto_ptr< Point > pt2 );            virtual      ~RegTri();      std::ostream&      print( std::ostream& out ) const;            std::ostream&       printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }	virtual	std::auto_ptr< Region >	deepCopy() const	    {		std::auto_ptr< Point > pts[ 3 ];		for( int i = 0; i < 3; ++i )		{		    if( m_points[ i ].get() )			pts[ i ] = m_points[ i ]->deepCopy();		}		return std::auto_ptr< Region >( new RegTri( pts[ 0 ],							    pts[ 1 ],							    pts[ 2 ] ) ); 	    }	      const Point*       getPt( unsigned int i ) const      { 	  if( i < 3 )	      return m_points[ i ].get();	  else	      return NULL;      }                  void      setAllPts( std::auto_ptr< Point > pt0,                 std::auto_ptr< Point > pt1,                 std::auto_ptr< Point > pt2 );    private:	std::auto_ptr< Point > m_points[ 3 ];    };   class RegRec      : public Region    {    public:      RegRec();            RegRec( std::auto_ptr< Point > pt0,              std::auto_ptr< Point > pt1 );            virtual      ~RegRec();      std::ostream&      print( std::ostream& out ) const;            std::ostream&       printPretty( std::ostream& out, const std::string& line_header ) const;//       void//       accept( Visitor& v )//       { v.startVisit( this ); }//       void//       accept( ConstVisitor& v ) const//       { v.startVisit( this ); }            virtual      std::auto_ptr< Region >      deepCopy() const      { 	  std::auto_ptr< Point > pts[ 2 ];	  for( int i = 0; i < 2; ++i )	  {	      if( m_points[ i ].get() )		  pts[ i ] = m_points[ i ]->deepCopy();	  }	  return std::auto_ptr< Region >( new RegRec( pts[ 0 ], pts[ 1 ] ) );       }	const Point* 	getPt( unsigned int i ) const	    {		if( i < 2 )		    return m_points[ i ].get();		else		    return NULL;	    }            void      setAllPts( std::auto_ptr< Point > pt0,                 std::auto_ptr< Point > pt1 );     private:	std::auto_ptr< Point > m_points[ 2 ];   };  }}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -