Ball.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 template <typename T>
00018 inline Ball<T>::Ball()
00019 : owner_(NULL)
00020 {
00021 coord_ = Coordinates(-1,-1);
00022 }
00023
00024 template <typename T>
00025 inline Ball<T>::~Ball()
00026 {
00027 }
00028
00029 template <typename T>
00030 inline void Ball<T>::setCoordinates(const Coordinates& pt)
00031 {
00032 coord_ = pt;
00033 }
00034
00035 template <typename T>
00036 inline const Coordinates& Ball<T>::getCoordinates() const
00037 {
00038 return coord_;
00039 }
00040
00041 template <typename T>
00042 inline T* Ball<T>::getOwner() const
00043 {
00044 return owner_;
00045 }
00046
00047 template <typename T>
00048 inline void Ball<T>::setOwner(T* player)
00049 {
00050 owner_ = player;
00051 }
00052
00053 template <typename U>
00054 inline std::ostream& operator<< (std::ostream& os, const Ball<U>& b)
00055 {
00056 b.printDebug(os);
00057 return os;
00058 }
00059
00060 template <typename T>
00061 inline void Ball<T>::printDebug(std::ostream& os) const
00062 {
00063 os << "Ball is ";
00064 if (owner_ == NULL)
00065 os << "free";
00066 else
00067 os << "hold by player `" << owner_->getId()
00068 << "' of team `" << owner_->getTeamId() << "'";
00069 os << " at coordinates " << coord_ << "." << std::endl;
00070 }
00071