Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgPointSetUtil.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file SgPointSetUtil.h
00003     Utility functions for SgPointSet. */
00004 //----------------------------------------------------------------------------
00005 
00006 #ifndef SG_POINTSETUTIL_H
00007 #define SG_POINTSETUTIL_H
00008 
00009 #include <iosfwd>
00010 #include <string>
00011 #include "SgPointSet.h"
00012 
00013 //----------------------------------------------------------------------------
00014 
00015 /** Write all points in set. */
00016 class SgWritePointSet
00017 {
00018 public:
00019     SgWritePointSet(const SgPointSet& pointSet, std::string label = "",
00020                     bool writeSize = true);
00021 
00022     std::ostream& Write(std::ostream& out) const;
00023 
00024 private:
00025     bool m_writeSize;
00026 
00027     const SgPointSet& m_pointSet;
00028 
00029     std::string m_label;
00030 };
00031 
00032 /** @relatesalso SgWritePointSet */
00033 std::ostream& operator<<(std::ostream& out, const SgWritePointSet& write);
00034 
00035 /** @relatesalso SgPointSet */
00036 std::ostream& operator<<(std::ostream& out, const SgPointSet& set);
00037 
00038 //----------------------------------------------------------------------------
00039 
00040 /** Write center point and size of set */
00041 class SgWritePointSetID
00042 {
00043 public:
00044     explicit SgWritePointSetID(const SgPointSet& p)
00045         : m_p(p)
00046     { }
00047 
00048     const SgPointSet& Points() const { return m_p; }
00049 private:
00050 
00051     const SgPointSet& m_p;
00052 };
00053 
00054 std::ostream& operator<<(std::ostream& stream, const SgWritePointSetID& w);
00055 
00056 //----------------------------------------------------------------------------
00057 
00058 /** Read all points in set. */
00059 class SgReadPointSet
00060 {
00061 public:
00062     SgReadPointSet(SgPointSet& pointSet);
00063 
00064     std::istream& Read(std::istream& in) const;
00065 
00066 private:
00067     mutable SgPointSet& m_pointSet; // allow temp objects to modify
00068 };
00069 
00070 /** @relatesalso SgReadPointSet */
00071 std::istream& operator>>(std::istream& in, const SgReadPointSet& Read);
00072 
00073 std::istream& operator>>(std::istream& in, SgPointSet& pointSet);
00074 
00075 //----------------------------------------------------------------------------
00076 
00077 namespace SgPointSetUtil
00078 {
00079     /** Rotate coordinates - see SgPointUtil::Rotate */
00080     void Rotate(int rotation, SgPointSet& pointSet, int boardSize);
00081 }
00082 //----------------------------------------------------------------------------
00083 
00084 #endif // SG_POINTSETUTIL_H


Sun Mar 13 2011 Doxygen 1.7.1